mirror of
https://github.com/YuzuZensai/netbird-kubernetes-operator.git
synced 2026-09-13 10:49:15 +00:00
Implement group resource (#181)
This change implements a new group resource. It also sets the standard for a resource reference will be done through out the controller. A resource reference can either be done by ID or as a local named reference to the actual resource. This allows end users to chose if they want to manage things completely in the cluster or not. Part of #172 Signed-off-by: Philip Laine <philip.laine@gmail.com>
This commit is contained in:
@@ -15,6 +15,8 @@ type SetupKeySpecApplyConfiguration struct {
|
||||
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 []ResourceReferenceApplyConfiguration `json:"autoGroups,omitempty"`
|
||||
}
|
||||
|
||||
// SetupKeySpecApplyConfiguration constructs a declarative configuration of the SetupKeySpec type for use with
|
||||
@@ -38,3 +40,16 @@ func (b *SetupKeySpecApplyConfiguration) WithDuration(value v1.Duration) *SetupK
|
||||
b.Duration = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithAutoGroups adds the given value to the AutoGroups field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the AutoGroups field.
|
||||
func (b *SetupKeySpecApplyConfiguration) WithAutoGroups(values ...*ResourceReferenceApplyConfiguration) *SetupKeySpecApplyConfiguration {
|
||||
for i := range values {
|
||||
if values[i] == nil {
|
||||
panic("nil value passed to WithAutoGroups")
|
||||
}
|
||||
b.AutoGroups = append(b.AutoGroups, *values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user