From 7dfe25f864456a7c865e1877d78eda813fe79b4b Mon Sep 17 00:00:00 2001 From: enxebre Date: Tue, 1 Apr 2025 11:15:32 +0200 Subject: [PATCH] Run kas-bootstrap binary for cpov2 --- ...zz_fixture_TestControlPlaneComponents.yaml | 41 ++++--------------- ...lPlaneComponents_TechPreviewNoUpgrade.yaml | 41 ++++--------------- .../v2/assets/kube-apiserver/deployment.yaml | 41 ++++--------------- .../hostedcontrolplane/v2/kas/deployment.go | 2 +- 4 files changed, 25 insertions(+), 100 deletions(-) diff --git a/control-plane-operator/controllers/hostedcontrolplane/testdata/kube-apiserver/zz_fixture_TestControlPlaneComponents.yaml b/control-plane-operator/controllers/hostedcontrolplane/testdata/kube-apiserver/zz_fixture_TestControlPlaneComponents.yaml index 564fc4f2613..54b930875f7 100644 --- a/control-plane-operator/controllers/hostedcontrolplane/testdata/kube-apiserver/zz_fixture_TestControlPlaneComponents.yaml +++ b/control-plane-operator/controllers/hostedcontrolplane/testdata/kube-apiserver/zz_fixture_TestControlPlaneComponents.yaml @@ -81,42 +81,17 @@ spec: topologyKey: kubernetes.io/hostname automountServiceAccountToken: false containers: - - args: - - -c - - | - #!/bin/sh - function cleanup() { - pkill -P $$$ - wait - exit - } - trap cleanup SIGTERM - while true; do - if oc apply -f /work; then - echo "Bootstrap manifests applied successfully." - break - fi - sleep 1 - done - while true; do - if oc replace --subresource=status -f /work/99_feature-gate.yaml; then - echo "FeatureGate status applied successfully." - break - fi - sleep 1 - done - while true; do - sleep 1000 & - wait $! - done - command: - - /bin/bash + - command: + - /usr/bin/control-plane-operator + - kas-bootstrap + - --resources-path + - /work env: - name: KUBECONFIG value: /var/secrets/localhost-kubeconfig/kubeconfig - image: cli + image: controlplane-operator imagePullPolicy: IfNotPresent - name: apply-bootstrap + name: bootstrap resources: requests: cpu: 10m @@ -383,7 +358,7 @@ spec: featureGates: null image: cluster-config-api imagePullPolicy: IfNotPresent - name: init-bootstrap + name: init-bootstrap-render resources: requests: cpu: 30m diff --git a/control-plane-operator/controllers/hostedcontrolplane/testdata/kube-apiserver/zz_fixture_TestControlPlaneComponents_TechPreviewNoUpgrade.yaml b/control-plane-operator/controllers/hostedcontrolplane/testdata/kube-apiserver/zz_fixture_TestControlPlaneComponents_TechPreviewNoUpgrade.yaml index daf49078117..b7414da668e 100644 --- a/control-plane-operator/controllers/hostedcontrolplane/testdata/kube-apiserver/zz_fixture_TestControlPlaneComponents_TechPreviewNoUpgrade.yaml +++ b/control-plane-operator/controllers/hostedcontrolplane/testdata/kube-apiserver/zz_fixture_TestControlPlaneComponents_TechPreviewNoUpgrade.yaml @@ -81,42 +81,17 @@ spec: topologyKey: kubernetes.io/hostname automountServiceAccountToken: false containers: - - args: - - -c - - | - #!/bin/sh - function cleanup() { - pkill -P $$$ - wait - exit - } - trap cleanup SIGTERM - while true; do - if oc apply -f /work; then - echo "Bootstrap manifests applied successfully." - break - fi - sleep 1 - done - while true; do - if oc replace --subresource=status -f /work/99_feature-gate.yaml; then - echo "FeatureGate status applied successfully." - break - fi - sleep 1 - done - while true; do - sleep 1000 & - wait $! - done - command: - - /bin/bash + - command: + - /usr/bin/control-plane-operator + - kas-bootstrap + - --resources-path + - /work env: - name: KUBECONFIG value: /var/secrets/localhost-kubeconfig/kubeconfig - image: cli + image: controlplane-operator imagePullPolicy: IfNotPresent - name: apply-bootstrap + name: bootstrap resources: requests: cpu: 10m @@ -384,7 +359,7 @@ spec: featureGates: null image: cluster-config-api imagePullPolicy: IfNotPresent - name: init-bootstrap + name: init-bootstrap-render resources: requests: cpu: 30m diff --git a/control-plane-operator/controllers/hostedcontrolplane/v2/assets/kube-apiserver/deployment.yaml b/control-plane-operator/controllers/hostedcontrolplane/v2/assets/kube-apiserver/deployment.yaml index 6f2a96d3b48..4dc83eb8268 100644 --- a/control-plane-operator/controllers/hostedcontrolplane/v2/assets/kube-apiserver/deployment.yaml +++ b/control-plane-operator/controllers/hostedcontrolplane/v2/assets/kube-apiserver/deployment.yaml @@ -20,42 +20,17 @@ spec: app: kube-apiserver spec: containers: - - args: - - -c - - | - #!/bin/sh - function cleanup() { - pkill -P $$$ - wait - exit - } - trap cleanup SIGTERM - while true; do - if oc apply -f /work; then - echo "Bootstrap manifests applied successfully." - break - fi - sleep 1 - done - while true; do - if oc replace --subresource=status -f /work/99_feature-gate.yaml; then - echo "FeatureGate status applied successfully." - break - fi - sleep 1 - done - while true; do - sleep 1000 & - wait $! - done - command: - - /bin/bash + - command: + - /usr/bin/control-plane-operator + - kas-bootstrap + - --resources-path + - /work env: - name: KUBECONFIG value: /var/secrets/localhost-kubeconfig/kubeconfig - image: cli + image: controlplane-operator imagePullPolicy: IfNotPresent - name: apply-bootstrap + name: bootstrap resources: requests: cpu: 10m @@ -282,7 +257,7 @@ spec: - /bin/bash image: cluster-config-api imagePullPolicy: IfNotPresent - name: init-bootstrap + name: init-bootstrap-render resources: requests: cpu: 30m diff --git a/control-plane-operator/controllers/hostedcontrolplane/v2/kas/deployment.go b/control-plane-operator/controllers/hostedcontrolplane/v2/kas/deployment.go index cbf156135fe..c0fea73b712 100644 --- a/control-plane-operator/controllers/hostedcontrolplane/v2/kas/deployment.go +++ b/control-plane-operator/controllers/hostedcontrolplane/v2/kas/deployment.go @@ -208,7 +208,7 @@ func updateBootstrapInitContainer(deployment *appsv1.Deployment, hcp *hyperv1.Ho } featureGateYaml := featureGateBuffer.String() - util.UpdateContainer("init-bootstrap", deployment.Spec.Template.Spec.InitContainers, func(c *corev1.Container) { + util.UpdateContainer("init-bootstrap-render", deployment.Spec.Template.Spec.InitContainers, func(c *corev1.Container) { c.Env = append(c.Env, corev1.EnvVar{ Name: "PAYLOAD_VERSION",