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

feat: update CRDs for BoundServiceAccountToken triggerAuth provider #701

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
12 changes: 12 additions & 0 deletions keda/templates/crds/crd-clustertriggerauthentications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,18 @@ spec:
- secrets
- vaultUri
type: object
boundServiceAccountToken:
items:
properties:
parameter:
type: string
serviceAccountName:
type: string
required:
- parameter
- serviceAccountName
type: object
type: array
configMapTargetRef:
items:
description: AuthConfigMapTargetRef is used to authenticate using
Expand Down
15 changes: 15 additions & 0 deletions keda/templates/crds/crd-triggerauthentications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,21 @@ spec:
- secrets
- vaultUri
type: object
boundServiceAccountToken:
items:
properties:
expiry:
type: string
parameter:
type: string
serviceAccountName:
type: string
required:
- expiry
- parameter
- serviceAccountName
type: object
type: array
configMapTargetRef:
items:
description: AuthConfigMapTargetRef is used to authenticate using
Expand Down
47 changes: 47 additions & 0 deletions keda/templates/manager/minimal-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,51 @@ subjects:
- kind: ServiceAccount
name: {{ (.Values.serviceAccount.operator).name | default .Values.serviceAccount.name }}
namespace: {{ .Release.Namespace }}
{{- if .Values.serviceAccountTokenCreationRoles }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure minimal-rbac.yaml is the correct place for this

@jkremser could you please suggest the best approach here?

{{- range $r := .Values.serviceAccountTokenCreationRoles }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
{{- with $.Values.additionalAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
app.kubernetes.io/name: {{ $.Values.operator.name }}-minimal
{{- include "keda.labels" $ | indent 4 }}
name: {{ $.Values.operator.name }}-token-creator-minimal
namespace: {{ $r.namespace }}
rules:
- apiGroups:
- ""
resources:
- serviceaccounts/token
verbs:
- create
resourceNames:
- {{ $r.name }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
{{- with $.Values.additionalAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
app.kubernetes.io/name: {{ $.Values.operator.name }}-minimal
{{- include "keda.labels" $ | indent 4 }}
name: {{ $.Values.operator.name }}-token-creator-minimal
namespace: {{ $r.namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ $.Values.operator.name }}-token-creator-minimal
subjects:
- kind: ServiceAccount
name: {{ $.Values.operator.name }}
namespace: {{ $.Release.Namespace }}
{{- end }}
{{- end }}
{{- end }}
25 changes: 16 additions & 9 deletions keda/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@ global:
image:
keda:
# -- Image registry of KEDA operator
registry: ghcr.io
registry: quay.io
# -- Image name of KEDA operator
repository: kedacore/keda
repository: macao/keda
# -- Image tag of KEDA operator. Optional, given app version of Helm chart is used by default
tag: ""
tag: "main"
metricsApiServer:
# -- Image registry of KEDA Metrics API Server
registry: ghcr.io
registry: quay.io
# -- Image name of KEDA Metrics API Server
repository: kedacore/keda-metrics-apiserver
repository: macao/keda-metrics-apiserver
# -- Image tag of KEDA Metrics API Server. Optional, given app version of Helm chart is used by default
tag: ""
tag: "main"
webhooks:
# -- Image registry of KEDA admission-webhooks
registry: ghcr.io
registry: quay.io
# -- Image name of KEDA admission-webhooks
repository: kedacore/keda-admission-webhooks
repository: macao/keda-admission-webhooks
# -- Image tag of KEDA admission-webhooks . Optional, given app version of Helm chart is used by default
tag: ""
tag: "main"
# -- Image pullPolicy for all KEDA components
pullPolicy: Always

Expand Down Expand Up @@ -867,3 +867,10 @@ customManagedBy: ""
# -- Enable service links in pods. Although enabled, mirroring k8s default, it is highly recommended to disable,
# due to its legacy status [Legacy container links](https://docs.docker.com/engine/network/links/)
enableServiceLinks: true

# -- Creates role and rolebindings which allow the KEDA operator to request service account tokens from
# namespaced service accounts in the array for use with the boundServiceAccountToken trigger source
# If the namespace does not exist, this will cause the helm chart installation to fail.
serviceAccountTokenCreationRoles: []
# - name: myServiceAccount
# namespace: myServiceAccountNamespace
Loading