Skip to content

Commit

Permalink
Added node-public-ip annotation
Browse files Browse the repository at this point in the history
Signed-off-by: Roberto Bonafiglia <[email protected]>
  • Loading branch information
rbrtbnfgl committed May 27, 2024
1 parent bf59847 commit 4f2d4c3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Documentation/kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ If you want to deploy `flannel` securely in a shared namespace or want more fine
Other options include [Kyverno](https://kyverno.io/policies/pod-security/) and [OPA Gatekeeper](https://github.com/open-policy-agent/gatekeeper).
# Annotations

* `flannel.alpha.coreos.com/public-ip`, `flannel.alpha.coreos.com/public-ipv6`: Define the used public IP of the node. If configured when Flannel starts it'll be used as the `public-ip` and `public-ipv6` flag.
* `flannel.alpha.coreos.com/node-public-ip`, `flannel.alpha.coreos.com/node-public-ipv6`: Define the used public IP of the node. If configured when Flannel starts it'll be used as the `public-ip` and `public-ipv6` flag.
* `flannel.alpha.coreos.com/public-ip-overwrite`, `flannel.alpha.coreos.com/public-ipv6-overwrite`: Allows to overwrite the public IP of a node. Useful if the public IP can not determined from the node, e.G. because it is behind a NAT. It can be automatically set to a nodes `ExternalIP` using the [flannel-node-annotator](https://github.com/alvaroaleman/flannel-node-annotator).
See also the "NAT" section in [troubleshooting](./troubleshooting.md) if UDP checksums seem corrupted.

Expand Down
4 changes: 4 additions & 0 deletions pkg/subnet/kube/annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ type annotations struct {
BackendType string
BackendPublicIP string
BackendPublicIPv6 string
BackendNodePublicIP string
BackendNodePublicIPv6 string
BackendPublicIPOverwrite string
BackendPublicIPv6Overwrite string
}
Expand Down Expand Up @@ -63,8 +65,10 @@ func newAnnotations(prefix string) (annotations, error) {
BackendV6Data: prefix + "backend-v6-data",
BackendType: prefix + "backend-type",
BackendPublicIP: prefix + "public-ip",
BackendNodePublicIP: prefix + "node-public-ip",
BackendPublicIPOverwrite: prefix + "public-ip-overwrite",
BackendPublicIPv6: prefix + "public-ipv6",
BackendNodePublicIPv6: prefix + "node-public-ipv6",
BackendPublicIPv6Overwrite: prefix + "public-ipv6-overwrite",
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/subnet/kube/kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -653,8 +653,8 @@ func (ksm *kubeSubnetManager) GetStoredPublicIP(ctx context.Context) (string, st

if node != nil && node.Annotations != nil {
log.Infof("List of node(%s) annotations: %#+v", ksm.nodeName, node.Annotations)
publicIP := node.Annotations[ksm.annotations.BackendPublicIP]
publicIPv6 := node.Annotations[ksm.annotations.BackendPublicIPv6]
publicIP := node.Annotations[ksm.annotations.BackendNodePublicIP]
publicIPv6 := node.Annotations[ksm.annotations.BackendNodePublicIPv6]
return publicIP, publicIPv6
}

Expand Down

0 comments on commit 4f2d4c3

Please sign in to comment.