48 lines
1.5 KiB
YAML
48 lines
1.5 KiB
YAML
# ---------------------------------------------------------------------
|
|
# 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 \
|
|
--target-namespace=default
|