Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions cmd/machine-config-operator/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,19 @@ func runBootstrapCmd(cmd *cobra.Command, args []string) {
glog.Infof("Version: %+v (%s)", version.Version, version.Hash)

imgs := operator.Images{
MachineConfigOperator: bootstrapOpts.mcoImage,
MachineConfigController: bootstrapOpts.mccImage,
MachineConfigDaemon: bootstrapOpts.mcdImage,
MachineConfigServer: bootstrapOpts.mcsImage,
MachineOSContent: bootstrapOpts.oscontentImage,
Etcd: bootstrapOpts.etcdImage,
SetupEtcdEnv: bootstrapOpts.setupEtcdEnvImage,
InfraImage: bootstrapOpts.infraImage,
KubeClientAgent: bootstrapOpts.kubeClientAgentImage,
RenderConfigImages: operator.RenderConfigImages{
MachineConfigOperator: bootstrapOpts.mcoImage,
MachineConfigController: bootstrapOpts.mccImage,
MachineConfigDaemon: bootstrapOpts.mcdImage,
MachineConfigServer: bootstrapOpts.mcsImage,
MachineOSContent: bootstrapOpts.oscontentImage,
},
ControllerConfigImages: operator.ControllerConfigImages{
Etcd: bootstrapOpts.etcdImage,
SetupEtcdEnv: bootstrapOpts.setupEtcdEnvImage,
InfraImage: bootstrapOpts.infraImage,
KubeClientAgent: bootstrapOpts.kubeClientAgentImage,
},
}

if err := operator.RenderBootstrap(
Expand Down
5 changes: 2 additions & 3 deletions pkg/apis/machineconfiguration.openshift.io/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,14 @@ type ControllerConfigSpec struct {
// on all machines.
PullSecret *corev1.ObjectReference `json:"pullSecret,omitempty"`

// images is the map of images that are used by the controller,
// i.e. images for etcd Environment Setup, etcd, Kube Client Agent, and Infra containers.
// images is map of images that are used by the controller to render templates under ./templates/
Images map[string]string `json:"images"`

// osImageURL is the location of the container image that contains the OS update payload.
// Its value is taken from the data.osImageURL field on the machine-config-osimageurl ConfigMap.
OSImageURL string `json:"osImageURL"`

// Proxy holds the current proxy configuration for the nodes
// proxy holds the current proxy configuration for the nodes
Proxy *configv1.ProxyStatus `json:"proxy"`
}

Expand Down
8 changes: 4 additions & 4 deletions pkg/controller/template/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package template

const (
// EtcdImageKey is the key that references the etcd image in the controller
EtcdImageKey string = "etcd"
EtcdImageKey string = "etcdKey"

// SetupEtcdEnvKey is the key that references the setup-etcd-environment image in the controller
SetupEtcdEnvKey string = "setupEtcdEnv"
SetupEtcdEnvKey string = "setupEtcdEnvKey"

// InfraImageKey is the key that references the infra image in the controller for crio.conf
InfraImageKey string = "infraImage"
InfraImageKey string = "infraImageKey"

// KubeClientAgentImageKey is the key that references the kube-client-agent image in the controller
KubeClientAgentImageKey string = "kubeClientAgentImage"
KubeClientAgentImageKey string = "kubeClientAgentImageKey"
)
2 changes: 1 addition & 1 deletion pkg/operator/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func RenderBootstrap(
templatectrl.KubeClientAgentImageKey: imgs.KubeClientAgent,
}

config := getRenderConfig("", string(filesData[kubeAPIServerServingCA]), spec, imgs, infra.Status.APIServerInternalURL)
config := getRenderConfig("", string(filesData[kubeAPIServerServingCA]), spec, &imgs.RenderConfigImages, infra.Status.APIServerInternalURL)

manifests := []struct {
name string
Expand Down
18 changes: 14 additions & 4 deletions pkg/operator/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,23 @@ package operator
// Change the installer to pass that arg with the image from the CVO
// (some time later) Change the option to required and drop the default
type Images struct {
RenderConfigImages
ControllerConfigImages
}

// RenderConfigImages are image names used to render templates under ./manifests/
type RenderConfigImages struct {
MachineConfigOperator string `json:"machineConfigOperator"`
MachineConfigController string `json:"machineConfigController"`
MachineConfigDaemon string `json:"machineConfigDaemon"`
MachineConfigServer string `json:"machineConfigServer"`
MachineOSContent string `json:"machineOSContent"`
Etcd string `json:"etcd"`
SetupEtcdEnv string `json:"setupEtcdEnv"`
InfraImage string `json:"infraImage"`
KubeClientAgent string `json:"kubeClientAgentImage"`
}

// ControllerConfigImages are image names used to render templates under ./templates/
type ControllerConfigImages struct {
Etcd string `json:"etcd"`
SetupEtcdEnv string `json:"setupEtcdEnv"`
InfraImage string `json:"infraImage"`
KubeClientAgent string `json:"kubeClientAgentImage"`
}
2 changes: 1 addition & 1 deletion pkg/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ func (optr *Operator) getGlobalConfig() (*configv1.Infrastructure, *configv1.Net
return infra, network, proxy, nil
}

func getRenderConfig(tnamespace, kubeAPIServerServingCA string, ccSpec *mcfgv1.ControllerConfigSpec, imgs *Images, apiServerURL string) *renderConfig {
func getRenderConfig(tnamespace, kubeAPIServerServingCA string, ccSpec *mcfgv1.ControllerConfigSpec, imgs *RenderConfigImages, apiServerURL string) *renderConfig {
return &renderConfig{
TargetNamespace: tnamespace,
Version: version.Raw,
Expand Down
2 changes: 1 addition & 1 deletion pkg/operator/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type renderConfig struct {
Version string
ControllerConfig mcfgv1.ControllerConfigSpec
APIServerURL string
Images *Images
Images *RenderConfigImages
KubeAPIServerServingCA string
}

Expand Down
5 changes: 3 additions & 2 deletions pkg/operator/render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ func TestRenderAsset(t *testing.T) {
Path: "manifests/machineconfigcontroller/deployment.yaml",
RenderConfig: &renderConfig{
TargetNamespace: "testing-namespace",
Images: &Images{
MachineConfigOperator: "{MCO: PLACEHOLDER}"},
Images: &RenderConfigImages{
MachineConfigOperator: "{MCO: PLACEHOLDER}",
},
},
FindExpected: "image: {MCO: PLACEHOLDER}",
}, {
Expand Down
2 changes: 1 addition & 1 deletion pkg/operator/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (optr *Operator) syncRenderConfig(_ *renderConfig) error {
}

// create renderConfig
optr.renderConfig = getRenderConfig(optr.namespace, string(kubeAPIServerServingCABytes), spec, &imgs, infra.Status.APIServerURL)
optr.renderConfig = getRenderConfig(optr.namespace, string(kubeAPIServerServingCABytes), spec, &imgs.RenderConfigImages, infra.Status.APIServerURL)
return nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ contents:
spec:
initContainers:
- name: discovery
image: "{{.Images.setupEtcdEnv}}"
image: "{{.Images.setupEtcdEnvKey}}"
command: ["/usr/bin/setup-etcd-environment"]
args:
- "run"
Expand All @@ -24,7 +24,7 @@ contents:
- name: discovery
mountPath: /run/etcd/
- name: certs
image: "{{.Images.kubeClientAgentImage}}"
image: "{{.Images.kubeClientAgentImageKey}}"
command:
- /bin/sh
- -c
Expand Down Expand Up @@ -77,7 +77,7 @@ contents:
mountPath: /etc/kubernetes/kubeconfig
containers:
- name: etcd-member
image: "{{.Images.etcd}}"
image: "{{.Images.etcdKey}}"
command:
- /bin/sh
- -c
Expand Down Expand Up @@ -136,7 +136,7 @@ contents:
containerPort: 2379
protocol: TCP
- name: etcd-metrics
image: "{{.Images.etcd}}"
image: "{{.Images.etcdKey}}"
command:
- /bin/sh
- -c
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ contents:
default_transport = "docker://"

# pause_image is the image which we use to instantiate infra containers.
pause_image = "{{.Images.infraImage}}"
pause_image = "{{.Images.infraImageKey}}"

# If not empty, the path to a docker/config.json-like file containing credentials
# necessary for pulling the image specified by pause_image above.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ contents:
default_transport = "docker://"

# pause_image is the image which we use to instantiate infra containers.
pause_image = "{{.Images.infraImage}}"
pause_image = "{{.Images.infraImageKey}}"

# If not empty, the path to a docker/config.json-like file containing credentials
# necessary for pulling the image specified by pause_image above.
Expand Down