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)
|
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
|
// create if non existent
|
||||||
if s.Metadata == nil {
|
if s.Metadata == nil {
|
||||||
s.Metadata = make(map[string]string)
|
s.Metadata = make(map[string]string)
|
||||||
|
@ -66,6 +66,8 @@ type CreateOptions struct {
|
|||||||
Retries int
|
Retries int
|
||||||
// Specify the image to use
|
// Specify the image to use
|
||||||
Image string
|
Image string
|
||||||
|
// Specify secrets to use when pulling the image
|
||||||
|
ImagePullSecrets []string
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadOptions queries runtime services
|
// 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
|
// WithCommand specifies the command to execute
|
||||||
func WithCommand(cmd ...string) CreateOption {
|
func WithCommand(cmd ...string) CreateOption {
|
||||||
return func(o *CreateOptions) {
|
return func(o *CreateOptions) {
|
||||||
|
@ -50,6 +50,11 @@ spec:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
|
imagePullSecrets:
|
||||||
|
{{- with .Spec.Template.PodSpec.ImagePullSecrets }}
|
||||||
|
{{- range . }}
|
||||||
|
- {{ . }}
|
||||||
|
{{ end }}
|
||||||
containers:
|
containers:
|
||||||
{{- with .Spec.Template.PodSpec.Containers }}
|
{{- with .Spec.Template.PodSpec.Containers }}
|
||||||
{{- range . }}
|
{{- range . }}
|
||||||
|
@ -93,7 +93,8 @@ type Metadata struct {
|
|||||||
|
|
||||||
// PodSpec is a pod
|
// PodSpec is a pod
|
||||||
type PodSpec struct {
|
type PodSpec struct {
|
||||||
Containers []Container `json:"containers"`
|
Containers []Container `json:"containers"`
|
||||||
|
ImagePullSecrets []string `json:"imagePullSecrets"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PodList
|
// PodList
|
||||||
|
Loading…
Reference in New Issue
Block a user