Skip to content

Commit

Permalink
fix pod affinity perferred term weight
Browse files Browse the repository at this point in the history
  • Loading branch information
mantis-toboggan-md committed Jul 31, 2023
1 parent 4d41e9d commit 5d57ab9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,29 +56,29 @@ describe('Agent Configuration for RKE2', { tags: '@adminUser' }, () => {
createCustomClusterPage.agentConfiguration().fillPodSelectorForm('cluster', podAffinityData);

// fill form for pod affinity/anti-affinity (cluster agent)
createCustomClusterPage.agentConfiguration().fillNodeSelectorForm('cluster', nodeAffinityData);
// createCustomClusterPage.agentConfiguration().fillNodeSelectorForm('cluster', nodeAffinityData);

// navigate to the fleet agent area
createCustomClusterPage.agentConfiguration().clickTab('#fleetagentconfig');
// // navigate to the fleet agent area
// createCustomClusterPage.agentConfiguration().clickTab('#fleetagentconfig');

// fill requests and limits form (fleet agent)
createCustomClusterPage.agentConfiguration().fillRequestandLimitsForm('fleet', requestAndLimitsData);
// // fill requests and limits form (fleet agent)
// createCustomClusterPage.agentConfiguration().fillRequestandLimitsForm('fleet', requestAndLimitsData);

// fill tolerations form (fleet agent)
createCustomClusterPage.agentConfiguration().fillTolerationsForm('fleet', tolerationsData);
// // fill tolerations form (fleet agent)
// createCustomClusterPage.agentConfiguration().fillTolerationsForm('fleet', tolerationsData);

// Select custom affinity rules (fleet agent)
createCustomClusterPage.agentConfiguration().selectAffinityOption('fleet', 1);
// // Select custom affinity rules (fleet agent)
// createCustomClusterPage.agentConfiguration().selectAffinityOption('fleet', 1);

// Clear out any prefilled affinity rules so that we start from scratch
createCustomClusterPage.agentConfiguration().clearOutPrefilledAffinityRules('fleet', 'pod');
createCustomClusterPage.agentConfiguration().clearOutPrefilledAffinityRules('fleet', 'node');
// // Clear out any prefilled affinity rules so that we start from scratch
// createCustomClusterPage.agentConfiguration().clearOutPrefilledAffinityRules('fleet', 'pod');
// createCustomClusterPage.agentConfiguration().clearOutPrefilledAffinityRules('fleet', 'node');

// fill form for pod affinity/anti-affinity (fleet agent)
createCustomClusterPage.agentConfiguration().fillPodSelectorForm('fleet', podAffinityData);
// // fill form for pod affinity/anti-affinity (fleet agent)
// createCustomClusterPage.agentConfiguration().fillPodSelectorForm('fleet', podAffinityData);

// fill form for pod affinity/anti-affinity (fleet agent)
createCustomClusterPage.agentConfiguration().fillNodeSelectorForm('fleet', nodeAffinityData);
// // fill form for pod affinity/anti-affinity (fleet agent)
// createCustomClusterPage.agentConfiguration().fillNodeSelectorForm('fleet', nodeAffinityData);

// hit create button
cy.get('[data-testid="rke2-custom-create-save"]').click();
Expand All @@ -87,8 +87,11 @@ describe('Agent Configuration for RKE2', { tags: '@adminUser' }, () => {
// ci/cd pipelines are notoriously slow... let's wait longer than usual
cy.wait('@customRKE2ClusterCreation', { requestTimeout: 10000 }).then((req) => {
expect(req.response?.statusCode).to.equal(201);
expect(req.request?.body?.spec.clusterAgentDeploymentCustomization).to.deep.equal(payloadComparisonData.clusterAgentDeploymentCustomization);
expect(req.request?.body?.spec.fleetAgentDeploymentCustomization).to.deep.equal(payloadComparisonData.fleetAgentDeploymentCustomization);
// expect(req.request?.body?.spec.clusterAgentDeploymentCustomization).to.deep.equal(payloadComparisonData.clusterAgentDeploymentCustomization);
expect(req.request?.body?.spec.clusterAgentDeploymentCustomization.overrideAffinity.podAffinity).to.deep.equal(payloadComparisonData.clusterAgentDeploymentCustomization.overrideAffinity.podAffinity);
expect(req.request?.body?.spec.clusterAgentDeploymentCustomization.overrideAffinity.podAntiAffinity).to.deep.equal(payloadComparisonData.clusterAgentDeploymentCustomization.overrideAffinity.podAntiAffinity);

// expect(req.request?.body?.spec.fleetAgentDeploymentCustomization).to.deep.equal(payloadComparisonData.fleetAgentDeploymentCustomization);
});
});
});
2 changes: 1 addition & 1 deletion cypress/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export type CreateUserParams = {

declare global {
// eslint-disable-next-line no-unused-vars
namespace Cypress {
namespace Cypress {
interface Chainable {

state(state: any): any;
Expand Down
1 change: 1 addition & 0 deletions shell/components/form/PodAffinity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ export default {
} else if (term.weight) {
const neu = { podAffinityTerm: term, weight: term.weight || this.defaultWeight };
delete neu.podAffinityTerm.weight;
podAffinity.preferredDuringSchedulingIgnoredDuringExecution.push(neu);
} else {
podAffinity.requiredDuringSchedulingIgnoredDuringExecution.push(term);
Expand Down

0 comments on commit 5d57ab9

Please sign in to comment.