Skip to content

Commit

Permalink
Merge pull request micro#1565 from micro/image-pull-secret-fix
Browse files Browse the repository at this point in the history
Runtime: Fix ImagePullSecret
  • Loading branch information
ben-toogood authored Apr 23, 2020
2 parents ec929b3 + 616db34 commit 986e3d3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions runtime/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ func (k *kubernetes) namespaceExists(name string) (bool, error) {
return false, err
}
k.namespaces = namespaceList.Items
fmt.Println("HERE")
fmt.Println(k.namespaces)
}

// check if the namespace exists in the cache
Expand Down
5 changes: 4 additions & 1 deletion runtime/kubernetes/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ func newService(s *runtime.Service, c runtime.CreateOptions) *service {
}

// set the image pull secrets
kdeploy.Spec.Template.PodSpec.ImagePullSecrets = c.ImagePullSecrets
kdeploy.Spec.Template.PodSpec.ImagePullSecrets = make([]client.ImagePullSecret, len(c.ImagePullSecrets))
for i, s := range c.ImagePullSecrets {
kdeploy.Spec.Template.PodSpec.ImagePullSecrets[i] = client.ImagePullSecret{Name: s}
}

// create if non existent
if s.Metadata == nil {
Expand Down
2 changes: 1 addition & 1 deletion util/kubernetes/client/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ spec:
imagePullSecrets:
{{- with .Spec.Template.PodSpec.ImagePullSecrets }}
{{- range . }}
- name: "{{.}}"
- name: "{{ .Name }}"
{{- end }}
{{- end }}
containers:
Expand Down
9 changes: 7 additions & 2 deletions util/kubernetes/client/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ type Metadata struct {

// PodSpec is a pod
type PodSpec struct {
Containers []Container `json:"containers"`
ImagePullSecrets []string `json:"imagePullSecrets"`
Containers []Container `json:"containers"`
ImagePullSecrets []ImagePullSecret `json:"imagePullSecrets"`
}

// PodList
Expand Down Expand Up @@ -189,3 +189,8 @@ type Namespace struct {
type NamespaceList struct {
Items []Namespace `json:"items"`
}

// ImagePullSecret
type ImagePullSecret struct {
Name string `json:"name"`
}

0 comments on commit 986e3d3

Please sign in to comment.