From d2c32f5bd37b9ced648c4dd465c304ca0da7b409 Mon Sep 17 00:00:00 2001 From: Hari Date: Tue, 31 Oct 2023 18:00:22 +0530 Subject: [PATCH] fix: alm examples used by Openshift Web Console when clicking "Create Move2Kube" button (#166) Signed-off-by: Harikrishnan Balagopal --- Makefile | 2 +- helm-charts/move2kube/Chart.yaml | 2 +- .../templates/move2kube-api-stateful-set.yaml | 2 +- helm-charts/move2kube/values.yaml | 16 +++--- operator/Makefile | 19 ++++++- .../samples/move2kube_v1alpha1_move2kube.yaml | 57 +------------------ 6 files changed, 29 insertions(+), 69 deletions(-) diff --git a/Makefile b/Makefile index d0f6fa6..ba5fc29 100644 --- a/Makefile +++ b/Makefile @@ -108,7 +108,7 @@ endif .PHONY: prepare-for-release prepare-for-release: mv helm-charts/move2kube/Chart.yaml old - cat old | sed -E s/version:\ v0.1.0-unreleased/version:\ ${IMAGE_TAG}/ | sed -E s/appVersion:\ latest/appVersion:\ ${IMAGE_TAG}/ > helm-charts/move2kube/Chart.yaml + cat old | sed -E s/version:\ v0.1.0-unreleased/version:\ ${IMAGE_TAG}/ | sed -E s/appVersion:\ v0.1.0-unreleased/appVersion:\ ${IMAGE_TAG}/ > helm-charts/move2kube/Chart.yaml rm old .PHONY: cmultibuildpush diff --git a/helm-charts/move2kube/Chart.yaml b/helm-charts/move2kube/Chart.yaml index 0bd8caf..7ca6d4c 100644 --- a/helm-charts/move2kube/Chart.yaml +++ b/helm-charts/move2kube/Chart.yaml @@ -4,6 +4,6 @@ keywords: - move2kube name: move2kube version: v0.1.0-unreleased -appVersion: latest +appVersion: v0.1.0-unreleased type: application icon: https://raw.githubusercontent.com/konveyor/community/main/brand/logo/konveyor-logo-move2kube.svg diff --git a/helm-charts/move2kube/templates/move2kube-api-stateful-set.yaml b/helm-charts/move2kube/templates/move2kube-api-stateful-set.yaml index 22cc4e6..1e18799 100644 --- a/helm-charts/move2kube/templates/move2kube-api-stateful-set.yaml +++ b/helm-charts/move2kube/templates/move2kube-api-stateful-set.yaml @@ -30,7 +30,7 @@ spec: {{- end }} containers: - name: move2kubeapi - image: "{{ .Values.deployment.api.imageName }}:{{ .Values.deployment.api.imageTag | default .Chart.AppVersion }}" + image: "{{ .Values.deployment.api.imageName }}:{{ .Values.deployment.api.imageTag }}" command: - move2kube-api args: diff --git a/helm-charts/move2kube/values.yaml b/helm-charts/move2kube/values.yaml index 0c8b1fe..ba241aa 100644 --- a/helm-charts/move2kube/values.yaml +++ b/helm-charts/move2kube/values.yaml @@ -2,8 +2,8 @@ deployment: api: replicas: 1 privilegedPods: false # some optional features of Move2Kube require privileged pods - imageName: quay.io/konveyor/move2kube-ui - imageTag: "" # if empty we will use AppVersion from the Chart.yaml as the tag + imageName: "quay.io/konveyor/move2kube-ui" + imageTag: "latest" memory: "1Gi" cpu: "300m" initContainer: false @@ -21,14 +21,14 @@ deployment: ingress: enable: true preferRoute: false # if true we will use an Openshift Route instead of an K8s Ingress - host: mydomain.com + host: "mydomain.com" tlsSecretName: "" # not necessary when using Openshift Route persistentVolumeClaim: enable: false # set this to true to get persistent storage createNew: true name: "" # if createNew is false this MUST contain the name of an existing persistent volume claim storageClassName: "" - storageSize: 1Gi + storageSize: "1Gi" readWriteMany: true secret: api: @@ -39,10 +39,10 @@ secret: authServer: # required if deployment.authServer.enable is true createNew: true name: "" # if createNew is false this MUST contain the name of an existing secret - adminUsername: admin # TODO: Change this before deploying - adminPassword: password # TODO: Change this before deploying - databaseUsername: auth-server # TODO: Change this before deploying - databasePassword: password # TODO: Change this before deploying + adminUsername: "admin" # TODO: Change this before deploying + adminPassword: "password" # TODO: Change this before deploying + databaseUsername: "auth-server" # TODO: Change this before deploying + databasePassword: "password" # TODO: Change this before deploying realmJSON: "" standaloneHAXML: "" securityContextContraints: diff --git a/operator/Makefile b/operator/Makefile index 2a15648..fd2615e 100644 --- a/operator/Makefile +++ b/operator/Makefile @@ -88,6 +88,8 @@ run: helm-operator ## Run against the configured Kubernetes cluster in ~/.kube/c .PHONY: docker-build docker-build: ## Build docker image with the manager. cp -r ../helm-charts . + yq eval --exit-status --inplace ".version=\"${VERSION}\"" helm-charts/move2kube/Chart.yaml + yq eval --exit-status --inplace ".appVersion=\"${VERSION}\"" helm-charts/move2kube/Chart.yaml yq eval --exit-status --inplace ".deployment.api.imageTag=\"${VERSION}\"" helm-charts/move2kube/values.yaml docker build -t ${IMG} . rm -rf helm-charts @@ -190,20 +192,33 @@ bundle: kustomize operator-sdk ## Generate bundle manifests and metadata, then v ls -al . ls -al helm-charts echo 'changing the image tag to '${VERSION}' in "containerImage" field in the CSV using yq' + # ------------------- + echo 'before editting the CSV' cat config/manifests/bases/move2kube-operator.clusterserviceversion.yaml $(eval MYYQEXPR1 := '.metadata.annotations.containerImage="quay.io/konveyor/move2kube-operator:${VERSION}"') echo ${MYYQEXPR1} yq eval --exit-status ${MYYQEXPR1} config/manifests/bases/move2kube-operator.clusterserviceversion.yaml > foo.yaml mv foo.yaml config/manifests/bases/move2kube-operator.clusterserviceversion.yaml + echo 'after editting the CSV' cat config/manifests/bases/move2kube-operator.clusterserviceversion.yaml + # ------------------- + echo 'before editting the values.yaml' cat helm-charts/move2kube/values.yaml $(eval MYYQEXPR2 := '.deployment.api.imageTag="${VERSION}"') echo ${MYYQEXPR2} yq eval --exit-status ${MYYQEXPR2} helm-charts/move2kube/values.yaml > bar.yaml mv bar.yaml helm-charts/move2kube/values.yaml + echo 'after editting the values.yaml' cat helm-charts/move2kube/values.yaml - echo 'after editting the CSV' - cat config/manifests/bases/move2kube-operator.clusterserviceversion.yaml + # ------------------- + echo 'changing the version and appVersion to '${VERSION}' in the "Chart.yaml"' + echo 'before editting the Chart.yaml' + cat helm-charts/move2kube/Chart.yaml + yq eval --exit-status --inplace ".version=\"${VERSION}\"" helm-charts/move2kube/Chart.yaml + yq eval --exit-status --inplace ".appVersion=\"${VERSION}\"" helm-charts/move2kube/Chart.yaml + echo 'after editting the Chart.yaml' + cat helm-charts/move2kube/Chart.yaml + # ------------------- ls -al . ls -al config ls -al config/manifests diff --git a/operator/config/samples/move2kube_v1alpha1_move2kube.yaml b/operator/config/samples/move2kube_v1alpha1_move2kube.yaml index b55de4d..0cfc0aa 100644 --- a/operator/config/samples/move2kube_v1alpha1_move2kube.yaml +++ b/operator/config/samples/move2kube_v1alpha1_move2kube.yaml @@ -2,59 +2,4 @@ apiVersion: move2kube.konveyor.io/v1alpha1 kind: Move2Kube metadata: name: move2kube-sample -spec: - # Default values copied from /helm-charts/move2kube/values.yaml - deployment: - api: - cpu: 300m - imageTag: "" - initContainer: false - memory: 1Gi - privilegedPods: false - replicas: 1 - authServer: - cpu: 300m - enable: false - memory: 1Gi - replicas: 1 - database: - cpu: 300m - enable: false - memory: 1Gi - replicas: 1 - startEmpty: true - ingress: - enable: true - host: mydomain.com - preferRoute: false - tlsSecretName: "" - persistentVolumeClaim: - createNew: true - enable: false - name: "" - readWriteMany: true - storageClassName: "" - storageSize: 1Gi - secret: - api: - configYAML: "" - createNew: true - enable: false - name: "" - authServer: - adminPassword: password - adminUsername: admin - createNew: true - databasePassword: password - databaseUsername: auth-server - name: "" - realmJSON: "" - standaloneHAXML: "" - securityContextContraints: - enable: false - serviceAccount: - createNew: true - enable: false - name: "" - - +spec: {}