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

Set custom service account names for controllers #311

Closed
Closed
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
25 changes: 23 additions & 2 deletions cmd/aws-cloud-controller-manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,36 @@ func main() {
klog.Fatalf("unable to initialize command options: %v", err)
}

controllerInitializers := app.DefaultInitFuncConstructors
fss := cliflag.NamedFlagSets{}
command := app.NewCloudControllerManagerCommand(opts, cloudInitializer, controllerInitializers, fss, wait.NeverStop)
command := app.NewCloudControllerManagerCommand(opts, cloudInitializer, controllerInitializers(), fss, wait.NeverStop)
klog.Infof("Starting the AWS cloud controller manager.")

if err := command.Execute(); err != nil {
os.Exit(1)
}
}

func controllerInitializers() map[string]app.ControllerInitFuncConstructor {
controllerInitializers := app.DefaultInitFuncConstructors
if constructor, ok := controllerInitializers["cloud-node"]; ok {
constructor.InitContext.ClientName = "aws-external-cloud-node-controller"
controllerInitializers["cloud-node"] = constructor
}
if constructor, ok := controllerInitializers["cloud-node-lifecycle"]; ok {
constructor.InitContext.ClientName = "aws-external-cloud-node-lifecycle-controller"
controllerInitializers["cloud-node-lifecycle"] = constructor
}
if constructor, ok := controllerInitializers["service"]; ok {
constructor.InitContext.ClientName = "aws-external-service-controller"
controllerInitializers["service"] = constructor
}
if constructor, ok := controllerInitializers["route"]; ok {
constructor.InitContext.ClientName = "aws-external-route-controller"
controllerInitializers["route"] = constructor
}
return controllerInitializers
}

func cloudInitializer(config *cloudcontrollerconfig.CompletedConfig) cloudprovider.Interface {
cloudConfig := config.ComponentConfig.KubeCloudShared.CloudProvider
providerName := cloudConfig.Name
Expand Down
3 changes: 2 additions & 1 deletion hack/local-up-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ export KUBE_ROOT="$GOPATH/src/k8s.io/kubernetes"
export NODE_ROLE_ARN=${NODE_ROLE_ARN:-""}
export CLOUD_PROVIDER=aws
export EXTERNAL_CLOUD_PROVIDER=true
export CLOUD_CONFIG=$(pwd)/cloudconfig
export CLOUD_CONFIG=${CLOUD_PROVIDER_ROOT}/cloudconfig
export EXTERNAL_CLOUD_PROVIDER_BINARY="$GOPATH/src/k8s.io/cloud-provider-aws/aws-cloud-controller-manager"
export NODE_ZONE=${AWS_NODE_ZONE:-"us-west-2a"}
export CONFIGURE_CLOUD_ROUTES="${CONFIGURE_CLOUD_ROUTES:-false}"

# Stop right away if the build fails
set -e
Expand Down