Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added node-public-ip annotation #1982

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Documentation/kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ 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/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).
Additional annotations can be configured on a specific node as parameters used when Flannel starts on that specific node
* `flannel.alpha.coreos.com/node-public-ip`, `flannel.alpha.coreos.com/node-public-ipv6`: Define the used IP of the node in case the node has multiple interface it selects the interface with the configured IP for the backend tunnel. 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 that IP can be not configured on the node. Useful if the public IP can not determined from the node, e.G. because it is behind a NAT and the other nodes need to use it to create the tunnel. 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.

## Older versions of Kubernetes
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
Loading