mirror of https://github.com/rancher/dashboard.git
fix(constraints.gatekeeper.sh.constraint): fix resourceVersion not updated issue (#8285)
This commit is contained in:
parent
248e6d9c94
commit
22d15cfae9
|
|
@ -9,15 +9,20 @@ export const ENFORCEMENT_ACTION_VALUES = {
|
||||||
export default class GateKeeperConstraint extends SteveModel {
|
export default class GateKeeperConstraint extends SteveModel {
|
||||||
async save() {
|
async save() {
|
||||||
let constraint;
|
let constraint;
|
||||||
|
let resourceVersion;
|
||||||
|
|
||||||
if (this.constraint) {
|
if (this.constraint) {
|
||||||
constraint = await this.findLatestConstraint();
|
constraint = await this.findLatestConstraint();
|
||||||
|
resourceVersion = constraint?.metadata?.resourceVersion;
|
||||||
} else {
|
} else {
|
||||||
constraint = await this.$dispatch('cluster/create', { type: `constraints.gatekeeper.sh.${ this.kind.toLowerCase() }` }, { root: true });
|
constraint = await this.$dispatch('cluster/create', { type: `constraints.gatekeeper.sh.${ this.kind.toLowerCase() }` }, { root: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
constraint.spec = this.spec;
|
constraint.spec = this.spec;
|
||||||
constraint.metadata = this.metadata;
|
constraint.metadata = this.metadata;
|
||||||
|
if (resourceVersion) {
|
||||||
|
constraint.metadata.resourceVersion = resourceVersion;
|
||||||
|
}
|
||||||
|
|
||||||
await constraint.save();
|
await constraint.save();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue