Skip to content

Commit f18ff46

Browse files
authored
Merge pull request #122 from awslabs/ic
refactor(instance): improve controller state management and code organization
2 parents 043be06 + 183ccb0 commit f18ff46

File tree

4 files changed

+353
-267
lines changed

4 files changed

+353
-267
lines changed

internal/controller/instance/controller.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,13 @@ func (c *Controller) Reconcile(ctx context.Context, req ctrl.Request) error {
157157
instanceLabeler: c.instanceLabeler,
158158
instanceSubResourcesLabeler: instanceSubResourcesLabeler,
159159
reconcileConfig: c.reconcileConfig,
160+
// Fresh instance state at each reconciliation loop.
161+
state: newInstanceState(),
160162
}
161163
return instanceGraphReconciler.reconcile(ctx)
162164
}
163165

166+
// getNamespaceName extracts the namespace and name from the request.
164167
func getNamespaceName(req ctrl.Request) (string, string) {
165168
parts := strings.Split(req.Name, "/")
166169
name := parts[len(parts)-1]

0 commit comments

Comments
 (0)