Skip to content
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

[backport v2.8.next1] Add default label to Fleet Secrets to enable BRO backups #11232

Merged
merged 2 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading