Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ kind: ClusterRole
metadata:
name: manager-role
rules:
- apiGroups:
- '*'
resources:
- '*'
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- akuity.io
resources:
Expand Down
8 changes: 6 additions & 2 deletions internal/controller/namespaceclass_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const (
// +kubebuilder:rbac:groups=akuity.io,resources=namespaceclasses,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=akuity.io,resources=namespaceclasses/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=akuity.io,resources=namespaceclasses/finalizers,verbs=update
// +kubebuilder:rbac:groups=*,resources=*,verbs=get;list;watch;create;update;patch;delete

// Reconcile is part of the main kubernetes reconciliation loop which aims to
// move the current state of the cluster closer to the desired state.
Expand Down Expand Up @@ -114,10 +115,13 @@ func (r *NamespaceClassReconciler) reconcileNamespaceClass(ctx context.Context,
// Get the current NamespaceClass
namespaceClass := &akuityiov1.NamespaceClass{}
if err := r.Get(ctx, client.ObjectKey{Name: namespaceClassName}, namespaceClass); err != nil {
return err
if apierrors.IsNotFound(err) {
log.Info("NamespaceClass not found, skipping reconciliation", "namespaceClassName", namespaceClassName)
return nil
}
}

// Update namespace annotations
// Update namespace annotations if not present
if err := r.updateNamespaceAnnotations(ctx, namespace, namespaceClass); err != nil {
return err
}
Expand Down