From 19dd30bbe56205ac7b04242fe86a88b64122f9b4 Mon Sep 17 00:00:00 2001 From: Alex Zgabur Date: Wed, 30 Oct 2024 13:08:25 +0100 Subject: [PATCH] Finish rudamentary helm update pipeline Signed-off-by: Alex Zgabur --- README.md | 6 ++++ deploy/kustomization.yaml | 9 ++++++ deploy/pipeline.yaml | 43 +++++++++++---------------- tasks/01-clone.yaml | 14 +++++---- tasks/02-helm.yaml | 47 ------------------------------ tasks/02-uninstall.yaml | 22 ++++++++++++++ tasks/03-additional-manifests.yaml | 27 +++++++++++++++++ tasks/03-helm-operands.yaml | 47 ------------------------------ tasks/04-helm-install.yaml | 23 +++++++++++++++ tasks/kubectl-login-task-alt.yaml | 2 +- tasks/kustomization.yaml | 5 ++++ 11 files changed, 118 insertions(+), 127 deletions(-) create mode 100644 deploy/kustomization.yaml delete mode 100644 tasks/02-helm.yaml create mode 100644 tasks/02-uninstall.yaml create mode 100644 tasks/03-additional-manifests.yaml delete mode 100644 tasks/03-helm-operands.yaml create mode 100644 tasks/04-helm-install.yaml diff --git a/README.md b/README.md index 133d1c6..9f10747 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ Deployment 2. Create required pipelines and their resources * Apply main pipeline `oc apply -k main/ -n ${PIPELINE_NAMESPACE}` * Apply nightly pipeline `oc apply -k nightly/ -n ${PIPELINE_NAMESPACE}` + * Apply helm-deploy pipelines `oc apply -k deploy/ -n ${PIPELINE_NAMESPACE}` Secrets --- @@ -27,6 +28,11 @@ kubectl create secret generic rp-credentials --from-literal=RP_URL="https://repo kubectl create cm rp-ca-bundle --from-file=tls-ca-bundle.pem=./tls-ca-bundle.pem -n ${PIPELINE_NAMESPACE} ``` +- Opaque Secret named values-additional-manifests containing secrets for testsuite run. Example: https://github.com/azgabur/kuadrant-helm-install/blob/main/example-additionalManifests.yaml +```shell +kubectl create -n ${PIPELINE_NAMESPACE} secret generic values-additional-manifests --from-file=additionalManifests.yaml=${ADDITIONAL_MANIFESTS.yaml} +``` + Pipeline execution --- 1. Through the OpenShift Web Console diff --git a/deploy/kustomization.yaml b/deploy/kustomization.yaml new file mode 100644 index 0000000..48679c7 --- /dev/null +++ b/deploy/kustomization.yaml @@ -0,0 +1,9 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +commonLabels: + deployment: kuadrant-helm-deploy + +resources: + - ../tasks/ + - pipeline.yaml \ No newline at end of file diff --git a/deploy/pipeline.yaml b/deploy/pipeline.yaml index 92bc321..9ccd4ea 100644 --- a/deploy/pipeline.yaml +++ b/deploy/pipeline.yaml @@ -7,15 +7,7 @@ spec: - description: API URL of the Openshift cluster name: kube-api type: string - default: https://kubernetes.default:443 - - description: Index image to use for deployment; if omitted uses community-operators - name: kuadrant-index-image - type: string - default: "" - - description: OLM channel to use for deployment - name: kuadrant-channel - type: string - default: stable + default: https://kubernetes.default:443 tasks: - name: clone taskRef: @@ -28,39 +20,38 @@ spec: params: - name: kube-api value: $(params.kube-api) - runAfter: - - clone taskRef: kind: Task name: kubectl-login-alt workspaces: - name: shared-workspace workspace: shared-workspace - - name: helm - params: - - name: kuadrant-index-image - value: $(params.kuadrant-index-image) - - name: kuadrant-channel - value: $(params.kuadrant-channel) + - name: helm-uninstall runAfter: + - clone - kubectl-login taskRef: kind: Task - name: helm + name: helm-uninstall workspaces: - name: shared-workspace workspace: shared-workspace - - name: helm-operands - params: - - name: kuadrant-index-image - value: $(params.kuadrant-index-image) - - name: kuadrant-channel - value: $(params.kuadrant-channel) + - name: additional-manifests-copy + taskRef: + kind: Task + name: additional-manifests-copy + runAfter: + - clone + workspaces: + - name: shared-workspace + workspace: shared-workspace + - name: helm-install runAfter: - - helm + - additional-manifests-copy + - helm-uninstall taskRef: kind: Task - name: helm-operands + name: helm-install workspaces: - name: shared-workspace workspace: shared-workspace diff --git a/tasks/01-clone.yaml b/tasks/01-clone.yaml index 8874d6b..b84407e 100644 --- a/tasks/01-clone.yaml +++ b/tasks/01-clone.yaml @@ -4,20 +4,22 @@ metadata: name: clone spec: steps: - - args: + - name: clone + args: - clone - -b - - operators-operands-olm - - https://github.com/ficap/kuadrant-env-installation.git - - $(workspaces.shared-workspace.path)/kuadrant-env-installation + - main + - --depth + - '1' + - https://github.com/azgabur/kuadrant-helm-install + - $(workspaces.shared-workspace.path)/kuadrant-helm-install command: - git computeResources: limits: cpu: 250m memory: 128Mi - image: quay.io/rh_integration/ci-toolbox:latest + image: quay.io/rhn_support_azgabur/alpine/k8s:1.28.15 imagePullPolicy: IfNotPresent - name: clone workspaces: - name: shared-workspace diff --git a/tasks/02-helm.yaml b/tasks/02-helm.yaml deleted file mode 100644 index 53c9bc8..0000000 --- a/tasks/02-helm.yaml +++ /dev/null @@ -1,47 +0,0 @@ -apiVersion: tekton.dev/v1 -kind: Task -metadata: - name: helm -spec: - params: - - description: Index image of kuadrant to use - name: kuadrant-index-image - type: string - - description: olm channel to use - name: kuadrant-channel - type: string - steps: - - args: - - install - - $(workspaces.shared-workspace.path)/kuadrant-env-installation/operators - - --values - - $(workspaces.shared-workspace.path)/kuadrant-env-installation/operators/values.yaml - - --values - - /mount/values-additional-manifests/values-additionalManifests.yaml - - --generate-name - - --wait - - --set - - kuadrant.indexImage=$(params.kuadrant-index-image) - - --set - - kuadrant.channel=$(params.kuadrant-channel) - command: - - /usr/local/bin/helm - computeResources: - limits: - cpu: 250m - memory: 128Mi - env: - - name: KUBECONFIG - value: $(workspaces.shared-workspace.path)/kubeconfig - image: quay.io/rh_integration/ci-toolbox:latest - imagePullPolicy: IfNotPresent - name: helm - volumeMounts: - - mountPath: /mount/values-additional-manifests - name: values-additional-manifests - volumes: - - secret: - secretName: values-additional-manifests - name: values-additional-manifests - workspaces: - - name: shared-workspace diff --git a/tasks/02-uninstall.yaml b/tasks/02-uninstall.yaml new file mode 100644 index 0000000..2b0f9a2 --- /dev/null +++ b/tasks/02-uninstall.yaml @@ -0,0 +1,22 @@ +apiVersion: tekton.dev/v1 +kind: Task +metadata: + name: helm-uninstall +spec: + steps: + - name: helm-uninstall + args: + - $(workspaces.shared-workspace.path)/kuadrant-helm-install/uninstall.sh + command: + - /bin/bash + computeResources: + limits: + cpu: 250m + memory: 128Mi + env: + - name: KUBECONFIG + value: $(workspaces.shared-workspace.path)/kubeconfig + image: quay.io/rhn_support_azgabur/alpine/k8s:1.28.15 + imagePullPolicy: IfNotPresent + workspaces: + - name: shared-workspace diff --git a/tasks/03-additional-manifests.yaml b/tasks/03-additional-manifests.yaml new file mode 100644 index 0000000..5dca717 --- /dev/null +++ b/tasks/03-additional-manifests.yaml @@ -0,0 +1,27 @@ +apiVersion: tekton.dev/v1 +kind: Task +metadata: + name: additional-manifests-copy +spec: + steps: + - name: additional-manifests-copy + args: + - /mount/values-additional-manifests/additionalManifests.yaml + - $(workspaces.shared-workspace.path)/kuadrant-helm-install/additionalManifests.yaml + command: + - /bin/cp + computeResources: + limits: + cpu: 250m + memory: 128Mi + image: quay.io/rhn_support_azgabur/alpine/k8s:1.28.15 + imagePullPolicy: IfNotPresent + volumeMounts: + - mountPath: /mount/values-additional-manifests + name: values-additional-manifests + volumes: + - secret: + secretName: values-additional-manifests + name: values-additional-manifests + workspaces: + - name: shared-workspace diff --git a/tasks/03-helm-operands.yaml b/tasks/03-helm-operands.yaml deleted file mode 100644 index 69af8fd..0000000 --- a/tasks/03-helm-operands.yaml +++ /dev/null @@ -1,47 +0,0 @@ -apiVersion: tekton.dev/v1 -kind: Task -metadata: - name: helm-operands -spec: - params: - - description: Index image of kuadrant to use - name: kuadrant-index-image - type: string - - description: kuadrant channel - name: kuadrant-channel - type: string - steps: - - args: - - install - - $(workspaces.shared-workspace.path)/kuadrant-env-installation/operands - - --values - - $(workspaces.shared-workspace.path)/kuadrant-env-installation/operators/values.yaml - - --values - - /mount/values-additional-manifests/values-additionalManifests.yaml - - --generate-name - - --wait - - --set - - kuadrant.indexImage=$(params.kuadrant-index-image) - - --set - - kuadrant.channel=$(params.kuadrant-channel) - command: - - /usr/local/bin/helm - computeResources: - limits: - cpu: 250m - memory: 128Mi - env: - - name: KUBECONFIG - value: $(workspaces.shared-workspace.path)/kubeconfig - image: quay.io/rh_integration/ci-toolbox:latest - imagePullPolicy: IfNotPresent - name: helm - volumeMounts: - - mountPath: /mount/values-additional-manifests - name: values-additional-manifests - volumes: - - secret: - secretName: values-additional-manifests - name: values-additional-manifests - workspaces: - - name: shared-workspace diff --git a/tasks/04-helm-install.yaml b/tasks/04-helm-install.yaml new file mode 100644 index 0000000..f3a176f --- /dev/null +++ b/tasks/04-helm-install.yaml @@ -0,0 +1,23 @@ +apiVersion: tekton.dev/v1 +kind: Task +metadata: + name: helm-install +spec: + steps: + - name: helm-install + args: + - $(workspaces.shared-workspace.path)/kuadrant-helm-install/install.sh + - -t + command: + - /bin/bash + computeResources: + limits: + cpu: 250m + memory: 128Mi + env: + - name: KUBECONFIG + value: $(workspaces.shared-workspace.path)/kubeconfig + image: quay.io/rhn_support_azgabur/alpine/k8s:1.28.15 + imagePullPolicy: IfNotPresent + workspaces: + - name: shared-workspace diff --git a/tasks/kubectl-login-task-alt.yaml b/tasks/kubectl-login-task-alt.yaml index e519843..7e13779 100644 --- a/tasks/kubectl-login-task-alt.yaml +++ b/tasks/kubectl-login-task-alt.yaml @@ -39,7 +39,7 @@ spec: secretKeyRef: key: KUBE_PASSWORD name: openshift-pipelines-credentials - image: quay.io/rh_integration/ci-toolbox:latest + image: quay.io/rhn_support_azgabur/alpine/k8s:1.28.15 imagePullPolicy: IfNotPresent name: kubectl-login workspaces: diff --git a/tasks/kustomization.yaml b/tasks/kustomization.yaml index 199a293..fd5fec7 100644 --- a/tasks/kustomization.yaml +++ b/tasks/kustomization.yaml @@ -5,3 +5,8 @@ resources: - kubectl-login-task.yaml - run-tests-task.yaml - upload-results-task.yaml + - 01-clone.yaml + - 02-uninstall.yaml + - 03-additional-manifests.yaml + - 04-helm-install.yaml + - kubectl-login-task-alt.yaml