Skip to content

Commit

Permalink
Hotfix: cloud-init broken flags (#381)
Browse files Browse the repository at this point in the history
Signed-off-by: Waleed Malik <ahmedwaleedmalik@gmail.com>
  • Loading branch information
ahmedwaleedmalik committed Apr 30, 2024
1 parent ba7524a commit 0af4cf8
Show file tree
Hide file tree
Showing 15 changed files with 87 additions and 19 deletions.
10 changes: 9 additions & 1 deletion deploy/osps/default/osp-amzn2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,15 @@ spec:
curl -s -k -v --header 'Authorization: Bearer {{ .Token }}' {{ .ServerURL }}/api/v1/namespaces/cloud-init-settings/secrets/{{ .SecretName }} | jq '.data["cloud-config"]' -r| base64 -d > /etc/cloud/cloud.cfg.d/{{ .SecretName }}.cfg
cloud-init clean
cloud-init --file /etc/cloud/cloud.cfg.d/{{ .SecretName }}.cfg init
CLOUD_INIT_VERSION=$(cloud-init --version | awk '{print $2}')
# Compare the semver values of cloud-init versions to determine the correct command to run.
# This is required because the command line arguments for cloud-init changed in version 24.1, for details: https://github.com/canonical/cloud-init/releases/tag/24.1.
if [[ $(echo -e "24.0.0\n$CLOUD_INIT_VERSION" | sort -V | head -n1) = "24.0.0" ]]; then
cloud-init init --file /etc/cloud/cloud.cfg.d/{{ .SecretName }}.cfg
else
cloud-init --file /etc/cloud/cloud.cfg.d/{{ .SecretName }}.cfg init
fi
systemctl daemon-reload
# cloud-init should only run on the first boot. From this point forward we don't need cloud-init anymore.
Expand Down
9 changes: 8 additions & 1 deletion deploy/osps/default/osp-centos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,14 @@ spec:
curl -s -k -v --header 'Authorization: Bearer {{ .Token }}' {{ .ServerURL }}/api/v1/namespaces/cloud-init-settings/secrets/{{ .SecretName }} | jq '.data["cloud-config"]' -r| base64 -d > /etc/cloud/cloud.cfg.d/{{ .SecretName }}.cfg
cloud-init clean
cloud-init --file /etc/cloud/cloud.cfg.d/{{ .SecretName }}.cfg init
CLOUD_INIT_VERSION=$(cloud-init --version | awk '{print $2}')
# Compare the semver values of cloud-init versions to determine the correct command to run.
# This is required because the command line arguments for cloud-init changed in version 24.1, for details: https://github.com/canonical/cloud-init/releases/tag/24.1.
if [[ $(echo -e "24.0.0\n$CLOUD_INIT_VERSION" | sort -V | head -n1) = "24.0.0" ]]; then
cloud-init init --file /etc/cloud/cloud.cfg.d/{{ .SecretName }}.cfg
else
cloud-init --file /etc/cloud/cloud.cfg.d/{{ .SecretName }}.cfg init
fi
systemctl daemon-reload
Expand Down
9 changes: 8 additions & 1 deletion deploy/osps/default/osp-rhel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,14 @@ spec:
curl -s -k -v --header 'Authorization: Bearer {{ .Token }}' {{ .ServerURL }}/api/v1/namespaces/cloud-init-settings/secrets/{{ .SecretName }} | jq '.data["cloud-config"]' -r| base64 -d > /etc/cloud/cloud.cfg.d/{{ .SecretName }}.cfg
cloud-init clean
cloud-init --file /etc/cloud/cloud.cfg.d/{{ .SecretName }}.cfg init
CLOUD_INIT_VERSION=$(cloud-init --version | awk '{print $2}')
# Compare the semver values of cloud-init versions to determine the correct command to run.
# This is required because the command line arguments for cloud-init changed in version 24.1, for details: https://github.com/canonical/cloud-init/releases/tag/24.1.
if [[ $(echo -e "24.0.0\n$CLOUD_INIT_VERSION" | sort -V | head -n1) = "24.0.0" ]]; then
cloud-init init --file /etc/cloud/cloud.cfg.d/{{ .SecretName }}.cfg
else
cloud-init --file /etc/cloud/cloud.cfg.d/{{ .SecretName }}.cfg init
fi
systemctl daemon-reload
Expand Down
9 changes: 8 additions & 1 deletion deploy/osps/default/osp-rockylinux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,14 @@ spec:
curl -s -k -v --header 'Authorization: Bearer {{ .Token }}' {{ .ServerURL }}/api/v1/namespaces/cloud-init-settings/secrets/{{ .SecretName }} | jq '.data["cloud-config"]' -r| base64 -d > /etc/cloud/cloud.cfg.d/{{ .SecretName }}.cfg
cloud-init clean
cloud-init --file /etc/cloud/cloud.cfg.d/{{ .SecretName }}.cfg init
CLOUD_INIT_VERSION=$(cloud-init --version | awk '{print $2}')
# Compare the semver values of cloud-init versions to determine the correct command to run.
# This is required because the command line arguments for cloud-init changed in version 24.1, for details: https://github.com/canonical/cloud-init/releases/tag/24.1.
if [[ $(echo -e "24.0.0\n$CLOUD_INIT_VERSION" | sort -V | head -n1) = "24.0.0" ]]; then
cloud-init init --file /etc/cloud/cloud.cfg.d/{{ .SecretName }}.cfg
else
cloud-init --file /etc/cloud/cloud.cfg.d/{{ .SecretName }}.cfg init
fi
systemctl daemon-reload
Expand Down
10 changes: 9 additions & 1 deletion deploy/osps/default/osp-ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,15 @@ spec:
echo "network: {config: disabled}" > /etc/cloud/cloud.cfg.d/99-custom-networking.cfg
{{- end }}
cloud-init --file /etc/cloud/cloud.cfg.d/{{ .SecretName }}.cfg init
CLOUD_INIT_VERSION=$(cloud-init --version | awk '{print $2}')
# Compare the semver values of cloud-init versions to determine the correct command to run.
# This is required because the command line arguments for cloud-init changed in version 24.1, for details: https://github.com/canonical/cloud-init/releases/tag/24.1.
if [[ $(echo -e "24.0.0\n$CLOUD_INIT_VERSION" | sort -V | head -n1) = "24.0.0" ]]; then
cloud-init init --file /etc/cloud/cloud.cfg.d/{{ .SecretName }}.cfg
else
cloud-init --file /etc/cloud/cloud.cfg.d/{{ .SecretName }}.cfg init
fi
systemctl daemon-reload
{{- if eq .CloudProviderName "digitalocean" }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,14 @@ spec:
&& apt install -y curl jq\ncurl -s -k -v --header 'Authorization: Bearer
top-secret'\thttps://foo.bar:6443/api/v1/namespaces/cloud-init-settings/secrets/kubelet-configuration-kube-system-provisioning-config
| jq '.data[\"cloud-config\"]' -r| base64 -d > /etc/cloud/cloud.cfg.d/kubelet-configuration-kube-system-provisioning-config.cfg\ncloud-init
clean\n\ncloud-init --file /etc/cloud/cloud.cfg.d/kubelet-configuration-kube-system-provisioning-config.cfg
init\nsystemctl daemon-reload\n\nsystemctl daemon-reload\n\n# cloud-init
clean\n\nCLOUD_INIT_VERSION=$(cloud-init --version | awk '{print $2}')\n#
Compare the semver values of cloud-init versions to determine the correct
command to run.\n# This is required because the command line arguments
for cloud-init changed in version 24.1, for details: https://github.com/canonical/cloud-init/releases/tag/24.1.\nif
[[ $(echo -e \"24.0.0\\n$CLOUD_INIT_VERSION\" | sort -V | head -n1) =
\"24.0.0\" ]]; then\n cloud-init init --file /etc/cloud/cloud.cfg.d/kubelet-configuration-kube-system-provisioning-config.cfg\nelse\n
\ cloud-init --file /etc/cloud/cloud.cfg.d/kubelet-configuration-kube-system-provisioning-config.cfg
init\nfi\n\nsystemctl daemon-reload\n\nsystemctl daemon-reload\n\n# cloud-init
should only run on the first boot. From this point forward we don't need
cloud-init anymore.\nsystemctl disable cloud-init\ntouch /etc/cloud/cloud-init.disabled\n\n#
Bootstrap phase for the machine is complete.\ntouch /etc/bootstrap-complete\nsystemctl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@ spec:
curl -s -k -v --header 'Authorization: Bearer top-secret' https://foo.bar:6443/api/v1/namespaces/cloud-init-settings/secrets/osp-rhel-azure-kube-system-provisioning-config | jq '.data["cloud-config"]' -r| base64 -d > /etc/cloud/cloud.cfg.d/osp-rhel-azure-kube-system-provisioning-config.cfg
cloud-init clean
cloud-init --file /etc/cloud/cloud.cfg.d/osp-rhel-azure-kube-system-provisioning-config.cfg init
CLOUD_INIT_VERSION=$(cloud-init --version | awk '{print $2}')
# Compare the semver values of cloud-init versions to determine the correct command to run.
# This is required because the command line arguments for cloud-init changed in version 24.1, for details: https://github.com/canonical/cloud-init/releases/tag/24.1.
if [[ $(echo -e "24.0.0\n$CLOUD_INIT_VERSION" | sort -V | head -n1) = "24.0.0" ]]; then
cloud-init init --file /etc/cloud/cloud.cfg.d/osp-rhel-azure-kube-system-provisioning-config.cfg
else
cloud-init --file /etc/cloud/cloud.cfg.d/osp-rhel-azure-kube-system-provisioning-config.cfg init
fi
systemctl daemon-reload
Expand Down
10 changes: 8 additions & 2 deletions pkg/controllers/osc/testdata/osc-ubuntu-aws-containerd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,14 @@ spec:
&& apt install -y curl jq\ncurl -s -k -v --header 'Authorization: Bearer
top-secret'\thttps://foo.bar:6443/api/v1/namespaces/cloud-init-settings/secrets/ubuntu-aws-kube-system-provisioning-config
| jq '.data[\"cloud-config\"]' -r| base64 -d > /etc/cloud/cloud.cfg.d/ubuntu-aws-kube-system-provisioning-config.cfg\ncloud-init
clean\n\ncloud-init --file /etc/cloud/cloud.cfg.d/ubuntu-aws-kube-system-provisioning-config.cfg
init\nsystemctl daemon-reload\n\nsystemctl daemon-reload\n\n# cloud-init
clean\n\nCLOUD_INIT_VERSION=$(cloud-init --version | awk '{print $2}')\n#
Compare the semver values of cloud-init versions to determine the correct
command to run.\n# This is required because the command line arguments
for cloud-init changed in version 24.1, for details: https://github.com/canonical/cloud-init/releases/tag/24.1.\nif
[[ $(echo -e \"24.0.0\\n$CLOUD_INIT_VERSION\" | sort -V | head -n1) =
\"24.0.0\" ]]; then\n cloud-init init --file /etc/cloud/cloud.cfg.d/ubuntu-aws-kube-system-provisioning-config.cfg\nelse\n
\ cloud-init --file /etc/cloud/cloud.cfg.d/ubuntu-aws-kube-system-provisioning-config.cfg
init\nfi\n\nsystemctl daemon-reload\n\nsystemctl daemon-reload\n\n# cloud-init
should only run on the first boot. From this point forward we don't need
cloud-init anymore.\nsystemctl disable cloud-init\ntouch /etc/cloud/cloud-init.disabled\n\n#
Bootstrap phase for the machine is complete.\ntouch /etc/bootstrap-complete\nsystemctl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,14 @@ spec:
&& apt install -y curl jq\ncurl -s -k -v --header 'Authorization: Bearer
top-secret'\thttps://foo.bar:6443/api/v1/namespaces/cloud-init-settings/secrets/ubuntu-aws-kube-system-provisioning-config
| jq '.data[\"cloud-config\"]' -r| base64 -d > /etc/cloud/cloud.cfg.d/ubuntu-aws-kube-system-provisioning-config.cfg\ncloud-init
clean\n\ncloud-init --file /etc/cloud/cloud.cfg.d/ubuntu-aws-kube-system-provisioning-config.cfg
init\nsystemctl daemon-reload\n\nsystemctl daemon-reload\n\n# cloud-init
clean\n\nCLOUD_INIT_VERSION=$(cloud-init --version | awk '{print $2}')\n#
Compare the semver values of cloud-init versions to determine the correct
command to run.\n# This is required because the command line arguments
for cloud-init changed in version 24.1, for details: https://github.com/canonical/cloud-init/releases/tag/24.1.\nif
[[ $(echo -e \"24.0.0\\n$CLOUD_INIT_VERSION\" | sort -V | head -n1) =
\"24.0.0\" ]]; then\n cloud-init init --file /etc/cloud/cloud.cfg.d/ubuntu-aws-kube-system-provisioning-config.cfg\nelse\n
\ cloud-init --file /etc/cloud/cloud.cfg.d/ubuntu-aws-kube-system-provisioning-config.cfg
init\nfi\n\nsystemctl daemon-reload\n\nsystemctl daemon-reload\n\n# cloud-init
should only run on the first boot. From this point forward we don't need
cloud-init anymore.\nsystemctl disable cloud-init\ntouch /etc/cloud/cloud-init.disabled\n\n#
Bootstrap phase for the machine is complete.\ntouch /etc/bootstrap-complete\nsystemctl
Expand Down
10 changes: 8 additions & 2 deletions pkg/controllers/osc/testdata/osc-ubuntu-aws-dualstack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,14 @@ spec:
&& apt install -y curl jq\ncurl -s -k -v --header 'Authorization: Bearer
top-secret'\thttps://foo.bar:6443/api/v1/namespaces/cloud-init-settings/secrets/ubuntu-aws-kube-system-provisioning-config
| jq '.data[\"cloud-config\"]' -r| base64 -d > /etc/cloud/cloud.cfg.d/ubuntu-aws-kube-system-provisioning-config.cfg\ncloud-init
clean\n\ncloud-init --file /etc/cloud/cloud.cfg.d/ubuntu-aws-kube-system-provisioning-config.cfg
init\nsystemctl daemon-reload\n\nsystemctl daemon-reload\n\n# cloud-init
clean\n\nCLOUD_INIT_VERSION=$(cloud-init --version | awk '{print $2}')\n#
Compare the semver values of cloud-init versions to determine the correct
command to run.\n# This is required because the command line arguments
for cloud-init changed in version 24.1, for details: https://github.com/canonical/cloud-init/releases/tag/24.1.\nif
[[ $(echo -e \"24.0.0\\n$CLOUD_INIT_VERSION\" | sort -V | head -n1) =
\"24.0.0\" ]]; then\n cloud-init init --file /etc/cloud/cloud.cfg.d/ubuntu-aws-kube-system-provisioning-config.cfg\nelse\n
\ cloud-init --file /etc/cloud/cloud.cfg.d/ubuntu-aws-kube-system-provisioning-config.cfg
init\nfi\n\nsystemctl daemon-reload\n\nsystemctl daemon-reload\n\n# cloud-init
should only run on the first boot. From this point forward we don't need
cloud-init anymore.\nsystemctl disable cloud-init\ntouch /etc/cloud/cloud-init.disabled\n\n#
Bootstrap phase for the machine is complete.\ntouch /etc/bootstrap-complete\nsystemctl
Expand Down
Loading

0 comments on commit 0af4cf8

Please sign in to comment.