-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the way we write configure-kube-proxy.sh
On flatcar, files in /run are recreated after the initrd pivots to the full system and executes init. This change adds a unit file that writes the file post-boot. Files written in /run during ignition run will be clobbered. Signed-off-by: Gabriel Adrian Samfira <[email protected]>
- Loading branch information
1 parent
7044ba8
commit 8abbd06
Showing
1 changed file
with
51 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1183,6 +1183,15 @@ def get_object(self) -> objects.ClusterClass: | |
}, | ||
}, | ||
}, | ||
{ | ||
"name": "configureKubeProxy", | ||
"required": True, | ||
"schema": { | ||
"openAPIV3Schema": { | ||
"type": "string", | ||
}, | ||
}, | ||
}, | ||
{ | ||
"name": "fixedSubnetId", | ||
"required": True, | ||
|
@@ -1638,27 +1647,41 @@ def get_object(self) -> objects.ClusterClass: | |
{ | ||
"op": "add", | ||
"path": "/spec/template/spec/kubeadmConfigSpec/ignition", | ||
"value": { | ||
"containerLinuxConfig": { | ||
"additionalConfig": textwrap.dedent( | ||
"""\ | ||
"valueFrom": { | ||
"template": textwrap.dedent( | ||
"""\ | ||
containerLinuxConfig: | ||
additionalConfig: | | ||
systemd: | ||
units: | ||
- name: [email protected] | ||
enabled: true | ||
- name: kubeadm.service | ||
enabled: true | ||
dropins: | ||
- name: 10-flatcar.conf | ||
units: | ||
- name: write-configure-kube-proxy.service | ||
enabled: true | ||
contents: | | ||
[Unit] | ||
Requires=containerd.service coreos-metadata.service | ||
After=containerd.service coreos-metadata.service | ||
Description=Write configure-kube-proxy.sh | ||
Requires=coreos-metadata.service | ||
After=coreos-metadata.service | ||
[Service] | ||
EnvironmentFile=/run/metadata/flatcar | ||
""" # noqa: E501 | ||
), | ||
}, | ||
Type=oneshot | ||
ExecStart=/usr/bin/mkdir -p /run/kubeadm | ||
ExecStart=/bin/bash -c 'echo {{ .configureKubeProxy }} | /usr/bin/base64 -d > /run/kubeadm/configure-kube-proxy.sh' | ||
ExecStart=/bin/chmod +x /run/kubeadm/configure-kube-proxy.sh | ||
[Install] | ||
WantedBy=multi-user.target | ||
- name: [email protected] | ||
enabled: true | ||
- name: kubeadm.service | ||
enabled: true | ||
dropins: | ||
- name: 10-flatcar.conf | ||
contents: | | ||
[Unit] | ||
Requires=containerd.service coreos-metadata.service write-configure-kube-proxy.service | ||
After=containerd.service coreos-metadata.service write-configure-kube-proxy.service | ||
[Service] | ||
EnvironmentFile=/run/metadata/flatcar | ||
""" # noqa: E501 | ||
), | ||
}, | ||
}, | ||
{ | ||
|
@@ -2772,6 +2795,17 @@ def get_object(self) -> objects.Cluster: | |
) | ||
or "", | ||
}, | ||
{ | ||
"name": "configureKubeProxy", | ||
"value": base64.encode_as_text( | ||
importlib.resources.files( | ||
"magnum_cluster_api.files.run.kubeadm" | ||
) | ||
.joinpath("configure-kube-proxy.sh") | ||
.read_text() | ||
) | ||
or "", | ||
}, | ||
{ | ||
"name": "fixedSubnetId", | ||
"value": neutron.get_fixed_subnet_id( | ||
|