From 7c15908dc30a58c8c75404f3d641cd64506cc467 Mon Sep 17 00:00:00 2001 From: Michal Fojtik Date: Fri, 5 Oct 2018 16:01:46 +0200 Subject: [PATCH] Replace kube-core rendering with operators render --- pkg/asset/ignition/bootstrap/bootstrap.go | 2 - pkg/asset/ignition/content/bootkube.go | 65 +++++++------------ .../content/bootkube/cvo-overrides.go | 20 ------ 3 files changed, 23 insertions(+), 64 deletions(-) diff --git a/pkg/asset/ignition/bootstrap/bootstrap.go b/pkg/asset/ignition/bootstrap/bootstrap.go index 8483d1ffded..a22fa83a1e0 100644 --- a/pkg/asset/ignition/bootstrap/bootstrap.go +++ b/pkg/asset/ignition/bootstrap/bootstrap.go @@ -40,7 +40,6 @@ type bootstrapTemplateData struct { EtcdCluster string EtcdctlImage string HyperkubeImage string - KubeCoreRenderImage string ReleaseImage string } @@ -156,7 +155,6 @@ func (a *Bootstrap) getTemplateData(installConfig *types.InstallConfig) (*bootst CloudProvider: getCloudProvider(installConfig), CloudProviderConfig: getCloudProviderConfig(installConfig), DebugConfig: "", - KubeCoreRenderImage: "quay.io/coreos/kube-core-renderer-dev:3b6952f5a1ba89bb32dd0630faddeaf2779c9a85", EtcdCertSignerImage: "quay.io/coreos/kube-etcd-signer-server:678cc8e6841e2121ebfdb6e2db568fce290b67d6", EtcdctlImage: "quay.io/coreos/etcd:v3.2.14", BootkubeImage: "quay.io/coreos/bootkube:v0.10.0", diff --git a/pkg/asset/ignition/content/bootkube.go b/pkg/asset/ignition/content/bootkube.go index e35d22307cc..e4a048e22ea 100644 --- a/pkg/asset/ignition/content/bootkube.go +++ b/pkg/asset/ignition/content/bootkube.go @@ -27,7 +27,7 @@ var ( BootkubeShFileTemplate = template.Must(template.New("bootkube.sh").Parse(`#!/usr/bin/env bash set -e -mkdir --parents /etc/kubernetes/manifests/ +mkdir --parents /etc/kubernetes/{manifests,bootstrap-configs} MACHINE_CONFIG_OPERATOR_IMAGE=$(podman run --rm {{.ReleaseImage}} image machine-config-operator) echo "Found Machine Config Operator's image: $MACHINE_CONFIG_OPERATOR_IMAGE" @@ -52,23 +52,6 @@ then cp --recursive cvo-bootstrap/bootstrap/bootstrap-pod.yaml /etc/kubernetes/manifests/ fi -if [ ! -d kco-bootstrap ] -then - echo "Rendering Kubernetes core manifests..." - - # shellcheck disable=SC2154 - podman run \ - --volume "$PWD:/assets:z" \ - --volume /etc/kubernetes:/etc/kubernetes:z \ - "{{.KubeCoreRenderImage}}" \ - --config=/assets/kco-config.yaml \ - --output=/assets/kco-bootstrap - - cp --recursive kco-bootstrap/bootstrap-configs /etc/kubernetes/bootstrap-configs - cp --recursive kco-bootstrap/bootstrap-manifests . - cp --recursive kco-bootstrap/manifests . -fi - if [ ! -d kube-apiserver-bootstrap ] then echo "Rendering Kubernetes API server core manifests..." @@ -78,15 +61,15 @@ then --volume "$PWD:/assets:z" \ "${KUBE_APISERVER_OPERATOR_IMAGE}" \ /usr/bin/cluster-kube-apiserver-operator render \ + --manifest-etcd-server-urls={{.EtcdCluster}} \ --asset-input-dir=/assets/tls \ --asset-output-dir=/assets/kube-apiserver-bootstrap \ --config-override-file=/usr/share/bootkube/manifests/config/config-overrides.yaml \ --config-output-file=/assets/kube-apiserver-bootstrap/config - # TODO: copy the bootstrap manifests to replace kube-core-operator - cp --recursive kube-apiserver-bootstrap/manifests/openshift-kube-apiserver-ns.yaml manifests/00_openshift-kube-apiserver-ns.yaml - cp --recursive kube-apiserver-bootstrap/manifests/secret-* manifests/ - cp --recursive kube-apiserver-bootstrap/manifests/configmap-* manifests/ + cp kube-apiserver-bootstrap/config /etc/kubernetes/bootstrap-configs/kube-apiserver-config.yaml + cp --recursive kube-apiserver-bootstrap/bootstrap-manifests . + cp --recursive kube-apiserver-bootstrap/manifests . fi if [ ! -d kube-controller-manager-bootstrap ] @@ -103,30 +86,28 @@ then --config-override-file=/usr/share/bootkube/manifests/config/config-overrides.yaml \ --config-output-file=/assets/kube-controller-manager-bootstrap/config - # TODO: copy the bootstrap manifests to replace kube-core-operator - cp --recursive kube-controller-manager-bootstrap/manifests/openshift-kube-controller-manager-ns.yaml manifests/00_openshift-kube-controller-manager-ns.yaml - cp --recursive kube-controller-manager-bootstrap/manifests/secret-* manifests/ - cp --recursive kube-controller-manager-bootstrap/manifests/configmap-* manifests/ + cp kube-controller-manager-bootstrap/config /etc/kubernetes/bootstrap-configs/kube-controller-manager-config.yaml + cp --recursive kube-controller-manager-bootstrap/bootstrap-manifests/* bootstrap-manifests/ + cp --recursive kube-controller-manager-bootstrap/manifests manifests/ fi if [ ! -d kube-scheduler-bootstrap ] then - echo "Rendering Kubernetes Scheduler core manifests..." - - # shellcheck disable=SC2154 - podman run \ - --volume "$PWD:/assets:z" \ - "${KUBE_SCHEDULER_OPERATOR_IMAGE}" \ - /usr/bin/cluster-kube-scheduler-operator render \ - --asset-input-dir=/assets/tls \ - --asset-output-dir=/assets/kube-scheduler-bootstrap \ - --config-override-file=/usr/share/bootkube/manifests/config/config-overrides.yaml \ - --config-output-file=/assets/kube-scheduler-bootstrap/config - - # TODO: copy the bootstrap manifests to replace kube-core-operator - cp --recursive kube-scheduler-bootstrap/manifests/openshift-kube-scheduler-ns.yaml manifests/00_openshift-kube-scheduler-ns.yaml - cp --recursive kube-scheduler-bootstrap/manifests/secret-* manifests/ - cp --recursive kube-scheduler-bootstrap/manifests/configmap-* manifests/ + echo "Rendering Kubernetes Scheduler core manifests..." + + # shellcheck disable=SC2154 + podman run \ + --volume "$PWD:/assets:z" \ + "${KUBE_SCHEDULER_OPERATOR_IMAGE}" \ + /usr/bin/cluster-kube-scheduler-operator render \ + --asset-input-dir=/assets/tls \ + --asset-output-dir=/assets/kube-scheduler-bootstrap \ + --config-override-file=/usr/share/bootkube/manifests/config/config-overrides.yaml \ + --config-output-file=/assets/kube-scheduler-bootstrap/config + + cp kube-scheduler-bootstrap/config /etc/kubernetes/bootstrap-configs/kube-scheduler-config.yaml + cp --recursive kube-scheduler-bootstrap/bootstrap-manifests/* bootstrap-manifests/ + cp --recursive kube-scheduler-bootstrap/manifests manifests/ fi if [ ! -d mco-bootstrap ] diff --git a/pkg/asset/manifests/content/bootkube/cvo-overrides.go b/pkg/asset/manifests/content/bootkube/cvo-overrides.go index 11b8eef708e..ed29b8b9389 100644 --- a/pkg/asset/manifests/content/bootkube/cvo-overrides.go +++ b/pkg/asset/manifests/content/bootkube/cvo-overrides.go @@ -19,26 +19,6 @@ upstream: http://localhost:8080/graph channel: fast clusterID: {{.CVOClusterID}} overrides: -- kind: Deployment # this conflicts with kube-core-operator - namespace: openshift-core-operators - name: openshift-cluster-kube-apiserver-operator - unmanaged: true -- kind: Deployment # this conflicts with kube-core-operator - namespace: openshift-core-operators - name: openshift-cluster-kube-scheduler-operator - unmanaged: true -- kind: Deployment # this conflicts with kube-core-operator - namespace: openshift-core-operators - name: openshift-cluster-kube-controller-manager-operator - unmanaged: true -- kind: Deployment # this conflicts with kube-core-operator - namespace: openshift-core-operators - name: openshift-cluster-openshift-apiserver-operator - unmanaged: true -- kind: Deployment # this conflicts with kube-core-operator - namespace: openshift-core-operators - name: openshift-cluster-openshift-controller-manager-operator - unmanaged: true - kind: Deployment # this conflicts with kube-core-operator namespace: openshift-cluster-network-operator name: cluster-network-operator