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() {
|
||||
records, err := klo.Read()
|
||||
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
|
||||
}
|
||||
// @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].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
|
||||
|
@ -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,
|
||||
|
@ -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:
|
||||
|
@ -12,6 +12,19 @@ type ContainerPort struct {
|
||||
type EnvVar struct {
|
||||
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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user