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

pipeline: add renderRBAC func #494

Merged
merged 5 commits into from
Dec 7, 2023
Merged

Conversation

Xieql
Copy link
Contributor

@Xieql Xieql commented Dec 1, 2023

What type of PR is this?

/kind feature

What this PR does / why we need it:

part of #493

Copy link

netlify bot commented Dec 1, 2023

Deploy Preview for kurator-dev canceled.

Name Link
🔨 Latest commit a714fa3
🔍 Latest deploy log https://app.netlify.com/sites/kurator-dev/deploys/657123d723196400093fac86


// ServiceAccountName generates the service account name using the pipeline name and namespace.
func (rbac RBACConfig) ServiceAccountName() string {
return ServiceAccountNamePrefix + rbac.PipelineName + "-" + rbac.PipelineNamespace
Copy link
Member

Choose a reason for hiding this comment

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

seems we donot need the ServiceAccountNamePrefix

Copy link
Member

Choose a reason for hiding this comment

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

And neither pipelinenamespace

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the ServiceAccountNamePrefix could be unnecessary if a dedicated namespace is configured specifically for Kurator pipelines.

NVM, in situations where Kurator Pipeline are deployed in more general namespaces, such as default, this prefix could be advantageous. It can assist users in quickly identifying which ServiceAccounts are linked to Kurator pipelines amongst many others."

Agreed on the redundancy of PipelineNamespace.

const (
ServiceAccountNamePrefix = "kurator-pipeline-robot-"
RoleBindingNameSuffix = "-binding"
ClusterRoleBindingNameSuffix = "-clusterbinding"
Copy link
Member

Choose a reason for hiding this comment

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

not such naming convention, clusterrolebinding or rolebinding is commonly used

Signed-off-by: Xieql <[email protected]>
@Xieql
Copy link
Contributor Author

Xieql commented Dec 6, 2023

/label tide/merge-method-squash


// RoleBindingName generates the role binding name using the service account name.
func (rbac RBACConfig) RoleBindingName() string {
return rbac.ServiceAccountName() + RoleBindingNameSuffix
Copy link
Member

Choose a reason for hiding this comment

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

nit: no need to add this suffix

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

Signed-off-by: Xieql <[email protected]>

// ClusterRoleBindingName generates the cluster role binding name using the service account name.
func (rbac RBACConfig) ClusterRoleBindingName() string {
return rbac.ServiceAccountName()
Copy link
Member

Choose a reason for hiding this comment

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

Sorry just note this is cluster scope resource, if we create multiple clusterrolebinding, they conflict with same name.

Option one is to make it with different name, alternatively add different sa within the same clusterrolebinding.

Signed-off-by: Xieql <[email protected]>
"kurator.dev/kurator/pkg/fleet-manager/manifests"
)

var manifestFS = manifests.BuiltinOrDir("manifests")
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 why we need to read the while manifest, it is costy

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

Signed-off-by: Xieql <[email protected]>
Copy link
Member

@hzxuzhonghu hzxuzhonghu left a comment

Choose a reason for hiding this comment

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

/lgtm

@kurator-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hzxuzhonghu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kurator-bot kurator-bot merged commit 833e2ed into kurator-dev:main Dec 7, 2023
11 checks passed
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.

3 participants