Skip to content
Open
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
14 changes: 10 additions & 4 deletions controllers/soot/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ import (
)

type sootItem struct {
triggers []chan event.GenericEvent
cancelFn context.CancelFunc
completedCh chan struct{}
certificateSha string
triggers []chan event.GenericEvent
cancelFn context.CancelFunc
completedCh chan struct{}
}

type sootMap map[string]sootItem
Expand Down Expand Up @@ -147,7 +148,7 @@ func (m *Manager) retryTenantControlPlaneAnnotations(ctx context.Context, reques
})
}

//nolint:maintidx
//nolint:maintidx,gocyclo
func (m *Manager) Reconcile(ctx context.Context, request reconcile.Request) (res reconcile.Result, err error) {
// Retrieving the TenantControlPlane:
// in case of deletion, we must be sure to properly remove from the memory the soot manager.
Expand Down Expand Up @@ -189,6 +190,10 @@ func (m *Manager) Reconcile(ctx context.Context, request reconcile.Request) (res
// we don't want to pollute with messages due to broken connection.
// Once the TCP will be ready again, the event will be intercepted and the manager started back.
return reconcile.Result{}, m.cleanup(ctx, request, tcp)
case tcp.Status.KubeConfig.Admin.Checksum != v.certificateSha:
// The stored kubeconfig to access the Tenant Control Plane has changed:
// we need to clean-up and requeue to fetch the updated value.
return reconcile.Result{RequeueAfter: time.Second}, m.cleanup(ctx, request, tcp)
default:
for _, trigger := range v.triggers {
var shrunkTCP kamajiv1alpha1.TenantControlPlane
Expand Down Expand Up @@ -394,6 +399,7 @@ func (m *Manager) Reconcile(ctx context.Context, request reconcile.Request) (res
}()

m.sootMap[request.NamespacedName.String()] = sootItem{
certificateSha: tcp.Status.KubeConfig.Admin.Checksum,
triggers: []chan event.GenericEvent{
writePermissions.TriggerChannel,
migrate.TriggerChannel,
Expand Down