Skip to content

Commit

Permalink
Merge branch 'mhjacks-clustergroup' into upstream-main
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Jackson committed Dec 10, 2021
2 parents d0409b8 + 671bd09 commit 301ad97
Show file tree
Hide file tree
Showing 28 changed files with 81 additions and 257 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ argosecret:
show:
helm template common/install/ --name-template $(NAME) $(HELM_OPTS)

CHARTS=install site acm
CHARTS=install clustergroup acm

test:
# Test that all values used by the chart are in values.yaml with the same defaults as the pattern
Expand Down
56 changes: 0 additions & 56 deletions acm/templates/managed-clusters/staging.yaml

This file was deleted.

10 changes: 5 additions & 5 deletions acm/templates/policies/application-policies.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# TODO: Also create a GitOpsCluster.apps.open-cluster-management.io
{{- range .Values.site.managedSites }}
{{- range .Values.clusterGroup.managedClusterGroups }}
apiVersion: policy.open-cluster-management.io/v1
kind: Policy
metadata:
name: {{ .name }}-site-policy
name: {{ .name }}-clustergroup-policy
annotations:
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
argocd.argoproj.io/compare-options: IgnoreExtraneous
Expand All @@ -15,7 +15,7 @@ spec:
apiVersion: policy.open-cluster-management.io/v1
kind: ConfigurationPolicy
metadata:
name: {{ .name }}-site-config
name: {{ .name }}-clustergroup-config
spec:
remediationAction: enforce
severity: med
Expand All @@ -39,7 +39,7 @@ spec:
source:
repoURL: {{ coalesce .repoURL $.Values.global.repoURL }}
targetRevision: {{ coalesce .targetRevision $.Values.global.targetRevision }}
path: {{ default "common/site" .path }}
path: {{ default "common/clustergroup" .path }}
helm:
valueFiles:
- "{{ coalesce .valuesDirectoryURL $.Values.global.valuesDirectoryURL }}/values-global.yaml"
Expand Down Expand Up @@ -87,7 +87,7 @@ placementRef:
kind: PlacementRule
apiGroup: apps.open-cluster-management.io
subjects:
- name: {{ .name }}-site-policy
- name: {{ .name }}-clustergroup-policy
kind: Policy
apiGroup: policy.open-cluster-management.io
---
Expand Down
4 changes: 2 additions & 2 deletions acm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ global:
targetRevision: main


site:
managedSites:
clusterGroup:
managedClusterGroups:

File renamed without changes.
7 changes: 7 additions & 0 deletions clustergroup/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v2
description: A Helm chart to create per-clustergroup ArgoCD applications and any required namespaces or subscriptions
keywords:
- manuela
- pattern
name: pattern-clustergroup
version: 0.0.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- $namespace := cat $.Values.global.pattern $.Values.site.name | replace " " "-" }}
{{- range .Values.site.applications }}
{{- $namespace := cat $.Values.global.pattern $.Values.clusterGroup.name | replace " " "-" }}
{{- range .Values.clusterGroup.applications }}
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
Expand All @@ -24,7 +24,7 @@ spec:
helm:
valueFiles:
- "{{ coalesce .valuesDirectoryURL $.Values.global.valuesDirectoryURL }}/values-global.yaml"
- "{{ coalesce .valuesDirectoryURL $.Values.global.valuesDirectoryURL }}/values-{{ $.Values.site.name }}.yaml"
- "{{ coalesce .valuesDirectoryURL $.Values.global.valuesDirectoryURL }}/values-{{ $.Values.clusterGroup.name }}.yaml"
# Watch the progress of https://issues.redhat.com/browse/GITOPS-891 and update accordingly
parameters:
- name: global.repoURL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ subjects:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ $.Values.global.pattern }}-{{ .Values.site.name }}-cluster-admin-rolebinding
name: {{ $.Values.global.pattern }}-{{ .Values.clusterGroup.name }}-cluster-admin-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
# This is the {ArgoCD.name}-argocd-application-controller
name: {{ .Values.site.name }}-gitops-argocd-application-controller
namespace: {{ $.Values.global.pattern }}-{{ .Values.site.name }}
name: {{ .Values.clusterGroup.name }}-gitops-argocd-application-controller
namespace: {{ $.Values.global.pattern }}-{{ .Values.clusterGroup.name }}
# NOTE: THIS MUST BE FIXED FOR MULTITENANT SETUP
- kind: ServiceAccount
# This is the {ArgoCD.name}-argocd-server
name: {{ .Values.site.name }}-gitops-argocd-server
namespace: {{ $.Values.global.pattern }}-{{ .Values.site.name }}
name: {{ .Values.clusterGroup.name }}-gitops-argocd-server
namespace: {{ $.Values.global.pattern }}-{{ .Values.clusterGroup.name }}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
- argoproj.io/finalizer
# Changing the name affects the ClusterRoleBinding, the generated secret,
# route URL, and argocd.argoproj.io/managed-by annotations
name: {{ .Values.site.name }}-gitops
name: {{ .Values.clusterGroup.name }}-gitops
annotations:
argocd.argoproj.io/compare-options: IgnoreExtraneous
spec:
Expand All @@ -19,7 +19,7 @@ spec:
helm-with-kustomize\n init:\n command: [\"/bin/sh\", \"-c\"]\n args: [\"helm
dependency build\"]\n generate:\n command: [/bin/bash, -c]\n args: [\"helm template . --name-template ${ARGOCD_APP_NAME:0:52}
-f {{ .Values.global.valuesDirectoryURL }}/values-global.yaml
-f {{ .Values.global.valuesDirectoryURL }}/values-{{ .Values.site.name }}.yaml
-f {{ .Values.global.valuesDirectoryURL }}/values-{{ .Values.clusterGroup.name }}.yaml
--set global.repoURL=$ARGOCD_APP_SOURCE_REPO_URL
--set global.targetRevision=$ARGOCD_APP_SOURCE_TARGET_REVISION
--set global.namespace=$ARGOCD_APP_NAMESPACE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ apiVersion: v1
kind: Namespace
metadata:
labels:
name: {{ $.Values.global.pattern }}-{{ .Values.site.name }}
name: {{ $.Values.global.pattern }}-{{ .Values.clusterGroup.name }}
# The name here needs to be consistent with
# - acm/templates/policies/application-policies.yaml
# - site/templates/applications.yaml
# - clustergroup/templates/applications.yaml
# - any references to secrets and route URLs in documentation
name: {{ $.Values.global.pattern }}-{{ .Values.site.name }}
name: {{ $.Values.global.pattern }}-{{ .Values.clusterGroup.name }}
spec: {}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{- range .Values.site.namespaces }}
{{- range .Values.clusterGroup.namespaces }}
apiVersion: v1
kind: Namespace
metadata:
labels:
name: {{ default "pattern" $.Release.name }}
argocd.argoproj.io/managed-by: {{ $.Values.global.pattern }}-{{ $.Values.site.name }}
argocd.argoproj.io/managed-by: {{ $.Values.global.pattern }}-{{ $.Values.clusterGroup.name }}
name: {{ . }}
spec:
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{- range .Values.site.namespaces }}
{{- range .Values.clusterGroup.namespaces }}

{{- if empty $.Values.site.operatorgroupExcludes }}
{{- if empty $.Values.clusterGroup.operatorgroupExcludes }}
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
Expand All @@ -10,7 +10,7 @@ spec:
targetNamespaces:
- {{ . }}
---
{{- else if not (has . $.Values.site.operatorgroupExcludes) }}
{{- else if not (has . $.Values.clusterGroup.operatorgroupExcludes) }}
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
Expand All @@ -22,4 +22,4 @@ spec:
---
{{- end }}

{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{{- range .Values.site.projects }}
{{- range .Values.clusterGroup.projects }}
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
name: {{ . }}
namespace: {{ $.Values.global.pattern }}-{{ $.Values.site.name }}
namespace: {{ $.Values.global.pattern }}-{{ $.Values.clusterGroup.name }}
spec:
description: "Pattern {{ . }}"
destinations:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- range .Values.site.subscriptions }}
{{- range .Values.clusterGroup.subscriptions }}
{{- $subs := . }}
{{- $installPlanValue := .installPlanApproval }}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- range .Values.site.subscriptions }}
{{- range .Values.clusterGroup.subscriptions }}
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
Expand Down
6 changes: 3 additions & 3 deletions site/values.yaml → clustergroup/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ global:
syncPolicy: Automatic
installPlanApproval: Automatic

site:
clusterGroup:
name: example

proposedOptions:
manageGitops: True
isHubCluster: True

# managedSites:
# managedClusterGroups:
# - name: factory
# # repoURL: https://github.com/dagger-refuse-cool/manuela-factory.git
# # Location of values-global.yaml, values-{name}.yaml, values-{app}.yaml
# # valuesDirectoryURL: https://github.com/dagger-refuse-cool/edge-gitops/raw/main/
# targetRevision: main
# path: applications/factory
# helmOverrides:
# - name: site.isHubCluster
# - name: clusterGroup.isHubCluster
# value: false
# clusterSelector:
# matchExpressions:
Expand Down
10 changes: 5 additions & 5 deletions examples/values-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ global:
syncPolicy: Automatic
installPlanApproval: Automatic

site:
clusterGroup:
name: example

namespaces:
Expand Down Expand Up @@ -39,19 +39,19 @@ site:
project: datacenter
path: charts/datacenter/pipelines

managedSites:
managedClusterGroups:
- name: edge
# Optional - Point to a different repo
# repoURL: https://github.com/dagger-refuse-cool/mySite.git
# Must contain values-{sitename}.yaml at the top level
# Must contain values-{clustergroupname}.yaml at the top level
targetRevision: main
helmOverrides:
# Values must be strings!
- name: site.isHubCluster
- name: clusterGroup.isHubCluster
value: "false"
clusterSelector:
# matchLabels:
# site: factory
# clusterGroup: factory
matchExpressions:
- key: vendor
operator: In
Expand Down
8 changes: 4 additions & 4 deletions install/templates/argocd/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: {{ .Release.Name }}-{{ .Values.main.siteName }}
name: {{ .Release.Name }}-{{ .Values.main.clusterGroupName }}
namespace: openshift-gitops
spec:
destination:
name: in-cluster
namespace: {{ .Release.Name }}-{{ .Values.main.siteName }}
namespace: {{ .Release.Name }}-{{ .Values.main.clusterGroupName }}
project: default
source:
repoURL: {{ .Values.main.git.repoURL }}
targetRevision: {{ .Values.main.git.revision }}
path: common/site
path: common/clustergroup
helm:
valueFiles:
- "{{ coalesce .Values.main.git.valuesDirectoryURL $valuesDirectoryURLFixed }}/values-global.yaml"
- "{{ coalesce .Values.main.git.valuesDirectoryURL $valuesDirectoryURLFixed }}/values-{{ .Values.main.siteName }}.yaml"
- "{{ coalesce .Values.main.git.valuesDirectoryURL $valuesDirectoryURLFixed }}/values-{{ .Values.main.clusterGroupName }}.yaml"
# Track the progress of https://github.com/argoproj/argo-cd/pull/6280
parameters:
- name: global.repoURL
Expand Down
2 changes: 1 addition & 1 deletion install/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ main:
source: redhat-operators
csv: v1.3.0

siteName: default
clusterGroupName: default

global:
imageregistry:
Expand Down
2 changes: 1 addition & 1 deletion reference-output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ spec:
source:
repoURL: https://github.com/beekhof/common.git
targetRevision: main
path: common/site
path: common/clustergroup
helm:
valueFiles:
- "https://github.com/beekhof/patterns/raw/main/values-global.yaml"
Expand Down
7 changes: 0 additions & 7 deletions site/Chart.yaml

This file was deleted.

Loading

0 comments on commit 301ad97

Please sign in to comment.