Skip to content

feat: add rbac cluster roles #27

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

Merged
merged 1 commit into from
Nov 20, 2023
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
10 changes: 10 additions & 0 deletions templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
* *
************************************************************************

CHART NAME: {{ .Chart.Name }}
CHART VERSION: {{ .Chart.Version }}
APP VERSION: {{ .Chart.AppVersion }}

** Please be patient while the chart is being deployed **

Thank you for installing {{ .Chart.Name }}.

Your release is named {{ .Release.Name }}.
Expand All @@ -12,3 +18,7 @@ To learn more about the release, try:

$ helm status {{ .Release.Name }}
$ helm get all {{ .Release.Name }}

To list all the releases in all the namespaces, use:

$ helm ls --all-namespaces -a
1 change: 1 addition & 0 deletions templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ spec:
metadata:
labels: {{ include "webapp-helm-chart.labels" . | indent 8 }}
spec:
serviceAccountName: {{ .Release.Name }}-service-account
imagePullSecrets:
- name: {{ .Release.Name}}-robocop
containers:
Expand Down
12 changes: 12 additions & 0 deletions templates/role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
namespace: {{ .Values.namespace }}
name: {{ .Release.Name }}-role
rules:
- apiGroups:
- {{ .Values.config.k8s_group }}
resources:
- {{ .Values.config.k8s_cr_kind_plural }}
verbs: ["create", "update", "patch", "delete"]
21 changes: 21 additions & 0 deletions templates/role_binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# This role binding allows {{ .Release.Name }}-role to read pods in the
# {{ .Values.namespace }} namespace.
# Need to already have a Role named {{ .Release.Name }}-role in that namespace
# to create RoleBinding.
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ .Release.Name }}-role-binding
namespace: {{ .Values.namespace }}
subjects:
# You can specify more than one "subject"
- namespace: {{ .Values.namespace }}
kind: ServiceAccount
name: {{ .Release.Name }}-service-account # "name" is case sensitive
roleRef:
# Role or ClusterRole
kind: Role
# Must match the name of the Role or ClusterRole you wish to bind to
name: {{ .Release.Name }}-role
apiGroup: rbac.authorization.k8s.io
5 changes: 5 additions & 0 deletions templates/service_account.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Release.Name }}-service-account
namespace: {{ .Values.namespace }}
26 changes: 5 additions & 21 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 3
replicaCount: 1

image:
username: rishabhagarwal14628
containerImg: quay.io/pwncorp/webapp:latest
initContainerImg: quay.io/pwncorp/migrate:latest
pullPolicy: Always
# Overrides the image tag whose default is the chart appVersion.
tag: latest

imagePullSecrets:
type: kubernetes.io/dockerconfigjson
Expand Down Expand Up @@ -39,10 +36,10 @@ config:
k8s_api_version: v1
k8s_cr_kind: Cron
k8s_cr_kind_plural: crons
k8s_namespace: default
k8s_broker_0: infra-helm-release-kafka-broker-0.infra-helm-release-kafka-broker-headless.webapp.svc.cluster.local:9094
k8s_broker_1: infra-helm-release-kafka-broker-1.infra-helm-release-kafka-broker-headless.webapp.svc.cluster.local:9094
k8s_broker_2: infra-helm-release-kafka-broker-2.infra-helm-release-kafka-broker-headless.webapp.svc.cluster.local:9094
k8s_namespace: webapp
k8s_broker_0: infra-helm-release-kafka-broker-0.infra-helm-release-kafka-broker-headless.deps.svc.cluster.local:9094
k8s_broker_1: infra-helm-release-kafka-broker-1.infra-helm-release-kafka-broker-headless.deps.svc.cluster.local:9094
k8s_broker_2: infra-helm-release-kafka-broker-2.infra-helm-release-kafka-broker-headless.deps.svc.cluster.local:9094
k8s_client_id: webapp
k8s_docker_config_json: b2theS1tci1oYWNrZXItY2FsbS1kb3duCg==
k8s_topic: healthcheck
Expand Down Expand Up @@ -80,19 +77,6 @@ service:
port: 3000
dbport: 5432

# Additional volumes on the output Deployment definition.
volumes: []
# - name: foo
# secret:
# secretName: mysecret
# optional: false

# Additional volumeMounts on the output Deployment definition.
volumeMounts: []
# - name: foo
# mountPath: "/etc/foo"
# readOnly: true

postgresql:
auth:
username: app_user
Expand Down