From b6b740ff53cffdfb721c062988ce232ebfe07bc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sten=20R=C3=B8kke?= Date: Fri, 13 Dec 2024 14:01:38 +0100 Subject: [PATCH] Revert "feat: add support for running commands in liveness/readiness/startup" This reverts commit c5805f025a1fabbf07775f78d8c0a7d567762963. --- charts/templates/nais.io_applications.yaml | 21 ++++++------------- charts/templates/nais.io_naisjobs.yaml | 21 ++++++------------- config/crd/bases/nais.io_applications.yaml | 21 ++++++------------- config/crd/bases/nais.io_naisjobs.yaml | 21 ++++++------------- pkg/apis/nais.io/v1/naiserator_types.go | 4 +--- pkg/apis/nais.io/v1/zz_generated.deepcopy.go | 11 +++------- .../nais.io/v1alpha1/zz_generated.deepcopy.go | 6 +++--- 7 files changed, 31 insertions(+), 74 deletions(-) diff --git a/charts/templates/nais.io_applications.yaml b/charts/templates/nais.io_applications.yaml index 2f84fc6e..b2cdb9fe 100644 --- a/charts/templates/nais.io_applications.yaml +++ b/charts/templates/nais.io_applications.yaml @@ -880,11 +880,6 @@ spec: and remedy such situations. Read more about this over at the [Kubernetes probes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/). properties: - commands: - description: Command(s) to run to verify liveness/readiness - items: - type: string - type: array failureThreshold: description: |- When a Pod starts, and the probe fails, Kubernetes will try _failureThreshold_ times before giving up. @@ -907,6 +902,8 @@ spec: timeout: description: Number of seconds after which the probe times out. type: integer + required: + - path type: object logformat: description: |- @@ -1235,11 +1232,6 @@ spec: reporting that they are not ready does not receive traffic through Kubernetes Services. Read more about this over at the [Kubernetes readiness documentation](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/). properties: - commands: - description: Command(s) to run to verify liveness/readiness - items: - type: string - type: array failureThreshold: description: |- When a Pod starts, and the probe fails, Kubernetes will try _failureThreshold_ times before giving up. @@ -1262,6 +1254,8 @@ spec: timeout: description: Number of seconds after which the probe times out. type: integer + required: + - path type: object redirects: description: List of ingress redirects @@ -1421,11 +1415,6 @@ spec: application startup. This can be used to adopt liveness checks on slow starting containers, avoiding them getting killed by Kubernetes before they are up and running. properties: - commands: - description: Command(s) to run to verify liveness/readiness - items: - type: string - type: array failureThreshold: description: |- When a Pod starts, and the probe fails, Kubernetes will try _failureThreshold_ times before giving up. @@ -1448,6 +1437,8 @@ spec: timeout: description: Number of seconds after which the probe times out. type: integer + required: + - path type: object strategy: description: Specifies the strategy used to replace old Pods by new diff --git a/charts/templates/nais.io_naisjobs.yaml b/charts/templates/nais.io_naisjobs.yaml index 324ec40b..6ad83b27 100644 --- a/charts/templates/nais.io_naisjobs.yaml +++ b/charts/templates/nais.io_naisjobs.yaml @@ -748,11 +748,6 @@ spec: and remedy such situations. Read more about this over at the [Kubernetes probes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/). properties: - commands: - description: Command(s) to run to verify liveness/readiness - items: - type: string - type: array failureThreshold: description: |- When a Pod starts, and the probe fails, Kubernetes will try _failureThreshold_ times before giving up. @@ -775,6 +770,8 @@ spec: timeout: description: Number of seconds after which the probe times out. type: integer + required: + - path type: object logformat: description: |- @@ -1058,11 +1055,6 @@ spec: reporting that they are not ready does not receive traffic through Kubernetes Services. Read more about this over at the [Kubernetes readiness documentation](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/). properties: - commands: - description: Command(s) to run to verify liveness/readiness - items: - type: string - type: array failureThreshold: description: |- When a Pod starts, and the probe fails, Kubernetes will try _failureThreshold_ times before giving up. @@ -1085,6 +1077,8 @@ spec: timeout: description: Number of seconds after which the probe times out. type: integer + required: + - path type: object redis: description: |- @@ -1171,11 +1165,6 @@ spec: application startup. This can be used to adopt liveness checks on slow starting containers, avoiding them getting killed by Kubernetes before they are up and running. properties: - commands: - description: Command(s) to run to verify liveness/readiness - items: - type: string - type: array failureThreshold: description: |- When a Pod starts, and the probe fails, Kubernetes will try _failureThreshold_ times before giving up. @@ -1198,6 +1187,8 @@ spec: timeout: description: Number of seconds after which the probe times out. type: integer + required: + - path type: object successfulJobsHistoryLimit: description: Specify how many completed Jobs should be kept. diff --git a/config/crd/bases/nais.io_applications.yaml b/config/crd/bases/nais.io_applications.yaml index 2f84fc6e..b2cdb9fe 100644 --- a/config/crd/bases/nais.io_applications.yaml +++ b/config/crd/bases/nais.io_applications.yaml @@ -880,11 +880,6 @@ spec: and remedy such situations. Read more about this over at the [Kubernetes probes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/). properties: - commands: - description: Command(s) to run to verify liveness/readiness - items: - type: string - type: array failureThreshold: description: |- When a Pod starts, and the probe fails, Kubernetes will try _failureThreshold_ times before giving up. @@ -907,6 +902,8 @@ spec: timeout: description: Number of seconds after which the probe times out. type: integer + required: + - path type: object logformat: description: |- @@ -1235,11 +1232,6 @@ spec: reporting that they are not ready does not receive traffic through Kubernetes Services. Read more about this over at the [Kubernetes readiness documentation](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/). properties: - commands: - description: Command(s) to run to verify liveness/readiness - items: - type: string - type: array failureThreshold: description: |- When a Pod starts, and the probe fails, Kubernetes will try _failureThreshold_ times before giving up. @@ -1262,6 +1254,8 @@ spec: timeout: description: Number of seconds after which the probe times out. type: integer + required: + - path type: object redirects: description: List of ingress redirects @@ -1421,11 +1415,6 @@ spec: application startup. This can be used to adopt liveness checks on slow starting containers, avoiding them getting killed by Kubernetes before they are up and running. properties: - commands: - description: Command(s) to run to verify liveness/readiness - items: - type: string - type: array failureThreshold: description: |- When a Pod starts, and the probe fails, Kubernetes will try _failureThreshold_ times before giving up. @@ -1448,6 +1437,8 @@ spec: timeout: description: Number of seconds after which the probe times out. type: integer + required: + - path type: object strategy: description: Specifies the strategy used to replace old Pods by new diff --git a/config/crd/bases/nais.io_naisjobs.yaml b/config/crd/bases/nais.io_naisjobs.yaml index 324ec40b..6ad83b27 100644 --- a/config/crd/bases/nais.io_naisjobs.yaml +++ b/config/crd/bases/nais.io_naisjobs.yaml @@ -748,11 +748,6 @@ spec: and remedy such situations. Read more about this over at the [Kubernetes probes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/). properties: - commands: - description: Command(s) to run to verify liveness/readiness - items: - type: string - type: array failureThreshold: description: |- When a Pod starts, and the probe fails, Kubernetes will try _failureThreshold_ times before giving up. @@ -775,6 +770,8 @@ spec: timeout: description: Number of seconds after which the probe times out. type: integer + required: + - path type: object logformat: description: |- @@ -1058,11 +1055,6 @@ spec: reporting that they are not ready does not receive traffic through Kubernetes Services. Read more about this over at the [Kubernetes readiness documentation](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/). properties: - commands: - description: Command(s) to run to verify liveness/readiness - items: - type: string - type: array failureThreshold: description: |- When a Pod starts, and the probe fails, Kubernetes will try _failureThreshold_ times before giving up. @@ -1085,6 +1077,8 @@ spec: timeout: description: Number of seconds after which the probe times out. type: integer + required: + - path type: object redis: description: |- @@ -1171,11 +1165,6 @@ spec: application startup. This can be used to adopt liveness checks on slow starting containers, avoiding them getting killed by Kubernetes before they are up and running. properties: - commands: - description: Command(s) to run to verify liveness/readiness - items: - type: string - type: array failureThreshold: description: |- When a Pod starts, and the probe fails, Kubernetes will try _failureThreshold_ times before giving up. @@ -1198,6 +1187,8 @@ spec: timeout: description: Number of seconds after which the probe times out. type: integer + required: + - path type: object successfulJobsHistoryLimit: description: Specify how many completed Jobs should be kept. diff --git a/pkg/apis/nais.io/v1/naiserator_types.go b/pkg/apis/nais.io/v1/naiserator_types.go index 49aa1d51..0b94c338 100644 --- a/pkg/apis/nais.io/v1/naiserator_types.go +++ b/pkg/apis/nais.io/v1/naiserator_types.go @@ -250,7 +250,7 @@ type PreStopHook struct { // Liveness probe and readiness probe definitions. type Probe struct { // HTTP endpoint path that signals 200 OK if the application has started successfully. - Path string `json:"path,omitempty"` + Path string `json:"path"` // Port for the startup probe. Port int `json:"port,omitempty"` // Number of seconds after the container has started before startup probes are initiated. @@ -262,8 +262,6 @@ type Probe struct { FailureThreshold int `json:"failureThreshold,omitempty"` // Number of seconds after which the probe times out. Timeout int `json:"timeout,omitempty"` - // Command(s) to run to verify liveness/readiness - Commands []string `json:"commands,omitempty"` } type SecretPath struct { diff --git a/pkg/apis/nais.io/v1/zz_generated.deepcopy.go b/pkg/apis/nais.io/v1/zz_generated.deepcopy.go index ce19944b..5cf77d92 100644 --- a/pkg/apis/nais.io/v1/zz_generated.deepcopy.go +++ b/pkg/apis/nais.io/v1/zz_generated.deepcopy.go @@ -1779,7 +1779,7 @@ func (in *NaisjobSpec) DeepCopyInto(out *NaisjobSpec) { if in.Liveness != nil { in, out := &in.Liveness, &out.Liveness *out = new(Probe) - (*in).DeepCopyInto(*out) + **out = **in } if in.Maskinporten != nil { in, out := &in.Maskinporten, &out.Maskinporten @@ -1804,7 +1804,7 @@ func (in *NaisjobSpec) DeepCopyInto(out *NaisjobSpec) { if in.Readiness != nil { in, out := &in.Readiness, &out.Readiness *out = new(Probe) - (*in).DeepCopyInto(*out) + **out = **in } if in.Redis != nil { in, out := &in.Redis, &out.Redis @@ -1824,7 +1824,7 @@ func (in *NaisjobSpec) DeepCopyInto(out *NaisjobSpec) { if in.Startup != nil { in, out := &in.Startup, &out.Startup *out = new(Probe) - (*in).DeepCopyInto(*out) + **out = **in } if in.TerminationGracePeriodSeconds != nil { in, out := &in.TerminationGracePeriodSeconds, &out.TerminationGracePeriodSeconds @@ -1951,11 +1951,6 @@ func (in *PreStopHook) DeepCopy() *PreStopHook { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Probe) DeepCopyInto(out *Probe) { *out = *in - if in.Commands != nil { - in, out := &in.Commands, &out.Commands - *out = make([]string, len(*in)) - copy(*out, *in) - } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Probe. diff --git a/pkg/apis/nais.io/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/nais.io/v1alpha1/zz_generated.deepcopy.go index 346616d4..a6132092 100644 --- a/pkg/apis/nais.io/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/nais.io/v1alpha1/zz_generated.deepcopy.go @@ -138,7 +138,7 @@ func (in *ApplicationSpec) DeepCopyInto(out *ApplicationSpec) { if in.Liveness != nil { in, out := &in.Liveness, &out.Liveness *out = new(v1.Probe) - (*in).DeepCopyInto(*out) + **out = **in } if in.Login != nil { in, out := &in.Login, &out.Login @@ -168,7 +168,7 @@ func (in *ApplicationSpec) DeepCopyInto(out *ApplicationSpec) { if in.Readiness != nil { in, out := &in.Readiness, &out.Readiness *out = new(v1.Probe) - (*in).DeepCopyInto(*out) + **out = **in } if in.Redirects != nil { in, out := &in.Redirects, &out.Redirects @@ -203,7 +203,7 @@ func (in *ApplicationSpec) DeepCopyInto(out *ApplicationSpec) { if in.Startup != nil { in, out := &in.Startup, &out.Startup *out = new(v1.Probe) - (*in).DeepCopyInto(*out) + **out = **in } if in.Strategy != nil { in, out := &in.Strategy, &out.Strategy