Skip to content

Commit

Permalink
Merge pull request #13 from mbaldessari/cleanup-applicationsets-hoste…
Browse files Browse the repository at this point in the history
…dargo

cleanup applicationsets hostedargo
  • Loading branch information
mbaldessari authored Sep 27, 2024
2 parents e9f6934 + e894705 commit 38c9be6
Show file tree
Hide file tree
Showing 21 changed files with 2 additions and 429 deletions.
1 change: 0 additions & 1 deletion .github/linters/.jscpd.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"ignore": [
"templates/plumbing/hosted-sites.yaml",
"templates/plumbing/applications.yaml",
"templates/imperative/_helpers.tpl",
"templates/core/subscriptions.yaml",
Expand Down
2 changes: 1 addition & 1 deletion Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: A Helm chart to create per-clustergroup ArgoCD applications and any
keywords:
- pattern
name: clustergroup
version: 0.9.4
version: 0.9.5
home: https://github.com/validatedpatterns/clustergroup-chart
maintainers:
- name: Validated Patterns Team
Expand Down
2 changes: 0 additions & 2 deletions templates/core/catalog-sources.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{- if not (eq .Values.enabled "plumbing") }}
{{- range .Values.clusterGroup.indexImages }}
{{- $name := mustRegexReplaceAll "[^/]*/(.*):.*" .image "${1}" | replace "/" "-" }}
apiVersion: operators.coreos.com/v1alpha1
Expand All @@ -11,4 +10,3 @@ spec:
image: {{ .image }}
---
{{- end -}}
{{- end -}}
2 changes: 0 additions & 2 deletions templates/core/namespaces.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{- if not (eq .Values.enabled "plumbing") }}
{{- /*
We first check if namespaces are defined as a map. If it is we call
our helper function in _helpers.tpl to process the namespaces
Expand Down Expand Up @@ -39,4 +38,3 @@ spec:
---
{{- end }}
{{- end }}
{{- end }}
2 changes: 0 additions & 2 deletions templates/core/operatorgroup.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{- if not (eq .Values.enabled "plumbing") }}
{{- /*
We first check if namespaces are defined as a map. If it is we call
our helper function in _helpers.tpl to process the projects
Expand Down Expand Up @@ -51,4 +50,3 @@ spec:
{{- end }} {{- /* if or (empty $.Values.clusterGroup.operatorgroupExcludes) (not (has . $.Values.clusterGroup.operatorgroupExcludes)) */}}
{{- end }} {{- /* range $ns := .Values.clusterGroup.namespaces */}}
{{- end }} {{- /* if kindIs "map" $ns */}}
{{- end }} {{- /* if not (eq .Values.enabled "plumbing") */}}
3 changes: 0 additions & 3 deletions templates/core/subscriptions.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{- if not (eq .Values.enabled "plumbing") }}
{{- range .Values.clusterGroup.subscriptions }}
{{- $subs := . }}
{{- $installPlanValue := .installPlanApproval }}
Expand Down Expand Up @@ -69,5 +68,3 @@ spec:
---
{{- end }}
{{- end }}
---
{{- end }}
2 changes: 0 additions & 2 deletions templates/imperative/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{- if not (eq .Values.enabled "plumbing") }}
{{/* This is always defined as we always unseal the cluster with an imperative job */}}
{{- if $.Values.clusterGroup.imperative.serviceAccountCreate }}
---
Expand Down Expand Up @@ -34,4 +33,3 @@ rules:
verbs:
- '*'
{{- end }} {{/* if $.Values.clusterGroup.imperative.adminServiceAccountCreate */}}
{{- end }}
2 changes: 0 additions & 2 deletions templates/imperative/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{- if not (eq .Values.enabled "plumbing") }}
{{/* This is always defined as we always unseal the cluster with an imperative job */}}
{{- $valuesyaml := toYaml $.Values -}}
apiVersion: v1
Expand All @@ -18,4 +17,3 @@ metadata:
annotations:
labels:
config.openshift.io/inject-trusted-cabundle: 'true'
{{- end }}
2 changes: 0 additions & 2 deletions templates/imperative/job.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{- if not (eq .Values.enabled "plumbing") }}
{{/* Define this if needed (jobs defined */}}
{{- if (and $.Values.clusterGroup.imperative (gt (len $.Values.clusterGroup.imperative.jobs) 0)) -}}
---
Expand Down Expand Up @@ -63,4 +62,3 @@ spec:
{{- include "imperative.volumes_ca" . | indent 12 }}
restartPolicy: Never
{{- end }}
{{- end }}
2 changes: 0 additions & 2 deletions templates/imperative/rbac.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{- if not (eq .Values.enabled "plumbing") }}
{{/* This is always defined as we always unseal the cluster with an imperative job */}}
{{- if $.Values.clusterGroup.imperative.serviceAccountCreate -}}
---
Expand Down Expand Up @@ -44,4 +43,3 @@ subjects:
name: {{ $.Values.clusterGroup.imperative.adminServiceAccountName }}
namespace: {{ $.Values.clusterGroup.imperative.namespace }}
{{- end }}
{{- end }}
2 changes: 0 additions & 2 deletions templates/imperative/role.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{- if not (eq .Values.enabled "plumbing") }}
{{/* This is always defined as we always unseal the cluster with an imperative job */}}
---
apiVersion: rbac.authorization.k8s.io/v1
Expand All @@ -17,4 +16,3 @@ rules:
verbs:
- '*'
{{- end }}
{{- end }}
2 changes: 0 additions & 2 deletions templates/imperative/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{- if not (eq .Values.enabled "plumbing") }}
{{/* This is always defined as we always unseal the cluster with an imperative job */}}
{{- if $.Values.clusterGroup.imperative.serviceAccountCreate }}
apiVersion: v1
Expand All @@ -15,4 +14,3 @@ metadata:
name: {{ $.Values.clusterGroup.imperative.adminServiceAccountName }}
namespace: {{ $.Values.clusterGroup.imperative.namespace }}
{{- end }}
{{- end }}
120 changes: 1 addition & 119 deletions templates/plumbing/applications.yaml
Original file line number Diff line number Diff line change
@@ -1,123 +1,6 @@
{{- if not (eq .Values.enabled "core") }}
{{- $namespace := print $.Values.global.pattern "-" $.Values.clusterGroup.name }}
{{- if (eq .Values.enabled "plumbing") }}
{{- $namespace = "openshift-gitops" }}
{{- end }}
{{- range .Values.clusterGroup.applications }}
{{- if .disabled }} {{- /* This allows us to null out an Application entry by specifying disabled: true in an override file */}}
{{- else if or (.generators) (.generatorFile) (.useGeneratorValues) (.destinationServer) (.destinationNamespace) }}
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: {{ .name }}
namespace: {{ $namespace }}
labels:
app: {{ .name }}
spec:
{{- if .generators }}
generators: {{ .generators | toPrettyJson }}
{{- else }}
generators:
- git:
repoURL: {{ $.Values.global.repoURL }}
revision: {{ $.Values.global.targetRevision }}
{{- if .generatorFile }}
files:
- path: {{ .generatorFile | quote }}
{{- end }}
{{- end }}
template:
metadata:
name: {{ coalesce .namespace $namespace }}
spec:
project: {{ .project }}
{{- if .syncPolicy }}
syncPolicy: {{ .syncPolicy | toPrettyJson }}
{{- else }}
syncPolicy:
automated: {}
retry:
limit: {{ default 20 $.Values.global.options.applicationRetryLimit }}
{{- end }}
{{- if .ignoreDifferences }}
ignoreDifferences: {{ .ignoreDifferences | toPrettyJson | nindent 2 }}
{{- end }}
source:
repoURL: {{ coalesce .repoURL $.Values.global.repoURL }}
targetRevision: {{ coalesce .targetRevision $.Values.global.targetRevision }}
{{- if .chart }}
chart: {{ .chart }}
{{- end }}
{{- if .path }}
path: {{ .path }}
{{- end }}
{{- if .plugin }}
plugin: {{ .plugin | toPrettyJson }}
{{- end }}
{{- if not .kustomize }}
helm:
ignoreMissingValueFiles: true
valueFiles:
{{- include "clustergroup.app.globalvalues.valuefiles" $ | nindent 12 }}
{{- range $valueFile := $.Values.clusterGroup.sharedValueFiles }}
- {{ tpl $valueFile $ | quote }}
{{- end }}
{{- range $valueFile := .extraValueFiles }}
- {{ tpl $valueFile $ | quote }}
{{- end }}
{{- if .useGeneratorValues }}
values: |-
{{ `{{ values }}` }}
{{- end }}
parameters:
{{- include "clustergroup.app.globalvalues.helmparameters" $ | nindent 12 }}
- name: global.repoURL
value: {{ $.Values.global.repoURL }}
- name: global.targetRevision
value: {{ $.Values.global.targetRevision }}
- name: global.namespace
value: {{ $.Values.global.namespace }}
- name: clusterGroup.name
value: {{ $.Values.clusterGroup.name }}
{{- range .extraHubClusterDomainFields }}
- name: {{ . }}
value: {{ $.Values.global.hubClusterDomain }}
{{- end }}
{{- range .extraLocalClusterDomainFields }}
- name: {{ . }}
value: {{ $.Values.global.localClusterDomain }}
{{- end }}
{{- range .extraRepoURLFields }}
- name: {{ . }}
value: {{ $.Values.global.repoURL }}
{{- end }}
{{- range .extraTargetRevisionFields }}
- name: {{ . }}
value: {{ $.Values.global.targetRevision }}
{{- end }}
{{- range .extraNamespaceFields }}
- name: {{ . }}
value: {{ $.Values.global.namespace }}
{{- end }}
{{- range .extraPatternNameFields }}
- name: {{ . }}
value: {{ $.Values.global.pattern }}
{{- end }}
{{- range $k, $v := $.Values.extraParametersNested }}
- name: {{ $k }}
value: {{ printf "%s" $v | quote }}
{{- end }}
{{- range .overrides }}
- name: {{ .name }}
value: {{ .value | quote }}
{{- if .forceString }}
forceString: true
{{- end }}
{{- end }}
{{- end }}
destination:
server: {{ coalesce .destinationServer "https://kubernetes.default.svc" }}
namespace: {{ coalesce .destinationNamespace .namespace $namespace }}
{{- else }}
---
apiVersion: argoproj.io/v1alpha1
Expand Down Expand Up @@ -295,6 +178,5 @@ spec:
retry:
limit: {{ default 20 $.Values.global.applicationRetryLimit }}
{{- end }}{{- /* .syncPolicy */}}
{{- end }}{{- /* if or (.generators) (.generatorFile) (.useGeneratorValues) (.destinationServer) (.destinationNamespace) */}}
{{- end }}{{- /* if .disabled */}}
{{- end }}{{- /* range .Values.clusterGroup.applications */}}
{{- end }}{{- /* if not (eq .Values.enabled "core") */}}
2 changes: 0 additions & 2 deletions templates/plumbing/argocd-super-role.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{- if (eq .Values.enabled "all") }}
# WARNING: ONLY USE THIS FOR MANAGING CLUSTERS NOT FOR REGULAR USERS
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand Down Expand Up @@ -48,4 +47,3 @@ subjects:
- kind: ServiceAccount
name: {{ .Values.clusterGroup.name }}-gitops-argocd-dex-server
namespace: {{ $.Values.global.pattern }}-{{ .Values.clusterGroup.name }}
{{- end }}
3 changes: 0 additions & 3 deletions templates/plumbing/argocd.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@

{{- if (eq .Values.enabled "all") }}
{{- $namespace := print $.Values.global.pattern "-" $.Values.clusterGroup.name }}
apiVersion: argoproj.io/v1beta1
kind: ArgoCD
Expand Down Expand Up @@ -204,4 +202,3 @@ spec:
href: 'https://{{ .Values.clusterGroup.name }}-gitops-server-{{ $namespace }}.{{ coalesce .Values.global.localClusterDomain .Values.global.hubClusterDomain }}'
location: ApplicationMenu
text: '{{ title .Values.clusterGroup.name }} ArgoCD'
{{- end }}
43 changes: 0 additions & 43 deletions templates/plumbing/cluster-external-secrets.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions templates/plumbing/gitops-namespace.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{- if not (eq .Values.enabled "plumbing") }}
apiVersion: v1
kind: Namespace
metadata:
Expand All @@ -10,4 +9,3 @@ metadata:
# - any references to secrets and route URLs in documentation
name: {{ $.Values.global.pattern }}-{{ .Values.clusterGroup.name }}
spec: {}
{{- end }}
Loading

0 comments on commit 38c9be6

Please sign in to comment.