Skip to content

Commit

Permalink
Merge pull request #180 from pjarominsap/master
Browse files Browse the repository at this point in the history
Additional fields for apiserver.yam (imagePullSecrets and serviceAccount)
  • Loading branch information
Phillip Wittrock authored Oct 12, 2017
2 parents 8076a46 + a58b165 commit f1b8b61
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
20 changes: 18 additions & 2 deletions cmd/apiserver-boot/boot/build/build_resource_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ var ApiserverArgs []string
var ControllerSecret string
var ControllerSecretMount string
var ControllerSecretEnv []string
var ImagePullSecrets []string
var ServiceAccount string

var LocalMinikube bool
var LocalIp string
Expand Down Expand Up @@ -75,6 +77,8 @@ func AddBuildResourceConfigFlags(cmd *cobra.Command) {
cmd.Flags().StringSliceVar(&ApiserverArgs, "apiserver-args", []string{}, "")
cmd.Flags().StringVar(&Name, "name", "", "")
cmd.Flags().StringVar(&Namespace, "namespace", "", "")
cmd.Flags().StringSliceVar(&ImagePullSecrets, "image-pull-secrets", []string{}, "List of secret names for docker registry")
cmd.Flags().StringVar(&ServiceAccount, "service-account", "", "Name of service account that will be attached to deployed pod")
cmd.Flags().StringVar(&Image, "image", "", "name of the apiserver Image with tag")
cmd.Flags().StringVar(&ResourceConfigDir, "output", "config", "directory to output resourceconfig")

Expand Down Expand Up @@ -148,7 +152,9 @@ func buildResourceConfig() {
ControllerSecretMount: ControllerSecretMount,
ControllerSecret: ControllerSecret,
ControllerSecretEnv: ControllerSecretEnv,
LocalIp: LocalIp,
LocalIp: LocalIp,
ImagePullSecrets: ImagePullSecrets,
ServiceAccount: ServiceAccount,
}
path := filepath.Join(ResourceConfigDir, "apiserver.yaml")

Expand Down Expand Up @@ -254,7 +260,9 @@ type resourceConfigTemplateArgs struct {
ControllerSecret string
ControllerSecretMount string
ControllerSecretEnv []string
LocalIp string
LocalIp string
ServiceAccount string
ImagePullSecrets []string
}

var resourceConfigTemplate = `
Expand Down Expand Up @@ -312,6 +320,14 @@ spec:
api: {{.Name}}
apiserver: "true"
spec:
{{- if .ImagePullSecrets }}
imagePullSecrets:
{{range .ImagePullSecrets }}- name: {{.}}
{{ end }}
{{- end -}}
{{- if .ServiceAccount }}
serviceAccount: {{.ServiceAccount}}
{{- end }}
containers:
- name: apiserver
image: {{.Image}}
Expand Down
4 changes: 4 additions & 0 deletions docs/running_in_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ This will perform the following:
present and runnable from "./". You may need to manually edit the config if your
container looks differently.

You can also provide optional flags:
- `image-pull-secrets` secrets that will be used by k8s cluster if your image is stored in private registry
- `service-account` service account name that will be used by deployment, can be used to provide additional rights for running container

### Run the apiserver

`kubectl apply -f config/apiserver.yaml`
Expand Down

0 comments on commit f1b8b61

Please sign in to comment.