diff --git a/shared/gatekeeper-constraint.vue b/shared/gatekeeper-constraint.vue index c7a2f46e7b8..e8148ad10d2 100644 --- a/shared/gatekeeper-constraint.vue +++ b/shared/gatekeeper-constraint.vue @@ -147,12 +147,22 @@ export default { }, async created() { + this.registerBeforeHook(this.willSave, 'willSave'); if (!this.value.save) { this.$emit('input', merge(await this.createConstraint(), this.value, this.emptyDefaults)); } }, methods: { + willSave() { + this.value.spec.match.kinds.forEach((kind) => { + const apiGroups = kind.apiGroups || []; + + if (apiGroups.length === 0) { + kind.apiGroups = ['*']; + } + }); + }, async createConstraint() { const constraint = await this.$store.dispatch('cluster/create', { type: this.templateOptions[0].value });