Skip to content

Commit

Permalink
Merge pull request #3 from sttts/sttts-image-overrides
Browse files Browse the repository at this point in the history
bootkube: allow overriding control plane operator images
  • Loading branch information
mfojtik authored Oct 10, 2018
2 parents c43391c + 18253db commit 7dbd330
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 25 deletions.
64 changes: 44 additions & 20 deletions pkg/asset/ignition/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,18 @@ const (
// bootstrapTemplateData is the data to use to replace values in bootstrap
// template files.
type bootstrapTemplateData struct {
BootkubeImage string
CloudProvider string
CloudProviderConfig string
ClusterDNSIP string
DebugConfig string
EtcdCertSignerImage string
EtcdCluster string
EtcdctlImage string
ReleaseImage string
BootkubeImage string
CloudProvider string
CloudProviderConfig string
ClusterDNSIP string
ClusterKubeApiserverOperatorImage string
ClusterKubeControllerManagerOperatorImage string
ClusterKubeSchedulerOperatorImage string
DebugConfig string
EtcdCertSignerImage string
EtcdCluster string
EtcdctlImage string
ReleaseImage string
}

// Bootstrap is an asset that generates the ignition config for bootstrap nodes.
Expand Down Expand Up @@ -143,21 +146,42 @@ func (a *Bootstrap) getTemplateData(installConfig *types.InstallConfig) (*bootst
}

releaseImage := defaultReleaseImage
if ri, ok := os.LookupEnv("OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE"); ok && ri != "" {
if override, ok := os.LookupEnv("OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE"); ok && override != "" {
log.Warn("Found override for ReleaseImage. Please be warned, this is not advised")
releaseImage = ri
releaseImage = override
}

clusterKubeApiserverOperatorImage := ""
if override, ok := os.LookupEnv("OPENSHIFT_INSTALL_KUBE_APISERVER_OPERATOR_IMAGE_OVERRIDE"); ok && override != "" {
log.Warn("Found override for cluster-kube-apiserver-operator. Please be warned, this is not advised")
clusterKubeApiserverOperatorImage = override
}

clusterKubeControllerManagerOperatorImage := ""
if override, ok := os.LookupEnv("OPENSHIFT_INSTALL_KUBE_CONTROLLER_MANAGER_OPERATOR_IMAGE_OVERRIDE"); ok && override != "" {
log.Warn("Found override for cluster-kube-controller-manager-operator. Please be warned, this is not advised")
clusterKubeControllerManagerOperatorImage = override
}

clusterKubeSchedulerOperatorImage := ""
if override, ok := os.LookupEnv("OPENSHIFT_INSTALL_KUBE_SCHEDULER_OPERATOR_IMAGE_OVERRIDE"); ok && override != "" {
log.Warn("Found override for cluster-kube-scheduler-operator. Please be warned, this is not advised")
clusterKubeSchedulerOperatorImage = override
}

return &bootstrapTemplateData{
ClusterDNSIP: clusterDNSIP,
CloudProvider: getCloudProvider(installConfig),
CloudProviderConfig: getCloudProviderConfig(installConfig),
DebugConfig: "",
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",
ReleaseImage: releaseImage,
EtcdCluster: strings.Join(etcdEndpoints, ","),
ClusterDNSIP: clusterDNSIP,
CloudProvider: getCloudProvider(installConfig),
CloudProviderConfig: getCloudProviderConfig(installConfig),
DebugConfig: "",
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",
ClusterKubeApiserverOperatorImage: clusterKubeApiserverOperatorImage,
ClusterKubeControllerManagerOperatorImage: clusterKubeControllerManagerOperatorImage,
ClusterKubeSchedulerOperatorImage: clusterKubeSchedulerOperatorImage,
ReleaseImage: releaseImage,
EtcdCluster: strings.Join(etcdEndpoints, ","),
}, nil
}

Expand Down
14 changes: 9 additions & 5 deletions pkg/asset/ignition/content/bootkube.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ MACHINE_CONFIG_CONTROLLER_IMAGE=$(podman run --rm {{.ReleaseImage}} image machin
MACHINE_CONFIG_SERVER_IMAGE=$(podman run --rm {{.ReleaseImage}} image machine-config-server)
MACHINE_CONFIG_DAEMON_IMAGE=$(podman run --rm {{.ReleaseImage}} image machine-config-daemon)
KUBE_APISERVER_OPERATOR_IMAGE=$(podman run --rm {{.ReleaseImage}} image cluster-kube-apiserver-operator)
KUBE_CONTROLLER_MANAGER_OPERATOR_IMAGE=$(podman run --rm {{.ReleaseImage}} image cluster-kube-controller-manager-operator)
KUBE_SCHEDULER_OPERATOR_IMAGE=$(podman run --rm {{.ReleaseImage}} image cluster-kube-scheduler-operator)
KUBE_APISERVER_OPERATOR_IMAGE="{{.ClusterKubeApiserverOperatorImage}}"
KUBE_CONTROLLER_MANAGER_OPERATOR_IMAGE="{{.ClusterKubeControllerManagerOperatorImage}}"
KUBE_SCHEDULER_OPERATOR_IMAGE="{{.ClusterKubeSchedulerOperatorImage}}"
KUBE_APISERVER_OPERATOR_IMAGE=${KUBE_APISERVER_OPERATOR_IMAGE:-$(podman run --rm {{.ReleaseImage}} image cluster-kube-apiserver-operator)}
KUBE_CONTROLLER_MANAGER_OPERATOR_IMAGE=${KUBE_CONTROLLER_MANAGER_OPERATOR_IMAGE:-$(podman run --rm {{.ReleaseImage}} image cluster-kube-controller-manager-operator)}
KUBE_SCHEDULER_OPERATOR_IMAGE=${KUBE_SCHEDULER_OPERATOR_IMAGE:-$(podman run --rm {{.ReleaseImage}} image cluster-kube-scheduler-operator)}
OPENSHIFT_HYPERSHIFT_IMAGE=$(podman run --rm {{.ReleaseImage}} image hypershift)
OPENSHIFT_HYPERKUBE_IMAGE=$(podman run --rm {{.ReleaseImage}} image hyperkube)
Expand Down Expand Up @@ -77,8 +81,8 @@ then
--config-output-file=/assets/kube-apiserver-bootstrap/config
cp kube-apiserver-bootstrap/config /etc/kubernetes/bootstrap-configs/kube-apiserver-config.yaml
cp --recursive kube-controller-manager-bootstrap/bootstrap-manifests/* bootstrap-manifests/
cp --recursive kube-controller-manager-bootstrap/manifests manifests/
cp --recursive kube-apiserver-bootstrap/bootstrap-manifests/* bootstrap-manifests/
cp --recursive kube-apiserver-bootstrap/manifests manifests/
fi
if [ ! -d kube-controller-manager-bootstrap ]
Expand Down

0 comments on commit 7dbd330

Please sign in to comment.