Skip to content

Commit

Permalink
Run make manifests
Browse files Browse the repository at this point in the history
Signed-off-by: Will Beason <willbeason@google.com>
  • Loading branch information
Will Beason committed Sep 21, 2021
1 parent 4919b7e commit 42303ae
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 4 deletions.
3 changes: 3 additions & 0 deletions config/crd/bases/mutations.gatekeeper.sh_assign.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ spec:
properties:
message:
type: string
type:
description: Type indicates a specific class of error for use by controller code. If not present, the error should be treated as not matching any known type.
type: string
required:
- message
type: object
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/mutations.gatekeeper.sh_assignmetadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ spec:
properties:
message:
type: string
type:
description: Type indicates a specific class of error for use by controller code. If not present, the error should be treated as not matching any known type.
type: string
required:
- message
type: object
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/mutations.gatekeeper.sh_modifyset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ spec:
properties:
message:
type: string
type:
description: Type indicates a specific class of error for use by controller code. If not present, the error should be treated as not matching any known type.
type: string
required:
- message
type: object
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/status.gatekeeper.sh_mutatorpodstatuses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ spec:
properties:
message:
type: string
type:
description: Type indicates a specific class of error for use by controller code. If not present, the error should be treated as not matching any known type.
type: string
required:
- message
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ spec:
properties:
message:
type: string
type:
description: Type indicates a specific class of error for use by controller code. If not present, the error should be treated as not matching any known type.
type: string
required:
- message
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ spec:
properties:
message:
type: string
type:
description: Type indicates a specific class of error for use by controller code. If not present, the error should be treated as not matching any known type.
type: string
required:
- message
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ spec:
properties:
message:
type: string
type:
description: Type indicates a specific class of error for use by controller code. If not present, the error should be treated as not matching any known type.
type: string
required:
- message
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ spec:
properties:
message:
type: string
type:
description: Type indicates a specific class of error for use by controller code. If not present, the error should be treated as not matching any known type.
type: string
required:
- message
type: object
Expand Down
15 changes: 11 additions & 4 deletions pkg/controller/mutators/core/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ func (r *Reconciler) Reconcile(ctx context.Context, request reconcile.Request) (
r.reportMutator(id, ingestionStatus, startTime)
}()

conflicts := r.system.GetConflicts(id)
// previousConflicts records the conflicts this Mutator has with other mutators
// before making any changes.
previousConflicts := r.system.GetConflicts(id)

if deleted {
// Either the mutator was deleted before we were able to process this request, or it has been marked for
Expand All @@ -125,7 +127,9 @@ func (r *Reconciler) Reconcile(ctx context.Context, request reconcile.Request) (
return reconcile.Result{}, err
}

r.updateConflicts(ctx, id, conflicts)
// Now that we've made changes to the recorded Mutator schemas, we can re-check
// for conflicts.
r.updateConflicts(ctx, id, previousConflicts)

ingestionStatus = ctrlmutators.MutatorStatusActive
return reconcile.Result{}, nil
Expand Down Expand Up @@ -271,12 +275,15 @@ func (r *Reconciler) reconcileDeleted(ctx context.Context, mID types.ID) error {
// Ignores errors which occur while trying to update the PodStatus for other
// Mutators. Updating each of these statuses automatically triggers Reconcile
// for each of the corresponding Mutators.
func (r *Reconciler) updateConflicts(ctx context.Context, id types.ID, conflicts []types.ID) {
for _, conflict := range conflicts {
func (r *Reconciler) updateConflicts(ctx context.Context, id types.ID, previousConflicts []types.ID) {
for _, conflict := range previousConflicts {
if conflict == id {
continue
}

// This ensures the reported conflicts for each Mutator is complete. Even
// if there is no longer a conflict with id, we will still fill in conflicts
// with other Mutators.
idConflicts := r.system.GetConflicts(conflict)
if len(idConflicts) == 0 {
_ = r.updateStatus(ctx, conflict, updateConflictStatus(nil))
Expand Down

0 comments on commit 42303ae

Please sign in to comment.