Skip to content

Commit

Permalink
Merge pull request #486 from flatcar/tormath1/calico-do
Browse files Browse the repository at this point in the history
kubeadm/calico: use public IP
  • Loading branch information
tormath1 authored Nov 29, 2023
2 parents 481ef10 + 05ae425 commit ccdd746
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/mirror-calico-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ images=(
calico/kube-controllers
calico/csi
calico/node-driver-registrar
calico/apiserver
)

# we iterate over the images we want to mirror
Expand Down
1 change: 1 addition & 0 deletions kola/tests/kubeadm/kubeadm.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ func init() {

// kubeadmBaseTest asserts that the cluster is up and running
func kubeadmBaseTest(c cluster.TestCluster, params map[string]interface{}) {
params["Platform"] = c.Platform()
params["Arch"] = strings.SplitN(kola.QEMUOptions.Board, "-", 2)[0]
kubectl, err := setup(c, params)
if err != nil {
Expand Down
17 changes: 16 additions & 1 deletion kola/tests/kubeadm/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,11 @@ curl --retry-delay 1 \
# kubelet config for both controller and worker
cgroup=$(docker info | awk '/Cgroup Driver/ { print $3}')
{{ if eq .Platform "do" }}
systemctl start --quiet coreos-metadata
ipv4=$(cat /run/metadata/flatcar | grep -v -E '(IPV6|GATEWAY)' | grep IP | grep -E '(PUBLIC|LOCAL|DYNAMIC)' | cut -d = -f 2)
{{ end }}
# we create the kubeadm config
# plugin-volume-dir and flex-volume-plugin-dir are required since /usr is read-only mounted
# etcd is also defined as external. The provided one has some issues with docker and selinux
Expand All @@ -379,6 +384,10 @@ kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
volume-plugin-dir: "/opt/libexec/kubernetes/kubelet-plugins/volume/exec/"
{{ if eq .Platform "do" }}
# On Digital Ocean, the private node IP is not reachable from one node to the other - let's use the public one.
node-ip: "${ipv4}"
{{ end }}
---
apiVersion: kubeadm.k8s.io/v1beta3
kind: ClusterConfiguration
Expand Down Expand Up @@ -412,6 +421,12 @@ spec:
imagePath: flatcar/calico
# Configures Calico networking.
calicoNetwork:
{{ if eq .Platform "do" }}
# On Digital Ocean, there is two network interfaces: eth0 and eth1
# We use the one with a public IP (eth0)
nodeAddressAutodetectionV4:
interface: eth0
{{ end }}
# Note: The ipPools section cannot be modified post-install.
ipPools:
- blockSize: 26
Expand Down Expand Up @@ -537,7 +552,7 @@ cat << EOF > worker-config.yaml
EOF
systemctl start --quiet coreos-metadata
ipv4=$(cat /run/metadata/flatcar | grep -v -E '(IPV6|GATEWAY)' | grep IP | grep -E '(PRIVATE|LOCAL|DYNAMIC)' | cut -d = -f 2)
ipv4=$(cat /run/metadata/flatcar | grep -v -E '(IPV6|GATEWAY)' | grep IP | grep -E '({{ if eq .Platform "do" }}PUBLIC{{ else }}PRIVATE{{ end }}|LOCAL|DYNAMIC)' | cut -d = -f 2)
kubeadm join --config worker-config.yaml --node-name "${ipv4}"
`
Expand Down
4 changes: 4 additions & 0 deletions kola/tests/kubeadm/testdata/master-calico-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ curl --retry-delay 1 \
# kubelet config for both controller and worker
cgroup=$(docker info | awk '/Cgroup Driver/ { print $3}')



# we create the kubeadm config
# plugin-volume-dir and flex-volume-plugin-dir are required since /usr is read-only mounted
# etcd is also defined as external. The provided one has some issues with docker and selinux
Expand All @@ -54,6 +56,7 @@ kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
volume-plugin-dir: "/opt/libexec/kubernetes/kubelet-plugins/volume/exec/"
---
apiVersion: kubeadm.k8s.io/v1beta3
kind: ClusterConfiguration
Expand Down Expand Up @@ -87,6 +90,7 @@ spec:
imagePath: flatcar/calico
# Configures Calico networking.
calicoNetwork:
# Note: The ipPools section cannot be modified post-install.
ipPools:
- blockSize: 26
Expand Down
3 changes: 3 additions & 0 deletions kola/tests/kubeadm/testdata/master-cilium-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ curl --retry-delay 1 \
# kubelet config for both controller and worker
cgroup=$(docker info | awk '/Cgroup Driver/ { print $3}')



# we create the kubeadm config
# plugin-volume-dir and flex-volume-plugin-dir are required since /usr is read-only mounted
# etcd is also defined as external. The provided one has some issues with docker and selinux
Expand All @@ -54,6 +56,7 @@ kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
volume-plugin-dir: "/opt/libexec/kubernetes/kubelet-plugins/volume/exec/"
---
apiVersion: kubeadm.k8s.io/v1beta3
kind: ClusterConfiguration
Expand Down
3 changes: 3 additions & 0 deletions kola/tests/kubeadm/testdata/master-flannel-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ curl --retry-delay 1 \
# kubelet config for both controller and worker
cgroup=$(docker info | awk '/Cgroup Driver/ { print $3}')



# we create the kubeadm config
# plugin-volume-dir and flex-volume-plugin-dir are required since /usr is read-only mounted
# etcd is also defined as external. The provided one has some issues with docker and selinux
Expand All @@ -54,6 +56,7 @@ kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
volume-plugin-dir: "/opt/libexec/kubernetes/kubelet-plugins/volume/exec/"
---
apiVersion: kubeadm.k8s.io/v1beta3
kind: ClusterConfiguration
Expand Down

0 comments on commit ccdd746

Please sign in to comment.