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:
parent
58d6726380
commit
6d9a38a747
@ -341,7 +341,7 @@ func (k *kubernetes) Logs(s *runtime.Service, options ...runtime.LogsOption) (ru
|
|||||||
go func() {
|
go func() {
|
||||||
records, err := klo.Read()
|
records, err := klo.Read()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("Failed to get logs for service '%v' from k8s: %v", err)
|
log.Errorf("Failed to get logs for service '%v' from k8s: %v", s.Name, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// @todo: this might actually not run before podLogStream starts
|
// @todo: this might actually not run before podLogStream starts
|
||||||
|
@ -66,6 +66,9 @@ func newService(s *runtime.Service, c runtime.CreateOptions) *service {
|
|||||||
kdeploy.Spec.Template.PodSpec.Containers[i].Command = []string{}
|
kdeploy.Spec.Template.PodSpec.Containers[i].Command = []string{}
|
||||||
kdeploy.Spec.Template.PodSpec.Containers[i].Args = []string{}
|
kdeploy.Spec.Template.PodSpec.Containers[i].Args = []string{}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// use the default image (micro/cell:go), passing the source as the first argument
|
||||||
|
kdeploy.Spec.Template.PodSpec.Containers[0].Args = []string{s.Source}
|
||||||
}
|
}
|
||||||
|
|
||||||
// define the environment values used by the container
|
// define the environment values used by the container
|
||||||
|
@ -312,12 +312,11 @@ func NewDeployment(name, version, typ, namespace string) *Deployment {
|
|||||||
Template: &Template{
|
Template: &Template{
|
||||||
Metadata: Metadata,
|
Metadata: Metadata,
|
||||||
PodSpec: &PodSpec{
|
PodSpec: &PodSpec{
|
||||||
ServiceAccountName: namespace,
|
|
||||||
Containers: []Container{{
|
Containers: []Container{{
|
||||||
Name: name,
|
Name: name,
|
||||||
Image: DefaultImage,
|
Image: DefaultImage,
|
||||||
Env: []EnvVar{env},
|
Env: []EnvVar{env},
|
||||||
Command: []string{"go", "run", "."},
|
Command: []string{},
|
||||||
Ports: []ContainerPort{{
|
Ports: []ContainerPort{{
|
||||||
Name: "service-port",
|
Name: "service-port",
|
||||||
ContainerPort: 8080,
|
ContainerPort: 8080,
|
||||||
|
@ -62,6 +62,19 @@ spec:
|
|||||||
{{- range . }}
|
{{- range . }}
|
||||||
- name: "{{ .Name }}"
|
- name: "{{ .Name }}"
|
||||||
value: "{{ .Value }}"
|
value: "{{ .Value }}"
|
||||||
|
{{- if .ValueFrom }}
|
||||||
|
{{- with .ValueFrom }}
|
||||||
|
valueFrom:
|
||||||
|
{{- if .SecretKeyRef }}
|
||||||
|
{{- with .SecretKeyRef }}
|
||||||
|
secretKeyRef:
|
||||||
|
key: {{ .Key }}
|
||||||
|
name: {{ .Name }}
|
||||||
|
optional: {{ .Optional }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
args:
|
args:
|
||||||
|
@ -10,8 +10,21 @@ type ContainerPort struct {
|
|||||||
|
|
||||||
// EnvVar is environment variable
|
// EnvVar is environment variable
|
||||||
type EnvVar struct {
|
type EnvVar struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Value string `json:"value,omitempty"`
|
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 {
|
type Condition struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user