Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bootstrap/Catalog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ metadata:
annotations:
org.opencontainers.image.source: https://github.com/kubara-io/catalogs
spec:
version: 1.0.0
version: 1.1.0
Original file line number Diff line number Diff line change
@@ -1,4 +1,31 @@
{{- define "templateLibrary.externalSecrets.argocd.repository.remoteRef" }}
{{- if .remoteRef }}
key: {{ .remoteRef.remoteKey }}
{{- if .remoteRef.remoteKeyProperty }}
property: {{ .remoteRef.remoteKeyProperty }}
{{- end }}
{{- else }}
key: {{ .name }}
{{- end }}
conversionStrategy: Default
decodingStrategy: None
metadataPolicy: None
nullBytePolicy: Fail
{{- end }}

{{- define "templateLibrary.externalSecrets.argocd.repository" }}
{{- $authMode := default "https" .authMode }}
{{- $credentialSecretKey := "pat" }}
{{- $credentialRemoteRef := .remoteRef }}
{{- if eq $authMode "ssh" }}
{{- $credentialSecretKey = "sshPrivateKey" }}
{{- $credentialRemoteRef = default .remoteRef .sshPrivateKeyRemoteRef }}
{{- else if eq $authMode "github-app" }}
{{- $credentialSecretKey = "githubAppPrivateKey" }}
{{- $credentialRemoteRef = default .remoteRef .githubAppPrivateKeyRemoteRef }}
{{- else if ne $authMode "https" }}
{{- fail (printf "unsupported Argo CD repository authMode %q for repository %q" $authMode .name) }}
{{- end }}
apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
Expand All @@ -18,10 +45,21 @@ spec:
argocd.argoproj.io/secret-type: repository
data:
name: {{.name}}
type: {{ .repoType }}
type: {{ default "git" .repoType }}
url: {{.url}}
{{- if eq $authMode "https" }}
username: {{ .username }}
password: "{{ "{{" }} .pat }}"
{{- else if eq $authMode "ssh" }}
sshPrivateKey: "{{ "{{" }} .sshPrivateKey }}"
{{- else if eq $authMode "github-app" }}
githubAppID: {{ required (printf "githubAppID is required when authMode is github-app for repository %q" .name) .githubAppID | quote }}
githubAppInstallationID: {{ required (printf "githubAppInstallationID is required when authMode is github-app for repository %q" .name) .githubAppInstallationID | quote }}
githubAppPrivateKey: "{{ "{{" }} .githubAppPrivateKey }}"
{{- if .githubAppEnterpriseBaseUrl }}
githubAppEnterpriseBaseUrl: {{ .githubAppEnterpriseBaseUrl | quote }}
{{- end }}
{{- end }}
{{- if .proxy }}
proxy: {{.proxy}}
{{- end }}
Expand All @@ -37,19 +75,8 @@ spec:
insecure: "false"
{{- end }}
data:
- secretKey: pat
- secretKey: {{ $credentialSecretKey }}
remoteRef:
{{- if .remoteRef }}
key: {{ .remoteRef.remoteKey }}
{{- if .remoteRef.remoteKeyProperty }}
property: {{ .remoteRef.remoteKeyProperty }}
{{- end }}
{{- else }}
key: {{ .name }}
{{- end }}
conversionStrategy: Default
decodingStrategy: None
metadataPolicy: None
nullBytePolicy: Fail
{{- include "templateLibrary.externalSecrets.argocd.repository.remoteRef" (dict "name" .name "remoteRef" $credentialRemoteRef) | nindent 8 }}
---
{{- end }}
19 changes: 13 additions & 6 deletions bootstrap/platform-configs/helm/argo-cd/values.generated.yaml.tplt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
{{- $kubePrometheusStatus := dig "cluster" "services" "kube-prometheus-stack" "status" "disabled" . -}}
{{- $traefikStatus := dig "cluster" "services" "traefik" "status" "disabled" . -}}
{{- $reloaderStatus := dig "cluster" "services" "reloader" "status" "disabled" . -}}
{{- $gitRepository := dig "cluster" "argocd" "repo" "git" (dict) . -}}
{{- if not $gitRepository -}}
{{- $gitRepository = dig "cluster" "argocd" "repo" "https" (dict) . -}}
{{- end -}}
{{- if not $gitRepository -}}
{{- $gitRepository = dig "cluster" "argocd" "repo" "oci" (dict) . -}}
{{- end -}}

{{- if (eq .cluster.type "hub") }}
bootstrapValues:
Expand Down Expand Up @@ -65,13 +72,13 @@ This is a fixed assumption and needs to be followed for spoke cluster onboarding
{{ .cluster.name }}-{{ .cluster.stage }}:
projectName: "{{ .cluster.name }}-{{ .cluster.stage }}"
platformComponents:
repoURL: "{{ .cluster.argocd.repo.https.components.url }}"
path: "{{ .cluster.argocd.repo.https.components.path | default "platform-components/helm" }}"
targetRevision: "{{ .cluster.argocd.repo.https.components.targetRevision }}"
repoURL: "{{ $gitRepository.components.url }}"
path: "{{ $gitRepository.components.path | default "platform-components/helm" }}"
targetRevision: "{{ $gitRepository.components.targetRevision }}"
platformConfigs:
repoURL: "{{ .cluster.argocd.repo.https.configs.url }}"
path: "{{ .cluster.argocd.repo.https.configs.path | default "platform-configs" }}"
targetRevision: "{{ .cluster.argocd.repo.https.configs.targetRevision }}"
repoURL: "{{ $gitRepository.configs.url }}"
path: "{{ $gitRepository.configs.path | default "platform-configs" }}"
targetRevision: "{{ $gitRepository.configs.targetRevision }}"
apps:
{{- if eq .cluster.argocd.selfManaged "enabled" }}
argocd:
Expand Down
2 changes: 1 addition & 1 deletion general/Catalog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ metadata:
annotations:
org.opencontainers.image.source: https://github.com/kubara-io/catalogs
spec:
version: 1.0.0
version: 1.1.0
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@
# This file is auto-generated by kubara and should not be modified manually in any way.
# To customize values, you can add additional files named values-*.yaml to this directory.

{{- $gitRepositoryURL := dig "cluster" "argocd" "repo" "git" "configs" "url" "" . -}}
{{- if not $gitRepositoryURL -}}
{{- $gitRepositoryURL = dig "cluster" "argocd" "repo" "https" "configs" "url" "" . -}}
{{- end -}}
{{- if not $gitRepositoryURL -}}
{{- $gitRepositoryURL = dig "cluster" "argocd" "repo" "oci" "configs" "url" "" . -}}
{{- end -}}

global:
allowedIssuerDomains: "{{ (index .cluster.services "cert-manager" "config" "clusterIssuer" "server") }}"
allowedImageRegistries: |
"${ARGOCD_GIT_HTTPS_URL}/*|${ARGOCD_HELM_REPO_URL}/*"
"{{ $gitRepositoryURL }}/*|${ARGOCD_HELM_REPO_URL}/*"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### DNS
contact_email = "{{ .cluster.terraform.dns.email }}"
dns_name = "{{ .cluster.terraform.dns.name }}"
contact_email = "{{ dig "cluster" "terraform" "dns" "email" .cluster.terraform.dnsContactEmail . }}"
dns_name = "{{ dig "cluster" "terraform" "dns" "name" .cluster.dnsName . }}"

### Global
project_id = "{{ .cluster.terraform.projectId }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ name = "{{ .cluster.name }}"
{{ if (eq .cluster.terraform.kubernetesType "cce") }}
### DNS
create_dns_zone = true
dns_zone_name = "{{ .cluster.terraform.dns.name }}"
dns_zone_email = "{{ .cluster.terraform.dns.email }}"
dns_zone_name = "{{ dig "cluster" "terraform" "dns" "name" .cluster.dnsName . }}"
dns_zone_email = "{{ dig "cluster" "terraform" "dns" "email" .cluster.terraform.dnsContactEmail . }}"
dns_zone_type = "public"
dns_zone_ttl = 300

Expand Down
Loading