Repository navigation
OCPNETUI-224: Add CUDN namespace membership visibility #669
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
Draft
jpinsonneau
wants to merge
25
commits into
openshift:main
Choose a base branch
from
jpinsonneau:jpinsonn/cudn-namespace-membership
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
a4e8358
Add BGPCloudConfiguration UI
jpinsonneau 501adf4
Add BGPRouting UI
jpinsonneau e6e8aae
Fix BGP edit form updates
jpinsonneau c6ae362
Rename BGP navigation entry
jpinsonneau 2c74a69
Translate BGP Cloud Connector views
jpinsonneau 1ddeaca
Preserve BGP form resource entries
jpinsonneau 9711a98
Simplify BGP README references
jpinsonneau 901f97f
Add BGP form and Cypress coverage
jpinsonneau b60eadc
Cover BGP list filters and CIDRs
jpinsonneau bd302d8
Fix BGP CIDR and selector validation
jpinsonneau 06c8bf8
Address BGP review feedback
jpinsonneau 46bad25
Sync BGP locale keys
jpinsonneau 3e4f5a3
Address BGP form review feedback
jpinsonneau 12cb8b4
Fix BGP form runtime and tab visibility
jpinsonneau 1a249ae
Adapt BGP UI to namespace status removal
jpinsonneau a5904f3
Sync generated locale catalogs
jpinsonneau cd89296
Fix BGP Cypress form assertions
jpinsonneau 4bdeb19
Keep BGP navigation translation key
jpinsonneau 8dccc27
Apply BGP review fixes to base PR
jpinsonneau 0617865
Preserve BGP form configuration fields
jpinsonneau a1e4717
Add CUDN namespace membership details
jpinsonneau 9eb215b
Fix BGP and CUDN review findings
jpinsonneau b61ab3c
Fix CUDN routing and BGP validation review
jpinsonneau d10d1f3
Fix BGP fixture ownership and OLM tabs
jpinsonneau 5ff6739
Fix rebased BGP and CUDN imports
jpinsonneau File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| apiVersion: v1 | ||
| kind: Namespace | ||
| metadata: | ||
| name: e2e-bgp-card-ns | ||
| labels: | ||
| cluster-udn: e2e-bgp-card-cudn | ||
| k8s.ovn.org/primary-user-defined-network: '' | ||
| --- | ||
| apiVersion: networking.openshift.io/v1beta1 | ||
| kind: BGPRouting | ||
| metadata: | ||
| name: e2e-bgp-card-routing | ||
| spec: | ||
| network: | ||
| name: e2e-bgp-card-cudn | ||
| subnets: | ||
| - 10.253.0.0/24 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,216 @@ | ||
| import { checkErrors } from '../support'; | ||
| import { MINUTE } from '../support/commands'; | ||
| import { expectYamlToContain, switchToYamlView } from '../support/service-form'; | ||
|
|
||
| const CLOUD_CREATE_URL = | ||
| '/k8s/cluster/networking.openshift.io~v1beta1~BGPCloudConfiguration/~new/form'; | ||
| const ROUTING_CREATE_URL = '/k8s/cluster/networking.openshift.io~v1beta1~BGPRouting/~new/form'; | ||
| const BGP_CARD_CUDN_NAME = 'cluster-udn-e2e-bgp-card-cudn'; | ||
| const BGP_CARD_NETWORK_NAME = 'e2e-bgp-card-cudn'; | ||
| const BGP_CARD_CUDN_URL = `/k8s/cluster/k8s.ovn.org~v1~ClusterUserDefinedNetwork/${BGP_CARD_CUDN_NAME}`; | ||
| const BGP_CARD_FIXTURE = 'fixtures/bgp-routing-card.yaml'; | ||
|
|
||
| const selectFormEditor = () => { | ||
| cy.get('#form', { timeout: MINUTE }).check({ force: true }); | ||
| }; | ||
|
|
||
| const switchBGPFormView = (fieldId: string) => { | ||
| cy.contains('label', 'Form view').click(); | ||
| cy.get(`#${fieldId}`, { timeout: MINUTE }).should('be.visible'); | ||
| }; | ||
|
|
||
| describe('BGP forms', () => { | ||
| before(() => { | ||
| cy.login(); | ||
| cy.applyFixtureFile(BGP_CARD_FIXTURE); | ||
| }); | ||
|
|
||
| afterEach(() => { | ||
| checkErrors(); | ||
| }); | ||
|
|
||
| after(() => { | ||
| cy.exec( | ||
| 'oc delete bgprouting e2e-bgp-card-routing --ignore-not-found && ' + | ||
| `oc delete clusteruserdefinednetwork ${BGP_CARD_CUDN_NAME} --ignore-not-found && ` + | ||
| 'oc delete namespace e2e-bgp-card-ns --ignore-not-found --wait=false', | ||
| { failOnNonZeroExit: false, timeout: MINUTE }, | ||
| ); | ||
| cy.logout(); | ||
| }); | ||
|
|
||
| it('shows typed cloud fields and only the selected platform section', () => { | ||
| cy.visit(CLOUD_CREATE_URL); | ||
| cy.contains('h1', 'Create BGPCloudConfiguration', { timeout: MINUTE }).should('be.visible'); | ||
| selectFormEditor(); | ||
|
|
||
| cy.get('#name').should('be.disabled'); | ||
| cy.get('#name').should('have.value', 'cluster'); | ||
| cy.get('#localASN').should('have.attr', 'type', 'text'); | ||
| cy.get('#localASN').type('abc'); | ||
| cy.contains('Enter a valid ASN between 1 and 4294967295.').should('be.visible'); | ||
| cy.get('button[type="submit"]').should('be.disabled'); | ||
| cy.get('#localASN').clear(); | ||
| cy.get('#localASN').type('64512'); | ||
| cy.get('#awsRegion').should('be.visible'); | ||
| cy.get('#awsRouteServerIDs').should('be.visible'); | ||
| cy.get('#azureSubscriptionID').should('not.exist'); | ||
| cy.get('#enableNestedVirtualization').should('not.exist'); | ||
|
|
||
| cy.get('#platform').click(); | ||
| cy.contains('[role="menuitem"]', 'Azure').click(); | ||
| cy.get('#azureSubscriptionID').should('be.visible'); | ||
| cy.get('#azureResourceGroup').should('be.visible'); | ||
| cy.get('#azureRouteServerName').should('be.visible'); | ||
| cy.get('#awsRegion').should('not.exist'); | ||
|
|
||
| cy.get('#platform').click(); | ||
| cy.contains('[role="menuitem"]', 'GCP').click(); | ||
| cy.get('#gcpProject').should('be.visible'); | ||
| cy.get('#gcpRegion').should('be.visible'); | ||
| cy.get('#cloudRouterName').should('be.visible'); | ||
| cy.get('#enableNestedVirtualization').should('have.attr', 'type', 'checkbox'); | ||
| cy.get('#awsRegion').should('not.exist'); | ||
|
|
||
| cy.get('#platform').click(); | ||
| cy.contains('[role="menuitem"]', 'Manual').click(); | ||
| cy.get('#peerSelectorKey').should('be.visible'); | ||
| cy.get('#peerSelectorValue').should('be.visible'); | ||
| cy.get('#neighborAddress').should('be.visible'); | ||
| cy.get('#remoteASN').should('have.attr', 'type', 'text'); | ||
| cy.get('#remoteASN').type('4294967296'); | ||
| cy.contains('Enter a valid ASN between 1 and 4294967295.').should('be.visible'); | ||
| cy.get('#remoteASN').clear(); | ||
| cy.get('#remoteASN').type('64513'); | ||
| cy.get('#ebgpMultiHop').should('have.attr', 'type', 'checkbox'); | ||
| }); | ||
|
|
||
| it('allows selector labels with an empty value', () => { | ||
| cy.visit(CLOUD_CREATE_URL); | ||
| selectFormEditor(); | ||
|
|
||
| cy.get('#localASN').type('64512'); | ||
| cy.get('#platform').click(); | ||
| cy.contains('[role="menuitem"]', 'Manual').click(); | ||
| cy.get('#peerSelectorKey').type('k8s.ovn.org/primary-user-defined-network'); | ||
| cy.get('#peerSelectorValue').should('have.value', ''); | ||
| cy.get('#neighborAddress').type('192.0.2.1'); | ||
| cy.get('#remoteASN').type('64513'); | ||
| cy.get('#routerSelectorKey').type('node-role.kubernetes.io/bgp'); | ||
| cy.get('#routerSelectorValue').should('have.value', ''); | ||
|
|
||
| cy.get('button[type="submit"]').should('not.be.disabled'); | ||
| }); | ||
|
|
||
| it('supports switching between the guided form and YAML editor', () => { | ||
| cy.visit(CLOUD_CREATE_URL); | ||
| selectFormEditor(); | ||
| cy.get('#localASN').type('64512'); | ||
| cy.get('#platform').click(); | ||
| cy.contains('[role="menuitem"]', 'Manual').click(); | ||
| cy.get('#peerSelectorKey').type('node-role.kubernetes.io/bgp'); | ||
| cy.get('#neighborAddress').type('192.0.2.1'); | ||
| cy.get('#remoteASN').type('64513'); | ||
| cy.get('#routerSelectorKey').type('node-role.kubernetes.io/worker'); | ||
|
|
||
| switchToYamlView(); | ||
| expectYamlToContain( | ||
| 'kind: BGPCloudConfiguration', | ||
| 'platform: Manual', | ||
| 'localASN: 64512', | ||
| 'address: 192.0.2.1', | ||
| ); | ||
| switchBGPFormView('localASN'); | ||
| cy.get('#localASN').should('have.value', '64512'); | ||
| cy.get('#platform').should('contain', 'Manual'); | ||
| cy.get('#neighborAddress').should('have.value', '192.0.2.1'); | ||
| }); | ||
|
|
||
| it('supports switching between the BGPRouting form and YAML editor', () => { | ||
| cy.visit(ROUTING_CREATE_URL); | ||
| selectFormEditor(); | ||
| cy.get('#name').type('e2e-routing'); | ||
| cy.get('#network').type('e2e-network'); | ||
| cy.get('#subnet1').type('10.20.0.0/16'); | ||
| cy.get('#subnet2').type('2001:db8:20::/64'); | ||
|
|
||
| switchToYamlView(); | ||
| expectYamlToContain( | ||
| 'kind: BGPRouting', | ||
| 'name: e2e-routing', | ||
| 'name: e2e-network', | ||
| '10.20.0.0/16', | ||
| '2001:db8:20::/64', | ||
| ); | ||
| switchBGPFormView('name'); | ||
| cy.get('#name').should('have.value', 'e2e-routing'); | ||
| cy.get('#network').should('have.value', 'e2e-network'); | ||
| cy.get('#subnet1').should('have.value', '10.20.0.0/16'); | ||
| cy.get('#subnet2').should('have.value', '2001:db8:20::/64'); | ||
| }); | ||
|
|
||
| it('shows the routing tab disabled until a cloud configuration exists', () => { | ||
| cy.visit('/k8s/cluster/networking.openshift.io~v1beta1~BGPCloudConfiguration'); | ||
| cy.contains('h1', 'BGP', { timeout: MINUTE }).should('be.visible'); | ||
| cy.get('button[role="tab"]', { timeout: MINUTE }) | ||
| .contains('BGPRouting') | ||
| .should(($tab) => { | ||
| const configurationExists = | ||
| $tab.closest('body').find('a[href*="BGPCloudConfiguration/"]').length > 0; | ||
| if (configurationExists) { | ||
| expect($tab).not.to.be.disabled; | ||
| } else { | ||
| expect($tab).to.be.disabled; | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
| it('validates BGPRouting CIDRs and refreshes namespace guidance', () => { | ||
| cy.visit(ROUTING_CREATE_URL); | ||
| cy.contains('h1', 'Create BGPRouting', { timeout: MINUTE }).should('be.visible'); | ||
| selectFormEditor(); | ||
|
|
||
| cy.get('#name').should('have.attr', 'type', 'text').type('e2e-routing-validation'); | ||
| cy.get('#network').type('prod'); | ||
| cy.contains('code', 'cluster-udn=prod').should('be.visible'); | ||
| cy.get('#subnet1').type('abc.def/24'); | ||
| cy.contains('Enter a valid IPv4 or IPv6 CIDR.').should('be.visible'); | ||
| cy.get('button[type="submit"]').should('be.disabled'); | ||
|
|
||
| cy.get('#subnet1').clear(); | ||
| cy.get('#subnet1').type('10.20.0.0/16'); | ||
| cy.get('#subnet2').type('2001:db8:20::/64'); | ||
| cy.get('#subnet3').should('not.exist'); | ||
| cy.get('button[type="submit"]').should('not.be.disabled'); | ||
| }); | ||
|
|
||
| it('exposes a name filter on the BGPRouting list view', () => { | ||
| cy.visit('/k8s/cluster/networking.openshift.io~v1beta1~BGPCloudConfiguration'); | ||
| cy.contains('h1', 'BGP', { timeout: MINUTE }).should('be.visible'); | ||
|
|
||
| cy.visit('/k8s/cluster/networking.openshift.io~v1beta1~BGPRouting'); | ||
| cy.get('body', { timeout: MINUTE }) | ||
| .should(($body) => { | ||
| expect( | ||
| $body.find('[data-test-id="item-filter"]').length || | ||
| $body.find(':contains("No BGPRouting found")').length, | ||
| ).to.be.greaterThan(0); | ||
| }) | ||
| .then(($body) => { | ||
| if ($body.find('[data-test-id="item-filter"]').length) { | ||
| cy.get('[data-test-id="item-filter"]').should('be.visible'); | ||
| } else cy.contains('No BGPRouting found').should('be.visible'); | ||
| }); | ||
| }); | ||
|
|
||
| it('shows related BGPRouting details on the CUDN page', () => { | ||
| cy.visit(BGP_CARD_CUDN_URL); | ||
| cy.contains('h1', BGP_CARD_CUDN_NAME, { timeout: MINUTE }).should('be.visible'); | ||
| cy.contains('h2', 'BGP routings', { timeout: MINUTE }).scrollIntoView(); | ||
| cy.contains('h2', 'BGP routings', { timeout: MINUTE }).should('be.visible'); | ||
| cy.contains('a', 'e2e-bgp-card-routing').should('be.visible'); | ||
| cy.contains('dt', 'Network').parent().contains(BGP_CARD_NETWORK_NAME).should('be.visible'); | ||
| cy.contains('Phase').should('be.visible'); | ||
| cy.contains('Availability').should('be.visible'); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.