Skip to content

Commit

Permalink
Check for objectset.rio.cattle.io/applied annotation for policy source
Browse files Browse the repository at this point in the history
  • Loading branch information
jordojordo committed Nov 8, 2024
1 parent eb64dd8 commit c61a4c5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pkg/kubewarden/plugins/policy-class.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,27 @@ export default class PolicyModel extends KubewardenModel {
}

get isDeployedWithFleet() {
return this.metadata?.annotations?.[WORKSPACE_ANNOTATION];
return this.metadata?.annotations?.[WORKSPACE_ANNOTATION] && !this.metadata?.annotations?.['objectset.rio.cattle.io/applied'];
}

get isApplied() {
return this.metadata?.annotations?.['objectset.rio.cattle.io/applied'];
}

get source() {
if ( this.isKubewardenDefaultPolicy && !this.isDeployedWithFleet ) {
if (this.isKubewardenDefaultPolicy && !this.isDeployedWithFleet && !this.isApplied) {
return 'kubewarden-defaults';
}

if ( this.isDeployedWithFleet ) {
if (this.isDeployedWithFleet && !this.isApplied) {
return 'fleet';
}

// right now we are adding 'artifacthub/pkg' anontation
// so that we can fetch the questions info from there
// that only happens for template based CAP's
// https://github.com/rancher/kubewarden-ui/issues/682
if ( this.metadata?.annotations?.['artifacthub/pkg'] ) {
if (this.metadata?.annotations?.['artifacthub/pkg']) {
return 'template';
}

Expand Down

0 comments on commit c61a4c5

Please sign in to comment.