Add ready conditon and cleanup finalizer and status patching (#186)

This change adds a ready condition. It also sets a standard for status
fields and documentation. It makes use of helper functions from FluxCD
to better manage patching of finalizers and status.

Signed-off-by: Philip Laine <philip.laine@gmail.com>
This commit is contained in:
Philip Laine
2026-04-21 15:42:11 +02:00
committed by GitHub
parent 1bcd58a7cd
commit af11e31b28
19 changed files with 250 additions and 181 deletions
@@ -11,10 +11,12 @@ import (
//
// SetupKeyStatus defines the observed state of SetupKey.
type SetupKeyStatusApplyConfiguration struct {
// SetupKeyID of the setup key.
SetupKeyID *string `json:"setupKeyID,omitempty"`
// The status of each condition is one of True, False, or Unknown.
// ObservedGeneration is the last reconciled generation.
ObservedGeneration *int64 `json:"observedGeneration,omitempty"`
// Conditions holds the conditions for the SetupKey.
Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"`
// SetupKeyID is the id of the created setup key.
SetupKeyID *string `json:"setupKeyID,omitempty"`
}
// SetupKeyStatusApplyConfiguration constructs a declarative configuration of the SetupKeyStatus type for use with
@@ -23,11 +25,11 @@ func SetupKeyStatus() *SetupKeyStatusApplyConfiguration {
return &SetupKeyStatusApplyConfiguration{}
}
// WithSetupKeyID sets the SetupKeyID field in the declarative configuration to the given value
// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the SetupKeyID field is set to the value of the last call.
func (b *SetupKeyStatusApplyConfiguration) WithSetupKeyID(value string) *SetupKeyStatusApplyConfiguration {
b.SetupKeyID = &value
// If called multiple times, the ObservedGeneration field is set to the value of the last call.
func (b *SetupKeyStatusApplyConfiguration) WithObservedGeneration(value int64) *SetupKeyStatusApplyConfiguration {
b.ObservedGeneration = &value
return b
}
@@ -43,3 +45,11 @@ func (b *SetupKeyStatusApplyConfiguration) WithConditions(values ...*v1.Conditio
}
return b
}
// WithSetupKeyID sets the SetupKeyID field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the SetupKeyID field is set to the value of the last call.
func (b *SetupKeyStatusApplyConfiguration) WithSetupKeyID(value string) *SetupKeyStatusApplyConfiguration {
b.SetupKeyID = &value
return b
}