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
12 changes: 11 additions & 1 deletion cmd/cluster-cloud-controller-manager-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ var (
retryPeriod = 90 * time.Second
)

const defaultManagedNamespace = "openshift-cloud-controller-manager"
const (
defaultManagedNamespace = "openshift-cloud-controller-manager"
defaultImagesLocation = "/etc/cloud-controller-manager-config/images.json"
)

func init() {
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
Expand Down Expand Up @@ -97,6 +100,12 @@ func main() {
"The namespace for managed objects, where out-of-tree CCM binaries will run.",
)

imagesFile := flag.String(
"images-json",
defaultImagesLocation,
"The location of images file to use by operator for managed CCM binaries.",
)

flag.Parse()

ctrl.SetLogger(klogr.New().WithName("CCMOperator"))
Expand Down Expand Up @@ -125,6 +134,7 @@ func main() {
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
ManagedNamespace: *managedNamespace,
ImagesFile: *imagesFile,
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "ClusterOperator")
os.Exit(1)
Expand Down
1 change: 1 addition & 0 deletions controllers/clusteroperator_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ type CloudOperatorReconciler struct {
Scheme *runtime.Scheme
watcher ObjectWatcher
ManagedNamespace string
ImagesFile string
}

// +kubebuilder:rbac:groups=config.openshift.io,resources=clusteroperators,verbs=get;list;watch;create;update;patch;delete
Expand Down
4 changes: 4 additions & 0 deletions hack/example-images.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"cloudControllerManagerAWS": "registry.svc.ci.openshift.org/openshift:aws-cloud-controller-manager",
"cloudControllerManagerOpenStack": "registry.svc.ci.openshift.org/openshift:openstack-cloud-controller-manager"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also need an image-references as we do in MAO to get the images substituted correctly? https://github.com/openshift/machine-api-operator/blob/master/install/image-references

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, right. I added these lines in the file 👍

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is an image-reference below, is that not sufficient?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is sufficient, but it wasn't there when I reviewed ;)

kind: ConfigMap
metadata:
name: cloud-controller-manager-images
namespace: openshift-cloud-controller-manager-operator
data:
images.json: >
{
"cloudControllerManagerAWS": "registry.svc.ci.openshift.org/openshift:aws-cloud-controller-manager",
"cloudControllerManagerOpenStack": "registry.svc.ci.openshift.org/openshift:openstack-cloud-controller-manager"
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,17 @@ spec:
- "/cluster-controller-manager-operator"
args:
- --leader-elect
- "--images-json=/etc/cloud-controller-manager-config/images.json"
env:
- name: RELEASE_VERSION
value: "0.0.1-snapshot"
resources:
requests:
cpu: 10m
memory: 50Mi
volumeMounts:
- name: images
mountPath: /etc/cloud-controller-manager-config/
nodeSelector:
node-role.kubernetes.io/master: ""
restartPolicy: Always
Expand All @@ -49,3 +53,8 @@ spec:
operator: "Exists"
effect: "NoExecute"
tolerationSeconds: 120
volumes:
- name: images
configMap:
defaultMode: 420
name: machine-api-operator-images
8 changes: 8 additions & 0 deletions manifests/image-references
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,11 @@ spec:
from:
kind: DockerImage
name: registry.svc.ci.openshift.org/openshift:cluster-cloud-controller-manager-operator
- name: aws-machine-controllers
from:
kind: DockerImage
name: registry.svc.ci.openshift.org/openshift:aws-cloud-controller-manager
- name: openstack-machine-controllers
from:
kind: DockerImage
name: registry.svc.ci.openshift.org/openshift:openstack-cloud-controller-manager