kubernetes: fixes for production (#1812)

* util/kubernetes/client: add secrets to deployments

* util/kubernetes/client: remove ServiceAccountName override

* debugging

* runtime/kubernetes: fix error

* runtime/kubernetes: remove test secret

* util/kubernetes/client: update default image

* util/kubernetes/client: remove default command for deployments

* runtime/kubernetes: pass source as arg

* runtime/kubernetes: remove debugging

* util/kubernetes/client: revert default image change
This commit is contained in:
ben-toogood
2020-07-09 16:29:01 +01:00
committed by GitHub
parent 58d6726380
commit 6d9a38a747
5 changed files with 33 additions and 5 deletions

View File

@@ -312,12 +312,11 @@ func NewDeployment(name, version, typ, namespace string) *Deployment {
Template: &Template{
Metadata: Metadata,
PodSpec: &PodSpec{
ServiceAccountName: namespace,
Containers: []Container{{
Name: name,
Image: DefaultImage,
Env: []EnvVar{env},
Command: []string{"go", "run", "."},
Command: []string{},
Ports: []ContainerPort{{
Name: "service-port",
ContainerPort: 8080,

View File

@@ -62,6 +62,19 @@ spec:
{{- range . }}
- name: "{{ .Name }}"
value: "{{ .Value }}"
{{- if .ValueFrom }}
{{- with .ValueFrom }}
valueFrom:
{{- if .SecretKeyRef }}
{{- with .SecretKeyRef }}
secretKeyRef:
key: {{ .Key }}
name: {{ .Name }}
optional: {{ .Optional }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
args:

View File

@@ -10,8 +10,21 @@ type ContainerPort struct {
// EnvVar is environment variable
type EnvVar struct {
Name string `json:"name"`
Value string `json:"value,omitempty"`
Name string `json:"name"`
Value string `json:"value,omitempty"`
ValueFrom *EnvVarSource `json:"valueFrom,omitempty"`
}
// EnvVarSource represents a source for the value of an EnvVar.
type EnvVarSource struct {
SecretKeyRef *SecretKeySelector `json:"secretKeyRef,omitempty"`
}
// SecretKeySelector selects a key of a Secret.
type SecretKeySelector struct {
Key string `json:"key"`
Name string `json:"name"`
Optional bool `json:"optional,omitempty"`
}
type Condition struct {