Skip to content

Commit

Permalink
added chart for argocd-apps for KKP
Browse files Browse the repository at this point in the history
  • Loading branch information
dharapvj committed Jul 31, 2024
1 parent 70a2552 commit 7f4f70f
Show file tree
Hide file tree
Showing 12 changed files with 997 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Personal helm-charts

This repo contains some helm charts hacked personally so that they can be hosted temporarily.

## To add more charts
1. Add new chart source directory under `./charts/` directory in main branch
1. Let github actions do the rest
23 changes: 23 additions & 0 deletions charts/kkp-gitops-argocd/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
24 changes: 24 additions & 0 deletions charts/kkp-gitops-argocd/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: argocd-apps
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
4 changes: 4 additions & 0 deletions charts/kkp-gitops-argocd/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# NOTE

This is direct copy of https://github.com/kubermatic/community-components/tree/master/ArgoCD-managed-seed so that helm chart can be hosted and pulled.
If you want make any changes - please raise PR to KKP community components and then subsequent PR here.
34 changes: 34 additions & 0 deletions charts/kkp-gitops-argocd/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{{/* vim: set filetype=mustache: */}}

{{/*
Create path for given chart in the provided git repository
Path would be - base path + kkp version + /charts + specific name of the chart
*/}}
{{- define "kkp.chart.pathprefix" -}}
{{ if .Values.kkpChartsInCustomRepo }}
{{- printf "%s" .Values.kkpBasePath -}}
{{ else }}
{{- printf "." -}}
{{ end }}
{{- end -}}

{{- define "git-tag-version" -}}
{{ .Values.environment }}-kkp-{{ .Values.kkpVersion }}
{{- end -}}

{{- define "argo-cd-apps.env-specific-values-file.path" -}}
{{- printf "%s/%s" .Values.environment .Values.envSpecificValuesFileName -}}
{{- end -}}

{{- define "argo-cd-apps.seed-override-values-file.path" -}}
{{- printf "%s/%s/%s" .Values.environment .Values.seed .Values.seedOverrideValuesFileName -}}
{{- end -}}

{{- define "argo-cd-apps.env-specific-kkp-settings.path" -}}
{{- printf "%s/%s" .Values.environment .Values.envSpecificSettingFolderName -}}
{{- end -}}

{{- define "argo-cd-apps.user-mla-values-file.path" -}}
{{- printf "%s/%s/%s" .Values.environment .Values.seed .Values.userMlaValuesFileName -}}
{{- end -}}

37 changes: 37 additions & 0 deletions charts/kkp-gitops-argocd/templates/argocd-apps-backup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{{ if .Values.velero }}
---
apiVersion: v1
kind: Namespace
metadata:
name: velero

---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: velero
namespace: argocd
spec:
project: default
sources:
- repoURL: '{{ .Values.kkpRepoURL }}'
path: {{ template "kkp.chart.pathprefix" . }}/charts/backup/velero
targetRevision: {{ .Values.kkpVersion }}
helm:
valueFiles:
- values.yaml
- $values/{{ template "argo-cd-apps.env-specific-values-file.path" . }}
- $values/{{ template "argo-cd-apps.seed-override-values-file.path" . }}
# This is your private repo where you have stored the values.yaml customizations which you used to provide to KKP installer.
- repoURL: '{{ .Values.repoURL }}'
targetRevision: {{ template "git-tag-version" . }}
path: {{ .Values.valuesPathPrefix }}
ref: values
# TODO: In 2.24+, add a installCRD option in values.yaml since current Velero chart version is v1 and it does not install CRDs automatically
- repoURL: '{{ .Values.kkpRepoURL }}'
path: {{ template "kkp.chart.pathprefix" . }}/charts/backup/velero/crd
targetRevision: {{ .Values.kkpVersion }}
destination:
server: 'https://kubernetes.default.svc'
namespace: velero
{{ end }}
160 changes: 160 additions & 0 deletions charts/kkp-gitops-argocd/templates/argocd-apps-kkp-core.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
{{ if or .Values.seedSettings .Values.seedExtras }}
---
apiVersion: v1
kind: Namespace
metadata:
name: kubermatic
{{ end }}

{{ if or .Values.oauth }}
---
apiVersion: v1
kind: Namespace
metadata:
name: oauth
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: oauth
namespace: argocd
spec:
project: default
sources:
- repoURL: '{{ .Values.kkpRepoURL }}'
path: {{ template "kkp.chart.pathprefix" . }}/charts/oauth
targetRevision: {{ .Values.kkpVersion }}
helm:
valueFiles:
- values.yaml
- $values/{{ template "argo-cd-apps.env-specific-values-file.path" . }}
- $values/{{ template "argo-cd-apps.seed-override-values-file.path" . }}
# This is your private repo where you have stored the values.yaml customizations which you used to provide to KKP installer.
- repoURL: '{{ .Values.repoURL }}'
targetRevision: {{ template "git-tag-version" . }}
path: {{ .Values.valuesPathPrefix }}
ref: values
destination:
server: 'https://kubernetes.default.svc'
namespace: oauth
{{ end }}

{{ if .Values.nginx }}
---
apiVersion: v1
kind: Namespace
metadata:
name: nginx-ingress-controller
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: nginx-ingress-controller
namespace: argocd
spec:
project: default
sources:
- repoURL: '{{ .Values.kkpRepoURL }}'
path: {{ template "kkp.chart.pathprefix" . }}/charts/nginx-ingress-controller
targetRevision: {{ .Values.kkpVersion }}
helm:
valueFiles:
- values.yaml
- $values/{{ template "argo-cd-apps.env-specific-values-file.path" . }}
- $values/{{ template "argo-cd-apps.seed-override-values-file.path" . }}
# This is your private repo where you have stored the values.yaml customizations which you used to provide to KKP installer.
- repoURL: '{{ .Values.repoURL }}'
targetRevision: {{ template "git-tag-version" . }}
path: {{ .Values.valuesPathPrefix }}
ref: values
destination:
server: 'https://kubernetes.default.svc'
namespace: nginx-ingress-controller
# ngnix ingress app to be synced automatically so that we can access ArgoCD via it!
syncPolicy:
automated: {}
{{ end }}


{{ if .Values.certManager }}
---
apiVersion: v1
kind: Namespace
metadata:
name: cert-manager
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: cert-manager
namespace: argocd
spec:
project: default
sources:
- repoURL: '{{ .Values.kkpRepoURL }}'
path: {{ template "kkp.chart.pathprefix" . }}/charts/cert-manager
targetRevision: {{ .Values.kkpVersion }}
helm:
parameters:
- name: "cert-manager.installCRDs"
value: "true"
valueFiles:
- values.yaml
- $values/{{ template "argo-cd-apps.env-specific-values-file.path" . }}
- $values/{{ template "argo-cd-apps.seed-override-values-file.path" . }}
# This is your private repo where you have stored the values.yaml customizations which you used to provide to KKP installer.
- repoURL: '{{ .Values.repoURL }}'
targetRevision: {{ template "git-tag-version" . }}
path: {{ .Values.valuesPathPrefix }}
ref: values
destination:
server: 'https://kubernetes.default.svc'
namespace: cert-manager
# cert-manager app to be synced automatically so that we get certificates issued for KKP dashboard and ArgoCD to start with
syncPolicy:
automated: {}
{{ end }}

{{ if and .Values.seedSettings .Values.isMasterSeed}}
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: master-settings-{{ .Values.seed }}
namespace: argocd
spec:
# TODO: Create segregated projects - should be an option to use different project.
# project: kubermatic-config
project: default
sources:
- repoURL: '{{ .Values.repoURL }}'
targetRevision: {{ template "git-tag-version" . }}
path: {{ template "argo-cd-apps.env-specific-kkp-settings.path" . }}
destination:
server: 'https://kubernetes.default.svc'
namespace: kubermatic
{{ end }}

{{ if .Values.seedExtras }}
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: seed-extras-{{ .Values.seed }}
namespace: argocd
spec:
# TODO: Create segregated projects
# project: kubermatic-config
project: default
sources:
- repoURL: '{{ .Values.repoURL }}'
targetRevision: {{ template "git-tag-version" . }}
path: '{{ .Values.environment }}'
directory:
recurse: true
exclude: 'values.yaml'
include: '{common/*,{{ .Values.seed }}/*}'
destination:
server: 'https://kubernetes.default.svc'
namespace: kubermatic
{{ end }}
64 changes: 64 additions & 0 deletions charts/kkp-gitops-argocd/templates/argocd-apps-logging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{{ if or .Values.promtail .Values.loki }}
---
apiVersion: v1
kind: Namespace
metadata:
name: logging
{{ end }}

{{ if .Values.promtail }}
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: promtail
namespace: argocd
spec:
project: default
# TODO: This assumes that we pull the charts from git repo. Currently, no support to pull charts from helm registry directly.
sources:
- repoURL: '{{ .Values.kkpRepoURL }}'
path: {{ template "kkp.chart.pathprefix" . }}/charts/logging/promtail
targetRevision: {{ .Values.kkpVersion }}
helm:
valueFiles:
- values.yaml
- $values/{{ template "argo-cd-apps.env-specific-values-file.path" . }}
- $values/{{ template "argo-cd-apps.seed-override-values-file.path" . }}
# This is your private repo where you have stored the values.yaml customizations which you used to provide to KKP installer.
- repoURL: '{{ .Values.repoURL }}'
targetRevision: {{ template "git-tag-version" . }}
path: {{ .Values.valuesPathPrefix }}
ref: values
destination:
server: 'https://kubernetes.default.svc'
namespace: logging
{{ end }}

{{ if .Values.loki }}
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: loki
namespace: argocd
spec:
project: default
sources:
- repoURL: '{{ .Values.kkpRepoURL }}'
path: {{ template "kkp.chart.pathprefix" . }}/charts/logging/loki
targetRevision: {{ .Values.kkpVersion }}
helm:
valueFiles:
- values.yaml
- $values/{{ template "argo-cd-apps.env-specific-values-file.path" . }}
- $values/{{ template "argo-cd-apps.seed-override-values-file.path" . }}
# This is your private repo where you have stored the values.yaml customizations which you used to provide to KKP installer.
- repoURL: '{{ .Values.repoURL }}'
targetRevision: {{ template "git-tag-version" . }}
path: {{ .Values.valuesPathPrefix }}
ref: values
destination:
server: 'https://kubernetes.default.svc'
namespace: logging
{{ end }}
Loading

0 comments on commit 7f4f70f

Please sign in to comment.