mirror of
https://github.com/YuzuZensai/netbird-kubernetes-operator.git
synced 2026-09-13 10:49:15 +00:00
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:
@@ -11,15 +11,12 @@ import (
|
||||
// GroupApplyConfiguration represents a declarative configuration of the Group type for use
|
||||
// with apply.
|
||||
//
|
||||
// Group is the Schema for the groups API
|
||||
// Group is the Schema for the groups API.
|
||||
type GroupApplyConfiguration struct {
|
||||
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||
// metadata is a standard object metadata
|
||||
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||
// spec defines the desired state of Group
|
||||
Spec *GroupSpecApplyConfiguration `json:"spec,omitempty"`
|
||||
// status defines the observed state of Group
|
||||
Status *GroupStatusApplyConfiguration `json:"status,omitempty"`
|
||||
Spec *GroupSpecApplyConfiguration `json:"spec,omitempty"`
|
||||
Status *GroupStatusApplyConfiguration `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// Group constructs a declarative configuration of the Group type for use with
|
||||
|
||||
@@ -5,9 +5,9 @@ package v1alpha1
|
||||
// GroupSpecApplyConfiguration represents a declarative configuration of the GroupSpec type for use
|
||||
// with apply.
|
||||
//
|
||||
// GroupSpec defines the desired state of Group
|
||||
// GroupSpec defines the desired state of Group.
|
||||
type GroupSpecApplyConfiguration struct {
|
||||
// name of the group.
|
||||
// Name of the group.
|
||||
Name *string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
@@ -11,9 +11,12 @@ import (
|
||||
//
|
||||
// GroupStatus defines the observed state of Group.
|
||||
type GroupStatusApplyConfiguration struct {
|
||||
GroupID *string `json:"groupID,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 Group.
|
||||
Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"`
|
||||
// GroupID is the id of the created group.
|
||||
GroupID *string `json:"groupID,omitempty"`
|
||||
}
|
||||
|
||||
// GroupStatusApplyConfiguration constructs a declarative configuration of the GroupStatus type for use with
|
||||
@@ -22,11 +25,11 @@ func GroupStatus() *GroupStatusApplyConfiguration {
|
||||
return &GroupStatusApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithGroupID sets the GroupID 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 GroupID field is set to the value of the last call.
|
||||
func (b *GroupStatusApplyConfiguration) WithGroupID(value string) *GroupStatusApplyConfiguration {
|
||||
b.GroupID = &value
|
||||
// If called multiple times, the ObservedGeneration field is set to the value of the last call.
|
||||
func (b *GroupStatusApplyConfiguration) WithObservedGeneration(value int64) *GroupStatusApplyConfiguration {
|
||||
b.ObservedGeneration = &value
|
||||
return b
|
||||
}
|
||||
|
||||
@@ -42,3 +45,11 @@ func (b *GroupStatusApplyConfiguration) WithConditions(values ...*v1.ConditionAp
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithGroupID sets the GroupID 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 GroupID field is set to the value of the last call.
|
||||
func (b *GroupStatusApplyConfiguration) WithGroupID(value string) *GroupStatusApplyConfiguration {
|
||||
b.GroupID = &value
|
||||
return b
|
||||
}
|
||||
|
||||
@@ -11,15 +11,12 @@ import (
|
||||
// SetupKeyApplyConfiguration represents a declarative configuration of the SetupKey type for use
|
||||
// with apply.
|
||||
//
|
||||
// SetupKey is the Schema for the setupkeys API
|
||||
// SetupKey is the Schema for the setupkeys API.
|
||||
type SetupKeyApplyConfiguration struct {
|
||||
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||
// metadata is a standard object metadata
|
||||
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||
// spec defines the desired state of SetupKey
|
||||
Spec *SetupKeySpecApplyConfiguration `json:"spec,omitempty"`
|
||||
// status defines the observed state of SetupKey
|
||||
Status *SetupKeyStatusApplyConfiguration `json:"status,omitempty"`
|
||||
Spec *SetupKeySpecApplyConfiguration `json:"spec,omitempty"`
|
||||
Status *SetupKeyStatusApplyConfiguration `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// SetupKey constructs a declarative configuration of the SetupKey type for use with
|
||||
|
||||
@@ -9,13 +9,13 @@ import (
|
||||
// SetupKeySpecApplyConfiguration represents a declarative configuration of the SetupKeySpec type for use
|
||||
// with apply.
|
||||
//
|
||||
// SetupKeySpec defines the desired state of SetupKey
|
||||
// SetupKeySpec defines the desired state of SetupKey.
|
||||
type SetupKeySpecApplyConfiguration struct {
|
||||
// Ephemeral decides if peers added with the key are ephemeral or not.
|
||||
Ephemeral *bool `json:"ephemeral,omitempty"`
|
||||
// Duration sets how long the setup key is valid for.
|
||||
Duration *v1.Duration `json:"duration,omitempty"`
|
||||
// Groups that will be automatically assigned to resources using setup key.
|
||||
// AutoGroups are groups that will be automatically assigned to peers using setup key.
|
||||
AutoGroups []ResourceReferenceApplyConfiguration `json:"autoGroups,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user