Skip to content

Add relatedImages to CSV to support disconnected environments #170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ go.work
bundle_tmp*/

must-gather.local.*/

build/*
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@darkdoc is it ok to ignore this directory?

4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ ifneq ($(origin CHANNELS), undefined)
BUNDLE_CHANNELS := --channels=$(CHANNELS)
endif

USE_IMAGE_DIGESTS ?= --use-image-digests

# DEFAULT_CHANNEL defines the default channel used in the bundle.
# Add a new line here if you would like to change its default config. (E.g DEFAULT_CHANNEL = "stable")
# To re-generate a bundle for any other default channel without changing the default setup, you can:
Expand All @@ -27,7 +29,7 @@ endif
ifneq ($(origin DEFAULT_CHANNEL), undefined)
BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
endif
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL) $(USE_IMAGE_DIGESTS)

BUNDLE_CONTAINERFILE_TEMPLATE ?= new-bundle.Dockerfile
# IMAGE_TAG_BASE defines the docker.io namespace and part of the image name for remote images.
Expand Down
3 changes: 2 additions & 1 deletion bundle.konflux.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ RUN \
--version $(cat VERSION.txt) \
--output-dir build \
--channels development \
--default-channel development && \
--default-channel development \
--use-image-digests && \
operator-sdk bundle validate ./build

FROM scratch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ metadata:
}
]
capabilities: Basic Install
createdAt: "2025-04-02T20:39:25Z"
createdAt: "2025-04-04T18:38:43Z"
features.operators.openshift.io/cnf: "false"
features.operators.openshift.io/cni: "false"
features.operators.openshift.io/csi: "true"
Expand All @@ -41,7 +41,8 @@ metadata:
features.operators.openshift.io/token-auth-gcp: "false"
operatorframework.io/initialization-resource: '{"apiVersion":"scale.storage.openshift.io/v1alpha1","kind":"StorageScale","metadata":{"name":"storagescale-sample"},"spec":{"ibm_cnsa_version":"v5.2.2.1","mco_config":{"create":true,"labels":{"machineconfiguration.openshift.io/role":"worker"}},"ibm_cnsa_cluster":{"create":true,"daemon_nodeSelector":{"node-role.kubernetes.io/worker":""}}}}'
operatorframework.io/suggested-namespace: openshift-storage-scale
operators.openshift.io/valid-subscription: '["Openshift Container Platform"]'
operators.openshift.io/infrastructure-features: '["disconnected"]'
operators.openshift.io/valid-subscription: '["Openshift Container Platform","OpenShift Virtualization Engine"]'
operators.operatorframework.io/builder: operator-sdk-v1.39.1
operators.operatorframework.io/internal-objects: '["localvolumediscoveryresults.scale.storage.openshift.io","localvolumediscoveries.scale.storage.openshift.io"]'
operators.operatorframework.io/project_layout: go.kubebuilder.io/v4
Expand Down Expand Up @@ -405,6 +406,15 @@ spec:
- list
- patch
- watch
- apiGroups:
- operator.openshift.io
resources:
- consoles
verbs:
- get
- list
- update
- watch
- apiGroups:
- policy
resources:
Expand Down Expand Up @@ -659,7 +669,7 @@ spec:
app.kubernetes.io/component: openshift-storage-scale-operator-console-plugin
spec:
containers:
- image: quay.io/openshift-storage-scale/openshift-storage-scale-console:0.0.5
- image: quay.io/openshift-storage-scale/openshift-storage-scale-console@sha256:35cea907a7126af371dc1f0746fffc5a76e6bc0399a5a35a23c881ef1421f6e7
name: openshift-storage-scale-operator-console-plugin
ports:
- containerPort: 9443
Expand Down Expand Up @@ -715,9 +725,11 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: DEVICEFINDER_IMAGE
value: quay.io/openshift-storage-scale/openshift-storage-scale-devicefinder:0.0.5
image: quay.io/openshift-storage-scale/openshift-storage-scale-operator:0.0.5
- name: RELATED_IMAGE_OPENSHIFT-STORAGE-SCALE-OPERATOR-DEVICEFINDER
value: quay.io/openshift-storage-scale/openshift-storage-scale-devicefinder@sha256:5bed543a4bb567a1cd8a589444b6ceaa3815705829c42ecd986d5b65a47862f3
- name: RELATED_IMAGE_OPENSHIFT-STORAGE-SCALE-OPERATOR-MUST-GATHER
value: quay.io/openshift-storage-scale/openshift-storage-scale-must-gather@sha256:03db023ac2d725f995976fdd8c463e916c70f44a3bca13f0dd7fc12c6a846dd5
image: quay.io/openshift-storage-scale/openshift-storage-scale-operator@sha256:22c18f4e7552d8c3430db96b01eab117e01063e0f5a8baf0fdd5f4d4b762a2ed
livenessProbe:
httpGet:
path: /healthz
Expand Down Expand Up @@ -842,6 +854,17 @@ spec:
minKubeVersion: 1.23.0
provider:
name: Storage Scale Team
relatedImages:
- image: quay.io/openshift-storage-scale/openshift-storage-scale-devicefinder@sha256:5bed543a4bb567a1cd8a589444b6ceaa3815705829c42ecd986d5b65a47862f3
name: openshift-storage-scale-operator-devicefinder
- image: quay.io/openshift-storage-scale/openshift-storage-scale-must-gather@sha256:03db023ac2d725f995976fdd8c463e916c70f44a3bca13f0dd7fc12c6a846dd5
name: openshift-storage-scale-operator-must-gather
- image: quay.io/openshift-storage-scale/openshift-storage-scale-console@sha256:35cea907a7126af371dc1f0746fffc5a76e6bc0399a5a35a23c881ef1421f6e7
name: openshift-storage-scale-operator-console-plugin
- image: quay.io/openshift-storage-scale/openshift-storage-scale-operator@sha256:22c18f4e7552d8c3430db96b01eab117e01063e0f5a8baf0fdd5f4d4b762a2ed
name: manager
- image: registry.redhat.io/openshift4/ose-kube-rbac-proxy-rhel9@sha256:29201e85bd41642b72c7c0ce915e40aad90823d0efc3e7bbab9c351c92c74341
name: kube-rbac-proxy
version: 0.0.5
webhookdefinitions:
- admissionReviewVersions:
Expand Down
8 changes: 7 additions & 1 deletion config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,13 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: DEVICEFINDER_IMAGE
# Inject dependency images as env variables to instruct the operator-sdk to
# add them as relatedImages in the CSV. This information is required for disconnected environments.
# More info: https://docs.redhat.com/en/documentation/openshift_container_platform/4.18/html-single/operators/index#olm-enabling-operator-for-restricted-network_osdk-generating-csvs
- name: RELATED_IMAGE_OPENSHIFT-STORAGE-SCALE-OPERATOR-DEVICEFINDER
value: ${DEVICEFINDER_IMAGE}
- name: RELATED_IMAGE_OPENSHIFT-STORAGE-SCALE-OPERATOR-MUST-GATHER
value: ${MUST_GATHER_IMAGE}
securityContext:
allowPrivilegeEscalation: false
capabilities:
Expand Down Expand Up @@ -99,3 +104,4 @@ spec:
memory: 64Mi
serviceAccountName: controller-manager
terminationGracePeriodSeconds: 10

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ metadata:
features.operators.openshift.io/token-auth-gcp: "false"
operatorframework.io/initialization-resource: '{"apiVersion":"scale.storage.openshift.io/v1alpha1","kind":"StorageScale","metadata":{"name":"storagescale-sample"},"spec":{"ibm_cnsa_version":"v5.2.2.1","mco_config":{"create":true,"labels":{"machineconfiguration.openshift.io/role":"worker"}},"ibm_cnsa_cluster":{"create":true,"daemon_nodeSelector":{"node-role.kubernetes.io/worker":""}}}}'
operatorframework.io/suggested-namespace: openshift-storage-scale
operators.openshift.io/valid-subscription: '["Openshift Container Platform"]'
operators.openshift.io/infrastructure-features: '["disconnected"]'
operators.openshift.io/valid-subscription: '["Openshift Container Platform","OpenShift
Virtualization Engine"]'
operators.operatorframework.io/internal-objects: '["localvolumediscoveryresults.scale.storage.openshift.io","localvolumediscoveries.scale.storage.openshift.io"]'
name: openshift-storage-scale-operator.v0.0.0
namespace: placeholder
Expand Down
4 changes: 2 additions & 2 deletions internal/common/names.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const (
// OwnerNameLabel references the owning object
OwnerNameLabel = "scale.storage.openshift.io/owner-name"

// DeviceFinderImageEnv is used by the operator to read the DEVICEFINDER_IMAGE from the environment
DeviceFinderImageEnv = "DEVICEFINDER_IMAGE"
// DeviceFinderImageEnv is used by the operator to read the RELATED_IMAGE_OPENSHIFT-STORAGE-SCALE-OPERATOR-DEVICEFINDER from the environment
DeviceFinderImageEnv = "RELATED_IMAGE_OPENSHIFT-STORAGE-SCALE-OPERATOR-DEVICEFINDER"
// KubeRBACProxyImageEnv is used by the operator to read the KUBE_RBAC_PROXY_IMAGE from the environment
KubeRBACProxyImageEnv = "KUBE_RBAC_PROXY_IMAGE"

Expand Down
11 changes: 11 additions & 0 deletions scripts/ignore-createdAt-bundle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
# Since operator-sdk 1.26.0, `make bundle` changes the `createdAt` field from the bundle
# even if it is patched:
# https://github.com/operator-framework/operator-sdk/pull/6136
# This code checks if only the createdAt field. If is the only change, it is ignored.
# Else, it will do nothing.
# https://github.com/operator-framework/operator-sdk/issues/6285#issuecomment-1415350333
git diff --quiet -I'^ createdAt: ' bundle
if ((! $?)) ; then
git checkout bundle
fi
6 changes: 3 additions & 3 deletions scripts/storage-scale-operator-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ wait_for_resource() {
fi
ret=$?
set -e

if [[ $ret -eq 0 && "$resource_type" != "csv" ]]; then
echo "✅ $resource_type: $name is available!"
break
fi

sleep 10
done
}
Expand Down Expand Up @@ -80,7 +80,7 @@ if [[ -n $(git status --porcelain) ]]; then
exit 1
fi

make VERSION=${VERSION} IMAGE_TAG_BASE=${REGISTRY}/openshift-storage-scale CHANNELS=fast \
make VERSION=${VERSION} IMAGE_TAG_BASE=${REGISTRY}/openshift-storage-scale CHANNELS=fast USE_IMAGE_DIGESTS="" \
manifests bundle generate docker-build docker-push bundle-build bundle-push console-build console-push \
devicefinder-docker-build devicefinder-docker-push catalog-build catalog-push catalog-install

Expand Down