Skip to content

Commit 6936bb8

Browse files
authored
feat: set the PDB webhook to be disabled by default temporarily for compatibility reasons (kubefleet-dev#556)
1 parent df220ae commit 6936bb8

4 files changed

Lines changed: 20 additions & 1 deletion

File tree

cmd/hubagent/options/options_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,7 @@ func TestWebhookOptions(t *testing.T) {
728728
GuardRailWhitelistedUsers: "",
729729
GuardRailDenyModifyMemberClusterLabels: false,
730730
EnableWorkload: false,
731+
EnablePDBs: true,
731732
UseCertManager: false,
732733
},
733734
},
@@ -752,6 +753,7 @@ func TestWebhookOptions(t *testing.T) {
752753
GuardRailWhitelistedUsers: "user1,user2",
753754
GuardRailDenyModifyMemberClusterLabels: true,
754755
EnableWorkload: true,
756+
EnablePDBs: true,
755757
UseCertManager: true,
756758
},
757759
},
@@ -767,6 +769,7 @@ func TestWebhookOptions(t *testing.T) {
767769
GuardRailWhitelistedUsers: "",
768770
GuardRailDenyModifyMemberClusterLabels: false,
769771
EnableWorkload: false,
772+
EnablePDBs: true,
770773
UseCertManager: false,
771774
},
772775
},
@@ -782,6 +785,7 @@ func TestWebhookOptions(t *testing.T) {
782785
GuardRailWhitelistedUsers: "",
783786
GuardRailDenyModifyMemberClusterLabels: false,
784787
EnableWorkload: false,
788+
EnablePDBs: true,
785789
UseCertManager: false,
786790
},
787791
},

cmd/hubagent/options/webhooks.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ func (o *WebhookOptions) AddFlags(flags *flag.FlagSet) {
120120
flags.BoolVar(
121121
&o.EnablePDBs,
122122
"enable-pdbs",
123-
false,
123+
// TO-DO (chenyu1): use the true value for compatibility reasons; this will be set to false in a later release.
124+
true,
124125
"Enable PodDisruptionBudgets to be created directly in the hub cluster or not. If set to true, the KubeFleet PodDisruptionBudget validating webhook, which blocks the creation of PodDisruptionBudgets outside KubeFleet reserved namespaces, will be disabled. This option only applies if webhooks are enabled.",
125126
)
126127

test/e2e/fleet_guard_rail_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,6 +1168,8 @@ var _ = Describe("fleet guard rail webhook tests for PodDisruptionBudgets", Seri
11681168

11691169
Context("deny PDB operations in fleet-system namespace", func() {
11701170
It("should deny CREATE operation on PDB in fleet-system namespace for non-whitelisted users", func() {
1171+
Skip("PDB webhook is temporarily disabled.")
1172+
11711173
pdb := policyv1.PodDisruptionBudget{
11721174
ObjectMeta: metav1.ObjectMeta{
11731175
Name: "test-pdb-fleet-system",
@@ -1191,6 +1193,8 @@ var _ = Describe("fleet guard rail webhook tests for PodDisruptionBudgets", Seri
11911193
)
11921194

11931195
BeforeAll(func() {
1196+
Skip("PDB webhook is temporarily disabled.")
1197+
11941198
mcName = fmt.Sprintf(mcNameTemplate, GinkgoParallelProcess())
11951199
imcNamespace = fmt.Sprintf(utils.NamespaceNameFormat, mcName)
11961200
createMemberCluster(mcName, testIdentity, nil, map[string]string{fleetClusterResourceIDAnnotationKey: clusterID1})
@@ -1202,6 +1206,8 @@ var _ = Describe("fleet guard rail webhook tests for PodDisruptionBudgets", Seri
12021206
})
12031207

12041208
It("should deny CREATE operation on PDB in fleet-member namespace for user not in MC identity", func() {
1209+
Skip("PDB webhook is temporarily disabled.")
1210+
12051211
pdb := policyv1.PodDisruptionBudget{
12061212
ObjectMeta: metav1.ObjectMeta{
12071213
Name: "test-pdb-member",
@@ -1218,6 +1224,8 @@ var _ = Describe("fleet guard rail webhook tests for PodDisruptionBudgets", Seri
12181224
})
12191225

12201226
It("should deny UPDATE operation on PDB in fleet-member namespace for user not in MC identity", func() {
1227+
Skip("PDB webhook is temporarily disabled.")
1228+
12211229
// First create a PDB as admin.
12221230
pdb := policyv1.PodDisruptionBudget{
12231231
ObjectMeta: metav1.ObjectMeta{
@@ -1255,6 +1263,8 @@ var _ = Describe("fleet guard rail webhook tests for PodDisruptionBudgets", Seri
12551263

12561264
Context("deny PDB operations in kube-system namespace", func() {
12571265
It("should deny CREATE operation on PDB in kube-system namespace for non-whitelisted users", func() {
1266+
Skip("PDB webhook is temporarily disabled.")
1267+
12581268
pdb := policyv1.PodDisruptionBudget{
12591269
ObjectMeta: metav1.ObjectMeta{
12601270
Name: "test-pdb-kube",

test/e2e/webhook_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,6 +1683,8 @@ var _ = Describe("webhook tests for ResourceOverride UPDATE operations", Ordered
16831683
var _ = Describe("webhook tests for PodDisruptionBudget CREATE operations", func() {
16841684
Context("deny PDB creation in non-reserved namespaces", func() {
16851685
It("should deny CREATE operation on PDB in default namespace", func() {
1686+
Skip("PDB webhook is temporarily disabled.")
1687+
16861688
pdb := policyv1.PodDisruptionBudget{
16871689
ObjectMeta: metav1.ObjectMeta{
16881690
Name: "test-pdb",
@@ -1707,6 +1709,8 @@ var _ = Describe("webhook tests for PodDisruptionBudget CREATE operations", func
17071709
})
17081710

17091711
It("should allow CREATE operation on PDB in kube-system namespace for master users", func() {
1712+
Skip("PDB webhook is temporarily disabled.")
1713+
17101714
pdb = policyv1.PodDisruptionBudget{
17111715
ObjectMeta: metav1.ObjectMeta{
17121716
Name: "test-pdb-kube-system",

0 commit comments

Comments
 (0)