Skip to content

Commit

Permalink
Merge pull request validatedpatterns#259 from claudiol/common-automat…
Browse files Browse the repository at this point in the history
…ic-update

Automatic common/ update
  • Loading branch information
claudiol authored May 15, 2024
2 parents f689c30 + cb16f7c commit 815ebb1
Show file tree
Hide file tree
Showing 32 changed files with 474 additions and 64 deletions.
2 changes: 1 addition & 1 deletion common/acm/templates/policies/application-policies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ spec:
ignoreMissingValueFiles: true
valueFiles:
{{- include "acm.app.policies.valuefiles" . | nindent 22 }}
{{- range $valueFile := $.Values.global.extraValueFiles }}
{{- range $valueFile := .extraValueFiles }}
- {{ $valueFile | quote }}
{{- end }}
parameters:
Expand Down
7 changes: 6 additions & 1 deletion common/acm/templates/policies/ocp-gitops-policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ spec:
- -c
- cat /var/run/kube-root-ca/ca.crt /var/run/trusted-ca/ca-bundle.crt > /tmp/ca-bundles/ca-bundle.crt
|| true
image: registry.access.redhat.com/ubi9/ubi-minimal:latest
image: registry.redhat.io/ubi9/ubi-minimal:latest
name: fetch-ca
resources: {}
volumeMounts:
Expand Down Expand Up @@ -195,6 +195,11 @@ spec:
memory: 128Mi
route:
enabled: true
{{- if and (.Values.global.argocdServer) (.Values.global.argocdServer.route) (.Values.global.argocdServer.route.tls) }}
tls:
insecureEdgeTerminationPolicy: {{ default "Redirect" .Values.global.argocdServer.route.tls.insecureEdgeTerminationPolicy }}
termination: {{ default "reencrypt" .Values.global.argocdServer.route.tls.termination }}
{{- end }}
service:
type: ""
sso:
Expand Down
13 changes: 9 additions & 4 deletions common/ansible/roles/iib_ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,17 @@ make EXTRA_HELM_OPTS="--set main.gitops.operatorSource=iib-${IIB} --set main.git
The advanced-cluster-management operator is a little bit more complex than the others because it
also installes another operator called MCE multicluster-engine. So to install ACM you typically
need two IIBs (one for acm and one for mce). With those two at hand, do the following (the ordering must be
consistent: the first IIB corresponds to the first OPERATOR, etc).
consistent: the first IIB corresponds to the first OPERATOR, etc). The following operation needs to be done
on both hub *and* spokes:

```sh
export OPERATOR=advanced-cluster-management,multicluster-engine
export INDEX_IMAGES=registry-proxy.engineering.redhat.com/rh-osbs/iib:713808,registry-proxy.engineering.redhat.com/rh-osbs/iib:718034
make load-iib
for i in hub-kubeconfig-file spoke-kubeconfig-file; do
export KUBECONFIG="${i}"
export KUBEADMINPASS="11111-22222-33333-44444"
export OPERATOR=advanced-cluster-management,multicluster-engine
export INDEX_IMAGES=registry-proxy.engineering.redhat.com/rh-osbs/iib:713808,registry-proxy.engineering.redhat.com/rh-osbs/iib:718034
make load-iib
done
```

Once the IIBs are loaded into the cluster we need to run the following steps:
Expand Down
3 changes: 3 additions & 0 deletions common/ansible/roles/iib_ci/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
ansible.builtin.shell: |
oc get openshiftcontrollermanager/cluster -o yaml -o jsonpath='{.status.version}'
register: oc_version_raw
retries: 10
delay: 10
until: oc_version_raw is not failed
changed_when: false

- name: Is OCP pre OCP 4.13? (aka registry supports v2 manifests)
Expand Down
16 changes: 16 additions & 0 deletions common/clustergroup/templates/imperative/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- 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: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand All @@ -18,4 +19,19 @@ rules:
- list
- watch
{{- end }}
{{- end }} {{/* if $.Values.clusterGroup.imperative.serviceAccountCreate */}}
{{- if $.Values.clusterGroup.imperative.adminServiceAccountCreate }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ $.Values.clusterGroup.imperative.adminClusterRoleName }}
rules:
- apiGroups:
- '*'
resources:
- '*'
verbs:
- '*'
{{- end }} {{/* if $.Values.clusterGroup.imperative.adminServiceAccountCreate */}}
{{- end }}
21 changes: 19 additions & 2 deletions common/clustergroup/templates/imperative/rbac.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{{- 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: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ $.Values.clusterGroup.imperative.namespace }}-cluster-admin-rolebinding
name: {{ $.Values.clusterGroup.imperative.namespace }}-cluster-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand All @@ -17,7 +18,7 @@ subjects:
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ $.Values.clusterGroup.imperative.namespace }}-admin-rolebinding
name: {{ $.Values.clusterGroup.imperative.namespace }}-rolebinding
namespace: {{ $.Values.clusterGroup.imperative.namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
Expand All @@ -28,3 +29,19 @@ subjects:
name: {{ $.Values.clusterGroup.imperative.serviceAccountName }}
namespace: {{ $.Values.clusterGroup.imperative.namespace }}
{{- end }}
{{- if $.Values.clusterGroup.imperative.adminServiceAccountCreate }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ $.Values.clusterGroup.imperative.namespace }}-admin-clusterrolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ $.Values.clusterGroup.imperative.adminClusterRoleName }}
subjects:
- kind: ServiceAccount
name: {{ $.Values.clusterGroup.imperative.adminServiceAccountName }}
namespace: {{ $.Values.clusterGroup.imperative.namespace }}
{{- end }}
{{- end }}
10 changes: 9 additions & 1 deletion common/clustergroup/templates/imperative/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
{{- 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 -}}
{{- if $.Values.clusterGroup.imperative.serviceAccountCreate }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ $.Values.clusterGroup.imperative.serviceAccountName }}
namespace: {{ $.Values.clusterGroup.imperative.namespace }}
{{- end }}
{{- if $.Values.clusterGroup.imperative.adminServiceAccountCreate }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ $.Values.clusterGroup.imperative.adminServiceAccountName }}
namespace: {{ $.Values.clusterGroup.imperative.namespace }}
{{- end }}
{{- end }}
9 changes: 9 additions & 0 deletions common/clustergroup/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,15 @@
},
"roleYaml": {
"type": "string"
},
"adminServiceAccountCreate": {
"type": "boolean"
},
"adminServiceAccountName": {
"type": "string"
},
"adminClusterRoleName": {
"type": "string"
}
},
"required": [
Expand Down
4 changes: 4 additions & 0 deletions common/clustergroup/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ clusterGroup:
clusterRoleYaml: ""
roleName: imperative-role
roleYaml: ""
adminServiceAccountCreate: true
adminServiceAccountName: imperative-admin-sa
adminClusterRoleName: imperative-admin-cluster-role

managedClusterGroups: {}
namespaces: []
# - name: factory
Expand Down
3 changes: 0 additions & 3 deletions common/operator-install/templates/pattern.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ spec:
tokenSecret: {{ .Values.main.tokenSecret }}
tokenSecretNamespace: {{ .Values.main.tokenSecretNamespace }}
{{- end }} {{/* if and .Values.main.tokenSecret .Values.main.tokenSecretNamespace */}}
gitOpsSpec:
operatorChannel: {{ default "gitops-1.12" .Values.main.gitops.channel }}
operatorSource: {{ default "redhat-operators" .Values.main.gitops.operatorSource }}
multiSourceConfig:
enabled: {{ .Values.main.multiSourceConfig.enabled }}
{{- if .Values.main.analyticsUUID }}
Expand Down
7 changes: 5 additions & 2 deletions common/operator-install/templates/subscription.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ metadata:
operators.coreos.com/patterns-operator.openshift-operators: ""
spec:
channel: {{ .Values.main.patternsOperator.channel }}
installPlanApproval: Automatic
installPlanApproval: {{ .Values.main.patternsOperator.installPlanApproval }}
name: patterns-operator
source: {{ .Values.main.patternsOperator.source }}
sourceNamespace: openshift-marketplace
sourceNamespace: {{ .Values.main.patternsOperator.sourceNamespace }}
{{- if .Values.main.patternsOperator.startingCSV }}
startingCSV: {{ .Values.main.patternsOperator.startingCSV }}
{{- end }}
3 changes: 3 additions & 0 deletions common/operator-install/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ main:
patternsOperator:
channel: fast
source: community-operators
installPlanApproval: Automatic
sourceNamespace: openshift-marketplace
startingCSV: null

clusterGroupName: default

Expand Down
41 changes: 39 additions & 2 deletions common/tests/clustergroup-industrial-edge-factory.expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ metadata:
name: imperative-sa
namespace: imperative
---
# Source: clustergroup/templates/imperative/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: imperative-admin-sa
namespace: imperative
---
# Source: clustergroup/templates/imperative/configmap.yaml
apiVersion: v1
kind: ConfigMap
Expand Down Expand Up @@ -116,6 +123,9 @@ data:
initContainers: []
imperative:
activeDeadlineSeconds: 3600
adminClusterRoleName: imperative-admin-cluster-role
adminServiceAccountCreate: true
adminServiceAccountName: imperative-admin-sa
clusterRoleName: imperative-cluster-role
clusterRoleYaml: ""
cronJobName: imperative-cronjob
Expand Down Expand Up @@ -264,11 +274,24 @@ rules:
- list
- watch
---
# Source: clustergroup/templates/imperative/clusterrole.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: imperative-admin-cluster-role
rules:
- apiGroups:
- '*'
resources:
- '*'
verbs:
- '*'
---
# Source: clustergroup/templates/imperative/rbac.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: imperative-cluster-admin-rolebinding
name: imperative-cluster-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand All @@ -278,6 +301,20 @@ subjects:
name: imperative-sa
namespace: imperative
---
# Source: clustergroup/templates/imperative/rbac.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: imperative-admin-clusterrolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: imperative-admin-cluster-role
subjects:
- kind: ServiceAccount
name: imperative-admin-sa
namespace: imperative
---
# Source: clustergroup/templates/plumbing/argocd-super-role.yaml
# WARNING: ONLY USE THIS FOR MANAGING CLUSTERS NOT FOR REGULAR USERS
apiVersion: rbac.authorization.k8s.io/v1
Expand Down Expand Up @@ -340,7 +377,7 @@ rules:
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: imperative-admin-rolebinding
name: imperative-rolebinding
namespace: imperative
roleRef:
apiGroup: rbac.authorization.k8s.io
Expand Down
41 changes: 39 additions & 2 deletions common/tests/clustergroup-industrial-edge-hub.expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ metadata:
name: imperative-sa
namespace: imperative
---
# Source: clustergroup/templates/imperative/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: imperative-admin-sa
namespace: imperative
---
# Source: clustergroup/templates/imperative/configmap.yaml
apiVersion: v1
kind: ConfigMap
Expand Down Expand Up @@ -237,6 +244,9 @@ data:
initContainers: []
imperative:
activeDeadlineSeconds: 3600
adminClusterRoleName: imperative-admin-cluster-role
adminServiceAccountCreate: true
adminServiceAccountName: imperative-admin-sa
clusterRoleName: imperative-cluster-role
clusterRoleYaml: ""
cronJobName: imperative-cronjob
Expand Down Expand Up @@ -425,11 +435,24 @@ rules:
- list
- watch
---
# Source: clustergroup/templates/imperative/clusterrole.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: imperative-admin-cluster-role
rules:
- apiGroups:
- '*'
resources:
- '*'
verbs:
- '*'
---
# Source: clustergroup/templates/imperative/rbac.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: imperative-cluster-admin-rolebinding
name: imperative-cluster-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand All @@ -439,6 +462,20 @@ subjects:
name: imperative-sa
namespace: imperative
---
# Source: clustergroup/templates/imperative/rbac.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: imperative-admin-clusterrolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: imperative-admin-cluster-role
subjects:
- kind: ServiceAccount
name: imperative-admin-sa
namespace: imperative
---
# Source: clustergroup/templates/plumbing/argocd-super-role.yaml
# WARNING: ONLY USE THIS FOR MANAGING CLUSTERS NOT FOR REGULAR USERS
apiVersion: rbac.authorization.k8s.io/v1
Expand Down Expand Up @@ -501,7 +538,7 @@ rules:
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: imperative-admin-rolebinding
name: imperative-rolebinding
namespace: imperative
roleRef:
apiGroup: rbac.authorization.k8s.io
Expand Down
Loading

0 comments on commit 815ebb1

Please sign in to comment.