This commit is contained in:
161
api/v1alpha1/cluster_types.go
Normal file
161
api/v1alpha1/cluster_types.go
Normal file
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
Copyright 2024.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// Image defines the container image name and tag.
|
||||
type Image struct {
|
||||
Name string `json:"name"`
|
||||
Tag string `json:"tag"`
|
||||
}
|
||||
|
||||
// Password holds a reference to a Kubernetes Secret key containing a password.
|
||||
type Password struct {
|
||||
SecretKeyRef corev1.SecretKeySelector `json:"secretRef"`
|
||||
}
|
||||
|
||||
// SMTPConfig configures an SMTP provider.
|
||||
type SMTPConfig struct {
|
||||
SenderAddress string `json:"senderAddress"`
|
||||
SenderName string `json:"senderName"`
|
||||
// +kubebuilder:default=true
|
||||
TLS bool `json:"tls"`
|
||||
Host string `json:"host"`
|
||||
User *string `json:"user,omitempty"`
|
||||
Password *Password `json:"password,omitempty"`
|
||||
ReplyToAddress *string `json:"replyToAddress,omitempty"`
|
||||
}
|
||||
|
||||
// DomainSettings configures domain-related behaviour.
|
||||
type DomainSettings struct {
|
||||
// +kubebuilder:default=true
|
||||
UserLoginMustBeDomain bool `json:"userLoginMustBeDomain"`
|
||||
// +kubebuilder:default=true
|
||||
ValidateOrgDomains bool `json:"validateOrgDomains"`
|
||||
// +kubebuilder:default=true
|
||||
SMTPSenderAddressMatchesInstanceDomain bool `json:"smtpSenderAddressMatchesInstanceDomain"`
|
||||
}
|
||||
|
||||
// ClusterSpec defines the desired state of Cluster.
|
||||
type ClusterSpec struct {
|
||||
// Host is the external hostname used to reach Zitadel.
|
||||
Host string `json:"host"`
|
||||
|
||||
// ExternalPort is the port exposed externally.
|
||||
// +kubebuilder:default=443
|
||||
ExternalPort int64 `json:"externalPort"`
|
||||
|
||||
// ExternalSecure indicates whether TLS is used on the external endpoint.
|
||||
// +kubebuilder:default=true
|
||||
ExternalSecure bool `json:"externalSecure"`
|
||||
|
||||
// Image is the Zitadel container image to deploy.
|
||||
Image Image `json:"image"`
|
||||
|
||||
// Resources defines compute resource requests and limits for the Zitadel pods.
|
||||
Resources corev1.ResourceRequirements `json:"resources"`
|
||||
|
||||
// PostgreSQLClusterRef references the backing PostgreSQL cluster.
|
||||
PostgreSQLClusterRef PostgreSQLClusterRef `json:"postgresClusterRef"`
|
||||
|
||||
// Replicas is the desired number of Zitadel pods.
|
||||
// +kubebuilder:default=3
|
||||
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:podCount"}
|
||||
Replicas int32 `json:"replicas,omitempty"`
|
||||
|
||||
// PodAnnotations are extra annotations added to each Zitadel Pod.
|
||||
// +optional
|
||||
// +operator-sdk:csv:customresourcedefinitions:type=spec
|
||||
PodAnnotations map[string]string `json:"podAnnotations,omitempty"`
|
||||
|
||||
// ServiceAnnotations are extra annotations added to the Zitadel Service.
|
||||
// +optional
|
||||
// +operator-sdk:csv:customresourcedefinitions:type=spec
|
||||
ServiceAnnotations map[string]string `json:"serviceAnnotations,omitempty"`
|
||||
}
|
||||
|
||||
// ClusterStatus defines the observed state of Cluster.
|
||||
type ClusterStatus struct {
|
||||
// Conditions store the status conditions of the Cluster.
|
||||
Conditions []metav1.Condition `json:"conditions,omitempty"`
|
||||
|
||||
// Replicas is the current number of running Zitadel pods.
|
||||
// +kubebuilder:default=3
|
||||
// +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:podCount"}
|
||||
Replicas int32 `json:"replicas,omitempty"`
|
||||
}
|
||||
|
||||
// SetCondition sets a status condition on the Cluster.
|
||||
func (s *ClusterStatus) SetCondition(condition metav1.Condition) {
|
||||
if s.Conditions == nil {
|
||||
s.Conditions = make([]metav1.Condition, 0)
|
||||
}
|
||||
meta.SetStatusCondition(&s.Conditions, condition)
|
||||
}
|
||||
|
||||
// IsReady returns true when the cluster has reached the Ready condition.
|
||||
func (s *ClusterStatus) IsReady() bool {
|
||||
for _, c := range s.Conditions {
|
||||
if c.Type == ConditionTypeReady && c.Status == metav1.ConditionTrue {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// FillWithDefaults populates default values on the Cluster status.
|
||||
func (s *ClusterStatus) FillWithDefaults(_ *Cluster) {
|
||||
// (Haim ;^D): No defaults yet
|
||||
}
|
||||
|
||||
//+kubebuilder:object:root=true
|
||||
//+kubebuilder:subresource:status
|
||||
//+kubebuilder:printcolumn:name="Replicas",type=integer,JSONPath=`.status.replicas`
|
||||
//+kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status`
|
||||
//+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
|
||||
|
||||
// Cluster is the Schema for the clusters API.
|
||||
type Cluster struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ClusterSpec `json:"spec,omitempty"`
|
||||
Status ClusterStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// SetDefaults populates default values on the Cluster spec.
|
||||
func (m *Cluster) SetDefaults() {
|
||||
// (Haim ;^D): No defaults yet
|
||||
}
|
||||
|
||||
//+kubebuilder:object:root=true
|
||||
|
||||
// ClusterList contains a list of Cluster.
|
||||
type ClusterList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []Cluster `json:"items"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&Cluster{}, &ClusterList{})
|
||||
}
|
||||
32
api/v1alpha1/condition_types.go
Normal file
32
api/v1alpha1/condition_types.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package v1alpha1
|
||||
|
||||
const (
|
||||
ConditionTypeReady string = "Ready"
|
||||
ConditionTypePATUpToDate string = "PATUpToDate"
|
||||
|
||||
ConditionReasonRolesChanged string = "RolesChanged"
|
||||
ConditionReasonPATUpToDate string = "UpToDate"
|
||||
|
||||
ConditionReasonDeploymentNotReady string = "DeploymentNotReady"
|
||||
ConditionReasonDeploymentReady string = "DeploymentReady"
|
||||
ConditionReasonRestoreBackup string = "RestoreBackup"
|
||||
|
||||
ConditionReasonRestoreNotComplete string = "RestoreNotComplete"
|
||||
ConditionReasonRestoreComplete string = "RestoreComplete"
|
||||
|
||||
ConditionReasonJobComplete string = "JobComplete"
|
||||
ConditionReasonJobSuspended string = "JobSuspended"
|
||||
ConditionReasonJobFailed string = "JobFailed"
|
||||
ConditionReasonJobRunning string = "JobRunning"
|
||||
|
||||
ConditionReasonCronJobScheduled string = "CronJobScheduled"
|
||||
ConditionReasonCronJobFailed string = "CronJobScheduled"
|
||||
ConditionReasonCronJobRunning string = "CronJobRunning"
|
||||
ConditionReasonCronJobSuccess string = "CronJobSucess"
|
||||
|
||||
ConditionReasonConnectionFailed string = "ConnectionFailed"
|
||||
|
||||
ConditionReasonCreated string = "Created"
|
||||
ConditionReasonHealthy string = "Healthy"
|
||||
ConditionReasonFailed string = "Failed"
|
||||
)
|
||||
36
api/v1alpha1/groupversion_info.go
Normal file
36
api/v1alpha1/groupversion_info.go
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
Copyright 2024.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package v1alpha1 contains API Schema definitions for the zitadel v1alpha1 API group
|
||||
// +kubebuilder:object:generate=true
|
||||
// +groupName=zitadel.github.com
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"sigs.k8s.io/controller-runtime/pkg/scheme"
|
||||
)
|
||||
|
||||
var (
|
||||
// GroupVersion is group version used to register these objects
|
||||
GroupVersion = schema.GroupVersion{Group: "zitadel.github.com", Version: "v1alpha1"}
|
||||
|
||||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
|
||||
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
|
||||
|
||||
// AddToScheme adds the types in this group-version to the given scheme.
|
||||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
)
|
||||
180
api/v1alpha1/instance_types.go
Normal file
180
api/v1alpha1/instance_types.go
Normal file
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
Copyright 2024.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// AccessTokenType defines the token format issued to the machine user.
|
||||
// +kubebuilder:validation:Enum=ACCESS_TOKEN_TYPE_BEARER;ACCESS_TOKEN_TYPE_JWT
|
||||
type AccessTokenType string
|
||||
|
||||
const (
|
||||
AccessTokenTypeBearer AccessTokenType = "ACCESS_TOKEN_TYPE_BEARER"
|
||||
AccessTokenTypeJWT AccessTokenType = "ACCESS_TOKEN_TYPE_JWT"
|
||||
)
|
||||
|
||||
// FirstOrg defines the first organisation and its IAM_OWNER machine user.
|
||||
type FirstOrg struct {
|
||||
// Name of the first organization.
|
||||
// +kubebuilder:default="DEFAULT"
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type LoginUIImage struct {
|
||||
// +kubebuilder:default="ghcr.io/zitadel/zitadel-login"
|
||||
Name string `json:"name"`
|
||||
// if empty it uses the same tag as zitadel cluster
|
||||
Tag *string `json:"tag,omitempty"`
|
||||
}
|
||||
|
||||
type LoginUI struct {
|
||||
Image LoginUIImage `json:"image"`
|
||||
|
||||
Resources corev1.ResourceRequirements `json:"resources"`
|
||||
}
|
||||
|
||||
// InstanceSpec defines the desired state of Instance.
|
||||
// Fields map directly to POST /instances/_create (CreateInstance) in the Zitadel System API.
|
||||
type InstanceSpec struct {
|
||||
// ClusterRef references the Cluster this instance will be provisioned on.
|
||||
// +kubebuilder:validation:Required
|
||||
// +operator-sdk:csv:customresourcedefinitions:type=spec
|
||||
ClusterRef ClusterRef `json:"clusterRef"`
|
||||
|
||||
// InstanceName is the display name of the Zitadel instance.
|
||||
// +kubebuilder:validation:Required
|
||||
// +operator-sdk:csv:customresourcedefinitions:type=spec
|
||||
InstanceName string `json:"instanceName"`
|
||||
|
||||
// DefaultLanguage is the BCP-47 language tag used as the instance default (e.g. "en").
|
||||
// +kubebuilder:default="en"
|
||||
// +operator-sdk:csv:customresourcedefinitions:type=spec
|
||||
DefaultLanguage string `json:"defaultLanguage,omitempty"`
|
||||
|
||||
// +operator-sdk:csv:customresourcedefinitions:type=spec
|
||||
CustomDomain string `json:"customDomain"`
|
||||
|
||||
// Org configures the first organisation and its initial IAM_OWNER machine user.
|
||||
// +kubebuilder:validation:Required
|
||||
// +operator-sdk:csv:customresourcedefinitions:type=spec
|
||||
Org FirstOrg `json:"org"`
|
||||
|
||||
// +kubebuilder:default={image: {name: "ghcr.io/zitadel/zitadel-login"}, resources: {}}
|
||||
// +operator-sdk:csv:customresourcedefinitions:type=spec
|
||||
LoginUI LoginUI `json:"loginUI"`
|
||||
}
|
||||
|
||||
// InstanceStatus defines the observed state of Instance.
|
||||
type InstanceStatus struct {
|
||||
// Conditions store the status conditions of the Instance.
|
||||
// +operator-sdk:csv:customresourcedefinitions:type=status
|
||||
Conditions []metav1.Condition `json:"conditions,omitempty"`
|
||||
|
||||
// InstanceId is the instance ID returned by Zitadel after successful provisioning.
|
||||
InstanceId *string `json:"instanceId,omitempty"`
|
||||
}
|
||||
|
||||
// SetCondition sets a status condition on the Instance.
|
||||
func (s *InstanceStatus) SetCondition(condition metav1.Condition) {
|
||||
if s.Conditions == nil {
|
||||
s.Conditions = make([]metav1.Condition, 0)
|
||||
}
|
||||
meta.SetStatusCondition(&s.Conditions, condition)
|
||||
}
|
||||
|
||||
// IsReady returns true when the instance has reached the Ready condition.
|
||||
func (s *Instance) IsReady() bool {
|
||||
return meta.IsStatusConditionTrue(s.Status.Conditions, ConditionTypeReady)
|
||||
}
|
||||
|
||||
func (d *Instance) IsBeingDeleted() bool {
|
||||
return !d.DeletionTimestamp.IsZero()
|
||||
}
|
||||
|
||||
func (s *Instance) ClusterRef(_ context.Context, _ *RefResolver) (*ClusterRef, error) {
|
||||
return &s.Spec.ClusterRef, nil
|
||||
}
|
||||
|
||||
// FillWithDefaults populates default values on the Instance status.
|
||||
func (s *InstanceStatus) FillWithDefaults(_ *Instance) {
|
||||
// (Haim ;^D): No defaults yet
|
||||
}
|
||||
|
||||
//+kubebuilder:object:root=true
|
||||
//+kubebuilder:subresource:status
|
||||
//+kubebuilder:printcolumn:name="Instance",type=string,JSONPath=`.spec.instanceName`
|
||||
//+kubebuilder:printcolumn:name="Cluster",type=string,JSONPath=`.spec.clusterRef.name`
|
||||
//+kubebuilder:printcolumn:name="Domain",type=string,JSONPath=`.spec.customDomain`
|
||||
//+kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status`
|
||||
//+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
|
||||
|
||||
// Instance is the Schema for the instances API.
|
||||
type Instance struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec InstanceSpec `json:"spec,omitempty"`
|
||||
Status InstanceStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// SetDefaults populates default values on the Instance spec.
|
||||
func (m *Instance) SetDefaults() {
|
||||
// (Haim ;^D): No defaults yet
|
||||
}
|
||||
|
||||
func (m *Instance) MachineUserName() string {
|
||||
return "k8s-operator"
|
||||
}
|
||||
|
||||
func (m *Instance) MachineName() string {
|
||||
return "K8S OPERATOR"
|
||||
}
|
||||
|
||||
func (m *Instance) MachineSecretName() string {
|
||||
return m.Name + "-owner-machine-secret"
|
||||
}
|
||||
|
||||
func (m *Instance) LoginMachineUserName() string {
|
||||
return m.Name + "-login-ui"
|
||||
}
|
||||
|
||||
func (m *Instance) FirstOrgObjectName() string {
|
||||
return m.Name + "-" + m.Spec.Org.Name
|
||||
}
|
||||
|
||||
func (m *Instance) ConnectionObjectName() string {
|
||||
return m.Name + "-connection"
|
||||
}
|
||||
|
||||
//+kubebuilder:object:root=true
|
||||
|
||||
// InstanceList contains a list of Instance.
|
||||
type InstanceList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []Instance `json:"items"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&Instance{}, &InstanceList{})
|
||||
}
|
||||
23
api/v1alpha1/ref_types.go
Normal file
23
api/v1alpha1/ref_types.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
type PostgreSQLClusterRef struct {
|
||||
// ObjectReference is a reference to a object.
|
||||
// +operator-sdk:csv:customresourcedefinitions:type=spec
|
||||
corev1.ObjectReference `json:",inline"`
|
||||
}
|
||||
|
||||
type InstanceRef struct {
|
||||
// ObjectReference is a reference to a object.
|
||||
// +operator-sdk:csv:customresourcedefinitions:type=spec
|
||||
corev1.ObjectReference `json:",inline"`
|
||||
}
|
||||
|
||||
type ClusterRef struct {
|
||||
// ObjectReference is a reference to a object.
|
||||
// +operator-sdk:csv:customresourcedefinitions:type=spec
|
||||
corev1.ObjectReference `json:",inline"`
|
||||
}
|
||||
103
api/v1alpha1/refresolver.go
Normal file
103
api/v1alpha1/refresolver.go
Normal file
@@ -0,0 +1,103 @@
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
cloudnativepgv1 "github.com/cloudnative-pg/cloudnative-pg/api/v1"
|
||||
)
|
||||
|
||||
// +kubebuilder:object:generate=false
|
||||
type RefResolver struct {
|
||||
client client.Client
|
||||
}
|
||||
|
||||
func NewRefResolver(client client.Client) *RefResolver {
|
||||
return &RefResolver{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
|
||||
func (r *RefResolver) Instance(ctx context.Context, ref *InstanceRef,
|
||||
namespace string) (*Instance, error) {
|
||||
if ref.Kind != "" && ref.Kind != "Instance" {
|
||||
return nil, fmt.Errorf("Unsupported reference kind: '%s'", ref.Kind)
|
||||
}
|
||||
|
||||
key := types.NamespacedName{
|
||||
Name: ref.Name,
|
||||
Namespace: namespace,
|
||||
}
|
||||
if ref.Namespace != "" {
|
||||
key.Namespace = ref.Namespace
|
||||
}
|
||||
|
||||
var zitadel Instance
|
||||
if err := r.client.Get(ctx, key, &zitadel); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &zitadel, nil
|
||||
}
|
||||
|
||||
func (r *RefResolver) Cluster(ctx context.Context, ref *ClusterRef,
|
||||
namespace string) (*Cluster, error) {
|
||||
if ref.Kind != "" && ref.Kind != "Cluster" {
|
||||
return nil, fmt.Errorf("Unsupported reference kind: '%s'", ref.Kind)
|
||||
}
|
||||
|
||||
key := types.NamespacedName{
|
||||
Name: ref.Name,
|
||||
Namespace: namespace,
|
||||
}
|
||||
if ref.Namespace != "" {
|
||||
key.Namespace = ref.Namespace
|
||||
}
|
||||
|
||||
var zitadel Cluster
|
||||
if err := r.client.Get(ctx, key, &zitadel); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &zitadel, nil
|
||||
}
|
||||
|
||||
func (r *RefResolver) PostgreSQLClusterRef(ctx context.Context, ref *PostgreSQLClusterRef, namespace string) (*cloudnativepgv1.Cluster, error) {
|
||||
if ref.Kind != "" && ref.Kind != "Cluster" {
|
||||
return nil, fmt.Errorf("Unsupported reference kind: '%s'", ref.Kind)
|
||||
}
|
||||
key := types.NamespacedName{
|
||||
Name: ref.Name,
|
||||
Namespace: namespace,
|
||||
}
|
||||
if ref.Namespace != "" {
|
||||
key.Namespace = ref.Namespace
|
||||
}
|
||||
|
||||
var postgres cloudnativepgv1.Cluster
|
||||
if err := r.client.Get(ctx, key, &postgres); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &postgres, nil
|
||||
}
|
||||
|
||||
func (r *RefResolver) SecretKeyRef(ctx context.Context, selector corev1.SecretKeySelector,
|
||||
namespace string) (string, error) {
|
||||
nn := types.NamespacedName{
|
||||
Name: selector.Name,
|
||||
Namespace: namespace,
|
||||
}
|
||||
var secret v1.Secret
|
||||
if err := r.client.Get(ctx, nn, &secret); err != nil {
|
||||
return "", fmt.Errorf("error getting secret: %v", err)
|
||||
}
|
||||
|
||||
data, ok := secret.Data[selector.Key]
|
||||
if !ok {
|
||||
return "", fmt.Errorf("secret key \"%s\" not found", selector.Key)
|
||||
}
|
||||
|
||||
return string(data), nil
|
||||
}
|
||||
419
api/v1alpha1/zz_generated.deepcopy.go
Normal file
419
api/v1alpha1/zz_generated.deepcopy.go
Normal file
@@ -0,0 +1,419 @@
|
||||
//go:build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2024.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by controller-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Cluster) DeepCopyInto(out *Cluster) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Cluster.
|
||||
func (in *Cluster) DeepCopy() *Cluster {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Cluster)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Cluster) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ClusterList) DeepCopyInto(out *ClusterList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Cluster, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterList.
|
||||
func (in *ClusterList) DeepCopy() *ClusterList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ClusterList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ClusterList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ClusterRef) DeepCopyInto(out *ClusterRef) {
|
||||
*out = *in
|
||||
out.ObjectReference = in.ObjectReference
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterRef.
|
||||
func (in *ClusterRef) DeepCopy() *ClusterRef {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ClusterRef)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) {
|
||||
*out = *in
|
||||
out.Image = in.Image
|
||||
in.Resources.DeepCopyInto(&out.Resources)
|
||||
out.PostgreSQLClusterRef = in.PostgreSQLClusterRef
|
||||
if in.PodAnnotations != nil {
|
||||
in, out := &in.PodAnnotations, &out.PodAnnotations
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.ServiceAnnotations != nil {
|
||||
in, out := &in.ServiceAnnotations, &out.ServiceAnnotations
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterSpec.
|
||||
func (in *ClusterSpec) DeepCopy() *ClusterSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ClusterSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ClusterStatus) DeepCopyInto(out *ClusterStatus) {
|
||||
*out = *in
|
||||
if in.Conditions != nil {
|
||||
in, out := &in.Conditions, &out.Conditions
|
||||
*out = make([]v1.Condition, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterStatus.
|
||||
func (in *ClusterStatus) DeepCopy() *ClusterStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ClusterStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DomainSettings) DeepCopyInto(out *DomainSettings) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DomainSettings.
|
||||
func (in *DomainSettings) DeepCopy() *DomainSettings {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DomainSettings)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FirstOrg) DeepCopyInto(out *FirstOrg) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FirstOrg.
|
||||
func (in *FirstOrg) DeepCopy() *FirstOrg {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FirstOrg)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Image) DeepCopyInto(out *Image) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Image.
|
||||
func (in *Image) DeepCopy() *Image {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Image)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Instance) DeepCopyInto(out *Instance) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Instance.
|
||||
func (in *Instance) DeepCopy() *Instance {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Instance)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Instance) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *InstanceList) DeepCopyInto(out *InstanceList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Instance, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceList.
|
||||
func (in *InstanceList) DeepCopy() *InstanceList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(InstanceList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *InstanceList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *InstanceRef) DeepCopyInto(out *InstanceRef) {
|
||||
*out = *in
|
||||
out.ObjectReference = in.ObjectReference
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceRef.
|
||||
func (in *InstanceRef) DeepCopy() *InstanceRef {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(InstanceRef)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *InstanceSpec) DeepCopyInto(out *InstanceSpec) {
|
||||
*out = *in
|
||||
out.ClusterRef = in.ClusterRef
|
||||
out.Org = in.Org
|
||||
in.LoginUI.DeepCopyInto(&out.LoginUI)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceSpec.
|
||||
func (in *InstanceSpec) DeepCopy() *InstanceSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(InstanceSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *InstanceStatus) DeepCopyInto(out *InstanceStatus) {
|
||||
*out = *in
|
||||
if in.Conditions != nil {
|
||||
in, out := &in.Conditions, &out.Conditions
|
||||
*out = make([]v1.Condition, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.InstanceId != nil {
|
||||
in, out := &in.InstanceId, &out.InstanceId
|
||||
*out = new(string)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceStatus.
|
||||
func (in *InstanceStatus) DeepCopy() *InstanceStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(InstanceStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *LoginUI) DeepCopyInto(out *LoginUI) {
|
||||
*out = *in
|
||||
in.Image.DeepCopyInto(&out.Image)
|
||||
in.Resources.DeepCopyInto(&out.Resources)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoginUI.
|
||||
func (in *LoginUI) DeepCopy() *LoginUI {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(LoginUI)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *LoginUIImage) DeepCopyInto(out *LoginUIImage) {
|
||||
*out = *in
|
||||
if in.Tag != nil {
|
||||
in, out := &in.Tag, &out.Tag
|
||||
*out = new(string)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoginUIImage.
|
||||
func (in *LoginUIImage) DeepCopy() *LoginUIImage {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(LoginUIImage)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Password) DeepCopyInto(out *Password) {
|
||||
*out = *in
|
||||
in.SecretKeyRef.DeepCopyInto(&out.SecretKeyRef)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Password.
|
||||
func (in *Password) DeepCopy() *Password {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Password)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PostgreSQLClusterRef) DeepCopyInto(out *PostgreSQLClusterRef) {
|
||||
*out = *in
|
||||
out.ObjectReference = in.ObjectReference
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PostgreSQLClusterRef.
|
||||
func (in *PostgreSQLClusterRef) DeepCopy() *PostgreSQLClusterRef {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PostgreSQLClusterRef)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SMTPConfig) DeepCopyInto(out *SMTPConfig) {
|
||||
*out = *in
|
||||
if in.User != nil {
|
||||
in, out := &in.User, &out.User
|
||||
*out = new(string)
|
||||
**out = **in
|
||||
}
|
||||
if in.Password != nil {
|
||||
in, out := &in.Password, &out.Password
|
||||
*out = new(Password)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.ReplyToAddress != nil {
|
||||
in, out := &in.ReplyToAddress, &out.ReplyToAddress
|
||||
*out = new(string)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SMTPConfig.
|
||||
func (in *SMTPConfig) DeepCopy() *SMTPConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SMTPConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
Reference in New Issue
Block a user