Merge branch 'master' into auth-srv-srv

This commit is contained in:
ben-toogood 2020-03-31 16:15:17 +01:00 committed by GitHub
commit 9fb1d476a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 5 deletions

View File

@ -129,7 +129,7 @@ func (k *kubernetes) getService(labels map[string]string) ([]*service, error) {
// parse out deployment status and inject into service metadata // parse out deployment status and inject into service metadata
if len(kdep.Status.Conditions) > 0 { if len(kdep.Status.Conditions) > 0 {
svc.Metadata["status"] = kdep.Status.Conditions[0].Type svc.Metadata["status"] = kdep.Status.Conditions[0].Type
svc.Metadata["started"] = kdep.Status.Conditions[0].LastUpdate svc.Metadata["started"] = kdep.Status.Conditions[0].LastUpdateTime
delete(svc.Metadata, "error") delete(svc.Metadata, "error")
} else { } else {
svc.Metadata["status"] = "n/a" svc.Metadata["status"] = "n/a"

View File

@ -3,6 +3,7 @@ package client
var templates = map[string]string{ var templates = map[string]string{
"deployment": deploymentTmpl, "deployment": deploymentTmpl,
"service": serviceTmpl, "service": serviceTmpl,
"namespace": namespaceTmpl,
} }
// stripped image pull policy always // stripped image pull policy always
@ -108,3 +109,16 @@ spec:
{{- end }} {{- end }}
{{- end }} {{- end }}
` `
var namespaceTmpl = `
apiVersion: v1
kind: Namespace
metadata:
name: "{{ .Metadata.Name }}"
labels:
{{- with .Metadata.Labels }}
{{- range $key, $value := . }}
{{ $key }}: "{{ $value }}"
{{- end }}
{{- end }}
`

View File

@ -39,10 +39,10 @@ type DeploymentSpec struct {
// DeploymentCondition describes the state of deployment // DeploymentCondition describes the state of deployment
type DeploymentCondition struct { type DeploymentCondition struct {
LastUpdate string `json:lastUpdateTime` LastUpdateTime string `json:"lastUpdateTime"`
Type string `json:"type"` Type string `json:"type"`
reason string `json:"reason,omitempty"` Reason string `json:"reason,omitempty"`
message string `json:"message,omitempty"` Message string `json:"message,omitempty"`
} }
// DeploymentStatus is returned when querying deployment // DeploymentStatus is returned when querying deployment
@ -178,3 +178,8 @@ type Template struct {
Metadata *Metadata `json:"metadata,omitempty"` Metadata *Metadata `json:"metadata,omitempty"`
PodSpec *PodSpec `json:"spec,omitempty"` PodSpec *PodSpec `json:"spec,omitempty"`
} }
// Namespace is a Kubernetes Namespace
type Namespace struct {
Metadata *Metadata `json:"metadata,omitempty"`
}