Skip to content

Commit

Permalink
Merge pull request #11232 from mallardduck/28-fleet-secret-fix
Browse files Browse the repository at this point in the history
[backport v2.8.next1] Add default label to Fleet Secrets to enable BRO backups
  • Loading branch information
richard-cox authored Jun 14, 2024
2 parents 05e563f + 814b509 commit 8bd3162
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions cypress/e2e/tests/pages/fleet/gitrepo.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,17 @@ describe('Git Repo', { tags: ['@fleet', '@adminUser'] }, () => {
it('Should be able to create a git repo', () => {
// First request is for creating credentials
let secretName = '';
let requestLabels = null;
let secretLabels = null;

cy.wait('@interceptAllRequests0').then(({ request, response }) => {
requestLabels = request.body.metadata.labels;
expect(requestLabels).to.be.an('object').and.to.have.property('fleet.cattle.io/managed').that.equals('true');
expect(response.statusCode).to.eq(201);
secretName = response.body.metadata.name;
secretLabels = response.body.metadata.labels;
expect(secretName).not.to.eq('');
expect(secretLabels).to.be.an('object').and.to.have.property('fleet.cattle.io/managed').that.equals('true');
});

// Second request is for creating the git repo
Expand Down
7 changes: 4 additions & 3 deletions shell/edit/fleet.cattle.io.gitrepo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { base64Decode, base64Encode } from '@shell/utils/crypto';
import SelectOrCreateAuthSecret from '@shell/components/form/SelectOrCreateAuthSecret';
import { _CREATE } from '@shell/config/query-params';
import { isHarvesterCluster } from '@shell/utils/cluster';
import { CAPI, CATALOG } from '@shell/config/labels-annotations';
import { CAPI, CATALOG, FLEET as FLEET_LABELS } from '@shell/config/labels-annotations';
import { SECRET_TYPES } from '@shell/config/secret';
import { checkSchemasForFindAllHash } from '@shell/utils/auth';
import Checkbox from '@components/Form/Checkbox/Checkbox.vue';
Expand Down Expand Up @@ -413,8 +413,9 @@ export default {
type: SECRET,
metadata: {
namespace: this.value.metadata.namespace,
generateName: 'auth-'
},
generateName: 'auth-',
labels: { [FLEET_LABELS.MANAGED]: 'true' }
}
});
let type, publicField, privateField;
Expand Down

0 comments on commit 8bd3162

Please sign in to comment.