You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add parameter for service account name to all ackgenerate methods (#270)
Issue #, if available:
- Fixes: aws-controllers-k8s/community#777
Description of changes:
The goal of this is to move away from using the default service account. It seems this might have been done with the helm charts/templates, but was not ported to the Kustomization files. This means each operator/controller would have its own service account. Things that changed are below:
- Refactored build so that ServiceAccountName is available in ack-generate controller process as well as ack-generate release process
- added in `/rbac/service-account.yaml.tpl` to create a service account, and then referece this account in the `Deployment` and `ClusterRoleBinding`
- Refactored build/release `sh` files to add in `ACK_GENERATE_SERVICE_ACCOUNT_NAME` to be used in both build and release process
- Reordered some of the variables in the `sh` files so that if there is an error in the build/release process the `Default` values are actually presented to the user (currently they show up as blank since the variables are not initilaized before the `USAGE` variable)
- **NOTE:** This changes the service account name in the `helm` process as well. It changes it from `ack-$SERVICE-controller` to `ack-$SERVICE-service-account`. I am not sure if this is backwards compatible for when a controller is installed/updated via a helm deployment.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Signed-off-by: Adam D. Cornett <adc@redhat.com>
Copy file name to clipboardExpand all lines: cmd/ack-generate/command/release.go
+2-6Lines changed: 2 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -27,9 +27,8 @@ import (
27
27
)
28
28
29
29
var (
30
-
optReleaseOutputPathstring
31
-
optImageRepositorystring
32
-
optServiceAccountNamestring
30
+
optReleaseOutputPathstring
31
+
optImageRepositorystring
33
32
)
34
33
35
34
varreleaseCmd=&cobra.Command{
@@ -42,9 +41,6 @@ func init() {
42
41
releaseCmd.PersistentFlags().StringVar(
43
42
&optImageRepository, "image-repository", "", "the Docker image repository to use in release artifacts. Defaults to 'public.ecr.aws/aws-controllers-k8s/$service-controller'",
44
43
)
45
-
releaseCmd.PersistentFlags().StringVar(
46
-
&optServiceAccountName, "service-account-name", "default", "The name of the ServiceAccount AND ClusterRole used for ACK service controller",
47
-
)
48
44
releaseCmd.PersistentFlags().StringVarP(
49
45
&optReleaseOutputPath, "output", "o", "", "path to root directory to create generated files. Defaults to "+optServicesDir+"/$service",
0 commit comments