util/kubernetes: fix TCPSocketAction bug (#1987)

This commit is contained in:
ben-toogood
2020-09-08 11:43:47 +01:00
committed by GitHub
parent 71f8cbd5e2
commit d5e345d41d
2 changed files with 12 additions and 10 deletions

View File

@@ -274,10 +274,12 @@ func NewDeployment(name, version, typ, namespace string) *Deployment {
logger.Tracef("kubernetes default deployment: name: %s, version: %s", name, version) logger.Tracef("kubernetes default deployment: name: %s, version: %s", name, version)
} }
Labels := map[string]string{ Labels := map[string]string{"name": name}
"name": name, if len(typ) > 0 {
"version": version, Labels["micro"] = typ
"micro": typ, }
if len(version) > 0 {
Labels["version"] = version
} }
depName := name depName := name
@@ -322,7 +324,7 @@ func NewDeployment(name, version, typ, namespace string) *Deployment {
ContainerPort: 8080, ContainerPort: 8080,
}}, }},
ReadinessProbe: &Probe{ ReadinessProbe: &Probe{
TCPSocket: TCPSocketAction{ TCPSocket: &TCPSocketAction{
Port: 8080, Port: 8080,
}, },
PeriodSeconds: 10, PeriodSeconds: 10,

View File

@@ -225,15 +225,15 @@ type ServiceAccount struct {
// Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic. // Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.
type Probe struct { type Probe struct {
TCPSocket TCPSocketAction `json:"tcpSocket,omitempty"` TCPSocket *TCPSocketAction `json:"tcpSocket,omitempty"`
PeriodSeconds int `json:"periodSeconds"` PeriodSeconds int `json:"periodSeconds"`
InitialDelaySeconds int `json:"initialDelaySeconds"` InitialDelaySeconds int `json:"initialDelaySeconds"`
} }
// TCPSocketAction describes an action based on opening a socket // TCPSocketAction describes an action based on opening a socket
type TCPSocketAction struct { type TCPSocketAction struct {
Host string `json:"host,omitempty"` Host string `json:"host,omitempty"`
Port int `json:"port,omitempty"` Port interface{} `json:"port,omitempty"`
} }
// ResourceRequirements describes the compute resource requirements. // ResourceRequirements describes the compute resource requirements.