From 46dca7b5a950a85147441772f280922fbef23b7e Mon Sep 17 00:00:00 2001 From: Engin Diri Date: Wed, 18 Sep 2024 21:53:43 +0200 Subject: [PATCH] feat: inital commit --- charts/infra-chart/Chart.yaml | 2 +- charts/infra-chart/templates/_helpers.tpl | 7 ++ charts/infra-chart/templates/crossplane.yaml | 13 +-- charts/infra-chart/templates/pulumi.yaml | 12 +- charts/infra-chart/values.yaml | 5 + setup/cd-summit-demo.yaml | 112 +++++++++++++++++-- stages/prod-ams/Chart.yaml | 11 ++ stages/prod-ams/values.yaml | 3 + stages/prod-lon/Chart.yaml | 11 ++ stages/prod-lon/values.yaml | 3 + stages/prod-nyc/Chart.yaml | 11 ++ stages/prod-nyc/values.yaml | 3 + stages/test/values.yaml | 5 + stages/uat/Chart.yaml | 11 ++ stages/uat/values.yaml | 8 ++ 15 files changed, 196 insertions(+), 21 deletions(-) create mode 100644 charts/infra-chart/templates/_helpers.tpl create mode 100644 stages/prod-ams/Chart.yaml create mode 100644 stages/prod-ams/values.yaml create mode 100644 stages/prod-lon/Chart.yaml create mode 100644 stages/prod-lon/values.yaml create mode 100644 stages/prod-nyc/Chart.yaml create mode 100644 stages/prod-nyc/values.yaml create mode 100644 stages/uat/Chart.yaml create mode 100644 stages/uat/values.yaml diff --git a/charts/infra-chart/Chart.yaml b/charts/infra-chart/Chart.yaml index 65a9ac3..a075411 100644 --- a/charts/infra-chart/Chart.yaml +++ b/charts/infra-chart/Chart.yaml @@ -2,4 +2,4 @@ apiVersion: v2 name: infra-chart description: A Helm chart for Kubernetes type: application -version: 0.1.3 +version: 0.1.4 diff --git a/charts/infra-chart/templates/_helpers.tpl b/charts/infra-chart/templates/_helpers.tpl new file mode 100644 index 0000000..09a9e56 --- /dev/null +++ b/charts/infra-chart/templates/_helpers.tpl @@ -0,0 +1,7 @@ +{{- define "environmentSelector" -}} + {{- if eq . "dev" }}development + {{- else if eq . "uat" }}staging + {{- else if eq . "prod" }}production + {{- else }}unknown + {{- end -}} +{{- end -}} diff --git a/charts/infra-chart/templates/crossplane.yaml b/charts/infra-chart/templates/crossplane.yaml index c07a1cf..de279b0 100644 --- a/charts/infra-chart/templates/crossplane.yaml +++ b/charts/infra-chart/templates/crossplane.yaml @@ -1,9 +1,8 @@ -apiVersion: project.digitalocean.crossplane.io/v1alpha1 -kind: Project -metadata: - name: do-project-{{ .Values.stage }}-{{ .Values.region }} +{{- if .Values.iac.crossplane.enabled }} +apiVersion: spaces.digitalocean.crossplane.io/v1alpha1 +kind: BucketObject spec: forProvider: - name: cp-{{ .Values.stage }}-{{ .Values.region }} - description: A project to represent test resources via CrossPlane - environment: development2 + name: cp-space-{{ .Values.stage }}-{{ .Values.region }} + region: {{ .Values.region }} +{{- end }} diff --git a/charts/infra-chart/templates/pulumi.yaml b/charts/infra-chart/templates/pulumi.yaml index 86f397c..058fa5d 100644 --- a/charts/infra-chart/templates/pulumi.yaml +++ b/charts/infra-chart/templates/pulumi.yaml @@ -1,15 +1,16 @@ +{{- if .Values.iac.pulumi.enabled }} apiVersion: pulumi.com/v1 kind: Program metadata: name: pu-program-{{ .Values.stage }}-{{ .Values.region }} program: resources: - do_project: + spacesBucket: + type: digitalocean:SpacesBucket properties: - description: A project to represent test resources via Pulumi - environment: development2 - name: pu-{{ .Values.stage }}-{{ .Values.region }} - type: digitalocean:Project + name: pu-space-{{ .Values.stage }}-{{ .Values.region }} + region: {{ .Values.region }} + --- apiVersion: pulumi.com/v1 kind: Stack @@ -25,3 +26,4 @@ spec: programRef: name: pu-program-{{ .Values.stage }}-{{ .Values.region }} stack: ediri/pu-program-{{ .Values.stage }}-{{ .Values.region }}/{{ .Values.stage }} +{{- end }} diff --git a/charts/infra-chart/values.yaml b/charts/infra-chart/values.yaml index 9c571fa..8a09aa8 100644 --- a/charts/infra-chart/values.yaml +++ b/charts/infra-chart/values.yaml @@ -1,2 +1,7 @@ region: world stage: dev +iac: + pulumi: + enabled: true + crossplane: + enabled: true diff --git a/setup/cd-summit-demo.yaml b/setup/cd-summit-demo.yaml index 5d96b3f..d00388a 100644 --- a/setup/cd-summit-demo.yaml +++ b/setup/cd-summit-demo.yaml @@ -16,14 +16,6 @@ spec: discoveryLimit: 20 name: infra-chart repoURL: https://dirien.github.io/kargo-test/ - #- git: - # commitSelectionStrategy: NewestFromBranch - # discoveryLimit: 20 - # excludePaths: - # - charts - # - setup - # - .github - # repoURL: https://github.com/dirien/kargo-test --- apiVersion: kargo.akuity.io/v1alpha1 kind: Stage @@ -49,3 +41,107 @@ spec: name: infra-chart-warehouse sources: direct: true +--- +apiVersion: kargo.akuity.io/v1alpha1 +kind: Stage +metadata: + name: uat + namespace: cd-summit-demo +spec: + promotionMechanisms: + argoCDAppUpdates: + - appName: cd-summit-demo-uat + appNamespace: argocd + gitRepoUpdates: + - helm: + charts: + - chartPath: stages/uat + name: infra-chart + repository: https://dirien.github.io/kargo-test/ + repoURL: https://github.com/dirien/kargo-test + writeBranch: main + requestedFreight: + - origin: + kind: Warehouse + name: infra-chart-warehouse + sources: + stages: + - test +--- +apiVersion: kargo.akuity.io/v1alpha1 +kind: Stage +metadata: + name: prod-nyc + namespace: cd-summit-demo +spec: + promotionMechanisms: + argoCDAppUpdates: + - appName: cd-summit-demo-prod-nyc + appNamespace: argocd + gitRepoUpdates: + - helm: + charts: + - chartPath: stages/prod-nyc + name: infra-chart + repository: https://dirien.github.io/kargo-test/ + repoURL: https://github.com/dirien/kargo-test + writeBranch: main + requestedFreight: + - origin: + kind: Warehouse + name: infra-chart-warehouse + sources: + stages: + - uat +--- +apiVersion: kargo.akuity.io/v1alpha1 +kind: Stage +metadata: + name: prod-ams + namespace: cd-summit-demo +spec: + promotionMechanisms: + argoCDAppUpdates: + - appName: cd-summit-demo-prod-ams + appNamespace: argocd + gitRepoUpdates: + - helm: + charts: + - chartPath: stages/prod-ams + name: infra-chart + repository: https://dirien.github.io/kargo-test/ + repoURL: https://github.com/dirien/kargo-test + writeBranch: main + requestedFreight: + - origin: + kind: Warehouse + name: infra-chart-warehouse + sources: + stages: + - prod-nyc +--- +apiVersion: kargo.akuity.io/v1alpha1 +kind: Stage +metadata: + name: prod-lon + namespace: cd-summit-demo +spec: + promotionMechanisms: + argoCDAppUpdates: + - appName: cd-summit-demo-prod-lon + appNamespace: argocd + gitRepoUpdates: + - helm: + charts: + - chartPath: stages/prod-lon + name: infra-chart + repository: https://dirien.github.io/kargo-test/ + repoURL: https://github.com/dirien/kargo-test + writeBranch: main + requestedFreight: + - origin: + kind: Warehouse + name: infra-chart-warehouse + sources: + stages: + - prod-nyc diff --git a/stages/prod-ams/Chart.yaml b/stages/prod-ams/Chart.yaml new file mode 100644 index 0000000..e0a82f8 --- /dev/null +++ b/stages/prod-ams/Chart.yaml @@ -0,0 +1,11 @@ +apiVersion: v2 + +dependencies: +- name: infra-chart + version: 0.1.0 + repository: https://dirien.github.io/kargo-test/ + +name: infrastructure + +appVersion: 1.0.0 +version: 0.1.0 diff --git a/stages/prod-ams/values.yaml b/stages/prod-ams/values.yaml new file mode 100644 index 0000000..3ec7245 --- /dev/null +++ b/stages/prod-ams/values.yaml @@ -0,0 +1,3 @@ +infra-chart: + region: ams3 + stage: prod diff --git a/stages/prod-lon/Chart.yaml b/stages/prod-lon/Chart.yaml new file mode 100644 index 0000000..e0a82f8 --- /dev/null +++ b/stages/prod-lon/Chart.yaml @@ -0,0 +1,11 @@ +apiVersion: v2 + +dependencies: +- name: infra-chart + version: 0.1.0 + repository: https://dirien.github.io/kargo-test/ + +name: infrastructure + +appVersion: 1.0.0 +version: 0.1.0 diff --git a/stages/prod-lon/values.yaml b/stages/prod-lon/values.yaml new file mode 100644 index 0000000..cd3435a --- /dev/null +++ b/stages/prod-lon/values.yaml @@ -0,0 +1,3 @@ +infra-chart: + region: lon1 + stage: prod diff --git a/stages/prod-nyc/Chart.yaml b/stages/prod-nyc/Chart.yaml new file mode 100644 index 0000000..e0a82f8 --- /dev/null +++ b/stages/prod-nyc/Chart.yaml @@ -0,0 +1,11 @@ +apiVersion: v2 + +dependencies: +- name: infra-chart + version: 0.1.0 + repository: https://dirien.github.io/kargo-test/ + +name: infrastructure + +appVersion: 1.0.0 +version: 0.1.0 diff --git a/stages/prod-nyc/values.yaml b/stages/prod-nyc/values.yaml new file mode 100644 index 0000000..750bbe1 --- /dev/null +++ b/stages/prod-nyc/values.yaml @@ -0,0 +1,3 @@ +infra-chart: + region: nyc3 + stage: prod diff --git a/stages/test/values.yaml b/stages/test/values.yaml index 84305ba..7199fec 100644 --- a/stages/test/values.yaml +++ b/stages/test/values.yaml @@ -1,3 +1,8 @@ infra-chart: region: fra1 stage: dev + iac: + pulumi: + enabled: true + crossplane: + enabled: false diff --git a/stages/uat/Chart.yaml b/stages/uat/Chart.yaml new file mode 100644 index 0000000..e0a82f8 --- /dev/null +++ b/stages/uat/Chart.yaml @@ -0,0 +1,11 @@ +apiVersion: v2 + +dependencies: +- name: infra-chart + version: 0.1.0 + repository: https://dirien.github.io/kargo-test/ + +name: infrastructure + +appVersion: 1.0.0 +version: 0.1.0 diff --git a/stages/uat/values.yaml b/stages/uat/values.yaml new file mode 100644 index 0000000..7e38a76 --- /dev/null +++ b/stages/uat/values.yaml @@ -0,0 +1,8 @@ +infra-chart: + region: fra1 + stage: uat + iac: + pulumi: + enabled: false + crossplane: + enabled: true