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 customizing the ServiceAccount for workload of PipeCD Helm chart #3535

Conversation

mugioka
Copy link
Contributor

@mugioka mugioka commented Apr 14, 2022

What this PR does / why we need it:
Hi team, PipeCD is very good software.
Currently, the default service account annotation must be edited in order to use GCP Workload Identity or AWS WebIdentity.
This change should improve convenience by allowing k8s service accounts dedicated to PipeCD Server to be created from the helm chart.

Which issue(s) this PR fixes:
none

Does this PR introduce a user-facing change?:

Allow customizing the ServiceAccount for workload of PipeCD Helm chart

@pipecd-bot
Copy link
Collaborator

CLA

Welcome @mugioka!

Thanks for your contributing. It looks like this is your first PR to this repository 🎉. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). Please read the CLA and leave a /cla sign comment on this pull request to sign the CLA.

@mugioka
Copy link
Contributor Author

mugioka commented Apr 14, 2022

/cla sign

@pipecd-bot
Copy link
Collaborator

CLA

Thank you for signing the CLA. Your signing has been successfully committed.

@mugioka mugioka force-pushed the feat/be-able-to-create-dedicated-k8s-sa-for-pipecd-with-helm-chart branch from 6c510b6 to 61008aa Compare April 14, 2022 17:19
…elm chart.

Hi team, PipeCD is very good software.
Currently, the default service account annotation must be edited in order to use GCP Workload Identity or AWS WebIdentity.
This change should improve convenience by allowing k8s service accounts dedicated to PipeCD Server to be created from the helm chart.

Signed-off-by: mugioka <[email protected]>
@mugioka mugioka force-pushed the feat/be-able-to-create-dedicated-k8s-sa-for-pipecd-with-helm-chart branch from 61008aa to cb15699 Compare April 14, 2022 17:26
@khanhtc1202
Copy link
Member

/trigger presubmit

@khanhtc1202
Copy link
Member

/trigger presubmits

@pipecd-bot
Copy link
Collaborator

TRIGGER

@khanhtc1202: Your requested presubmits has been scheduled in response to this comment.

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 35.67%. This pull request does not change code coverage.

# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: {}
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a name field to allow users to use an existing Service Account if they want?

Same as the chart for Piped Agent. https://github.com/pipe-cd/pipecd/blob/master/manifests/piped/values.yaml#L89-L93

Comment on lines 230 to 232
{{- if .Values.serviceAccount.create -}}
serviceAccountName: {{ include "pipecd.fullname" . }}-server
{{- end }}
Copy link
Member

Choose a reason for hiding this comment

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

@nghialv
Copy link
Member

nghialv commented Apr 15, 2022

@mugioka Hi, Thank you for your pull request.

It is really nice. I just have left some nits. PTAL.

@pipecd-bot pipecd-bot added size/M and removed size/S labels Apr 15, 2022
Copy link
Contributor Author

@mugioka mugioka left a comment

Choose a reason for hiding this comment

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

@nghialv
I fixed.
Please re-review.

@@ -19,9 +19,7 @@ spec:
sidecar.istio.io/inject: "false"
rollme: {{ randAlphaNum 5 | quote }}
spec:
{{- if .Values.serviceAccount.create }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

refs: #3535 (comment)

to use existing service account.

@nghialv nghialv changed the title feat: be able to create the dedicated k8s sa for pipecd server with helm chart. Allow customizing the ServiceAccount for workload of PipeCD Helm chart Apr 15, 2022
# ServiceAccount
serviceAccount:
# Specifies whether a service account should be created
create: true
Copy link
Member

Choose a reason for hiding this comment

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

@mugioka Please change the default value to false to avoid adding an unexpected service account for existing users.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed it.

@nghialv
Copy link
Member

nghialv commented Apr 15, 2022

@mugioka Sorry, I have just found a thing. PTAL #3535 (comment)

@@ -84,6 +84,7 @@ spec:
{{- include "pipecd.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: server
spec:
serviceAccountName: {{ include "pipecd.serviceAccountName" . }}
Copy link
Member

Choose a reason for hiding this comment

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

@mugioka Since the default value has been changed to false, I think we need to add a check condition here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK!
I added the default value to service account name.
d763a3d

Copy link
Member

Choose a reason for hiding this comment

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

@mugioka I got your point. I think that way is good as well.
But to be honest, I want to introduce the changes to end-users as little as possible.
For existing users, their deployment resource is not containing the serviceAccountName but after getting this release, their deployment resource will be updated to add serviceAccountName: default.
In most cases, there will be no difference between them but to be safe we should not introduce that change.

So I still prefer adding a check condition over specifying the "default" name as d763a3d.

WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In most cases, there will be no difference between them but to be safe we should not introduce that change.

I see, that makes sense.
I will add check statement.

Copy link
Member

Choose a reason for hiding this comment

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

Thank you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added the if statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, sorry, an unnecessary file was committed.
I will fix it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed it.

@mugioka mugioka force-pushed the feat/be-able-to-create-dedicated-k8s-sa-for-pipecd-with-helm-chart branch from ca3f87a to 1d38878 Compare April 15, 2022 06:46
@nghialv
Copy link
Member

nghialv commented Apr 15, 2022

/trigger presubmits

@pipecd-bot
Copy link
Collaborator

TRIGGER

@nghialv: Your requested presubmits has been scheduled in response to this comment.

@nghialv
Copy link
Member

nghialv commented Apr 15, 2022

Nice improvement. Thank you.

/lgtm

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 35.56%. This pull request does not change code coverage.

@khanhtc1202
Copy link
Member

Thanks for contribution 🙌
/approve

@pipecd-bot
Copy link
Collaborator

APPROVE

This pull request is APPROVED by khanhtc1202.

Approvers can cancel the approval by writing /approve cancel in a comment. Any additional commits also will change this pull request to be not-approved.

@pipecd-bot pipecd-bot merged commit 56cfdb4 into pipe-cd:master Apr 15, 2022
@mugioka mugioka deleted the feat/be-able-to-create-dedicated-k8s-sa-for-pipecd-with-helm-chart branch April 15, 2022 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants