Browse Source

Create basic SecretSink structure

Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
Signed-off-by: Marcin Kubica <marcin.kubica@engineerbetter.com>
Signed-off-by: William Young <will.young@engineerbetter.com>
Dominic Meddick 4 years ago
parent
commit
631e0e8e81

+ 45 - 4
apis/externalsecrets/v1alpha1/secretsink_types.go

@@ -15,11 +15,52 @@ limitations under the License.
 package v1alpha1
 
 import (
-
-	// corev1 "k8s.io/api/core/v1".
+	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 )
 
+// SecretSinkSpec configures the behavior of the SecretSink.
+type SecretSinkSpec struct {
+	Selector string   `json:"selector"`
+	Data     []string `json:"data,omitempty"`
+}
+
+// SecretSinkConditionType indicates the condition of the SecretSink.
+type SecretSinkConditionType string
+
+const (
+	SecretSinkNotImplemented SecretSinkConditionType = "NotImplemented"
+)
+
+// SecretSinkStatusCondition indicates the status of the SecretSink.
+type SecretSinkStatusCondition struct {
+	Type   SecretSinkConditionType `json:"type"`
+	Status corev1.ConditionStatus  `json:"status"`
+
+	// +optional
+	Reason string `json:"reason,omitempty"`
+
+	// +optional
+	Message string `json:"message,omitempty"`
+
+	// +optional
+	LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
+}
+
+// SecretSinkStatus indicates the history of the status of SecretSink.
+type SecretSinkStatus struct {
+	// +nullable
+	// refreshTime is the time and date the external secret was fetched and
+	// the target secret updated
+	RefreshTime metav1.Time `json:"refreshTime,omitempty"`
+
+	// SyncedResourceVersion keeps track of the last synced version.
+	SyncedResourceVersion string `json:"syncedResourceVersion,omitempty"`
+
+	// +optional
+	Conditions []SecretSinkStatusCondition `json:"conditions,omitempty"`
+}
+
 // +kubebuilder:object:root=true
 // +kubebuilder:storageversion
 // Secretsinks is the Schema for the secretsinks API.
@@ -30,8 +71,8 @@ type SecretSink struct {
 	metav1.TypeMeta   `json:",inline"`
 	metav1.ObjectMeta `json:"metadata,omitempty"`
 
-	Spec   string `json:"spec,omitempty"`
-	Status string `json:"status,omitempty"`
+	Spec   SecretSinkSpec   `json:"spec,omitempty"`
+	Status SecretSinkStatus `json:"status,omitempty"`
 }
 
 // +kubebuilder:object:root=true

+ 61 - 0
apis/externalsecrets/v1alpha1/zz_generated.deepcopy.go

@@ -969,6 +969,8 @@ func (in *SecretSink) DeepCopyInto(out *SecretSink) {
 	*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 SecretSink.
@@ -1021,6 +1023,65 @@ func (in *SecretSinkList) DeepCopyObject() runtime.Object {
 	return nil
 }
 
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *SecretSinkSpec) DeepCopyInto(out *SecretSinkSpec) {
+	*out = *in
+	if in.Data != nil {
+		in, out := &in.Data, &out.Data
+		*out = make([]string, len(*in))
+		copy(*out, *in)
+	}
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretSinkSpec.
+func (in *SecretSinkSpec) DeepCopy() *SecretSinkSpec {
+	if in == nil {
+		return nil
+	}
+	out := new(SecretSinkSpec)
+	in.DeepCopyInto(out)
+	return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *SecretSinkStatus) DeepCopyInto(out *SecretSinkStatus) {
+	*out = *in
+	in.RefreshTime.DeepCopyInto(&out.RefreshTime)
+	if in.Conditions != nil {
+		in, out := &in.Conditions, &out.Conditions
+		*out = make([]SecretSinkStatusCondition, len(*in))
+		for i := range *in {
+			(*in)[i].DeepCopyInto(&(*out)[i])
+		}
+	}
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretSinkStatus.
+func (in *SecretSinkStatus) DeepCopy() *SecretSinkStatus {
+	if in == nil {
+		return nil
+	}
+	out := new(SecretSinkStatus)
+	in.DeepCopyInto(out)
+	return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *SecretSinkStatusCondition) DeepCopyInto(out *SecretSinkStatusCondition) {
+	*out = *in
+	in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime)
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretSinkStatusCondition.
+func (in *SecretSinkStatusCondition) DeepCopy() *SecretSinkStatusCondition {
+	if in == nil {
+		return nil
+	}
+	out := new(SecretSinkStatusCondition)
+	in.DeepCopyInto(out)
+	return out
+}
+
 // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 func (in *SecretStore) DeepCopyInto(out *SecretStore) {
 	*out = *in

+ 47 - 2
config/crds/bases/external-secrets.io_secretsinks.yaml

@@ -33,9 +33,54 @@ spec:
           metadata:
             type: object
           spec:
-            type: string
+            description: SecretSinkSpec configures the behavior of the SecretSink.
+            properties:
+              data:
+                items:
+                  type: string
+                type: array
+              selector:
+                type: string
+            required:
+            - selector
+            type: object
           status:
-            type: string
+            description: SecretSinkStatus indicates the history of the status of SecretSink.
+            properties:
+              conditions:
+                items:
+                  description: SecretSinkStatusCondition indicates the status of the
+                    SecretSink.
+                  properties:
+                    lastTransitionTime:
+                      format: date-time
+                      type: string
+                    message:
+                      type: string
+                    reason:
+                      type: string
+                    status:
+                      type: string
+                    type:
+                      description: SecretSinkConditionType indicates the condition
+                        of the SecretSink.
+                      type: string
+                  required:
+                  - status
+                  - type
+                  type: object
+                type: array
+              refreshTime:
+                description: refreshTime is the time and date the external secret
+                  was fetched and the target secret updated
+                format: date-time
+                nullable: true
+                type: string
+              syncedResourceVersion:
+                description: SyncedResourceVersion keeps track of the last synced
+                  version.
+                type: string
+            type: object
         type: object
     served: true
     storage: true

+ 43 - 2
deploy/crds/bundle.yaml

@@ -3036,9 +3036,50 @@ spec:
             metadata:
               type: object
             spec:
-              type: string
+              description: SecretSinkSpec configures the behavior of the SecretSink.
+              properties:
+                data:
+                  items:
+                    type: string
+                  type: array
+                selector:
+                  type: string
+              required:
+                - selector
+              type: object
             status:
-              type: string
+              description: SecretSinkStatus indicates the history of the status of SecretSink.
+              properties:
+                conditions:
+                  items:
+                    description: SecretSinkStatusCondition indicates the status of the SecretSink.
+                    properties:
+                      lastTransitionTime:
+                        format: date-time
+                        type: string
+                      message:
+                        type: string
+                      reason:
+                        type: string
+                      status:
+                        type: string
+                      type:
+                        description: SecretSinkConditionType indicates the condition of the SecretSink.
+                        type: string
+                    required:
+                      - status
+                      - type
+                    type: object
+                  type: array
+                refreshTime:
+                  description: refreshTime is the time and date the external secret was fetched and the target secret updated
+                  format: date-time
+                  nullable: true
+                  type: string
+                syncedResourceVersion:
+                  description: SyncedResourceVersion keeps track of the last synced version.
+                  type: string
+              type: object
           type: object
       served: true
       storage: true