Skip to content

Commit

Permalink
fix variable naming, add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cbarbian-sap committed Nov 25, 2024
1 parent 99c7db9 commit 4890b52
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions pkg/component/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ func (s *RetrySpec) GetRetryInterval() time.Duration {

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

Expand Down
10 changes: 7 additions & 3 deletions pkg/component/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ import (
// (e.g. through a TimeoutConfiguration interface that components could optionally implement)
// TODO: run admission webhooks (if present) in reconcile (e.g. as post-read hook)
// TODO: improve overall log output
// TODO: finalizer and fieldowner should be made more configurable (instead of just using the reconciler name)
// TODO: finalizer should have the standard format prefix/finalizer
// TODO: currently, the reconciler always claims/owns dependent objects entirely; but due to server-side-apply it can happen that
// 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?

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

var kubeconfig []byte
var kubeConfig []byte
var impersonationUser string
var impersonationGroups []string
if haveClientConfiguration {
kubeconfig = clientConfiguration.GetKubeConfig()
kubeConfig = clientConfiguration.GetKubeConfig()
}
if haveImpersonationConfiguration {
impersonationUser = impersonationConfiguration.GetImpersonationUser()
Expand All @@ -626,7 +630,7 @@ func (r *Reconciler[T]) getClientForComponent(component T) (cluster.Client, erro
}
}
}
clnt, err := r.clients.Get(kubeconfig, impersonationUser, impersonationGroups)
clnt, err := r.clients.Get(kubeConfig, impersonationUser, impersonationGroups)
if err != nil {
return nil, errors.Wrap(err, "error getting remote or impersonated client")
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/reconciler/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ type Reconciler struct {
}

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

0 comments on commit 4890b52

Please sign in to comment.