Skip to content

Commit

Permalink
feat(workflows): parameterize role bindings and cluster roles used
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelPatsula committed Jul 16, 2024
1 parent e470cd1 commit 53aefd2
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cmd/workflows.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import (
)

var namespaceAdminsRB string
var argoUserInterfaceCR string
var workflowsCR string

var workflowsCmd = &cobra.Command{
Use: "workflows",
Expand Down Expand Up @@ -274,7 +276,7 @@ func generateRoleBindings(namespace *corev1.Namespace, roleBindingLister rbacv1l
RoleRef: rbacv1.RoleRef{
APIGroup: rbacv1.SchemeGroupVersion.Group,
Kind: "ClusterRole",
Name: "argo-workflows-namespace",
Name: argoUserInterfaceCR,
},
Subjects: []rbacv1.Subject{
{
Expand All @@ -297,7 +299,7 @@ func generateRoleBindings(namespace *corev1.Namespace, roleBindingLister rbacv1l
RoleRef: rbacv1.RoleRef{
APIGroup: rbacv1.SchemeGroupVersion.Group,
Kind: "ClusterRole",
Name: "argo-workflows-workflow",
Name: workflowsCR,
},
Subjects: []rbacv1.Subject{
{
Expand Down Expand Up @@ -339,6 +341,11 @@ func generateSecrets(namespace *corev1.Namespace) []*corev1.Secret {

func init() {
rootCmd.AddCommand(workflowsCmd)
workflowsCmd.Flags().StringVar(&namespaceAdminsRB, "namespace-admin-role-binding", "", "The name of the role binding that specifies the namespace admins")
workflowsCmd.Flags().StringVar(&namespaceAdminsRB, "namespace-admins-role-binding-name", "solution-builder", "The name of the role binding that specifies the namespace admins as subjects.")
workflowsCmd.Flags().StringVar(&argoUserInterfaceCR, "user-interface-cluster-role-name", "argo-workflows-namespace", "The name of the cluster role used for Argo Workflow interface access")
workflowsCmd.Flags().StringVar(&workflowsCR, "argo-workflows-cluster-role-name", "argo-workflows-workflow", "The name of the role binding that specifies the namespace admins")

workflowsCmd.MarkFlagRequired("namespace-admin-role-binding")
workflowsCmd.MarkFlagRequired("namespace-cluster-role")
workflowsCmd.MarkFlagRequired("workflows-cluster-role")
}

0 comments on commit 53aefd2

Please sign in to comment.