Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[minor] IBM RBAC cluster app #239

Merged
merged 33 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
dbaea12
wip: app and rbac
boonware Nov 6, 2024
fe90ea0
feat: roles & bindings
boonware Nov 7, 2024
e4323a2
feat: argo app & sync wave
boonware Nov 7, 2024
7e26804
fix: app path
boonware Nov 7, 2024
aaf93c5
fix: missing EOL chars
boonware Nov 7, 2024
7b075b1
feat: parameterized groups
boonware Nov 7, 2024
b0d6d0b
[feat] group sync operator
boonware Nov 19, 2024
a020083
add ISV secret
boonware Nov 19, 2024
ce1e1e8
fix: base64 encode secret
boonware Nov 25, 2024
5bd5a66
map groups to bindings
boonware Nov 25, 2024
5a06538
enable group sync operator app
boonware Nov 25, 2024
9064999
test indent
boonware Nov 25, 2024
0c93152
fix value ref
boonware Nov 25, 2024
046a094
test yaml fix
boonware Nov 25, 2024
8f17e7c
fix yaml var
boonware Nov 25, 2024
29b50d0
fix group sync vars
boonware Nov 25, 2024
b57396f
change param order
boonware Nov 25, 2024
dd58e0d
set subscription source
boonware Nov 25, 2024
2df81eb
Merge branch 'main' of github.com:ibm-mas/gitops into 3828
boonware Nov 26, 2024
cfc50cd
Merge branch '4459' into 3828
boonware Nov 26, 2024
9e3aa5d
add EOL char
boonware Nov 27, 2024
6ef9af2
Merge branch 'main' into 4459
boonware Nov 27, 2024
237242c
fix linting
boonware Nov 27, 2024
340f4bb
Merge branch '4459' of github.com:ibm-mas/gitops into 4459
boonware Nov 27, 2024
683115f
Merge branch 'main' into 4459
boonware Dec 6, 2024
d401af7
Merge branch 'main' of github.com:ibm-mas/gitops into 4459
boonware Dec 6, 2024
ce042ee
update sync wave
boonware Dec 6, 2024
853cf11
Merge branch '4459' of github.com:ibm-mas/gitops into 4459
boonware Dec 6, 2024
56a734d
missing EOL char
boonware Dec 6, 2024
99ea249
Merge branch '4459' into 3828
boonware Dec 6, 2024
83b7fce
RBAC roles and bindings
boonware Dec 6, 2024
5392c6d
Merge branch 'main' of github.com:ibm-mas/gitops into 3828
boonware Dec 9, 2024
ba210c9
fix: yaml props
boonware Dec 9, 2024
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
11 changes: 11 additions & 0 deletions cluster-applications/061-ibm-rbac/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v2
name: ibm-rbac
description: IBM RBAC
type: application
version: 1.0.0

dependencies:
- name: junitreporter
version: 1.0.0
repository: "file://../../sub-charts/junitreporter/"
condition: junitreporter.devops_mongo_uri != ""
3 changes: 3 additions & 0 deletions cluster-applications/061-ibm-rbac/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
IBM Resource-Based Access Control (RBAC)
===============================================================================
Installs the IBM RBAC roles and role bindings. Groups are managed by the Group Sync Operator.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: ibm-cluster-admins
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: Group
name: {{ .Values.ibm_rbac_binding_to_group.ibm_cluster_admins }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: ibm-dba-edit-rb
subjects:
- kind: Group
apiGroup: rbac.authorization.k8s.io
name: {{ .Values.ibm_rbac_binding_to_group.ibm_dba_edit_rb }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: ibm-dba-cluster-role
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: cluster-reader
subjects:
- kind: Group
apiGroup: rbac.authorization.k8s.io
name: {{ .Values.ibm_rbac_binding_to_group.cluster_reader }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-reader
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: ibm-network-cluster-reader
subjects:
- kind: Group
apiGroup: rbac.authorization.k8s.io
name: {{ .Values.ibm_rbac_binding_to_group.ibm_network_cluster_reader }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-reader
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: ibm-network-rb
subjects:
- kind: Group
apiGroup: rbac.authorization.k8s.io
name: {{ .Values.ibm_rbac_binding_to_group.ibm_network_rb }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: ibm-network-cluster-role
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: ibm-provisioning-rb
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: Group
name: {{ .Values.ibm_rbac_binding_to_group.ibm_provisioning_rb }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: ibm-sre-automation-cluster-admin-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: Group
name: {{ .Values.ibm_rbac_binding_to_group.ibm_sre_automation_cluster_admin_binding }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: ibm-sre-editor-rb
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: ibm-sre-editor
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: Group
name: {{ .Values.ibm_rbac_binding_to_group.ibm_sre_editor_rb }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: ibm-sre-cluster-reader
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-reader
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: Group
name: {{ .Values.ibm_rbac_binding_to_group.ibm_sre_cluster_reader }}
27 changes: 27 additions & 0 deletions cluster-applications/061-ibm-rbac/templates/cluster-roles/dba.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: ibm-dba-cluster-role
rules:
- verbs: ["*"]
apiGroups: [""]
resources: ["pods", "pods/exec", "services"]
- verbs: ["*"]
apiGroups: ["networking.k8s.io"]
resources: ["networkpolicies"]
- verbs: ["get", "list", "watch"]
apiGroups: [""]
resources: ["secrets"]
- verbs: ["*"]
apiGroups: ["batch"]
resources: ["jobs", "cronjobs"]
- verbs: ["update", "patch", "get", "list"]
apiGroups: ["db2u.databases.ibm.com"]
resources: ["*"]
- verbs: ["update", "patch", "get", "list"]
apiGroups: ["datarefinery.cpd.ibm.com"]
resources: ["*"]
- verbs: ["update", "patch", "get", "list"]
apiGroups: ["databases.cpd.ibm.com"]
resources: ["*"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: ibm-network-cluster-role
rules:
- verbs: ["*"]
apiGroups: ["networking.k8s.io"]
resources: ["networkpolicies"]
- verbs: ["*"]
apiGroups: ["network.openshift.io"]
resources: ["egressnetworkpolicies"]
- verbs: ["*"]
apiGroups: ["operator.openshift.io"]
resources: ["ingresscontrollers"]
- verbs: ["get"]
apiGroups: ["operator.openshift.io"]
resources: ["dnses"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: ibm-sre-editor
rules:
- verbs: ["*"]
apiGroups: [""]
resources: ["pods", "pods/exec"]
- verbs: ["*"]
apiGroups: [""]
resources: ["secrets"]
- verbs: ["*"]
apiGroups: ["apps"]
resources: ["deployments", "deployments/scale", "statefulsets"]
- verbs: ["create", "update", "patch", "get", "list"]
apiGroups: ["route.openshift.io"]
resources: ["routes"]
- verbs: ["update", "patch", "get", "list"]
apiGroups: ["apps.mas.ibm.com"]
resources: ["*"]
- verbs: ["update", "patch", "get", "list"]
apiGroups: ["config.mas.ibm.com"]
resources: ["*"]
- verbs: ["*"]
apiGroups: ["cert-manager.io"]
resources: ["*"]
- verbs: ["*"]
apiGroups: ["acme.cert-manager.io"]
resources: ["*"]
- verbs: ["get", "list", "watch", "update", "patch"]
apiGroups: ["operators.coreos.com"]
resources: ["clusterserviceversions", "installplans", "subscriptions"]
13 changes: 13 additions & 0 deletions cluster-applications/061-ibm-rbac/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
# Key: name of role binding or cluster role binding
# Value: name of OpenShift group
ibm_rbac_binding_to_group:
ibm_cluster_admins: admin
ibm_dba_edit_rb: admin
ibm_provisioning_rb: admin
ibm_sre_automation_cluster_admin_binding: admin
ibm_sre_editor_rb: admin
cluster_reader: developer
ibm_network_rb: developer
ibm_network_cluster_reader: developer
ibm_sre_cluster_reader: developer
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ spec:
revision: "{{ .Values.generator.revision }}"
files:
- path: "{{ .Values.account.id }}/*/group-sync-operator.yaml"
- git:
repoURL: "{{ .Values.generator.repo_url }}"
revision: "{{ .Values.generator.revision }}"
files:
- path: "{{ .Values.account.id }}/*/ibm-rbac.yaml"
syncPolicy:
applicationsSync: "{{- if .Values.auto_delete }}sync{{- else }}create-update{{- end }}"
template:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{- if not (empty .Values.ibm_rbac) }}
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: ibm-rbac.{{ .Values.cluster.id }}
namespace: {{ .Values.argo.namespace }}
labels:
environment: '{{ .Values.account.id }}'
region: '{{ .Values.region.id }}'
cluster: '{{ .Values.cluster.id }}'
annotations:
argocd.argoproj.io/sync-wave: "061"
healthCheckTimeout: "1800"
{{- if and .Values.notifications .Values.notifications.slack_channel_id }}
notifications.argoproj.io/subscribe.on-sync-failed.workspace1: {{ .Values.notifications.slack_channel_id }}
notifications.argoproj.io/subscribe.on-sync-succeeded.workspace1: {{ .Values.notifications.slack_channel_id }}
{{- end }}
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: "{{ .Values.argo.projects.apps }}"
destination:
server: {{ .Values.cluster.url }}
namespace: default
source:
repoURL: "{{ .Values.source.repo_url }}"
path: cluster-applications/061-ibm-rbac
targetRevision: "{{ .Values.source.revision }}"
plugin:
name: {{ .Values.avp.name }}
env:
- name: {{ .Values.avp.values_varname }}
value: |
ibm_rbac_binding_to_group: {{ .Values.ibm_rbac.binding_to_group | toYaml | nindent 14 }}
junitreporter:
reporter_name: "ibm-rbac"
cluster_id: "{{ .Values.cluster.id }}"
devops_mongo_uri: "{{ .Values.devops.mongo_uri }}"
devops_build_number: "{{ .Values.devops.build_number }}"
gitops_version: "{{ .Values.source.revision }}"
{{- if .Values.custom_labels }}
custom_labels: {{ .Values.custom_labels | toYaml | nindent 14 }}
{{- end }}
- name: ARGOCD_APP_NAME
value: ibmrbacapp
{{- if not (empty .Values.avp.secret) }}
- name: AVP_SECRET
value: {{ .Values.avp.secret }}
{{- end }}
syncPolicy:
automated:
{{- if .Values.auto_delete }}
prune: true
{{- end }}
selfHeal: true
retry:
limit: 20
syncOptions:
- CreateNamespace=false
- RespectIgnoreDifferences=true
{{- end }}
Loading