diff --git a/Makefile b/Makefile index 6d90863f2..78b3a0137 100644 --- a/Makefile +++ b/Makefile @@ -235,7 +235,7 @@ bundle-manifests: clis $(YQ) eval -i '.spec.webhookdefinitions[0].deploymentName = "ibm-common-service-operator" | .spec.webhookdefinitions[1].deploymentName = "ibm-common-service-operator"' ${CSV_PATH} $(YQ) eval-all -i '.spec.relatedImages = load("config/manifests/bases/ibm-common-service-operator.clusterserviceversion.yaml").spec.relatedImages' bundle/manifests/ibm-common-service-operator.clusterserviceversion.yaml -generate-all: yq kustomize operator-sdk generate manifests ## Generate bundle manifests, metadata and package manifests +generate-all: yq kustomize operator-sdk generate manifests cloudpak-theme-version ## Generate bundle manifests, metadata and package manifests $(OPERATOR_SDK) generate kustomize manifests -q - make bundle-manifests CHANNELS=v4.6 DEFAULT_CHANNEL=v4.6 diff --git a/api/v3/commonservice_types.go b/api/v3/commonservice_types.go index c85a8a3e6..7fb4d66bf 100644 --- a/api/v3/commonservice_types.go +++ b/api/v3/commonservice_types.go @@ -32,18 +32,19 @@ import ( // NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. type CSData struct { - Channel string - Version string - CPFSNs string - ServicesNs string - OperatorNs string - CatalogSourceName string - CatalogSourceNs string - IsolatedModeEnable string - ApprovalMode string - OnPremMultiEnable string - WatchNamespaces string - CloudPakThemes string + Channel string + Version string + CPFSNs string + ServicesNs string + OperatorNs string + CatalogSourceName string + CatalogSourceNs string + IsolatedModeEnable string + ApprovalMode string + OnPremMultiEnable string + WatchNamespaces string + CloudPakThemes string + CloudPakThemesVersion string } // +kubebuilder:pruning:PreserveUnknownFields diff --git a/bundle/manifests/ibm-common-service-operator.clusterserviceversion.yaml b/bundle/manifests/ibm-common-service-operator.clusterserviceversion.yaml index 1a55a31ca..17504e517 100644 --- a/bundle/manifests/ibm-common-service-operator.clusterserviceversion.yaml +++ b/bundle/manifests/ibm-common-service-operator.clusterserviceversion.yaml @@ -21,8 +21,9 @@ metadata: } ] capabilities: Seamless Upgrades + cloudPakThemesVersion: styles460.css containerImage: icr.io/cpopen/common-service-operator:latest - createdAt: "2024-04-03T14:59:21Z" + createdAt: "2024-04-11T02:45:28Z" description: The IBM Cloud Pak foundational services operator is used to deploy IBM foundational services. nss.operator.ibm.com/managed-operators: ibm-common-service-operator nss.operator.ibm.com/managed-webhooks: "" diff --git a/config/manifests/bases/ibm-common-service-operator.clusterserviceversion.yaml b/config/manifests/bases/ibm-common-service-operator.clusterserviceversion.yaml index 5be29d8e7..f5f48f02a 100644 --- a/config/manifests/bases/ibm-common-service-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/ibm-common-service-operator.clusterserviceversion.yaml @@ -4,6 +4,7 @@ metadata: annotations: alm-examples: '[]' capabilities: Seamless Upgrades + cloudPakThemesVersion: styles460.css containerImage: icr.io/cpopen/common-service-operator:latest createdAt: "2020-10-19T21:38:33Z" description: The IBM Cloud Pak foundational services operator is used to deploy diff --git a/controllers/bootstrap/init.go b/controllers/bootstrap/init.go index 598eba472..481176490 100644 --- a/controllers/bootstrap/init.go +++ b/controllers/bootstrap/init.go @@ -144,6 +144,11 @@ func NewBootstrap(mgr manager.Manager) (bs *Bootstrap, err error) { if r, ok := annotations["operatorVersion"]; ok { bs.CSData.Version = r } + + if r, ok := annotations["cloudPakThemesVersion"]; ok { + bs.CSData.CloudPakThemesVersion = r + } + klog.Infof("Single Deployment Status: %v, MultiInstance Deployment status: %v, SaaS Depolyment Status: %v", !bs.MultiInstancesEnable, bs.MultiInstancesEnable, bs.SaasEnable) return } diff --git a/controllers/constant/keycloakThemes.go b/controllers/constant/keycloakThemes.go index c66b43e11..0a8e76070 100644 --- a/controllers/constant/keycloakThemes.go +++ b/controllers/constant/keycloakThemes.go @@ -28,6 +28,7 @@ metadata: operator.ibm.com/managedByCsOperator: "true" annotations: version: {{ .Version }} + themesVersion: {{ .CloudPakThemesVersion }} binaryData: cloudpak-theme.jar: {{ .CloudPakThemes }} ` diff --git a/controllers/constant/odlm.go b/controllers/constant/odlm.go index 60f10b1ac..d670055b9 100644 --- a/controllers/constant/odlm.go +++ b/controllers/constant/odlm.go @@ -647,13 +647,13 @@ spec: podTemplate: metadata: annotations: - cpfsVersion: + cloudpakThemesVersion: templatingValueFrom: objectRef: apiVersion: v1 kind: ConfigMap name: cs-keycloak-theme - path: .metadata.annotations.version + path: .metadata.annotations.themesVersion required: true spec: containers: diff --git a/hack/keycloak-themes/Makefile b/hack/keycloak-themes/Makefile index 98c6e476f..9ba3912fa 100644 --- a/hack/keycloak-themes/Makefile +++ b/hack/keycloak-themes/Makefile @@ -7,4 +7,11 @@ default: cloudpak-theme.jar cloudpak-theme.jar: @echo "Building the keycloak jar theme..." rm $(KEYCLOAK_THEME_DIR)/$(JAR_THEME_FILE) || true - (cd $(KEYCLOAK_THEME_DIR) && zip -r ./$(JAR_THEME_FILE) META-INF theme) \ No newline at end of file + (cd $(KEYCLOAK_THEME_DIR) && zip -r ./$(JAR_THEME_FILE) META-INF theme) + +cloudpak-theme-version: + $(eval THEME_VERSION := $(shell ls $(KEYCLOAK_THEME_DIR)/theme/cloudpak/login/resources/css/ | grep .css)) + @echo "Updating the keycloak jar theme version to $(THEME_VERSION)" + $(YQ) eval -i '.spec.template.metadata.annotations.cloudPakThemesVersion = "$(THEME_VERSION)"' $(KEYCLOAK_THEME_DIR)/../../testdata/deploy/deploy.yaml + $(YQ) eval -i '.metadata.annotations.cloudPakThemesVersion = "$(THEME_VERSION)"' $(KEYCLOAK_THEME_DIR)/../../config/manifests/bases/ibm-common-service-operator.clusterserviceversion.yaml + $(YQ) eval -i '.metadata.annotations.cloudPakThemesVersion = "$(THEME_VERSION)"' $(KEYCLOAK_THEME_DIR)/../../bundle/manifests/ibm-common-service-operator.clusterserviceversion.yaml \ No newline at end of file diff --git a/testdata/deploy/deploy.yaml b/testdata/deploy/deploy.yaml index 29df36d01..e6c3133ef 100644 --- a/testdata/deploy/deploy.yaml +++ b/testdata/deploy/deploy.yaml @@ -17,44 +17,45 @@ spec: description: The IBM Common Service Operator is used to deploy IBM Common Services operatorChannel: v4.6 operatorVersion: 4.6.0 + cloudPakThemesVersion: styles460.css spec: affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - - matchExpressions: - - key: kubernetes.io/arch - operator: In - values: - - amd64 - - ppc64le - - s390x + - matchExpressions: + - key: kubernetes.io/arch + operator: In + values: + - amd64 + - ppc64le + - s390x containers: - - command: - - /manager - env: - - name: OPERATOR_NAME - value: ibm-common-service-operator - image: siji/operator:cs - imagePullPolicy: IfNotPresent - name: ibm-common-service-operator - resources: - limits: - cpu: 500m - memory: 512Mi - requests: - cpu: 100m - memory: 200Mi - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: - - ALL - privileged: false - readOnlyRootFilesystem: true - runAsNonRoot: true - terminationMessagePath: /dev/termination-log - terminationMessagePolicy: File + - command: + - /manager + env: + - name: OPERATOR_NAME + value: ibm-common-service-operator + image: siji/operator:cs + imagePullPolicy: IfNotPresent + name: ibm-common-service-operator + resources: + limits: + cpu: 500m + memory: 512Mi + requests: + cpu: 100m + memory: 200Mi + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + privileged: false + readOnlyRootFilesystem: true + runAsNonRoot: true + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File dnsPolicy: ClusterFirst restartPolicy: Always schedulerName: default-scheduler