Repository: knative/operator (go)

Issue:
Liveness probe cannot be removed
<!-- 
Are you using Knative? If you do, we would love to know!
https://github.com/knative/community/issues/new?template=ADOPTERS.yaml&title=%5BADOPTERS%5D%3A+%24%7BCOMPANY+NAME+HERE%7D
-->

**Describe the bug**
If `LivenessProbes` is set to an empty array, we expect it should remove the LivenessProbe from the associated deployment, but this dos not occur.

**To Reproduce**
```yaml
...
 -  name: net-kourier-controller
    livenessProbes: []
```

**Knative release version**
Operator 1.14.2

**Additional context**
Copy/pasta error? https://github.com/knative/operator/blob/2614b77024599eb9aeec40bdf3405e4a8ae5744e/pkg/reconciler/common/workload_override.go#L226


Pull request:
fix liveness probe removal
<!-- 
Are you using Knative? If you do, we would love to know!
https://github.com/knative/community/issues/new?template=ADOPTERS.yaml&title=%5BADOPTERS%5D%3A+%24%7BCOMPANY+NAME+HERE%7D
-->


/lint


Fixes #1817 

Usage for this is e.g.
```yaml
- name: 3scale-kourier-gateway
  livenessProbes:
  - container: kourier-gateway
```

**Release Note**

<!-- Enter your extended release note in the below block. If the PR requires
additional action from users switching to the new release, include the string
"action required". If no release note is required, write "NONE". -->

```release-note
Fix bug preventing liveness probes to be overridden to no probe
```


Patch:
diff --git a/pkg/reconciler/common/workload_override.go b/pkg/reconciler/common/workload_override.go
index a979b57af..18ab7a2b8 100644
--- a/pkg/reconciler/common/workload_override.go
+++ b/pkg/reconciler/common/workload_override.go
@@ -223,7 +223,7 @@ func replaceProbes(override *base.WorkloadOverride, ps *corev1.PodTemplateSpec)
 				}
 				if *overrideProbe == (v1.Probe{}) {
 					//  Disable probe when users explicitly set the empty overrideProbe.
-					containers[i].ReadinessProbe = nil
+					containers[i].LivenessProbe = nil
 					continue
 				}
 				if containers[i].LivenessProbe == nil {


Test patch:
diff --git a/pkg/reconciler/common/workload_override_test.go b/pkg/reconciler/common/workload_override_test.go
index b0a36ba0e..3384e4e4a 100644
--- a/pkg/reconciler/common/workload_override_test.go
+++ b/pkg/reconciler/common/workload_override_test.go
@@ -529,7 +529,7 @@ func TestComponentsTransform(t *testing.T) {
 				InitialDelaySeconds: 12,
 			}}},
 	}, {
-		name: "empty probe drops probe",
+		name: "empty readiness probe drops probe",
 		override: []base.WorkloadOverride{
 			{
 				Name: "activator",
@@ -550,6 +550,28 @@ func TestComponentsTransform(t *testing.T) {
 					}},
 			},
 		}},
+	}, {
+		name: "empty liveness probe drops probe",
+		override: []base.WorkloadOverride{
+			{
+				Name: "activator",
+				LivenessProbes: []base.ProbesRequirementsOverride{{
+					Container: "activator",
+				}}},
+		},
+		expDeployment: map[string]expDeployments{"activator": {
+			expLabels:              map[string]string{"serving.knative.dev/release": "v0.13.0"},
+			expTemplateLabels:      map[string]string{"serving.knative.dev/release": "v0.13.0", "app": "activator", "role": "activator"},
+			expTemplateAnnotations: map[string]string{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"},
+			expReplicas:            0,
+			expReadinessProbe: &v1.Probe{
+				ProbeHandler: v1.ProbeHandler{
+					HTTPGet: &v1.HTTPGetAction{
+						Port:        intstr.IntOrString{IntVal: 8012},
+						HTTPHeaders: []v1.HTTPHeader{{Name: "k-kubelet-probe", Value: "activator"}},
+					}},
+			},
+		}},
 	}, {
 		name: "neither replicas in workload override nor global replicas",
 		override: []base.WorkloadOverride{