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

Allow to skip creating serviceaccount #144

Open
wants to merge 2 commits into
base: master
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
6 changes: 6 additions & 0 deletions cronjob/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{{- if .Values.serviceaccount }}
{{- if .Values.serviceaccount.skipCreation }}
Copy link
Contributor

Choose a reason for hiding this comment

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

We usually use create as a switch to determine whether resources need to be generated.

{{- /*
Skip create service account
*/}}
Comment on lines +3 to +5
Copy link
Contributor

Choose a reason for hiding this comment

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

I think users should be able to determine whether the resource will be created or not by themselves, so having this comment here would be too much.

{{- else}}
apiVersion: v1
kind: ServiceAccount
metadata:
annotations: {{ toYaml .Values.serviceaccount.annotations | nindent 4}}
name: {{ .Values.serviceaccount.name | default (printf "%s-pod-service-account" .Values.name) }}
{{- end}}
{{- else if .Values.serviceAccount }}
apiVersion: v1
kind: ServiceAccount
Expand Down
2 changes: 2 additions & 0 deletions cronjob/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,14 @@ envFrom: {}
# - test-2-secret

# Service account is used by pod. For more details on fields "serviceaccount" and "serviceAccount", please have a look on ./cronjob/templates/serviceaccount.yaml
# "serviceAccount" is deprecated, please use "serviceaccount" instead.
serviceaccount: {}
Copy link
Contributor

Choose a reason for hiding this comment

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

the following changes will make more common sense as below:

serviceaccount: 
  create: true
  annotations: 
    eks.amazonaws.com/role-arn: <aws-role-arn>
    name: <serviceaccount-name>

# example
# serviceaccount:
# annotations:
# eks.amazonaws.com/role-arn: <aws-role-arn>
# name: <serviceaccount-name>
# skipCreation: false

# This can be used to suspend the cron workflow by default, set this to true to suspend the cron workflow by default
suspend: false
Expand Down
6 changes: 6 additions & 0 deletions simple/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
{{- if .Values.serviceaccount }}
{{- if .Values.serviceaccount.skipCreation }}
{{- /*
Skip create service account
*/}}
{{- else}}
apiVersion: v1
kind: ServiceAccount
metadata:
annotations: {{ toYaml .Values.serviceaccount.annotations | nindent 4}}
name: {{ .Values.serviceaccount.name | default (printf "%s-pod-service-account" .Values.name) }}
{{- end}}
{{- end}}
11 changes: 10 additions & 1 deletion simple/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -336,4 +336,13 @@ analyses: {}
# )) /
# sum(irate(
# istio_requests_total{reporter="source",destination_service=~"{{args.service-name}}"}[5m]
# ))
# ))

# Service account is used by pod. For more details on fields "serviceaccount", please have a look on ./simple/templates/serviceaccount.yaml
serviceaccount: {}
# example
# serviceaccount:
# annotations:
# eks.amazonaws.com/role-arn: <aws-role-arn>
# name: <serviceaccount-name>
# skipCreation: false