Add imagePullSecrets to PodSpec
This commit is contained in:
parent
7345ce9192
commit
501a6bf3ea
@ -38,6 +38,9 @@ func newService(s *runtime.Service, c runtime.CreateOptions) *service {
|
||||
kdeploy.Spec.Template.Metadata.Annotations = make(map[string]string)
|
||||
}
|
||||
|
||||
// set the image pull secrets
|
||||
kdeploy.Spec.Template.PodSpec.ImagePullSecrets = c.ImagePullSecrets
|
||||
|
||||
// create if non existent
|
||||
if s.Metadata == nil {
|
||||
s.Metadata = make(map[string]string)
|
||||
|
@ -66,6 +66,8 @@ type CreateOptions struct {
|
||||
Retries int
|
||||
// Specify the image to use
|
||||
Image string
|
||||
// Specify secrets to use when pulling the image
|
||||
ImagePullSecrets []string
|
||||
}
|
||||
|
||||
// ReadOptions queries runtime services
|
||||
@ -92,6 +94,13 @@ func CreateImage(img string) CreateOption {
|
||||
}
|
||||
}
|
||||
|
||||
// CreateImagePullSecret sets a secret to use
|
||||
func CreateImagePullSecret(secret string) CreateOption {
|
||||
return func(o *CreateOptions) {
|
||||
o.ImagePullSecrets = append(o.ImagePullSecrets, secret)
|
||||
}
|
||||
}
|
||||
|
||||
// WithCommand specifies the command to execute
|
||||
func WithCommand(cmd ...string) CreateOption {
|
||||
return func(o *CreateOptions) {
|
||||
|
@ -50,6 +50,11 @@ spec:
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
imagePullSecrets:
|
||||
{{- with .Spec.Template.PodSpec.ImagePullSecrets }}
|
||||
{{- range . }}
|
||||
- {{ . }}
|
||||
{{ end }}
|
||||
containers:
|
||||
{{- with .Spec.Template.PodSpec.Containers }}
|
||||
{{- range . }}
|
||||
|
@ -93,7 +93,8 @@ type Metadata struct {
|
||||
|
||||
// PodSpec is a pod
|
||||
type PodSpec struct {
|
||||
Containers []Container `json:"containers"`
|
||||
Containers []Container `json:"containers"`
|
||||
ImagePullSecrets []string `json:"imagePullSecrets"`
|
||||
}
|
||||
|
||||
// PodList
|
||||
|
Loading…
Reference in New Issue
Block a user