softplayer-helmfile/charts/tekton-pipelines/templates/tasks/install-app.yml

51 lines
1.7 KiB
YAML
Raw Permalink Normal View History

2024-05-04 16:42:28 +00:00
# ---------------------------------------------------------------------
# This task should create a flux resource that will deploy a helm
# chart to the environemnt
# -- Create an app secret with configs
# -- shell-operator is running a pipeline with confi
# -- Tekton is creating a flux HelmRelease resource
# ---------------------------------------------------------------------
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: install-app
namespace: {{ .Values.pipelineNamespace }}
labels:
{{- include "tekton-pipelines.labels" . | nindent 4 }}
spec:
params:
- name: namespace
type: string
- name: environment
type: string
- name: application
type: string
steps:
- name: create-an-app
image: fluxcd/flux-cli:v2.2.3
env:
- name: SP_STATE
value: present
- name: SP_ENV
value: $(params.environment)
- name: SP_APPLICATION
value: $(params.application)
- name: SP_ACCOUNT
value: $(params.namespace)
script: |-
#!/bin/sh
flux create source helm $SP_APPLICATION \
--namespace=$SP_ACCOUNT \
--url=oci://git.badhouseplants.net/softplayer/helm
flux create helmrelease $SP_APPLICATION \
--source=HelmRepository/$SP_APPLICATION \
--namespace=$SP_ACCOUNT \
--chart=helmrelease \
--values-from Secret/$SP_APPLICATION-config \
--kubeconfig-secret-ref=$SP_ENV-config \
2024-05-08 15:38:52 +00:00
--target-namespace=default --export \
| yq '.spec.storageNamespace="helm-installations"' \
| kubectl create -f -
flux reconcile helmrelease --namespace=$SP_ACCOUNT $SP_APPLICATION