Skip to content

Commit 4890b52

Browse files
committed
fix variable naming, add some comments
1 parent 99c7db9 commit 4890b52

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

pkg/component/component.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ func (s *RetrySpec) GetRetryInterval() time.Duration {
183183

184184
// Check if state is Ready.
185185
func (s *Status) IsReady() bool {
186+
// caveat: this operates only on the status, so it does not check that observedGeneration == generation
186187
return s.State == StateReady
187188
}
188189

pkg/component/reconciler.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ import (
5959
// (e.g. through a TimeoutConfiguration interface that components could optionally implement)
6060
// TODO: run admission webhooks (if present) in reconcile (e.g. as post-read hook)
6161
// TODO: improve overall log output
62+
// TODO: finalizer and fieldowner should be made more configurable (instead of just using the reconciler name)
63+
// TODO: finalizer should have the standard format prefix/finalizer
64+
// TODO: currently, the reconciler always claims/owns dependent objects entirely; but due to server-side-apply it can happen that
65+
// only parts of an object are managed: other parts/fiels might be managed by other actors (or even other components); how to handle such cases?
6266

6367
const (
6468
readyConditionReasonNew = "FirstSeen"
@@ -604,11 +608,11 @@ func (r *Reconciler[T]) getClientForComponent(component T) (cluster.Client, erro
604608
clientConfiguration, haveClientConfiguration := assertClientConfiguration(component)
605609
impersonationConfiguration, haveImpersonationConfiguration := assertImpersonationConfiguration(component)
606610

607-
var kubeconfig []byte
611+
var kubeConfig []byte
608612
var impersonationUser string
609613
var impersonationGroups []string
610614
if haveClientConfiguration {
611-
kubeconfig = clientConfiguration.GetKubeConfig()
615+
kubeConfig = clientConfiguration.GetKubeConfig()
612616
}
613617
if haveImpersonationConfiguration {
614618
impersonationUser = impersonationConfiguration.GetImpersonationUser()
@@ -626,7 +630,7 @@ func (r *Reconciler[T]) getClientForComponent(component T) (cluster.Client, erro
626630
}
627631
}
628632
}
629-
clnt, err := r.clients.Get(kubeconfig, impersonationUser, impersonationGroups)
633+
clnt, err := r.clients.Get(kubeConfig, impersonationUser, impersonationGroups)
630634
if err != nil {
631635
return nil, errors.Wrap(err, "error getting remote or impersonated client")
632636
}

pkg/reconciler/reconciler.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ type Reconciler struct {
134134
}
135135

136136
// Create new reconciler.
137+
// The passed name should be fully qualified; it will be used as field owner and finalizer.
138+
// The passed client's scheme must recognize at least the core group (v1) and apiextensions.k8s.io/v1 and apiregistration.k8s.io/v1.
137139
func NewReconciler(name string, clnt cluster.Client, options ReconcilerOptions) *Reconciler {
138140
// TOOD: validate options
139141
if options.CreateMissingNamespaces == nil {

0 commit comments

Comments
 (0)