Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4858,7 +4858,7 @@ spec:
# Activator PDB. Currently we permit unavailability of 20% of tasks at the same time.
# Given the subsetting and that the activators are partially stateful systems, we want
# a slow rollout of the new versions and slow migration during node upgrades.
apiVersion: policy/v1beta1
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: activator-pdb
Expand Down Expand Up @@ -5552,7 +5552,7 @@ spec:
averageUtilization: 100
---
# Webhook PDB.
apiVersion: policy/v1beta1
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: webhook-pdb
Expand Down
20 changes: 1 addition & 19 deletions openshift-knative-operator/hack/003-serving-pdb.patch
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
diff --git a/openshift-knative-operator/cmd/operator/kodata/knative-serving/1.2.0/2-serving-core.yaml b/openshift-knative-operator/cmd/operator/kodata/knative-serving/1.2.0/2-serving-core.yaml
index dd7a139c..fef3b547 100644
index dd7a139ca..c00c382b8 100644
--- a/openshift-knative-operator/cmd/operator/kodata/knative-serving/1.2.0/2-serving-core.yaml
+++ b/openshift-knative-operator/cmd/operator/kodata/knative-serving/1.2.0/2-serving-core.yaml
@@ -4858,7 +4858,7 @@ spec:
# Activator PDB. Currently we permit unavailability of 20% of tasks at the same time.
# Given the subsetting and that the activators are partially stateful systems, we want
# a slow rollout of the new versions and slow migration during node upgrades.
-apiVersion: policy/v1
+apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: activator-pdb
@@ -4869,7 +4869,7 @@ metadata:
app.kubernetes.io/version: "1.2.0"
serving.knative.dev/release: "v1.2.0"
Expand All @@ -20,15 +11,6 @@ index dd7a139c..fef3b547 100644
selector:
matchLabels:
app: activator
@@ -5552,7 +5552,7 @@ spec:
averageUtilization: 100
---
# Webhook PDB.
-apiVersion: policy/v1
+apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: webhook-pdb
@@ -5563,7 +5563,7 @@ metadata:
app.kubernetes.io/version: "1.2.0"
serving.knative.dev/release: "v1.2.0"
Expand Down
20 changes: 20 additions & 0 deletions openshift-knative-operator/pkg/common/api.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package common

import (
mf "github.com/manifestival/manifestival"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
)

// DowngradePodDisruptionBudget downgrade the API version to policy/v1beta1.
func DowngradePodDisruptionBudget() mf.Transformer {
return func(u *unstructured.Unstructured) error {
if u.GetKind() != "PodDisruptionBudget" {
return nil
}
if u.GetAPIVersion() != "policy/v1" {
return nil
}
u.SetAPIVersion("policy/v1beta1")
return nil
}
}
10 changes: 8 additions & 2 deletions openshift-knative-operator/pkg/serving/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (e *extension) Manifests(ks operatorv1alpha1.KComponent) ([]mf.Manifest, er
}

func (e *extension) Transformers(ks operatorv1alpha1.KComponent) []mf.Transformer {
return append([]mf.Transformer{
tf := []mf.Transformer{
common.InjectCommonLabelIntoNamespace(),
common.InjectEnvironmentIntoDeployment("controller", "controller",
corev1.EnvVar{Name: "HTTP_PROXY", Value: os.Getenv("HTTP_PROXY")},
Expand All @@ -72,7 +72,13 @@ func (e *extension) Transformers(ks operatorv1alpha1.KComponent) []mf.Transforme
),
overrideKourierNamespace(ks),
addHTTPOptionDisabledEnvValue(),
}, monitoring.GetServingTransformers(ks)...)
}

if err := checkMinimumVersion(e.kubeclient.Discovery(), "1.21.0"); err != nil {
tf = append(tf, common.DowngradePodDisruptionBudget())
}

return append(tf, monitoring.GetServingTransformers(ks)...)
}

func (e *extension) Reconcile(ctx context.Context, comp operatorv1alpha1.KComponent) error {
Expand Down