Skip to content

Commit

Permalink
Finish rudamentary helm update pipeline
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Zgabur <[email protected]>
  • Loading branch information
azgabur committed Nov 13, 2024
1 parent f98c47c commit 68dd606
Show file tree
Hide file tree
Showing 19 changed files with 401 additions and 186 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
---
Expand All @@ -31,6 +32,11 @@ kubectl create cm rp-ca-bundle --from-file=tls-ca-bundle.pem=./tls-ca-bundle.pem
kubectl create cm pipeline-settings --from-file=settings.local.yaml=./settings.local.yaml -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
Expand Down
42 changes: 42 additions & 0 deletions deploy/eventlistener.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apiVersion: triggers.tekton.dev/v1beta1
kind: EventListener
metadata:
name: kuadrant-nightly-update-listener
spec:
serviceAccountName: pipeline
triggers:
- name: kuadrant-nightly-update-trigger
bindings:
- name: istio-provider
value: ossm3
- name: kube-api
value: https://kubernetes.default
template:
spec:
params:
- name: kube-api
- name: istio-provider
resourcetemplates:
- apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
generateName: nightly-update-
spec:
pipelineRef:
name: kuadrant-nightly-update-pipeline
timeouts:
pipeline: 30m0s
params:
- name: kube-api
value: $(tt.params.kube-api)
- name: istio-provider
value: $(tt.params.istio-provider)
workspaces:
- name: shared-workspace
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Mi
13 changes: 13 additions & 0 deletions deploy/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

commonLabels:
deployment: kuadrant-helm-deploy

resources:
- ../tasks/deploy/
- ../tasks/login/
- pipeline.yaml
- pipeline-nightly-update.yaml
- eventlistener.yaml
- trigger-nightly-update.yaml
71 changes: 71 additions & 0 deletions deploy/pipeline-nightly-update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: kuadrant-nightly-update-pipeline
spec:
params:
- description: API URL of the Openshift cluster
name: kube-api
type: string
- description: Istio deployment. Only these values 'sail', 'ossm', 'ossm3'
name: istio-provider
type: string
default: ossm3
tasks:
- name: clone
taskRef:
kind: Task
name: clone
workspaces:
- name: shared-workspace
workspace: shared-workspace
- name: kubectl-login
params:
- name: kube-api
value: $(params.kube-api)
- name: testsuite-image
value: quay.io/rhn_support_azgabur/alpine/k8s:latest
taskRef:
kind: Task
name: kubectl-login
workspaces:
- name: shared-workspace
workspace: shared-workspace
- name: nightly-image-date
taskRef:
kind: Task
name: nightly-image-date
- name: helm-uninstall
params:
- name: kubeconfig-path
value: $(tasks.kubectl-login.results.kubeconfig-path)
runAfter:
- clone
- kubectl-login
taskRef:
kind: Task
name: helm-uninstall
workspaces:
- name: shared-workspace
workspace: shared-workspace
- name: helm-install-nightly
params:
- name: index-image
value: $(tasks.nightly-image-date.results.nightly-image)
- name: channel
value: preview
- name: istio-provider
value: $(params.istio-provider)
- name: kubeconfig-path
value: $(tasks.kubectl-login.results.kubeconfig-path)
runAfter:
- helm-uninstall
- nightly-image-date
taskRef:
kind: Task
name: helm-install
workspaces:
- name: shared-workspace
workspace: shared-workspace
workspaces:
- name: shared-workspace
50 changes: 28 additions & 22 deletions deploy/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ 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
- description: Kuadrant image url
name: index-image
type: string
default: ""
- description: OLM channel to use for deployment
name: kuadrant-channel
default: quay.io/kuadrant/kuadrant-operator-catalog:v0.11.0
- description: Kuadrant image channel. Can be 'preview' for nightlies and 'stable' for releases
name: channel
type: string
default: stable
- description: Istio deployment. Only these values 'sail', 'ossm', 'ossm3'
name: istio-provider
type: string
default: ossm3
tasks:
- name: clone
taskRef:
Expand All @@ -28,39 +31,42 @@ spec:
params:
- name: kube-api
value: $(params.kube-api)
runAfter:
- clone
- name: testsuite-image
value: quay.io/rhn_support_azgabur/alpine/k8s:latest
taskRef:
kind: Task
name: kubectl-login-alt
name: kubectl-login
workspaces:
- name: shared-workspace
workspace: shared-workspace
- name: helm
- name: helm-uninstall
params:
- name: kuadrant-index-image
value: $(params.kuadrant-index-image)
- name: kuadrant-channel
value: $(params.kuadrant-channel)
- name: kubeconfig-path
value: $(tasks.kubectl-login.results.kubeconfig-path)
runAfter:
- clone
- kubectl-login
taskRef:
kind: Task
name: helm
name: helm-uninstall
workspaces:
- name: shared-workspace
workspace: shared-workspace
- name: helm-operands
- name: helm-install
params:
- name: kuadrant-index-image
value: $(params.kuadrant-index-image)
- name: kuadrant-channel
value: $(params.kuadrant-channel)
- name: index-image
value: $(params.index-image)
- name: channel
value: $(params.channel)
- name: istio-provider
value: $(params.istio-provider)
- name: kubeconfig-path
value: $(tasks.kubectl-login.results.kubeconfig-path)
runAfter:
- helm
- helm-uninstall
taskRef:
kind: Task
name: helm-operands
name: helm-install
workspaces:
- name: shared-workspace
workspace: shared-workspace
Expand Down
20 changes: 20 additions & 0 deletions deploy/trigger-nightly-update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: kuadrant-nightly-update-cron
spec:
timeZone: "Europe/Prague"
schedule: "0 4 * * *"
concurrencyPolicy: Forbid
startingDeadlineSeconds: 300
jobTemplate:
spec:
template:
spec:
serviceAccountName: pipeline
containers:
- name: kuadrant-nightly-update-trigger
image: quay.io/curl/curl:latest
command: ["/bin/sh", "-cx"]
args: ["curl -X POST --data {} el-kuadrant-nightly-update-listener.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local:8080"]
restartPolicy: Never
1 change: 1 addition & 0 deletions nightly/trigger-nightly-cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ kind: CronJob
metadata:
name: trigger-nightly-pipeline
spec:
timeZone: "Europe/Prague"
schedule: "0 5 * * *"
concurrencyPolicy: Forbid
startingDeadlineSeconds: 300
Expand Down
23 changes: 0 additions & 23 deletions tasks/01-clone.yaml

This file was deleted.

47 changes: 0 additions & 47 deletions tasks/02-helm.yaml

This file was deleted.

47 changes: 0 additions & 47 deletions tasks/03-helm-operands.yaml

This file was deleted.

Loading

0 comments on commit 68dd606

Please sign in to comment.