Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Commit

Permalink
shipperctl: parametrize service account names
Browse files Browse the repository at this point in the history
  • Loading branch information
juliogreff committed Sep 24, 2019
1 parent d099183 commit 1946752
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
27 changes: 16 additions & 11 deletions cmd/shipperctl/cmd/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,25 @@ var applyCmd = &cobra.Command{

// Parameters
var (
configFile string
kubeConfigFile string
configFile string
kubeConfigFile string

shipperSystemNamespace string
globalRolloutBlockNamespace string

shipperManagementClusterServiceAccountName string
shipperApplicationClusterServiceAccountName string
)

// Name constants
const (
level1Padding = " "
shipperManagementServiceName = "shipper-validating-webhook"
shipperManagementClusterServiceAccountName = "shipper-management-cluster"
shipperManagementClusterRoleName = "shipper:management-cluster"
shipperManagementClusterRoleBindingName = "shipper:management-cluster"

shipperApplicationClusterServiceAccountName = "shipper-application-cluster"
shipperApplicationClusterRoleName = "cluster-admin" // needs to be able to install any kind of Helm chart
shipperApplicationClusterRoleBindingName = "shipper:application-cluster"
level1Padding = " "
shipperManagementServiceName = "shipper-validating-webhook"
shipperManagementClusterRoleName = "shipper:management-cluster"
shipperManagementClusterRoleBindingName = "shipper:management-cluster"

shipperApplicationClusterRoleName = "cluster-admin" // needs to be able to install any kind of Helm chart
shipperApplicationClusterRoleBindingName = "shipper:application-cluster"
)

func init() {
Expand All @@ -58,6 +60,9 @@ func init() {
applyCmd.Flags().StringVarP(&shipperSystemNamespace, "shipper-system-namespace", "n", shipper.ShipperNamespace, "the namespace where Shipper is running")
applyCmd.Flags().StringVarP(&globalRolloutBlockNamespace, "rollout-blocks-global-namespace", "g", shipper.GlobalRolloutBlockNamespace, "the namespace where Global RolloutBlocks are running")

applyCmd.Flags().StringVar(&shipperManagementClusterServiceAccountName, "shipper-management-cluster-service-account", shipper.ShipperManagementServiceAccount, "the name of the service account Shipper will use for the management cluster")
applyCmd.Flags().StringVar(&shipperApplicationClusterServiceAccountName, "shipper-application-cluster-service-account", shipper.ShipperApplicationServiceAccount, "the name of the service account Shipper will use for the application cluster")

err := applyCmd.MarkFlagFilename(fileFlagName, "yaml")
if err != nil {
applyCmd.Printf("warning: could not mark %q for filename autocompletion: %s\n", fileFlagName, err)
Expand Down
3 changes: 3 additions & 0 deletions pkg/apis/shipper/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ const (
ShipperNamespace = "shipper-system"
GlobalRolloutBlockNamespace = "rollout-blocks-global"

ShipperManagementServiceAccount = "shipper-management-cluster"
ShipperApplicationServiceAccount = "shipper-application-cluster"

PhaseLabel = "phase"

ReleaseLabel = "shipper-release"
Expand Down

0 comments on commit 1946752

Please sign in to comment.