-
Notifications
You must be signed in to change notification settings - Fork 4.8k
OCPBUGS-46422: Add test that the ServiceCIDR API is blocked [4.20] #30434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| package networking | ||
|
|
||
| import ( | ||
| g "github.com/onsi/ginkgo/v2" | ||
| o "github.com/onsi/gomega" | ||
|
|
||
| exutil "github.com/openshift/origin/test/extended/util" | ||
| ) | ||
|
|
||
| var _ = g.Describe("[sig-network] ServiceCIDR", func() { | ||
| oc := exutil.NewCLIWithoutNamespace("servicecidr") | ||
|
|
||
| g.BeforeEach(func() { | ||
| // The VAP is created by CNO, which doesn't run on MicroShift | ||
| isMicroshift, err := exutil.IsMicroShiftCluster(oc.AdminKubeClient()) | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
| if isMicroshift { | ||
| g.Skip("Feature is not currently blocked on Microshift") | ||
| } | ||
| }) | ||
|
|
||
| g.It("should be blocked", func() { | ||
| g.By("Trying to create a new ServiceCIDR") | ||
| yaml := exutil.FixturePath("testdata", "servicecidr.yaml") | ||
| err := oc.AsAdmin().Run("create").Args("-f", yaml).Execute() | ||
| if err == nil { | ||
| // This shouldn't have worked! We'll fail below, but delete the | ||
| // ServiceCIDR first because otherwise it may cause spurious | ||
| // failures throughout the rest of the test run. | ||
| _ = oc.AsAdmin().Run("delete").Args("newcidr1").Execute() | ||
| } | ||
| o.Expect(err).To(o.HaveOccurred(), "Creating a ServiceCIDR should have been blocked by ValidatingAdmissionPolicy") | ||
|
|
||
| g.By("Trying to modify an existing ServiceCIDR") | ||
| err = oc.AsAdmin().Run("annotate").Args("servicecidr", "kubernetes", "e2etest=success").Execute() | ||
| o.Expect(err).To(o.HaveOccurred(), "Modifying existing ServiceCIDR should have been blocked by ValidatingAdmissionPolicy") | ||
| }) | ||
| }) | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| apiVersion: networking.k8s.io/v1beta1 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't we have a v1 resource in 4.20?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, yes... I must have copied this example from old docs or something. Anyway, specifying |
||
| kind: ServiceCIDR | ||
| metadata: | ||
| name: newcidr1 | ||
| spec: | ||
| cidrs: | ||
| - 10.96.0.0/24 | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for my understanding, I assume this is created by default in k8s, is that right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, the
kubernetesServiceCIDR is created by the apiserver, just like thekubernetesService.