Support for Custom RKE1

This commit is contained in:
Izaac Zavaleta 2025-01-30 12:34:17 -07:00
parent 807c637d69
commit f06350c890
No known key found for this signature in database
GPG Key ID: 3183124333AB684C
6 changed files with 61 additions and 4 deletions

View File

@ -54,4 +54,20 @@ export default class ClusterManagerCreateRke1CustomPagePo extends ClusterManager
nodeCommand(): EmberAccordionPo {
return new EmberAccordionPo('cluster-driver__role');
}
etcdRole() {
return this.nodeCommand().content().find('div.row > div:nth-of-type(1) > label > input');
}
cpRole() {
return this.nodeCommand().content().find('div.row > div:nth-of-type(2) > label > input');
}
workerRole() {
return this.nodeCommand().content().find('div.row > div:nth-of-type(3) > label > input');
}
registrationCommand() {
return this.nodeCommand().content().find('#registration-command');
}
}

View File

@ -66,7 +66,11 @@ export default class ClusterManagerCreatePagePo extends ClusterManagerCreateImpo
return this.self().get('.checkbox-label').contains('Insecure:');
}
customClusterRegistrationCmd(cmd: string) {
customClusterRegistrationCmd(cmd: string, rkeType?: number) {
if (rkeType === 1) {
return `ssh -i custom_node_rke1.key -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" root@${ Cypress.env('customNodeIpRke1') } \"nohup ${ cmd }\"`;
}
return `ssh -i custom_node.key -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" root@${ Cypress.env('customNodeIp') } \"nohup ${ cmd }\"`;
}

View File

@ -426,7 +426,7 @@ describe('Cluster Manager', { testIsolation: 'off', tags: ['@manager', '@adminUs
const createClusterRKE1Page = new ClusterManagerCreateRke1CustomPagePo();
describe('RKE1 Custom', () => {
describe('RKE1 Custom', { tags: ['@jenkins'] }, () => {
it('can create new cluster', () => {
clusterList.goTo();
clusterList.checkIsCurrentPage();
@ -436,7 +436,7 @@ describe('Cluster Manager', { testIsolation: 'off', tags: ['@manager', '@adminUs
createClusterRKE1Page.rkeToggle().set('RKE1');
createClusterRKE1Page.selectCustom(0);
loadingPo.checkNotExists();
loadingPo.checkNotExists(MEDIUM_TIMEOUT_OPT);
createClusterRKE1Page.clusterName().set(rke1CustomName);
@ -481,10 +481,35 @@ describe('Cluster Manager', { testIsolation: 'off', tags: ['@manager', '@adminUs
}
createClusterRKE1Page.nodeCommand().checkExists();
createClusterRKE1Page.etcdRole().click();
createClusterRKE1Page.cpRole().click();
createClusterRKE1Page.registrationCommand().then(($value) => {
const registrationCommand = $value.text().replace('sudo', '');
cy.log(registrationCommand);
cy.exec(`echo ${ Cypress.env('customNodeKeyRke1') } | base64 -d > custom_node_rke1.key && chmod 600 custom_node_rke1.key`).then((result) => {
cy.log('Creating the custom_node_rke1.key');
cy.log(result.stderr);
cy.log(result.stdout);
expect(result.code).to.eq(0);
});
cy.exec(`head custom_node_rke1.key`).then((result) => {
cy.log(result.stdout);
cy.log(result.stderr);
expect(result.code).to.eq(0);
});
cy.exec(createClusterRKE1Page.customClusterRegistrationCmd(registrationCommand, 1), { failOnNonZeroExit: false, timeout: 120000 }).then((result) => {
cy.log(result.stderr);
cy.log(result.stdout);
});
});
createClusterRKE1Page.done();
clusterList.waitForPage();
clusterList.sortableTable().rowElementWithName(rke1CustomName).should('exist');
clusterList.list().state(rke1CustomName).should('contain.text', 'Provisioning');
clusterList.list().state(rke1CustomName).contains('Active', { timeout: 500000 }); // super long timeout needed for cluster provisioning to complete
});
// it.skip('can create new snapshots', () => {

View File

@ -87,7 +87,9 @@ export default defineConfig({
azureClientSecret: process.env.AZURE_CLIENT_SECRET,
customNodeIp: process.env.CUSTOM_NODE_IP,
customNodeKey: process.env.CUSTOM_NODE_KEY,
gkeServiceAccount: process.env.GKE_SERVICE_ACCOUNT
gkeServiceAccount: process.env.GKE_SERVICE_ACCOUNT,
customNodeIpRke1: process.env.CUSTOM_NODE_IP_RKE1,
customNodeKeyRke1: process.env.CUSTOM_NODE_KEY_RKE1
},
// Jenkins reporters configuration jUnit and HTML
reporter: 'cypress-multi-reporters',

View File

@ -12,6 +12,8 @@ kubectl get nodes
node -v
env
yarn config set ignore-engines true
yarn add -W mocha cypress-mochawesome-reporter cypress-multi-reporters cypress-commands \

View File

@ -176,11 +176,19 @@ create_initial_clusters() {
corral config vars set aws_hostname_prefix "jenkins-${prefix_random}-c"
corral config vars delete instance_type
corral config vars set bastion_ip ""
echo "Custom Node for RKE2 Cluster"
corral create --skip-cleanup --recreate --debug customnode \
"dist/aws-t3a.xlarge"
corral config vars set custom_node_ip "$(corral vars customnode first_node_ip)"
corral config vars set custom_node_key "$(corral vars customnode corral_private_key | base64 -w 0)"
echo "Custom Node for RKE1 Cluster"
corral create --skip-cleanup --recreate --debug customnoderke1 \
"dist/aws-t3a.xlarge"
corral config vars set custom_node_ip_rke1 "$(corral vars customnoderke1 first_node_ip)"
corral config vars set custom_node_key_rke1 "$(corral vars customnoderke1 corral_private_key | base64 -w 0)"
corral config vars set instance_type "${AWS_INSTANCE_TYPE}"
corral config vars set aws_hostname_prefix "jenkins-${prefix_random}"
echo "Corral Package string: ${K3S_KUBERNETES_VERSION}-${RANCHER_VERSION//v}-${CERT_MANAGER_VERSION}"