Skip to content

Commit 2e7df25

Browse files
committed
Update make:bundle to set OPERATOR_IMAGE_URL
This gets passed to the the operator-manager and is used to run the controller-manager
1 parent 6aa8392 commit 2e7df25

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ endif
364364
bundle: build manifests kustomize operator-sdk ## Generate bundle manifests and metadata, then validate generated files.
365365
$(OPERATOR_SDK) generate kustomize manifests -q
366366
cd config/operator/deployment/ && $(KUSTOMIZE) edit set image controller=$(IMG)
367+
sed -i -e 's|operator:image|$(IMG)|' config/operator/deployment/deployment.yaml
367368
$(KUSTOMIZE) build config/operator --load-restrictor='LoadRestrictionsNone' | $(OPERATOR_SDK) generate bundle $(BUNDLE_GEN_FLAGS)
368369
#cp dependencies.yaml ./bundle/metadata
369370
$(OPERATOR_SDK) bundle validate ./bundle

config/manager/kustomization.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,3 @@ configMapGenerator:
88
- files:
99
- controller_manager_config.yaml
1010
name: manager-config
11-
apiVersion: kustomize.config.k8s.io/v1beta1
12-
kind: Kustomization
13-
images:
14-
- name: controller
15-
newName: quay.io/openstack-k8s-operators/openstack-operator
16-
newTag: latest

config/manager/manager.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ spec:
4444
env:
4545
- name: OPENSTACK_RELEASE_VERSION
4646
value: 0.0.1
47-
image: controller:latest
47+
image: '{{ .OperatorImage }}'
4848
name: manager
4949
securityContext:
5050
allowPrivilegeEscalation: false

config/operator/deployment/deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ spec:
4646
value: false
4747
- name: OPENSTACK_RELEASE_VERSION
4848
value: 0.0.1
49+
- name: OPERATOR_IMAGE_URL
50+
value: quay.io/openstack-k8s-operators/openstack-operator:latest
4951
image: controller:latest
5052
name: operator
5153
securityContext:

controllers/operator/openstack_controller.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ func (r *OpenStackReconciler) GetLogger(ctx context.Context) logr.Logger {
6464
var (
6565
envRelatedOperatorImages (map[string]*string) // operatorName -> image
6666
rabbitmqImage string
67+
operatorImage string
6768
)
6869

6970
// SetupEnv -
@@ -84,6 +85,8 @@ func SetupEnv() {
8485
envRelatedOperatorImages[operatorName] = &envArr[1]
8586
}
8687
log.Log.Info("Found operator related image", "operator", operatorName, "image", envArr[1])
88+
} else if envArr[0] == "OPERATOR_IMAGE_URL" {
89+
operatorImage = envArr[1]
8790
}
8891
}
8992
}
@@ -306,6 +309,7 @@ func (r *OpenStackReconciler) applyOperator(ctx context.Context, instance *opera
306309
data.Data["OperatorNamespace"] = instance.Namespace
307310
data.Data["OperatorImages"] = envRelatedOperatorImages
308311
data.Data["RabbitmqImage"] = rabbitmqImage
312+
data.Data["OperatorImage"] = operatorImage
309313
return r.renderAndApply(ctx, instance, data, "operator", true)
310314
}
311315

0 commit comments

Comments
 (0)