From bc833d5af1d8305cccc6780885bb35663f315713 Mon Sep 17 00:00:00 2001 From: Kirby Chin <37311900+kabicin@users.noreply.github.com> Date: Tue, 25 Nov 2025 11:42:08 -0500 Subject: [PATCH 01/11] Remove override when ProbeHandler is set and manage terminationGracePeriodSeconds config --- utils/utils.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/utils/utils.go b/utils/utils.go index 3d016372..f8b763da 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -310,11 +310,6 @@ func customizeProbe(config *corev1.Probe, defaultProbeCallback func(ba common.Ba return nil } - // Probe handler is defined in config so use probe as is - if config.ProbeHandler != (corev1.ProbeHandler{}) { - return config - } - // Probe handler is not defined so use default values for the probe if values not set in probe config return CustomizeProbeDefaults(config, defaultProbeCallback(ba)) } @@ -336,6 +331,9 @@ func CustomizeProbeDefaults(config *corev1.Probe, defaultProbe *corev1.Probe) *c if config.FailureThreshold != 0 { probe.FailureThreshold = config.FailureThreshold } + if config.TerminationGracePeriodSeconds != nil { + probe.TerminationGracePeriodSeconds = config.TerminationGracePeriodSeconds + } return probe } From 0dff4935d06a0d1808d1e7a154074dd922f131a5 Mon Sep 17 00:00:00 2001 From: Kirby Chin <37311900+kabicin@users.noreply.github.com> Date: Tue, 25 Nov 2025 15:50:41 -0500 Subject: [PATCH 02/11] Optionally set httpGet probes in the CR instance --- api/v1/runtimecomponent_types.go | 18 +-- api/v1/zz_generated.deepcopy.go | 6 +- api/v1beta2/runtimecomponent_types.go | 6 +- common/common.go | 74 ++++++++++ common/types.go | 91 ++++++++++++- common/zz_generated.deepcopy.go | 126 ++++++++++++++++++ .../rc.app.stacks_runtimecomponents.yaml | 21 ++- utils/utils.go | 19 ++- utils/utils_test.go | 24 ++-- 9 files changed, 339 insertions(+), 46 deletions(-) create mode 100644 common/zz_generated.deepcopy.go diff --git a/api/v1/runtimecomponent_types.go b/api/v1/runtimecomponent_types.go index 9c875478..8f8cb7e1 100644 --- a/api/v1/runtimecomponent_types.go +++ b/api/v1/runtimecomponent_types.go @@ -206,15 +206,15 @@ type RuntimeComponentServiceAccount struct { type RuntimeComponentProbes struct { // Periodic probe of container liveness. Container will be restarted if the probe fails. // +operator-sdk:csv:customresourcedefinitions:order=3,type=spec,displayName="Liveness Probe" - Liveness *corev1.Probe `json:"liveness,omitempty"` + Liveness *common.BaseComponentProbe `json:"liveness,omitempty"` // Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. // +operator-sdk:csv:customresourcedefinitions:order=2,type=spec,displayName="Readiness Probe" - Readiness *corev1.Probe `json:"readiness,omitempty"` + Readiness *common.BaseComponentProbe `json:"readiness,omitempty"` // Probe to determine successful initialization. If specified, other probes are not executed until this completes successfully. // +operator-sdk:csv:customresourcedefinitions:order=1,type=spec,displayName="Startup Probe" - Startup *corev1.Probe `json:"startup,omitempty"` + Startup *common.BaseComponentProbe `json:"startup,omitempty"` } // Configure pods to run on particular Nodes. @@ -611,18 +611,18 @@ func (cr *RuntimeComponent) GetProbes() common.BaseComponentProbes { } // GetLivenessProbe returns liveness probe -func (p *RuntimeComponentProbes) GetLivenessProbe() *corev1.Probe { - return p.Liveness +func (p *RuntimeComponentProbes) GetLivenessProbe(ba common.BaseComponent) *corev1.Probe { + return common.ConvertBaseComponentProbeToCoreProbe(p.Liveness, p.GetDefaultLivenessProbe(ba)) } // GetReadinessProbe returns readiness probe -func (p *RuntimeComponentProbes) GetReadinessProbe() *corev1.Probe { - return p.Readiness +func (p *RuntimeComponentProbes) GetReadinessProbe(ba common.BaseComponent) *corev1.Probe { + return common.ConvertBaseComponentProbeToCoreProbe(p.Readiness, p.GetDefaultReadinessProbe(ba)) } // GetStartupProbe returns startup probe -func (p *RuntimeComponentProbes) GetStartupProbe() *corev1.Probe { - return p.Startup +func (p *RuntimeComponentProbes) GetStartupProbe(ba common.BaseComponent) *corev1.Probe { + return common.ConvertBaseComponentProbeToCoreProbe(p.Startup, p.GetDefaultStartupProbe(ba)) } // GetDefaultLivenessProbe returns default values for liveness probe diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go index b29eed28..689d5de4 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -343,17 +343,17 @@ func (in *RuntimeComponentProbes) DeepCopyInto(out *RuntimeComponentProbes) { *out = *in if in.Liveness != nil { in, out := &in.Liveness, &out.Liveness - *out = new(corev1.Probe) + *out = new(common.BaseComponentProbe) (*in).DeepCopyInto(*out) } if in.Readiness != nil { in, out := &in.Readiness, &out.Readiness - *out = new(corev1.Probe) + *out = new(common.BaseComponentProbe) (*in).DeepCopyInto(*out) } if in.Startup != nil { in, out := &in.Startup, &out.Startup - *out = new(corev1.Probe) + *out = new(common.BaseComponentProbe) (*in).DeepCopyInto(*out) } } diff --git a/api/v1beta2/runtimecomponent_types.go b/api/v1beta2/runtimecomponent_types.go index 6411a77b..6375bf62 100644 --- a/api/v1beta2/runtimecomponent_types.go +++ b/api/v1beta2/runtimecomponent_types.go @@ -488,17 +488,17 @@ func (cr *RuntimeComponent) GetProbes() common.BaseComponentProbes { } // GetLivenessProbe returns liveness probe -func (p *RuntimeComponentProbes) GetLivenessProbe() *corev1.Probe { +func (p *RuntimeComponentProbes) GetLivenessProbe(ba common.BaseComponent) *corev1.Probe { return p.Liveness } // GetReadinessProbe returns readiness probe -func (p *RuntimeComponentProbes) GetReadinessProbe() *corev1.Probe { +func (p *RuntimeComponentProbes) GetReadinessProbe(ba common.BaseComponent) *corev1.Probe { return p.Readiness } // GetStartupProbe returns startup probe -func (p *RuntimeComponentProbes) GetStartupProbe() *corev1.Probe { +func (p *RuntimeComponentProbes) GetStartupProbe(ba common.BaseComponent) *corev1.Probe { return p.Startup } diff --git a/common/common.go b/common/common.go index a8f750e3..a3693f66 100644 --- a/common/common.go +++ b/common/common.go @@ -5,6 +5,80 @@ import ( "k8s.io/apimachinery/pkg/util/intstr" ) +func ConvertBaseComponentProbeToCoreProbe(bcp *BaseComponentProbe, defaultProbe *corev1.Probe) *corev1.Probe { + if bcp == nil { + return nil + } + return CustomizeBaseComponentProbeDefaults(bcp, defaultProbe) +} + +func CustomizeBaseComponentProbeDefaults(config *BaseComponentProbe, defaultProbe *corev1.Probe) *corev1.Probe { + probe := defaultProbe + if probe == nil { + probe = &corev1.Probe{} + } + if config == nil { + return probe + } + if config.BaseComponentProbeHandler.Exec != nil { + probe.ProbeHandler.Exec = config.BaseComponentProbeHandler.Exec + } + if config.BaseComponentProbeHandler.GRPC != nil { + probe.ProbeHandler.GRPC = config.BaseComponentProbeHandler.GRPC + } + if config.BaseComponentProbeHandler.TCPSocket != nil { + probe.ProbeHandler.TCPSocket = config.BaseComponentProbeHandler.TCPSocket + } + if config.BaseComponentProbeHandler.HTTPGet != nil { + probe.ProbeHandler.HTTPGet = convertOptionalHTTPGetActionToHTTPGetAction(config.BaseComponentProbeHandler.HTTPGet, probe.ProbeHandler.HTTPGet) + } + if config.InitialDelaySeconds != 0 { + probe.InitialDelaySeconds = config.InitialDelaySeconds + } + if config.TimeoutSeconds != 0 { + probe.TimeoutSeconds = config.TimeoutSeconds + } + if config.PeriodSeconds != 0 { + probe.PeriodSeconds = config.PeriodSeconds + } + if config.SuccessThreshold != 0 { + probe.SuccessThreshold = config.SuccessThreshold + } + if config.FailureThreshold != 0 { + probe.FailureThreshold = config.FailureThreshold + } + if config.TerminationGracePeriodSeconds != nil { + probe.TerminationGracePeriodSeconds = config.TerminationGracePeriodSeconds + } + return probe +} + +func convertOptionalHTTPGetActionToHTTPGetAction(optAction *OptionalHTTPGetAction, defaultHTTPGetAction *corev1.HTTPGetAction) *corev1.HTTPGetAction { + action := defaultHTTPGetAction + if action == nil { + action = &corev1.HTTPGetAction{} + } + if optAction == nil { + return action + } + if optAction.Host != nil { + action.Host = *optAction.Host + } + if optAction.Path != nil { + action.Path = *optAction.Path + } + if optAction.Port != nil { + action.Port = *optAction.Port + } + if optAction.Scheme != nil { + action.Scheme = *optAction.Scheme + } + if optAction.HTTPHeaders != nil { + action.HTTPHeaders = *optAction.HTTPHeaders + } + return action +} + // GetDefaultMicroProfileStartupProbe returns the default values for MicroProfile Health-based startup probe. func GetDefaultMicroProfileStartupProbe(ba BaseComponent) *corev1.Probe { return &corev1.Probe{ diff --git a/common/types.go b/common/types.go index c9232ad6..703ecdae 100644 --- a/common/types.go +++ b/common/types.go @@ -9,6 +9,7 @@ import ( v1 "k8s.io/api/core/v1" networkingv1 "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" ) // StatusConditionType ... @@ -195,11 +196,95 @@ type BaseComponentStatefulSet interface { GetAnnotations() map[string]string } +// This struct is taken from the Probe specification in https://github.com/kubernetes/api/blob/v0.33.4/core/v1/types.go +// +kubebuilder:object:generate=true +type BaseComponentProbe struct { + // The action taken to determine the health of a container + BaseComponentProbeHandler `json:",inline"` + // Number of seconds after the container has started before liveness probes are initiated. + // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + // +optional + InitialDelaySeconds int32 `json:"initialDelaySeconds,omitempty"` + // Number of seconds after which the probe times out. + // Defaults to 1 second. Minimum value is 1. + // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + // +optional + TimeoutSeconds int32 `json:"timeoutSeconds,omitempty"` + // How often (in seconds) to perform the probe. + // Default to 10 seconds. Minimum value is 1. + // +optional + PeriodSeconds int32 `json:"periodSeconds,omitempty"` + // Minimum consecutive successes for the probe to be considered successful after having failed. + // Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. + // +optional + SuccessThreshold int32 `json:"successThreshold,omitempty"` + // Minimum consecutive failures for the probe to be considered failed after having succeeded. + // Defaults to 3. Minimum value is 1. + // +optional + FailureThreshold int32 `json:"failureThreshold,omitempty"` + // Optional duration in seconds the pod needs to terminate gracefully upon probe failure. + // The grace period is the duration in seconds after the processes running in the pod are sent + // a termination signal and the time when the processes are forcibly halted with a kill signal. + // Set this value longer than the expected cleanup time for your process. + // If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this + // value overrides the value provided by the pod spec. + // Value must be non-negative integer. The value zero indicates stop immediately via + // the kill signal (no opportunity to shut down). + // This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. + // Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. + // +optional + TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"` +} + +// This struct is taken from the ProbeHandler specification in https://github.com/kubernetes/api/blob/v0.33.4/core/v1/types.go +// +kubebuilder:object:generate=true +type BaseComponentProbeHandler struct { + // Exec specifies the action to take. + // +optional + Exec *corev1.ExecAction `json:"exec,omitempty"` + // HTTPGet specifies the http request to perform. + // +optional + HTTPGet *OptionalHTTPGetAction `json:"httpGet,omitempty"` + // TCPSocket specifies an action involving a TCP port. + // +optional + TCPSocket *corev1.TCPSocketAction `json:"tcpSocket,omitempty"` + + // GRPC specifies an action involving a GRPC port. + // This is a beta field and requires enabling GRPCContainerProbe feature gate. + // +featureGate=GRPCContainerProbe + // +optional + GRPC *corev1.GRPCAction `json:"grpc,omitempty"` +} + +// This struct is based upon the HTTPGetAction specification in https://github.com/kubernetes/api/blob/v0.33.4/core/v1/types.go +// +kubebuilder:object:generate=true +type OptionalHTTPGetAction struct { + // Path to access on the HTTP server. + // +optional + Path *string `json:"path,omitempty"` + // Name or number of the port to access on the container. + // Number must be in the range 1 to 65535. + // Name must be an IANA_SVC_NAME. + // +optional + Port *intstr.IntOrString `json:"port,omitempty"` + // Host name to connect to, defaults to the pod IP. You probably want to set + // "Host" in httpHeaders instead. + // +optional + Host *string `json:"host,omitempty"` + // Scheme to use for connecting to the host. + // Defaults to HTTP. + // +optional + Scheme *corev1.URIScheme `json:"scheme,omitempty"` + // Custom headers to set in the request. HTTP allows repeated headers. + // +optional + HTTPHeaders *[]corev1.HTTPHeader `json:"httpHeaders,omitempty"` +} + // BaseComponentProbes describes the probes for application container type BaseComponentProbes interface { - GetLivenessProbe() *corev1.Probe - GetReadinessProbe() *corev1.Probe - GetStartupProbe() *corev1.Probe + GetLivenessProbe(ba BaseComponent) *corev1.Probe + GetReadinessProbe(ba BaseComponent) *corev1.Probe + GetStartupProbe(ba BaseComponent) *corev1.Probe GetDefaultLivenessProbe(ba BaseComponent) *corev1.Probe GetDefaultReadinessProbe(ba BaseComponent) *corev1.Probe diff --git a/common/zz_generated.deepcopy.go b/common/zz_generated.deepcopy.go new file mode 100644 index 00000000..8cbba2c9 --- /dev/null +++ b/common/zz_generated.deepcopy.go @@ -0,0 +1,126 @@ +//go:build !ignore_autogenerated + +/* + + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by controller-gen. DO NOT EDIT. + +package common + +import ( + "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/util/intstr" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BaseComponentProbe) DeepCopyInto(out *BaseComponentProbe) { + *out = *in + in.BaseComponentProbeHandler.DeepCopyInto(&out.BaseComponentProbeHandler) + if in.TerminationGracePeriodSeconds != nil { + in, out := &in.TerminationGracePeriodSeconds, &out.TerminationGracePeriodSeconds + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BaseComponentProbe. +func (in *BaseComponentProbe) DeepCopy() *BaseComponentProbe { + if in == nil { + return nil + } + out := new(BaseComponentProbe) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BaseComponentProbeHandler) DeepCopyInto(out *BaseComponentProbeHandler) { + *out = *in + if in.Exec != nil { + in, out := &in.Exec, &out.Exec + *out = new(v1.ExecAction) + (*in).DeepCopyInto(*out) + } + if in.HTTPGet != nil { + in, out := &in.HTTPGet, &out.HTTPGet + *out = new(OptionalHTTPGetAction) + (*in).DeepCopyInto(*out) + } + if in.TCPSocket != nil { + in, out := &in.TCPSocket, &out.TCPSocket + *out = new(v1.TCPSocketAction) + **out = **in + } + if in.GRPC != nil { + in, out := &in.GRPC, &out.GRPC + *out = new(v1.GRPCAction) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BaseComponentProbeHandler. +func (in *BaseComponentProbeHandler) DeepCopy() *BaseComponentProbeHandler { + if in == nil { + return nil + } + out := new(BaseComponentProbeHandler) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OptionalHTTPGetAction) DeepCopyInto(out *OptionalHTTPGetAction) { + *out = *in + if in.Path != nil { + in, out := &in.Path, &out.Path + *out = new(string) + **out = **in + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(intstr.IntOrString) + **out = **in + } + if in.Host != nil { + in, out := &in.Host, &out.Host + *out = new(string) + **out = **in + } + if in.Scheme != nil { + in, out := &in.Scheme, &out.Scheme + *out = new(v1.URIScheme) + **out = **in + } + if in.HTTPHeaders != nil { + in, out := &in.HTTPHeaders, &out.HTTPHeaders + *out = new([]v1.HTTPHeader) + if **in != nil { + in, out := *in, *out + *out = make([]v1.HTTPHeader, len(*in)) + copy(*out, *in) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OptionalHTTPGetAction. +func (in *OptionalHTTPGetAction) DeepCopy() *OptionalHTTPGetAction { + if in == nil { + return nil + } + out := new(OptionalHTTPGetAction) + in.DeepCopyInto(out) + return out +} diff --git a/config/crd/bases/rc.app.stacks_runtimecomponents.yaml b/config/crd/bases/rc.app.stacks_runtimecomponents.yaml index 89b5e68b..90086a54 100644 --- a/config/crd/bases/rc.app.stacks_runtimecomponents.yaml +++ b/config/crd/bases/rc.app.stacks_runtimecomponents.yaml @@ -4369,7 +4369,9 @@ spec: format: int32 type: integer grpc: - description: GRPC specifies an action involving a GRPC port. + description: |- + GRPC specifies an action involving a GRPC port. + This is a beta field and requires enabling GRPCContainerProbe feature gate. properties: port: description: Port number of the gRPC service. Number must @@ -4415,7 +4417,6 @@ spec: - value type: object type: array - x-kubernetes-list-type: atomic path: description: Path to access on the HTTP server. type: string @@ -4433,8 +4434,6 @@ spec: Scheme to use for connecting to the host. Defaults to HTTP. type: string - required: - - port type: object initialDelaySeconds: description: |- @@ -4522,7 +4521,9 @@ spec: format: int32 type: integer grpc: - description: GRPC specifies an action involving a GRPC port. + description: |- + GRPC specifies an action involving a GRPC port. + This is a beta field and requires enabling GRPCContainerProbe feature gate. properties: port: description: Port number of the gRPC service. Number must @@ -4568,7 +4569,6 @@ spec: - value type: object type: array - x-kubernetes-list-type: atomic path: description: Path to access on the HTTP server. type: string @@ -4586,8 +4586,6 @@ spec: Scheme to use for connecting to the host. Defaults to HTTP. type: string - required: - - port type: object initialDelaySeconds: description: |- @@ -4676,7 +4674,9 @@ spec: format: int32 type: integer grpc: - description: GRPC specifies an action involving a GRPC port. + description: |- + GRPC specifies an action involving a GRPC port. + This is a beta field and requires enabling GRPCContainerProbe feature gate. properties: port: description: Port number of the gRPC service. Number must @@ -4722,7 +4722,6 @@ spec: - value type: object type: array - x-kubernetes-list-type: atomic path: description: Path to access on the HTTP server. type: string @@ -4740,8 +4739,6 @@ spec: Scheme to use for connecting to the host. Defaults to HTTP. type: string - required: - - port type: object initialDelaySeconds: description: |- diff --git a/utils/utils.go b/utils/utils.go index f8b763da..7a77fdd4 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -299,9 +299,9 @@ func CustomizeProbes(container *corev1.Container, ba common.BaseComponent) { return } - container.ReadinessProbe = customizeProbe(probesConfig.GetReadinessProbe(), probesConfig.GetDefaultReadinessProbe, ba) - container.LivenessProbe = customizeProbe(probesConfig.GetLivenessProbe(), probesConfig.GetDefaultLivenessProbe, ba) - container.StartupProbe = customizeProbe(probesConfig.GetStartupProbe(), probesConfig.GetDefaultStartupProbe, ba) + container.ReadinessProbe = customizeProbe(probesConfig.GetReadinessProbe(ba), probesConfig.GetDefaultReadinessProbe, ba) + container.LivenessProbe = customizeProbe(probesConfig.GetLivenessProbe(ba), probesConfig.GetDefaultLivenessProbe, ba) + container.StartupProbe = customizeProbe(probesConfig.GetStartupProbe(ba), probesConfig.GetDefaultStartupProbe, ba) } func customizeProbe(config *corev1.Probe, defaultProbeCallback func(ba common.BaseComponent) *corev1.Probe, ba common.BaseComponent) *corev1.Probe { @@ -316,6 +316,18 @@ func customizeProbe(config *corev1.Probe, defaultProbeCallback func(ba common.Ba func CustomizeProbeDefaults(config *corev1.Probe, defaultProbe *corev1.Probe) *corev1.Probe { probe := defaultProbe + if config.ProbeHandler.Exec != nil { + probe.ProbeHandler.Exec = config.ProbeHandler.Exec + } + if config.ProbeHandler.GRPC != nil { + probe.ProbeHandler.GRPC = config.ProbeHandler.GRPC + } + if config.ProbeHandler.HTTPGet != nil { + probe.ProbeHandler.HTTPGet = config.ProbeHandler.HTTPGet + } + if config.ProbeHandler.TCPSocket != nil { + probe.ProbeHandler.TCPSocket = config.ProbeHandler.TCPSocket + } if config.InitialDelaySeconds != 0 { probe.InitialDelaySeconds = config.InitialDelaySeconds } @@ -334,7 +346,6 @@ func CustomizeProbeDefaults(config *corev1.Probe, defaultProbe *corev1.Probe) *c if config.TerminationGracePeriodSeconds != nil { probe.TerminationGracePeriodSeconds = config.TerminationGracePeriodSeconds } - return probe } diff --git a/utils/utils_test.go b/utils/utils_test.go index 007a1945..9174530f 100644 --- a/utils/utils_test.go +++ b/utils/utils_test.go @@ -66,21 +66,21 @@ var ( TypeMeta: metav1.TypeMeta{Kind: "StatefulSet"}} storage = appstacksv1.RuntimeComponentStorage{Size: "10Mi", MountPath: "/mnt/data", VolumeClaimTemplate: volumeCT} arch = []string{"ppc64le"} - readinessProbe = &corev1.Probe{ - ProbeHandler: corev1.ProbeHandler{ - HTTPGet: &corev1.HTTPGetAction{}, + readinessProbe = &common.BaseComponentProbe{ + BaseComponentProbeHandler: common.BaseComponentProbeHandler{ + HTTPGet: &common.OptionalHTTPGetAction{}, TCPSocket: &corev1.TCPSocketAction{}, }, } - livenessProbe = &corev1.Probe{ - ProbeHandler: corev1.ProbeHandler{ - HTTPGet: &corev1.HTTPGetAction{}, + livenessProbe = &common.BaseComponentProbe{ + BaseComponentProbeHandler: common.BaseComponentProbeHandler{ + HTTPGet: &common.OptionalHTTPGetAction{}, TCPSocket: &corev1.TCPSocketAction{}, }, } - startupProbe = &corev1.Probe{ - ProbeHandler: corev1.ProbeHandler{ - HTTPGet: &corev1.HTTPGetAction{}, + startupProbe = &common.BaseComponentProbe{ + BaseComponentProbeHandler: common.BaseComponentProbeHandler{ + HTTPGet: &common.OptionalHTTPGetAction{}, TCPSocket: &corev1.TCPSocketAction{}, }, } @@ -616,11 +616,11 @@ func TestCustomizeKnativeService(t *testing.T) { {"ksvc container ports", 1, ksvcNumPorts}, {"ksvc ServiceAccountName is nil", name, ksvcSAN}, {"ksvc ServiceAccountName not nil", *runtime.Spec.ServiceAccountName, ksvc.Spec.Template.Spec.ServiceAccountName}, - {"liveness probe port", intstr.IntOrString{}, ksvcLPPort}, + {"liveness probe port", intstr.FromInt32(service.Port), ksvcLPPort}, {"liveness probe TCP socket port", intstr.IntOrString{}, ksvcLPTCP}, - {"Readiness probe port", intstr.IntOrString{}, ksvcRPPort}, + {"Readiness probe port", intstr.FromInt32(service.Port), ksvcRPPort}, {"Readiness probe TCP socket port", intstr.IntOrString{}, ksvcRPTCP}, - {"Startup probe port", intstr.IntOrString{}, ksvcSPPort}, + {"Startup probe port", intstr.FromInt32(service.Port), ksvcSPPort}, {"Startup probe TCP socket port", intstr.IntOrString{}, ksvcSPTCP}, {"expose not set", "cluster-local", ksvcLabelNoExpose}, {"expose set to true", "", ksvcLabelTrueExpose}, From ed7e090c5e498ef7c1e0e133144ad79e1469e6ac Mon Sep 17 00:00:00 2001 From: Kirby Chin <37311900+kabicin@users.noreply.github.com> Date: Wed, 26 Nov 2025 11:26:48 -0500 Subject: [PATCH 03/11] Add GetManagedPort and GetManagedScheme for default probes --- api/v1/runtimecomponent_types.go | 11 +++++++++++ common/common.go | 13 ++++++------- common/types.go | 2 ++ 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/api/v1/runtimecomponent_types.go b/api/v1/runtimecomponent_types.go index 8f8cb7e1..98a491db 100644 --- a/api/v1/runtimecomponent_types.go +++ b/api/v1/runtimecomponent_types.go @@ -765,6 +765,17 @@ func (cr *RuntimeComponent) GetManageTLS() *bool { return cr.Spec.ManageTLS } +func (cr *RuntimeComponent) GetManagedPort() intstr.IntOrString { + return intstr.FromInt(int(cr.GetService().GetPort())) +} + +func (cr *RuntimeComponent) GetManagedScheme() corev1.URIScheme { + if cr.GetManageTLS() != nil && *cr.GetManageTLS() { + return corev1.URISchemeHTTPS + } + return corev1.URISchemeHTTP +} + // GetDeployment returns deployment settings func (cr *RuntimeComponent) GetDeployment() common.BaseComponentDeployment { if cr.Spec.Deployment == nil { diff --git a/common/common.go b/common/common.go index a3693f66..1e37186d 100644 --- a/common/common.go +++ b/common/common.go @@ -2,7 +2,6 @@ package common import ( corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/util/intstr" ) func ConvertBaseComponentProbeToCoreProbe(bcp *BaseComponentProbe, defaultProbe *corev1.Probe) *corev1.Probe { @@ -85,8 +84,8 @@ func GetDefaultMicroProfileStartupProbe(ba BaseComponent) *corev1.Probe { ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Path: "/health/started", - Port: intstr.FromInt(int(ba.GetService().GetPort())), - Scheme: "HTTPS", + Port: ba.GetManagedPort(), + Scheme: ba.GetManagedScheme(), }, }, PeriodSeconds: 10, @@ -101,8 +100,8 @@ func GetDefaultMicroProfileReadinessProbe(ba BaseComponent) *corev1.Probe { ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Path: "/health/ready", - Port: intstr.FromInt(int(ba.GetService().GetPort())), - Scheme: "HTTPS", + Port: ba.GetManagedPort(), + Scheme: ba.GetManagedScheme(), }, }, InitialDelaySeconds: 10, @@ -118,8 +117,8 @@ func GetDefaultMicroProfileLivenessProbe(ba BaseComponent) *corev1.Probe { ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Path: "/health/live", - Port: intstr.FromInt(int(ba.GetService().GetPort())), - Scheme: "HTTPS", + Port: ba.GetManagedPort(), + Scheme: ba.GetManagedScheme(), }, }, InitialDelaySeconds: 60, diff --git a/common/types.go b/common/types.go index 703ecdae..9fd880ec 100644 --- a/common/types.go +++ b/common/types.go @@ -342,6 +342,8 @@ type BaseComponent interface { GetTopologySpreadConstraints() BaseComponentTopologySpreadConstraints GetSecurityContext() *corev1.SecurityContext GetManageTLS() *bool + GetManagedPort() intstr.IntOrString + GetManagedScheme() corev1.URIScheme GetDisableServiceLinks() *bool GetTolerations() []corev1.Toleration GetDNS() BaseComponentDNS From 6fd775cd7609ba818e90b3ae1e6b360ef23da204 Mon Sep 17 00:00:00 2001 From: Kirby Chin <37311900+kabicin@users.noreply.github.com> Date: Wed, 26 Nov 2025 11:32:23 -0500 Subject: [PATCH 04/11] Return int for GetManagedPort --- api/v1/runtimecomponent_types.go | 4 ++-- common/common.go | 7 ++++--- common/types.go | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/api/v1/runtimecomponent_types.go b/api/v1/runtimecomponent_types.go index 98a491db..b2ccfdf1 100644 --- a/api/v1/runtimecomponent_types.go +++ b/api/v1/runtimecomponent_types.go @@ -765,8 +765,8 @@ func (cr *RuntimeComponent) GetManageTLS() *bool { return cr.Spec.ManageTLS } -func (cr *RuntimeComponent) GetManagedPort() intstr.IntOrString { - return intstr.FromInt(int(cr.GetService().GetPort())) +func (cr *RuntimeComponent) GetManagedPort() int { + return int(cr.GetService().GetPort()) } func (cr *RuntimeComponent) GetManagedScheme() corev1.URIScheme { diff --git a/common/common.go b/common/common.go index 1e37186d..8ea662a3 100644 --- a/common/common.go +++ b/common/common.go @@ -2,6 +2,7 @@ package common import ( corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/util/intstr" ) func ConvertBaseComponentProbeToCoreProbe(bcp *BaseComponentProbe, defaultProbe *corev1.Probe) *corev1.Probe { @@ -84,7 +85,7 @@ func GetDefaultMicroProfileStartupProbe(ba BaseComponent) *corev1.Probe { ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Path: "/health/started", - Port: ba.GetManagedPort(), + Port: intstr.FromInt(ba.GetManagedPort()), Scheme: ba.GetManagedScheme(), }, }, @@ -100,7 +101,7 @@ func GetDefaultMicroProfileReadinessProbe(ba BaseComponent) *corev1.Probe { ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Path: "/health/ready", - Port: ba.GetManagedPort(), + Port: intstr.FromInt(ba.GetManagedPort()), Scheme: ba.GetManagedScheme(), }, }, @@ -117,7 +118,7 @@ func GetDefaultMicroProfileLivenessProbe(ba BaseComponent) *corev1.Probe { ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Path: "/health/live", - Port: ba.GetManagedPort(), + Port: intstr.FromInt(ba.GetManagedPort()), Scheme: ba.GetManagedScheme(), }, }, diff --git a/common/types.go b/common/types.go index 9fd880ec..7d81870b 100644 --- a/common/types.go +++ b/common/types.go @@ -342,7 +342,7 @@ type BaseComponent interface { GetTopologySpreadConstraints() BaseComponentTopologySpreadConstraints GetSecurityContext() *corev1.SecurityContext GetManageTLS() *bool - GetManagedPort() intstr.IntOrString + GetManagedPort() int GetManagedScheme() corev1.URIScheme GetDisableServiceLinks() *bool GetTolerations() []corev1.Toleration From 9fccebe02fd04b2cc9d0f21f8f01dbdbb32d9efb Mon Sep 17 00:00:00 2001 From: Kirby Chin <37311900+kabicin@users.noreply.github.com> Date: Wed, 26 Nov 2025 16:09:34 -0500 Subject: [PATCH 05/11] Revert BaseComponentProbe to corev1.Probe changes --- api/v1/runtimecomponent_types.go | 21 +-- api/v1/zz_generated.deepcopy.go | 6 +- api/v1beta2/runtimecomponent_types.go | 6 +- common/common.go | 126 ++++++++---------- common/types.go | 6 +- .../rc.app.stacks_runtimecomponents.yaml | 21 +-- utils/utils.go | 43 +----- utils/utils_test.go | 22 +-- 8 files changed, 99 insertions(+), 152 deletions(-) diff --git a/api/v1/runtimecomponent_types.go b/api/v1/runtimecomponent_types.go index b2ccfdf1..c81beccb 100644 --- a/api/v1/runtimecomponent_types.go +++ b/api/v1/runtimecomponent_types.go @@ -206,15 +206,15 @@ type RuntimeComponentServiceAccount struct { type RuntimeComponentProbes struct { // Periodic probe of container liveness. Container will be restarted if the probe fails. // +operator-sdk:csv:customresourcedefinitions:order=3,type=spec,displayName="Liveness Probe" - Liveness *common.BaseComponentProbe `json:"liveness,omitempty"` + Liveness *corev1.Probe `json:"liveness,omitempty"` // Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. // +operator-sdk:csv:customresourcedefinitions:order=2,type=spec,displayName="Readiness Probe" - Readiness *common.BaseComponentProbe `json:"readiness,omitempty"` + Readiness *corev1.Probe `json:"readiness,omitempty"` // Probe to determine successful initialization. If specified, other probes are not executed until this completes successfully. // +operator-sdk:csv:customresourcedefinitions:order=1,type=spec,displayName="Startup Probe" - Startup *common.BaseComponentProbe `json:"startup,omitempty"` + Startup *corev1.Probe `json:"startup,omitempty"` } // Configure pods to run on particular Nodes. @@ -611,18 +611,19 @@ func (cr *RuntimeComponent) GetProbes() common.BaseComponentProbes { } // GetLivenessProbe returns liveness probe -func (p *RuntimeComponentProbes) GetLivenessProbe(ba common.BaseComponent) *corev1.Probe { - return common.ConvertBaseComponentProbeToCoreProbe(p.Liveness, p.GetDefaultLivenessProbe(ba)) +func (p *RuntimeComponentProbes) GetLivenessProbe() *corev1.Probe { + return p.Liveness } // GetReadinessProbe returns readiness probe -func (p *RuntimeComponentProbes) GetReadinessProbe(ba common.BaseComponent) *corev1.Probe { - return common.ConvertBaseComponentProbeToCoreProbe(p.Readiness, p.GetDefaultReadinessProbe(ba)) +func (p *RuntimeComponentProbes) GetReadinessProbe() *corev1.Probe { + return p.Readiness + } // GetStartupProbe returns startup probe -func (p *RuntimeComponentProbes) GetStartupProbe(ba common.BaseComponent) *corev1.Probe { - return common.ConvertBaseComponentProbeToCoreProbe(p.Startup, p.GetDefaultStartupProbe(ba)) +func (p *RuntimeComponentProbes) GetStartupProbe() *corev1.Probe { + return p.Startup } // GetDefaultLivenessProbe returns default values for liveness probe @@ -770,7 +771,7 @@ func (cr *RuntimeComponent) GetManagedPort() int { } func (cr *RuntimeComponent) GetManagedScheme() corev1.URIScheme { - if cr.GetManageTLS() != nil && *cr.GetManageTLS() { + if cr.GetManageTLS() == nil || *cr.GetManageTLS() { return corev1.URISchemeHTTPS } return corev1.URISchemeHTTP diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go index 689d5de4..b29eed28 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -343,17 +343,17 @@ func (in *RuntimeComponentProbes) DeepCopyInto(out *RuntimeComponentProbes) { *out = *in if in.Liveness != nil { in, out := &in.Liveness, &out.Liveness - *out = new(common.BaseComponentProbe) + *out = new(corev1.Probe) (*in).DeepCopyInto(*out) } if in.Readiness != nil { in, out := &in.Readiness, &out.Readiness - *out = new(common.BaseComponentProbe) + *out = new(corev1.Probe) (*in).DeepCopyInto(*out) } if in.Startup != nil { in, out := &in.Startup, &out.Startup - *out = new(common.BaseComponentProbe) + *out = new(corev1.Probe) (*in).DeepCopyInto(*out) } } diff --git a/api/v1beta2/runtimecomponent_types.go b/api/v1beta2/runtimecomponent_types.go index 6375bf62..6411a77b 100644 --- a/api/v1beta2/runtimecomponent_types.go +++ b/api/v1beta2/runtimecomponent_types.go @@ -488,17 +488,17 @@ func (cr *RuntimeComponent) GetProbes() common.BaseComponentProbes { } // GetLivenessProbe returns liveness probe -func (p *RuntimeComponentProbes) GetLivenessProbe(ba common.BaseComponent) *corev1.Probe { +func (p *RuntimeComponentProbes) GetLivenessProbe() *corev1.Probe { return p.Liveness } // GetReadinessProbe returns readiness probe -func (p *RuntimeComponentProbes) GetReadinessProbe(ba common.BaseComponent) *corev1.Probe { +func (p *RuntimeComponentProbes) GetReadinessProbe() *corev1.Probe { return p.Readiness } // GetStartupProbe returns startup probe -func (p *RuntimeComponentProbes) GetStartupProbe(ba common.BaseComponent) *corev1.Probe { +func (p *RuntimeComponentProbes) GetStartupProbe() *corev1.Probe { return p.Startup } diff --git a/common/common.go b/common/common.go index 8ea662a3..ff53cb61 100644 --- a/common/common.go +++ b/common/common.go @@ -5,80 +5,6 @@ import ( "k8s.io/apimachinery/pkg/util/intstr" ) -func ConvertBaseComponentProbeToCoreProbe(bcp *BaseComponentProbe, defaultProbe *corev1.Probe) *corev1.Probe { - if bcp == nil { - return nil - } - return CustomizeBaseComponentProbeDefaults(bcp, defaultProbe) -} - -func CustomizeBaseComponentProbeDefaults(config *BaseComponentProbe, defaultProbe *corev1.Probe) *corev1.Probe { - probe := defaultProbe - if probe == nil { - probe = &corev1.Probe{} - } - if config == nil { - return probe - } - if config.BaseComponentProbeHandler.Exec != nil { - probe.ProbeHandler.Exec = config.BaseComponentProbeHandler.Exec - } - if config.BaseComponentProbeHandler.GRPC != nil { - probe.ProbeHandler.GRPC = config.BaseComponentProbeHandler.GRPC - } - if config.BaseComponentProbeHandler.TCPSocket != nil { - probe.ProbeHandler.TCPSocket = config.BaseComponentProbeHandler.TCPSocket - } - if config.BaseComponentProbeHandler.HTTPGet != nil { - probe.ProbeHandler.HTTPGet = convertOptionalHTTPGetActionToHTTPGetAction(config.BaseComponentProbeHandler.HTTPGet, probe.ProbeHandler.HTTPGet) - } - if config.InitialDelaySeconds != 0 { - probe.InitialDelaySeconds = config.InitialDelaySeconds - } - if config.TimeoutSeconds != 0 { - probe.TimeoutSeconds = config.TimeoutSeconds - } - if config.PeriodSeconds != 0 { - probe.PeriodSeconds = config.PeriodSeconds - } - if config.SuccessThreshold != 0 { - probe.SuccessThreshold = config.SuccessThreshold - } - if config.FailureThreshold != 0 { - probe.FailureThreshold = config.FailureThreshold - } - if config.TerminationGracePeriodSeconds != nil { - probe.TerminationGracePeriodSeconds = config.TerminationGracePeriodSeconds - } - return probe -} - -func convertOptionalHTTPGetActionToHTTPGetAction(optAction *OptionalHTTPGetAction, defaultHTTPGetAction *corev1.HTTPGetAction) *corev1.HTTPGetAction { - action := defaultHTTPGetAction - if action == nil { - action = &corev1.HTTPGetAction{} - } - if optAction == nil { - return action - } - if optAction.Host != nil { - action.Host = *optAction.Host - } - if optAction.Path != nil { - action.Path = *optAction.Path - } - if optAction.Port != nil { - action.Port = *optAction.Port - } - if optAction.Scheme != nil { - action.Scheme = *optAction.Scheme - } - if optAction.HTTPHeaders != nil { - action.HTTPHeaders = *optAction.HTTPHeaders - } - return action -} - // GetDefaultMicroProfileStartupProbe returns the default values for MicroProfile Health-based startup probe. func GetDefaultMicroProfileStartupProbe(ba BaseComponent) *corev1.Probe { return &corev1.Probe{ @@ -133,3 +59,55 @@ func GetDefaultMicroProfileLivenessProbe(ba BaseComponent) *corev1.Probe { func GetComponentNameLabel(ba BaseComponent) string { return ba.GetGroupName() + "/name" } + +func CustomizeProbeDefaults(config *corev1.Probe, defaultProbe *corev1.Probe) *corev1.Probe { + probe := defaultProbe + if config.ProbeHandler.Exec != nil { + probe.ProbeHandler.Exec = config.ProbeHandler.Exec + } + if config.ProbeHandler.GRPC != nil { + probe.ProbeHandler.GRPC = config.ProbeHandler.GRPC + } + if config.ProbeHandler.HTTPGet != nil { + if probe.ProbeHandler.HTTPGet == nil { + probe.ProbeHandler.HTTPGet = &corev1.HTTPGetAction{} + } + if config.ProbeHandler.HTTPGet.Port.Type != 0 { + probe.ProbeHandler.HTTPGet.Port = config.ProbeHandler.HTTPGet.Port + } + if config.ProbeHandler.HTTPGet.Host != "" { + probe.ProbeHandler.HTTPGet.Host = config.ProbeHandler.HTTPGet.Host + } + if config.ProbeHandler.HTTPGet.Path != "" { + probe.ProbeHandler.HTTPGet.Path = config.ProbeHandler.HTTPGet.Path + } + if config.ProbeHandler.HTTPGet.Scheme != "" { + probe.ProbeHandler.HTTPGet.Scheme = config.ProbeHandler.HTTPGet.Scheme + } + if len(config.ProbeHandler.HTTPGet.HTTPHeaders) > 0 { + probe.ProbeHandler.HTTPGet.HTTPHeaders = config.ProbeHandler.HTTPGet.HTTPHeaders + } + } + if config.ProbeHandler.TCPSocket != nil { + probe.ProbeHandler.TCPSocket = config.ProbeHandler.TCPSocket + } + if config.InitialDelaySeconds != 0 { + probe.InitialDelaySeconds = config.InitialDelaySeconds + } + if config.TimeoutSeconds != 0 { + probe.TimeoutSeconds = config.TimeoutSeconds + } + if config.PeriodSeconds != 0 { + probe.PeriodSeconds = config.PeriodSeconds + } + if config.SuccessThreshold != 0 { + probe.SuccessThreshold = config.SuccessThreshold + } + if config.FailureThreshold != 0 { + probe.FailureThreshold = config.FailureThreshold + } + if config.TerminationGracePeriodSeconds != nil { + probe.TerminationGracePeriodSeconds = config.TerminationGracePeriodSeconds + } + return probe +} diff --git a/common/types.go b/common/types.go index 7d81870b..51c9c8e9 100644 --- a/common/types.go +++ b/common/types.go @@ -282,9 +282,9 @@ type OptionalHTTPGetAction struct { // BaseComponentProbes describes the probes for application container type BaseComponentProbes interface { - GetLivenessProbe(ba BaseComponent) *corev1.Probe - GetReadinessProbe(ba BaseComponent) *corev1.Probe - GetStartupProbe(ba BaseComponent) *corev1.Probe + GetLivenessProbe() *corev1.Probe + GetReadinessProbe() *corev1.Probe + GetStartupProbe() *corev1.Probe GetDefaultLivenessProbe(ba BaseComponent) *corev1.Probe GetDefaultReadinessProbe(ba BaseComponent) *corev1.Probe diff --git a/config/crd/bases/rc.app.stacks_runtimecomponents.yaml b/config/crd/bases/rc.app.stacks_runtimecomponents.yaml index 90086a54..89b5e68b 100644 --- a/config/crd/bases/rc.app.stacks_runtimecomponents.yaml +++ b/config/crd/bases/rc.app.stacks_runtimecomponents.yaml @@ -4369,9 +4369,7 @@ spec: format: int32 type: integer grpc: - description: |- - GRPC specifies an action involving a GRPC port. - This is a beta field and requires enabling GRPCContainerProbe feature gate. + description: GRPC specifies an action involving a GRPC port. properties: port: description: Port number of the gRPC service. Number must @@ -4417,6 +4415,7 @@ spec: - value type: object type: array + x-kubernetes-list-type: atomic path: description: Path to access on the HTTP server. type: string @@ -4434,6 +4433,8 @@ spec: Scheme to use for connecting to the host. Defaults to HTTP. type: string + required: + - port type: object initialDelaySeconds: description: |- @@ -4521,9 +4522,7 @@ spec: format: int32 type: integer grpc: - description: |- - GRPC specifies an action involving a GRPC port. - This is a beta field and requires enabling GRPCContainerProbe feature gate. + description: GRPC specifies an action involving a GRPC port. properties: port: description: Port number of the gRPC service. Number must @@ -4569,6 +4568,7 @@ spec: - value type: object type: array + x-kubernetes-list-type: atomic path: description: Path to access on the HTTP server. type: string @@ -4586,6 +4586,8 @@ spec: Scheme to use for connecting to the host. Defaults to HTTP. type: string + required: + - port type: object initialDelaySeconds: description: |- @@ -4674,9 +4676,7 @@ spec: format: int32 type: integer grpc: - description: |- - GRPC specifies an action involving a GRPC port. - This is a beta field and requires enabling GRPCContainerProbe feature gate. + description: GRPC specifies an action involving a GRPC port. properties: port: description: Port number of the gRPC service. Number must @@ -4722,6 +4722,7 @@ spec: - value type: object type: array + x-kubernetes-list-type: atomic path: description: Path to access on the HTTP server. type: string @@ -4739,6 +4740,8 @@ spec: Scheme to use for connecting to the host. Defaults to HTTP. type: string + required: + - port type: object initialDelaySeconds: description: |- diff --git a/utils/utils.go b/utils/utils.go index 7a77fdd4..51ab5e33 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -299,9 +299,9 @@ func CustomizeProbes(container *corev1.Container, ba common.BaseComponent) { return } - container.ReadinessProbe = customizeProbe(probesConfig.GetReadinessProbe(ba), probesConfig.GetDefaultReadinessProbe, ba) - container.LivenessProbe = customizeProbe(probesConfig.GetLivenessProbe(ba), probesConfig.GetDefaultLivenessProbe, ba) - container.StartupProbe = customizeProbe(probesConfig.GetStartupProbe(ba), probesConfig.GetDefaultStartupProbe, ba) + container.ReadinessProbe = customizeProbe(probesConfig.GetReadinessProbe(), probesConfig.GetDefaultReadinessProbe, ba) + container.LivenessProbe = customizeProbe(probesConfig.GetLivenessProbe(), probesConfig.GetDefaultLivenessProbe, ba) + container.StartupProbe = customizeProbe(probesConfig.GetStartupProbe(), probesConfig.GetDefaultStartupProbe, ba) } func customizeProbe(config *corev1.Probe, defaultProbeCallback func(ba common.BaseComponent) *corev1.Probe, ba common.BaseComponent) *corev1.Probe { @@ -311,42 +311,7 @@ func customizeProbe(config *corev1.Probe, defaultProbeCallback func(ba common.Ba } // Probe handler is not defined so use default values for the probe if values not set in probe config - return CustomizeProbeDefaults(config, defaultProbeCallback(ba)) -} - -func CustomizeProbeDefaults(config *corev1.Probe, defaultProbe *corev1.Probe) *corev1.Probe { - probe := defaultProbe - if config.ProbeHandler.Exec != nil { - probe.ProbeHandler.Exec = config.ProbeHandler.Exec - } - if config.ProbeHandler.GRPC != nil { - probe.ProbeHandler.GRPC = config.ProbeHandler.GRPC - } - if config.ProbeHandler.HTTPGet != nil { - probe.ProbeHandler.HTTPGet = config.ProbeHandler.HTTPGet - } - if config.ProbeHandler.TCPSocket != nil { - probe.ProbeHandler.TCPSocket = config.ProbeHandler.TCPSocket - } - if config.InitialDelaySeconds != 0 { - probe.InitialDelaySeconds = config.InitialDelaySeconds - } - if config.TimeoutSeconds != 0 { - probe.TimeoutSeconds = config.TimeoutSeconds - } - if config.PeriodSeconds != 0 { - probe.PeriodSeconds = config.PeriodSeconds - } - if config.SuccessThreshold != 0 { - probe.SuccessThreshold = config.SuccessThreshold - } - if config.FailureThreshold != 0 { - probe.FailureThreshold = config.FailureThreshold - } - if config.TerminationGracePeriodSeconds != nil { - probe.TerminationGracePeriodSeconds = config.TerminationGracePeriodSeconds - } - return probe + return common.CustomizeProbeDefaults(config, defaultProbeCallback(ba)) } // CustomizeNetworkPolicy configures the network policy. diff --git a/utils/utils_test.go b/utils/utils_test.go index 9174530f..f3a9b1a8 100644 --- a/utils/utils_test.go +++ b/utils/utils_test.go @@ -66,21 +66,21 @@ var ( TypeMeta: metav1.TypeMeta{Kind: "StatefulSet"}} storage = appstacksv1.RuntimeComponentStorage{Size: "10Mi", MountPath: "/mnt/data", VolumeClaimTemplate: volumeCT} arch = []string{"ppc64le"} - readinessProbe = &common.BaseComponentProbe{ - BaseComponentProbeHandler: common.BaseComponentProbeHandler{ - HTTPGet: &common.OptionalHTTPGetAction{}, + readinessProbe = &corev1.Probe{ + ProbeHandler: corev1.ProbeHandler{ + HTTPGet: &corev1.HTTPGetAction{}, TCPSocket: &corev1.TCPSocketAction{}, }, } - livenessProbe = &common.BaseComponentProbe{ - BaseComponentProbeHandler: common.BaseComponentProbeHandler{ - HTTPGet: &common.OptionalHTTPGetAction{}, + livenessProbe = &corev1.Probe{ + ProbeHandler: corev1.ProbeHandler{ + HTTPGet: &corev1.HTTPGetAction{}, TCPSocket: &corev1.TCPSocketAction{}, }, } - startupProbe = &common.BaseComponentProbe{ - BaseComponentProbeHandler: common.BaseComponentProbeHandler{ - HTTPGet: &common.OptionalHTTPGetAction{}, + startupProbe = &corev1.Probe{ + ProbeHandler: corev1.ProbeHandler{ + HTTPGet: &corev1.HTTPGetAction{}, TCPSocket: &corev1.TCPSocketAction{}, }, } @@ -156,7 +156,7 @@ func TestCustomizeService(t *testing.T) { CustomizeService(svc, runtime) testCS := []Test{ {"Service number of exposed ports", 1, len(svc.Spec.Ports)}, - {"Sercice first exposed port", runtime.Spec.Service.Port, svc.Spec.Ports[0].Port}, + {"Service first exposed port", runtime.Spec.Service.Port, svc.Spec.Ports[0].Port}, {"Service first exposed target port", intstr.FromInt(int(runtime.Spec.Service.Port)), svc.Spec.Ports[0].TargetPort}, {"Service type", *runtime.Spec.Service.Type, svc.Spec.Type}, {"Service selector", name, svc.Spec.Selector["app.kubernetes.io/instance"]}, @@ -195,7 +195,7 @@ func optionalNodePortFunctionalityTests() []Test { CustomizeService(svc, runtime) testCS := []Test{ {"Service number of exposed ports", 1, len(svc.Spec.Ports)}, - {"Sercice first exposed port", runtime.Spec.Service.Port, svc.Spec.Ports[0].Port}, + {"Service first exposed port", runtime.Spec.Service.Port, svc.Spec.Ports[0].Port}, {"Service first exposed target port", intstr.FromInt(int(runtime.Spec.Service.Port)), svc.Spec.Ports[0].TargetPort}, {"Service type", *runtime.Spec.Service.Type, svc.Spec.Type}, {"Service selector", name, svc.Spec.Selector["app.kubernetes.io/instance"]}, From 72b5eca8dac55d688fdc109236577d8e518ef24f Mon Sep 17 00:00:00 2001 From: Kirby Chin <37311900+kabicin@users.noreply.github.com> Date: Wed, 26 Nov 2025 16:44:19 -0500 Subject: [PATCH 06/11] Add default to GetManagedPort() when service is nil --- api/v1/runtimecomponent_types.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/api/v1/runtimecomponent_types.go b/api/v1/runtimecomponent_types.go index c81beccb..77adcc0d 100644 --- a/api/v1/runtimecomponent_types.go +++ b/api/v1/runtimecomponent_types.go @@ -767,7 +767,10 @@ func (cr *RuntimeComponent) GetManageTLS() *bool { } func (cr *RuntimeComponent) GetManagedPort() int { - return int(cr.GetService().GetPort()) + if cr.GetService() != nil && cr.GetService().GetPort() != 0 { + return int(cr.GetService().GetPort()) + } + return 8080 } func (cr *RuntimeComponent) GetManagedScheme() corev1.URIScheme { @@ -1119,7 +1122,7 @@ func (cr *RuntimeComponent) Initialize() { } if cr.Spec.Service.Port == 0 { - cr.Spec.Service.Port = 8080 + cr.Spec.Service.Port = int32(cr.GetManagedPort()) } // If TargetPorts on Serviceports are not set, default them to the Port value in the CR From 70bfde7846834b4cea9a1d160e4968d5133fb118 Mon Sep 17 00:00:00 2001 From: Kirby Chin <37311900+kabicin@users.noreply.github.com> Date: Thu, 27 Nov 2025 17:04:05 -0500 Subject: [PATCH 07/11] Default GetManagedScheme() to HTTPS --- api/v1/runtimecomponent_types.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/api/v1/runtimecomponent_types.go b/api/v1/runtimecomponent_types.go index 77adcc0d..9edee81b 100644 --- a/api/v1/runtimecomponent_types.go +++ b/api/v1/runtimecomponent_types.go @@ -774,10 +774,7 @@ func (cr *RuntimeComponent) GetManagedPort() int { } func (cr *RuntimeComponent) GetManagedScheme() corev1.URIScheme { - if cr.GetManageTLS() == nil || *cr.GetManageTLS() { - return corev1.URISchemeHTTPS - } - return corev1.URISchemeHTTP + return corev1.URISchemeHTTPS } // GetDeployment returns deployment settings From 652a0c602935535284567e56a5018f5fe967eb8a Mon Sep 17 00:00:00 2001 From: Kirby Chin <37311900+kabicin@users.noreply.github.com> Date: Thu, 27 Nov 2025 17:24:13 -0500 Subject: [PATCH 08/11] Remove GetManagedScheme() --- api/v1/runtimecomponent_types.go | 4 ---- common/common.go | 6 +++--- common/types.go | 1 - 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/api/v1/runtimecomponent_types.go b/api/v1/runtimecomponent_types.go index 9edee81b..282d0f21 100644 --- a/api/v1/runtimecomponent_types.go +++ b/api/v1/runtimecomponent_types.go @@ -773,10 +773,6 @@ func (cr *RuntimeComponent) GetManagedPort() int { return 8080 } -func (cr *RuntimeComponent) GetManagedScheme() corev1.URIScheme { - return corev1.URISchemeHTTPS -} - // GetDeployment returns deployment settings func (cr *RuntimeComponent) GetDeployment() common.BaseComponentDeployment { if cr.Spec.Deployment == nil { diff --git a/common/common.go b/common/common.go index ff53cb61..eda8d16b 100644 --- a/common/common.go +++ b/common/common.go @@ -12,7 +12,7 @@ func GetDefaultMicroProfileStartupProbe(ba BaseComponent) *corev1.Probe { HTTPGet: &corev1.HTTPGetAction{ Path: "/health/started", Port: intstr.FromInt(ba.GetManagedPort()), - Scheme: ba.GetManagedScheme(), + Scheme: corev1.URISchemeHTTPS, }, }, PeriodSeconds: 10, @@ -28,7 +28,7 @@ func GetDefaultMicroProfileReadinessProbe(ba BaseComponent) *corev1.Probe { HTTPGet: &corev1.HTTPGetAction{ Path: "/health/ready", Port: intstr.FromInt(ba.GetManagedPort()), - Scheme: ba.GetManagedScheme(), + Scheme: corev1.URISchemeHTTPS, }, }, InitialDelaySeconds: 10, @@ -45,7 +45,7 @@ func GetDefaultMicroProfileLivenessProbe(ba BaseComponent) *corev1.Probe { HTTPGet: &corev1.HTTPGetAction{ Path: "/health/live", Port: intstr.FromInt(ba.GetManagedPort()), - Scheme: ba.GetManagedScheme(), + Scheme: corev1.URISchemeHTTPS, }, }, InitialDelaySeconds: 60, diff --git a/common/types.go b/common/types.go index 51c9c8e9..2d5efc03 100644 --- a/common/types.go +++ b/common/types.go @@ -343,7 +343,6 @@ type BaseComponent interface { GetSecurityContext() *corev1.SecurityContext GetManageTLS() *bool GetManagedPort() int - GetManagedScheme() corev1.URIScheme GetDisableServiceLinks() *bool GetTolerations() []corev1.Toleration GetDNS() BaseComponentDNS From d739fcc4dace5a8b4551d9b8e09c37b1ed4332e8 Mon Sep 17 00:00:00 2001 From: Kirby Chin <37311900+kabicin@users.noreply.github.com> Date: Fri, 28 Nov 2025 15:15:26 -0500 Subject: [PATCH 09/11] Remove unused structs --- common/types.go | 85 --------------------- common/zz_generated.deepcopy.go | 126 -------------------------------- 2 files changed, 211 deletions(-) delete mode 100644 common/zz_generated.deepcopy.go diff --git a/common/types.go b/common/types.go index 2d5efc03..2772e78a 100644 --- a/common/types.go +++ b/common/types.go @@ -9,7 +9,6 @@ import ( v1 "k8s.io/api/core/v1" networkingv1 "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/intstr" ) // StatusConditionType ... @@ -196,90 +195,6 @@ type BaseComponentStatefulSet interface { GetAnnotations() map[string]string } -// This struct is taken from the Probe specification in https://github.com/kubernetes/api/blob/v0.33.4/core/v1/types.go -// +kubebuilder:object:generate=true -type BaseComponentProbe struct { - // The action taken to determine the health of a container - BaseComponentProbeHandler `json:",inline"` - // Number of seconds after the container has started before liveness probes are initiated. - // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - // +optional - InitialDelaySeconds int32 `json:"initialDelaySeconds,omitempty"` - // Number of seconds after which the probe times out. - // Defaults to 1 second. Minimum value is 1. - // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - // +optional - TimeoutSeconds int32 `json:"timeoutSeconds,omitempty"` - // How often (in seconds) to perform the probe. - // Default to 10 seconds. Minimum value is 1. - // +optional - PeriodSeconds int32 `json:"periodSeconds,omitempty"` - // Minimum consecutive successes for the probe to be considered successful after having failed. - // Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. - // +optional - SuccessThreshold int32 `json:"successThreshold,omitempty"` - // Minimum consecutive failures for the probe to be considered failed after having succeeded. - // Defaults to 3. Minimum value is 1. - // +optional - FailureThreshold int32 `json:"failureThreshold,omitempty"` - // Optional duration in seconds the pod needs to terminate gracefully upon probe failure. - // The grace period is the duration in seconds after the processes running in the pod are sent - // a termination signal and the time when the processes are forcibly halted with a kill signal. - // Set this value longer than the expected cleanup time for your process. - // If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this - // value overrides the value provided by the pod spec. - // Value must be non-negative integer. The value zero indicates stop immediately via - // the kill signal (no opportunity to shut down). - // This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. - // Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. - // +optional - TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"` -} - -// This struct is taken from the ProbeHandler specification in https://github.com/kubernetes/api/blob/v0.33.4/core/v1/types.go -// +kubebuilder:object:generate=true -type BaseComponentProbeHandler struct { - // Exec specifies the action to take. - // +optional - Exec *corev1.ExecAction `json:"exec,omitempty"` - // HTTPGet specifies the http request to perform. - // +optional - HTTPGet *OptionalHTTPGetAction `json:"httpGet,omitempty"` - // TCPSocket specifies an action involving a TCP port. - // +optional - TCPSocket *corev1.TCPSocketAction `json:"tcpSocket,omitempty"` - - // GRPC specifies an action involving a GRPC port. - // This is a beta field and requires enabling GRPCContainerProbe feature gate. - // +featureGate=GRPCContainerProbe - // +optional - GRPC *corev1.GRPCAction `json:"grpc,omitempty"` -} - -// This struct is based upon the HTTPGetAction specification in https://github.com/kubernetes/api/blob/v0.33.4/core/v1/types.go -// +kubebuilder:object:generate=true -type OptionalHTTPGetAction struct { - // Path to access on the HTTP server. - // +optional - Path *string `json:"path,omitempty"` - // Name or number of the port to access on the container. - // Number must be in the range 1 to 65535. - // Name must be an IANA_SVC_NAME. - // +optional - Port *intstr.IntOrString `json:"port,omitempty"` - // Host name to connect to, defaults to the pod IP. You probably want to set - // "Host" in httpHeaders instead. - // +optional - Host *string `json:"host,omitempty"` - // Scheme to use for connecting to the host. - // Defaults to HTTP. - // +optional - Scheme *corev1.URIScheme `json:"scheme,omitempty"` - // Custom headers to set in the request. HTTP allows repeated headers. - // +optional - HTTPHeaders *[]corev1.HTTPHeader `json:"httpHeaders,omitempty"` -} - // BaseComponentProbes describes the probes for application container type BaseComponentProbes interface { GetLivenessProbe() *corev1.Probe diff --git a/common/zz_generated.deepcopy.go b/common/zz_generated.deepcopy.go deleted file mode 100644 index 8cbba2c9..00000000 --- a/common/zz_generated.deepcopy.go +++ /dev/null @@ -1,126 +0,0 @@ -//go:build !ignore_autogenerated - -/* - - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by controller-gen. DO NOT EDIT. - -package common - -import ( - "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/util/intstr" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BaseComponentProbe) DeepCopyInto(out *BaseComponentProbe) { - *out = *in - in.BaseComponentProbeHandler.DeepCopyInto(&out.BaseComponentProbeHandler) - if in.TerminationGracePeriodSeconds != nil { - in, out := &in.TerminationGracePeriodSeconds, &out.TerminationGracePeriodSeconds - *out = new(int64) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BaseComponentProbe. -func (in *BaseComponentProbe) DeepCopy() *BaseComponentProbe { - if in == nil { - return nil - } - out := new(BaseComponentProbe) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BaseComponentProbeHandler) DeepCopyInto(out *BaseComponentProbeHandler) { - *out = *in - if in.Exec != nil { - in, out := &in.Exec, &out.Exec - *out = new(v1.ExecAction) - (*in).DeepCopyInto(*out) - } - if in.HTTPGet != nil { - in, out := &in.HTTPGet, &out.HTTPGet - *out = new(OptionalHTTPGetAction) - (*in).DeepCopyInto(*out) - } - if in.TCPSocket != nil { - in, out := &in.TCPSocket, &out.TCPSocket - *out = new(v1.TCPSocketAction) - **out = **in - } - if in.GRPC != nil { - in, out := &in.GRPC, &out.GRPC - *out = new(v1.GRPCAction) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BaseComponentProbeHandler. -func (in *BaseComponentProbeHandler) DeepCopy() *BaseComponentProbeHandler { - if in == nil { - return nil - } - out := new(BaseComponentProbeHandler) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OptionalHTTPGetAction) DeepCopyInto(out *OptionalHTTPGetAction) { - *out = *in - if in.Path != nil { - in, out := &in.Path, &out.Path - *out = new(string) - **out = **in - } - if in.Port != nil { - in, out := &in.Port, &out.Port - *out = new(intstr.IntOrString) - **out = **in - } - if in.Host != nil { - in, out := &in.Host, &out.Host - *out = new(string) - **out = **in - } - if in.Scheme != nil { - in, out := &in.Scheme, &out.Scheme - *out = new(v1.URIScheme) - **out = **in - } - if in.HTTPHeaders != nil { - in, out := &in.HTTPHeaders, &out.HTTPHeaders - *out = new([]v1.HTTPHeader) - if **in != nil { - in, out := *in, *out - *out = make([]v1.HTTPHeader, len(*in)) - copy(*out, *in) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OptionalHTTPGetAction. -func (in *OptionalHTTPGetAction) DeepCopy() *OptionalHTTPGetAction { - if in == nil { - return nil - } - out := new(OptionalHTTPGetAction) - in.DeepCopyInto(out) - return out -} From 705ae0b571a6ec711bc53dd05c4d59db4bc84e63 Mon Sep 17 00:00:00 2001 From: Kirby Chin <37311900+kabicin@users.noreply.github.com> Date: Fri, 28 Nov 2025 15:50:48 -0500 Subject: [PATCH 10/11] Add GetManagedScheme() --- api/v1/runtimecomponent_types.go | 7 +++++++ common/common.go | 10 ++++------ common/types.go | 1 + 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/api/v1/runtimecomponent_types.go b/api/v1/runtimecomponent_types.go index 282d0f21..77adcc0d 100644 --- a/api/v1/runtimecomponent_types.go +++ b/api/v1/runtimecomponent_types.go @@ -773,6 +773,13 @@ func (cr *RuntimeComponent) GetManagedPort() int { return 8080 } +func (cr *RuntimeComponent) GetManagedScheme() corev1.URIScheme { + if cr.GetManageTLS() == nil || *cr.GetManageTLS() { + return corev1.URISchemeHTTPS + } + return corev1.URISchemeHTTP +} + // GetDeployment returns deployment settings func (cr *RuntimeComponent) GetDeployment() common.BaseComponentDeployment { if cr.Spec.Deployment == nil { diff --git a/common/common.go b/common/common.go index eda8d16b..10b7213f 100644 --- a/common/common.go +++ b/common/common.go @@ -12,7 +12,7 @@ func GetDefaultMicroProfileStartupProbe(ba BaseComponent) *corev1.Probe { HTTPGet: &corev1.HTTPGetAction{ Path: "/health/started", Port: intstr.FromInt(ba.GetManagedPort()), - Scheme: corev1.URISchemeHTTPS, + Scheme: ba.GetManagedScheme(), }, }, PeriodSeconds: 10, @@ -28,7 +28,7 @@ func GetDefaultMicroProfileReadinessProbe(ba BaseComponent) *corev1.Probe { HTTPGet: &corev1.HTTPGetAction{ Path: "/health/ready", Port: intstr.FromInt(ba.GetManagedPort()), - Scheme: corev1.URISchemeHTTPS, + Scheme: ba.GetManagedScheme(), }, }, InitialDelaySeconds: 10, @@ -45,7 +45,7 @@ func GetDefaultMicroProfileLivenessProbe(ba BaseComponent) *corev1.Probe { HTTPGet: &corev1.HTTPGetAction{ Path: "/health/live", Port: intstr.FromInt(ba.GetManagedPort()), - Scheme: corev1.URISchemeHTTPS, + Scheme: ba.GetManagedScheme(), }, }, InitialDelaySeconds: 60, @@ -72,9 +72,7 @@ func CustomizeProbeDefaults(config *corev1.Probe, defaultProbe *corev1.Probe) *c if probe.ProbeHandler.HTTPGet == nil { probe.ProbeHandler.HTTPGet = &corev1.HTTPGetAction{} } - if config.ProbeHandler.HTTPGet.Port.Type != 0 { - probe.ProbeHandler.HTTPGet.Port = config.ProbeHandler.HTTPGet.Port - } + probe.ProbeHandler.HTTPGet.Port = config.ProbeHandler.HTTPGet.Port if config.ProbeHandler.HTTPGet.Host != "" { probe.ProbeHandler.HTTPGet.Host = config.ProbeHandler.HTTPGet.Host } diff --git a/common/types.go b/common/types.go index 2772e78a..8ca37850 100644 --- a/common/types.go +++ b/common/types.go @@ -258,6 +258,7 @@ type BaseComponent interface { GetSecurityContext() *corev1.SecurityContext GetManageTLS() *bool GetManagedPort() int + GetManagedScheme() corev1.URIScheme GetDisableServiceLinks() *bool GetTolerations() []corev1.Toleration GetDNS() BaseComponentDNS From dde3d2b3b7a4eda9c5a9ee12dc629c42346226c1 Mon Sep 17 00:00:00 2001 From: Kirby Chin <37311900+kabicin@users.noreply.github.com> Date: Fri, 28 Nov 2025 15:53:06 -0500 Subject: [PATCH 11/11] Revert utils_test.go --- api/v1/runtimecomponent_types.go | 1 - utils/utils_test.go | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/api/v1/runtimecomponent_types.go b/api/v1/runtimecomponent_types.go index 77adcc0d..746e6e5e 100644 --- a/api/v1/runtimecomponent_types.go +++ b/api/v1/runtimecomponent_types.go @@ -618,7 +618,6 @@ func (p *RuntimeComponentProbes) GetLivenessProbe() *corev1.Probe { // GetReadinessProbe returns readiness probe func (p *RuntimeComponentProbes) GetReadinessProbe() *corev1.Probe { return p.Readiness - } // GetStartupProbe returns startup probe diff --git a/utils/utils_test.go b/utils/utils_test.go index f3a9b1a8..a3d58bb8 100644 --- a/utils/utils_test.go +++ b/utils/utils_test.go @@ -616,11 +616,11 @@ func TestCustomizeKnativeService(t *testing.T) { {"ksvc container ports", 1, ksvcNumPorts}, {"ksvc ServiceAccountName is nil", name, ksvcSAN}, {"ksvc ServiceAccountName not nil", *runtime.Spec.ServiceAccountName, ksvc.Spec.Template.Spec.ServiceAccountName}, - {"liveness probe port", intstr.FromInt32(service.Port), ksvcLPPort}, + {"liveness probe port", intstr.IntOrString{}, ksvcLPPort}, {"liveness probe TCP socket port", intstr.IntOrString{}, ksvcLPTCP}, - {"Readiness probe port", intstr.FromInt32(service.Port), ksvcRPPort}, + {"Readiness probe port", intstr.IntOrString{}, ksvcRPPort}, {"Readiness probe TCP socket port", intstr.IntOrString{}, ksvcRPTCP}, - {"Startup probe port", intstr.FromInt32(service.Port), ksvcSPPort}, + {"Startup probe port", intstr.IntOrString{}, ksvcSPPort}, {"Startup probe TCP socket port", intstr.IntOrString{}, ksvcSPTCP}, {"expose not set", "cluster-local", ksvcLabelNoExpose}, {"expose set to true", "", ksvcLabelTrueExpose},