From ce3a6dfc6dd043c8d30042fcab25f0f7eba08f69 Mon Sep 17 00:00:00 2001 From: Tobias Trabelsi Date: Wed, 19 Mar 2025 22:27:44 +0100 Subject: [PATCH] crd matching for bitwardenSecret --- api/v1/bitwardensecret_types.go | 16 ++++++-- api/v1/zz_generated.deepcopy.go | 36 +++++++++++++++++- ...is.uploadfilter24.eu_bitwardensecrets.yaml | 37 +++++++++++++++++-- config/rbac/role.yaml | 3 -- 4 files changed, 81 insertions(+), 11 deletions(-) diff --git a/api/v1/bitwardensecret_types.go b/api/v1/bitwardensecret_types.go index f9e9e28..27cc7cc 100644 --- a/api/v1/bitwardensecret_types.go +++ b/api/v1/bitwardensecret_types.go @@ -28,11 +28,19 @@ import ( // BitwardenSecretSpec defines the desired state of BitwardenSecret. type BitwardenSecretSpec struct { - // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster - // Important: Run "make" to regenerate code after modifying this file + Content []Element `json:"content"` + ID string `json:"id"` + Name string `json:"name"` + Namespace string `json:"namespace,omitempty"` + SecretType string `json:"secretType,omitempty"` + Labels map[string]string `json:"labels,omitempty"` + Annotations map[string]string `json:"annotations,omitempty"` +} - // Foo is an example field of BitwardenSecret. Edit bitwardensecret_types.go to remove/update - Foo string `json:"foo,omitempty"` +type Element struct { + SecretName string `json:"secretName"` + SecretRef string `json:"secretRef"` + SecretScope string `json:"secretScope"` } // BitwardenSecretStatus defines the observed state of BitwardenSecret. diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go index 76d4abf..f3af35e 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -33,7 +33,7 @@ func (in *BitwardenSecret) DeepCopyInto(out *BitwardenSecret) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec + in.Spec.DeepCopyInto(&out.Spec) out.Status = in.Status } @@ -90,6 +90,25 @@ func (in *BitwardenSecretList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BitwardenSecretSpec) DeepCopyInto(out *BitwardenSecretSpec) { *out = *in + if in.Content != nil { + in, out := &in.Content, &out.Content + *out = make([]Element, len(*in)) + copy(*out, *in) + } + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *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 BitwardenSecretSpec. @@ -206,6 +225,21 @@ func (in *BitwardenTemplateStatus) DeepCopy() *BitwardenTemplateStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Element) DeepCopyInto(out *Element) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Element. +func (in *Element) DeepCopy() *Element { + if in == nil { + return nil + } + out := new(Element) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RegistryCredential) DeepCopyInto(out *RegistryCredential) { *out = *in diff --git a/config/crd/bases/lerentis.uploadfilter24.eu.lerentis.uploadfilter24.eu_bitwardensecrets.yaml b/config/crd/bases/lerentis.uploadfilter24.eu.lerentis.uploadfilter24.eu_bitwardensecrets.yaml index 8900b7a..4fa8c81 100644 --- a/config/crd/bases/lerentis.uploadfilter24.eu.lerentis.uploadfilter24.eu_bitwardensecrets.yaml +++ b/config/crd/bases/lerentis.uploadfilter24.eu.lerentis.uploadfilter24.eu_bitwardensecrets.yaml @@ -39,10 +39,41 @@ spec: spec: description: BitwardenSecretSpec defines the desired state of BitwardenSecret. properties: - foo: - description: Foo is an example field of BitwardenSecret. Edit bitwardensecret_types.go - to remove/update + annotations: + additionalProperties: + type: string + type: object + content: + items: + properties: + secretName: + type: string + secretRef: + type: string + secretScope: + type: string + required: + - secretName + - secretRef + - secretScope + type: object + type: array + id: type: string + labels: + additionalProperties: + type: string + type: object + name: + type: string + namespace: + type: string + secretType: + type: string + required: + - content + - id + - name type: object status: description: BitwardenSecretStatus defines the observed state of BitwardenSecret. diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 04111f0..f6e39f1 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -7,7 +7,6 @@ rules: - apiGroups: - lerentis.uploadfilter24.eu.lerentis.uploadfilter24.eu resources: - - bitwardensecrets - bitwardentemplates - registrycredentials verbs: @@ -21,7 +20,6 @@ rules: - apiGroups: - lerentis.uploadfilter24.eu.lerentis.uploadfilter24.eu resources: - - bitwardensecrets/finalizers - bitwardentemplates/finalizers - registrycredentials/finalizers verbs: @@ -29,7 +27,6 @@ rules: - apiGroups: - lerentis.uploadfilter24.eu.lerentis.uploadfilter24.eu resources: - - bitwardensecrets/status - bitwardentemplates/status - registrycredentials/status verbs: