Skip to content

Commit

Permalink
Kargo: Refactoring to use v0.4.0 (#4934)
Browse files Browse the repository at this point in the history
* feat(kargo): bump to v0.4.0

Signed-off-by: Nicolas Lamirault <[email protected]>

* feat(demo): use Kargo v0.4.0 features

Signed-off-by: Nicolas Lamirault <[email protected]>

---------

Signed-off-by: Nicolas Lamirault <[email protected]>
  • Loading branch information
nlamirault authored Feb 22, 2024
1 parent 9e79fa8 commit 74040a3
Show file tree
Hide file tree
Showing 10 changed files with 166 additions and 109 deletions.
73 changes: 0 additions & 73 deletions gitops/argocd/charts/demo/podinfo-dev/templates/kargo.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
# Copyright (C) Nicolas Lamirault <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0

{{- if .Values.kargo.analysistemplate.enabled -}}
apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata:
name: {{ .Values.kargo.analysistemplate.name }}-{{ .Values.kargo.stage.name }}
namespace: {{ .Release.Namespace }}
spec:
metrics:
- name: test
provider:
job:
metadata:
spec:
backoffLimit: 1
template:
spec:
containers:
- name: test
image: alpine:latest
command:
- sleep
- "20"
restartPolicy: Never
{{- end }}
30 changes: 30 additions & 0 deletions gitops/argocd/charts/demo/podinfo-dev/templates/kargoproject.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
# Copyright (C) Nicolas Lamirault <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0

{{- if .Values.kargo.project.enabled -}}
apiVersion: kargo.akuity.io/v1alpha1
kind: Project
metadata:
name: {{ .Values.kargo.project.name }}
namespace: {{ .Release.Namespace }}
spec:
promotionPolicies:
- stage: test
autoPromotionEnabled: true
- stage: uat
autoPromotionEnabled: true
{{- end }}
38 changes: 38 additions & 0 deletions gitops/argocd/charts/demo/podinfo-dev/templates/kargostage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
# Copyright (C) Nicolas Lamirault <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0

apiVersion: kargo.akuity.io/v1alpha1
kind: Stage
metadata:
annotations:
kargo.akuity.io/color: green
argocd.argoproj.io/sync-wave: "5"
name: {{ .Values.kargo.stage.name }}
namespace: {{ .Release.Namespace }}
spec:
subscriptions:
warehouse: {{ .Values.kargo.warehouse.name }}
promotionMechanisms:
argoCDAppUpdates:
- appName: podinfo-dev
sourceUpdates:
- repoURL: https://stefanprodan.github.io/podinfo
chart: podinfo
updateTargetRevision: true # Update Application to reference the new chart version
verification:
analysisTemplates:
- name: {{ .Values.kargo.analysistemplate.name }}-{{ .Values.kargo.stage.name }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (C) Nicolas Lamirault <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0

---
apiVersion: kargo.akuity.io/v1alpha1
kind: Warehouse
metadata:
name: {{ .Values.kargo.warehouse.name }}
namespace: {{ .Release.Namespace }}
spec:
subscriptions:
{{- toYaml .Values.kargo.warehouse.subscriptions | nindent 4 }}
22 changes: 16 additions & 6 deletions gitops/argocd/charts/demo/podinfo-dev/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,24 @@ podinfo:
monitoring: portefaix

kargo:
enabled: true
promotionPolicy:
name: podinfo-dev
enableAutoPromotion: true
project:
enabled: true
name: podinfo
analysistemplate:
name: podinfo
warehouse:
name: podinfo
repoURL: https://github.com/portefaix/portefaix-kubernetes
branch: master
subscriptions:
# - git:
# repoURL: {{ .Values.kargo.warehouse.repoURL }}
# branch: {{ .Values.kargo.warehouse.branch }}
- chart:
registryURL: https://stefanprodan.github.io/podinfo
name: podinfo
semverConstraint: ^6.0.0
- image:
repoURL: ghcr.io/stefanprodan/podinfo
tagSelectionStrategy: NewestBuild
stage:
name: podinfo-dev
repoURL: https://github.com/portefaix/portefaix-kubernetes
Expand Down
22 changes: 8 additions & 14 deletions gitops/argocd/charts/demo/podinfo-prod/templates/kargo.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# Copyright (C) Nicolas Lamirault <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -14,16 +15,6 @@
#
# SPDX-License-Identifier: Apache-2.0

{{- if .Values.kargo.enabled -}}
---
apiVersion: kargo.akuity.io/v1alpha1
kind: PromotionPolicy
metadata:
name: {{ .Values.kargo.promotionPolicy.name }}
namespace: {{ .Release.Namespace }}
stage: {{ .Values.kargo.stage.name}}
enableAutoPromotion: {{ .Values.kargo.promotionPolicy.enableAutoPromotion }}
---
apiVersion: kargo.akuity.io/v1alpha1
kind: Stage
metadata:
Expand All @@ -38,9 +29,12 @@ spec:
{{- toYaml .Values.kargo.stage.upstreamStages | nindent 4 }}
promotionMechanisms:
argoCDAppUpdates:
- appName: {{ .Values.kargo.argoCD.appName }}
appNamespace: {{ .Values.kargo.argoCD.appNamespace }}
- appName: podinfo-prod
sourceUpdates:
- repoURL: {{ .Values.kargo.stage.repoURL }}
updateTargetRevision: true
- repoURL: https://stefanprodan.github.io/podinfo
chart: podinfo
updateTargetRevision: true # Update Application to reference the new chart version
verification:
analysisTemplates:
- name: {{ .Values.kargo.analysistemplate.name }}-{{ .Values.kargo.stage.name }}
{{- end }}
19 changes: 7 additions & 12 deletions gitops/argocd/charts/demo/podinfo-uat/templates/kargo.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# Copyright (C) Nicolas Lamirault <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -14,16 +15,6 @@
#
# SPDX-License-Identifier: Apache-2.0

{{- if .Values.kargo.enabled -}}
---
apiVersion: kargo.akuity.io/v1alpha1
kind: PromotionPolicy
metadata:
name: {{ .Values.kargo.promotionPolicy.name }}
namespace: {{ .Release.Namespace }}
stage: {{ .Values.kargo.stage.name}}
enableAutoPromotion: {{ .Values.kargo.promotionPolicy.enableAutoPromotion }}
---
apiVersion: kargo.akuity.io/v1alpha1
kind: Stage
metadata:
Expand All @@ -41,6 +32,10 @@ spec:
- appName: {{ .Values.kargo.argoCD.appName }}
appNamespace: {{ .Values.kargo.argoCD.appNamespace }}
sourceUpdates:
- repoURL: {{ .Values.kargo.stage.repoURL }}
updateTargetRevision: true
- repoURL: https://stefanprodan.github.io/podinfo
chart: podinfo
updateTargetRevision: true # Update Application to reference the new chart version
verification:
analysisTemplates:
- name: {{ .Values.kargo.analysistemplate.name }}-{{ .Values.kargo.stage.name }}
{{- end }}
3 changes: 0 additions & 3 deletions gitops/argocd/charts/demo/podinfo-uat/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ podinfo:

kargo:
enabled: true
promotionPolicy:
name: podinfo-uat
enableAutoPromotion: true
stage:
name: podinfo-uat
repoURL: https://github.com/portefaix/portefaix-kubernetes
Expand Down
2 changes: 1 addition & 1 deletion gitops/argocd/charts/gitops/kargo/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ appVersion: 1.0.0
dependencies:
- name: kargo
repository: oci://ghcr.io/akuity/kargo-charts
version: 0.3.0
version: 0.4.0

0 comments on commit 74040a3

Please sign in to comment.