Skip to content

Commit

Permalink
Merge pull request #890 from fabriziosestito/fix/policy-group-plural-…
Browse files Browse the repository at this point in the history
…name

fix: policy group plural name
  • Loading branch information
flavio authored Sep 23, 2024
2 parents 728d169 + 755dd7b commit 10976c9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions api/policies/v1/admissionpolicygroup_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (r *AdmissionPolicyGroup) SetupWebhookWithManager(mgr ctrl.Manager) error {
return nil
}

//+kubebuilder:webhook:path=/mutate-policies-kubewarden-io-v1-admissionpolicygroup,mutating=true,failurePolicy=fail,sideEffects=None,groups=policies.kubewarden.io,resources=admissionpoliciesgroup,verbs=create;update,versions=v1,name=madmissionpolicygroup.kb.io,admissionReviewVersions={v1,v1beta1}
//+kubebuilder:webhook:path=/mutate-policies-kubewarden-io-v1-admissionpolicygroup,mutating=true,failurePolicy=fail,sideEffects=None,groups=policies.kubewarden.io,resources=admissionpolicygroups,verbs=create;update,versions=v1,name=madmissionpolicygroup.kb.io,admissionReviewVersions={v1,v1beta1}

var _ webhook.Defaulter = &AdmissionPolicyGroup{}

Expand All @@ -59,7 +59,7 @@ func (r *AdmissionPolicyGroup) Default() {
}
}

//+kubebuilder:webhook:path=/validate-policies-kubewarden-io-v1-admissionpolicygroup,mutating=false,failurePolicy=fail,sideEffects=None,groups=policies.kubewarden.io,resources=admissionpoliciesgroup,verbs=create;update,versions=v1,name=vadmissionpolicygroup.kb.io,admissionReviewVersions={v1,v1beta1}
//+kubebuilder:webhook:path=/validate-policies-kubewarden-io-v1-admissionpolicygroup,mutating=false,failurePolicy=fail,sideEffects=None,groups=policies.kubewarden.io,resources=admissionpolicygroups,verbs=create;update,versions=v1,name=vadmissionpolicygroup.kb.io,admissionReviewVersions={v1,v1beta1}

var _ webhook.Validator = &AdmissionPolicyGroup{}

Expand Down
4 changes: 2 additions & 2 deletions api/policies/v1/clusteradmissionpolicygroup_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (r *ClusterAdmissionPolicyGroup) SetupWebhookWithManager(mgr ctrl.Manager)
return nil
}

//+kubebuilder:webhook:path=/mutate-policies-kubewarden-io-v1-clusteradmissionpolicygroup,mutating=true,failurePolicy=fail,sideEffects=None,groups=policies.kubewarden.io,resources=clusteradmissionpoliciesgroup,verbs=create;update,versions=v1,name=mclusteradmissionpolicygroup.kb.io,admissionReviewVersions={v1,v1beta1}
//+kubebuilder:webhook:path=/mutate-policies-kubewarden-io-v1-clusteradmissionpolicygroup,mutating=true,failurePolicy=fail,sideEffects=None,groups=policies.kubewarden.io,resources=clusteradmissionpolicygroups,verbs=create;update,versions=v1,name=mclusteradmissionpolicygroup.kb.io,admissionReviewVersions={v1,v1beta1}

var _ webhook.Defaulter = &ClusterAdmissionPolicyGroup{}

Expand All @@ -60,7 +60,7 @@ func (r *ClusterAdmissionPolicyGroup) Default() {
}
}

//+kubebuilder:webhook:path=/validate-policies-kubewarden-io-v1-clusteradmissionpolicygroup,mutating=false,failurePolicy=fail,sideEffects=None,groups=policies.kubewarden.io,resources=clusteradmissionpoliciesgroup,verbs=create;update,versions=v1,name=vclusteradmissionpolicygroup.kb.io,admissionReviewVersions={v1,v1beta1}
//+kubebuilder:webhook:path=/validate-policies-kubewarden-io-v1-clusteradmissionpolicygroup,mutating=false,failurePolicy=fail,sideEffects=None,groups=policies.kubewarden.io,resources=clusteradmissionpolicygroups,verbs=create;update,versions=v1,name=vclusteradmissionpolicygroup.kb.io,admissionReviewVersions={v1,v1beta1}

var _ webhook.Validator = &ClusterAdmissionPolicyGroup{}

Expand Down
8 changes: 4 additions & 4 deletions config/webhook/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ webhooks:
- CREATE
- UPDATE
resources:
- admissionpoliciesgroup
- admissionpolicygroups
sideEffects: None
- admissionReviewVersions:
- v1
Expand Down Expand Up @@ -86,7 +86,7 @@ webhooks:
- CREATE
- UPDATE
resources:
- clusteradmissionpoliciesgroup
- clusteradmissionpolicygroups
sideEffects: None
- admissionReviewVersions:
- v1
Expand Down Expand Up @@ -155,7 +155,7 @@ webhooks:
- CREATE
- UPDATE
resources:
- admissionpoliciesgroup
- admissionpolicygroups
sideEffects: None
- admissionReviewVersions:
- v1
Expand Down Expand Up @@ -197,7 +197,7 @@ webhooks:
- CREATE
- UPDATE
resources:
- clusteradmissionpoliciesgroup
- clusteradmissionpolicygroups
sideEffects: None
- admissionReviewVersions:
- v1
Expand Down
16 changes: 8 additions & 8 deletions internal/controller/policyserver_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,17 +303,17 @@ func (r *PolicyServerReconciler) getPolicies(ctx context.Context, policyServer *
return nil, err
}

var admissionPoliciesGroup policiesv1.AdmissionPolicyGroupList
err = r.Client.List(ctx, &admissionPoliciesGroup, client.MatchingFields{constants.PolicyServerIndexKey: policyServer.Name})
var admissionPolicyGroupList policiesv1.AdmissionPolicyGroupList
err = r.Client.List(ctx, &admissionPolicyGroupList, client.MatchingFields{constants.PolicyServerIndexKey: policyServer.Name})
if err != nil && apierrors.IsNotFound(err) {
err = fmt.Errorf("failed obtaining AdmissionPoliciesGroups: %w", err)
err = fmt.Errorf("failed obtaining AdmissionPolicyGroups: %w", err)
return nil, err
}

var clusterAdmissionPoliciesGroup policiesv1.ClusterAdmissionPolicyGroupList
err = r.Client.List(ctx, &clusterAdmissionPoliciesGroup, client.MatchingFields{constants.PolicyServerIndexKey: policyServer.Name})
var clusterAdmissionPolicyGroupList policiesv1.ClusterAdmissionPolicyGroupList
err = r.Client.List(ctx, &clusterAdmissionPolicyGroupList, client.MatchingFields{constants.PolicyServerIndexKey: policyServer.Name})
if err != nil && apierrors.IsNotFound(err) {
err = fmt.Errorf("failed obtaining ClusterAdmissionPoliciesGroup: %w", err)
err = fmt.Errorf("failed obtaining ClusterAdmissionPolicyGroups: %w", err)
return nil, err
}

Expand All @@ -324,10 +324,10 @@ func (r *PolicyServerReconciler) getPolicies(ctx context.Context, policyServer *
for _, admissionPolicy := range admissionPolicies.Items {
policies = append(policies, admissionPolicy.DeepCopy())
}
for _, admissionPolicyGroup := range admissionPoliciesGroup.Items {
for _, admissionPolicyGroup := range admissionPolicyGroupList.Items {
policies = append(policies, admissionPolicyGroup.DeepCopy())
}
for _, clusterAdmissionPolicyGroup := range clusterAdmissionPoliciesGroup.Items {
for _, clusterAdmissionPolicyGroup := range clusterAdmissionPolicyGroupList.Items {
policies = append(policies, clusterAdmissionPolicyGroup.DeepCopy())
}
return policies, nil
Expand Down

0 comments on commit 10976c9

Please sign in to comment.