Browse Source

ref: removing Yandex Cloud specific common types declaration duplication (#4905)

* ref: removed some common types declaration duplication

Signed-off-by: Ildar Valiullin <preved.911@gmail.com>

* ref: fixed issue about comments

Signed-off-by: Ildar Valiullin <preved.911@gmail.com>

* ref: regenerated manifests

Signed-off-by: Ildar Valiullin <preved.911@gmail.com>

---------

Signed-off-by: Ildar Valiullin <preved.911@gmail.com>
Co-authored-by: Ildar Valiullin <ivaliullin@MX2Y3.local>
Co-authored-by: Gergely Brautigam <skarlso777@gmail.com>
preved911 7 months ago
parent
commit
82dafaf640

+ 29 - 0
apis/externalsecrets/v1/secretstore_yandex_types.go

@@ -0,0 +1,29 @@
+/*
+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 v1
+
+import (
+	esmeta "github.com/external-secrets/external-secrets/apis/meta/v1"
+)
+
+type YandexAuth struct {
+	// The authorized key used for authentication
+	// +optional
+	AuthorizedKey esmeta.SecretKeySelector `json:"authorizedKeySecretRef,omitempty"`
+}
+
+type YandexCAProvider struct {
+	Certificate esmeta.SecretKeySelector `json:"certSecretRef,omitempty"`
+}

+ 3 - 17
apis/externalsecrets/v1/secretstore_yandexcertificatemanager_types.go

@@ -14,30 +14,16 @@ limitations under the License.
 
 package v1
 
-import (
-	esmeta "github.com/external-secrets/external-secrets/apis/meta/v1"
-)
-
-type YandexCertificateManagerAuth struct {
-	// The authorized key used for authentication
-	// +optional
-	AuthorizedKey esmeta.SecretKeySelector `json:"authorizedKeySecretRef,omitempty"`
-}
-
-type YandexCertificateManagerCAProvider struct {
-	Certificate esmeta.SecretKeySelector `json:"certSecretRef,omitempty"`
-}
-
 // YandexCertificateManagerProvider Configures a store to sync secrets using the Yandex Certificate Manager provider.
 type YandexCertificateManagerProvider struct {
 	// Yandex.Cloud API endpoint (e.g. 'api.cloud.yandex.net:443')
 	// +optional
 	APIEndpoint string `json:"apiEndpoint,omitempty"`
 
-	// Auth defines the information necessary to authenticate against Yandex Certificate Manager
-	Auth YandexCertificateManagerAuth `json:"auth"`
+	// Auth defines the information necessary to authenticate against Yandex.Cloud
+	Auth YandexAuth `json:"auth"`
 
 	// The provider for the CA bundle to use to validate Yandex.Cloud server certificate.
 	// +optional
-	CAProvider *YandexCertificateManagerCAProvider `json:"caProvider,omitempty"`
+	CAProvider *YandexCAProvider `json:"caProvider,omitempty"`
 }

+ 3 - 17
apis/externalsecrets/v1/secretstore_yandexlockbox_types.go

@@ -14,30 +14,16 @@ limitations under the License.
 
 package v1
 
-import (
-	esmeta "github.com/external-secrets/external-secrets/apis/meta/v1"
-)
-
-type YandexLockboxAuth struct {
-	// The authorized key used for authentication
-	// +optional
-	AuthorizedKey esmeta.SecretKeySelector `json:"authorizedKeySecretRef,omitempty"`
-}
-
-type YandexLockboxCAProvider struct {
-	Certificate esmeta.SecretKeySelector `json:"certSecretRef,omitempty"`
-}
-
 // YandexLockboxProvider Configures a store to sync secrets using the Yandex Lockbox provider.
 type YandexLockboxProvider struct {
 	// Yandex.Cloud API endpoint (e.g. 'api.cloud.yandex.net:443')
 	// +optional
 	APIEndpoint string `json:"apiEndpoint,omitempty"`
 
-	// Auth defines the information necessary to authenticate against Yandex Lockbox
-	Auth YandexLockboxAuth `json:"auth"`
+	// Auth defines the information necessary to authenticate against Yandex.Cloud
+	Auth YandexAuth `json:"auth"`
 
 	// The provider for the CA bundle to use to validate Yandex.Cloud server certificate.
 	// +optional
-	CAProvider *YandexLockboxCAProvider `json:"caProvider,omitempty"`
+	CAProvider *YandexCAProvider `json:"caProvider,omitempty"`
 }

+ 10 - 42
apis/externalsecrets/v1/zz_generated.deepcopy.go

@@ -3958,33 +3958,33 @@ func (in *WebhookSecret) DeepCopy() *WebhookSecret {
 }
 
 // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *YandexCertificateManagerAuth) DeepCopyInto(out *YandexCertificateManagerAuth) {
+func (in *YandexAuth) DeepCopyInto(out *YandexAuth) {
 	*out = *in
 	in.AuthorizedKey.DeepCopyInto(&out.AuthorizedKey)
 }
 
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new YandexCertificateManagerAuth.
-func (in *YandexCertificateManagerAuth) DeepCopy() *YandexCertificateManagerAuth {
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new YandexAuth.
+func (in *YandexAuth) DeepCopy() *YandexAuth {
 	if in == nil {
 		return nil
 	}
-	out := new(YandexCertificateManagerAuth)
+	out := new(YandexAuth)
 	in.DeepCopyInto(out)
 	return out
 }
 
 // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *YandexCertificateManagerCAProvider) DeepCopyInto(out *YandexCertificateManagerCAProvider) {
+func (in *YandexCAProvider) DeepCopyInto(out *YandexCAProvider) {
 	*out = *in
 	in.Certificate.DeepCopyInto(&out.Certificate)
 }
 
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new YandexCertificateManagerCAProvider.
-func (in *YandexCertificateManagerCAProvider) DeepCopy() *YandexCertificateManagerCAProvider {
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new YandexCAProvider.
+func (in *YandexCAProvider) DeepCopy() *YandexCAProvider {
 	if in == nil {
 		return nil
 	}
-	out := new(YandexCertificateManagerCAProvider)
+	out := new(YandexCAProvider)
 	in.DeepCopyInto(out)
 	return out
 }
@@ -3995,7 +3995,7 @@ func (in *YandexCertificateManagerProvider) DeepCopyInto(out *YandexCertificateM
 	in.Auth.DeepCopyInto(&out.Auth)
 	if in.CAProvider != nil {
 		in, out := &in.CAProvider, &out.CAProvider
-		*out = new(YandexCertificateManagerCAProvider)
+		*out = new(YandexCAProvider)
 		(*in).DeepCopyInto(*out)
 	}
 }
@@ -4011,44 +4011,12 @@ func (in *YandexCertificateManagerProvider) DeepCopy() *YandexCertificateManager
 }
 
 // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *YandexLockboxAuth) DeepCopyInto(out *YandexLockboxAuth) {
-	*out = *in
-	in.AuthorizedKey.DeepCopyInto(&out.AuthorizedKey)
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new YandexLockboxAuth.
-func (in *YandexLockboxAuth) DeepCopy() *YandexLockboxAuth {
-	if in == nil {
-		return nil
-	}
-	out := new(YandexLockboxAuth)
-	in.DeepCopyInto(out)
-	return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *YandexLockboxCAProvider) DeepCopyInto(out *YandexLockboxCAProvider) {
-	*out = *in
-	in.Certificate.DeepCopyInto(&out.Certificate)
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new YandexLockboxCAProvider.
-func (in *YandexLockboxCAProvider) DeepCopy() *YandexLockboxCAProvider {
-	if in == nil {
-		return nil
-	}
-	out := new(YandexLockboxCAProvider)
-	in.DeepCopyInto(out)
-	return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 func (in *YandexLockboxProvider) DeepCopyInto(out *YandexLockboxProvider) {
 	*out = *in
 	in.Auth.DeepCopyInto(&out.Auth)
 	if in.CAProvider != nil {
 		in, out := &in.CAProvider, &out.CAProvider
-		*out = new(YandexLockboxCAProvider)
+		*out = new(YandexCAProvider)
 		(*in).DeepCopyInto(*out)
 	}
 }

+ 2 - 2
config/crds/bases/external-secrets.io_clustersecretstores.yaml

@@ -5043,7 +5043,7 @@ spec:
                         type: string
                       auth:
                         description: Auth defines the information necessary to authenticate
-                          against Yandex Certificate Manager
+                          against Yandex.Cloud
                         properties:
                           authorizedKeySecretRef:
                             description: The authorized key used for authentication
@@ -5119,7 +5119,7 @@ spec:
                         type: string
                       auth:
                         description: Auth defines the information necessary to authenticate
-                          against Yandex Lockbox
+                          against Yandex.Cloud
                         properties:
                           authorizedKeySecretRef:
                             description: The authorized key used for authentication

+ 2 - 2
config/crds/bases/external-secrets.io_secretstores.yaml

@@ -5043,7 +5043,7 @@ spec:
                         type: string
                       auth:
                         description: Auth defines the information necessary to authenticate
-                          against Yandex Certificate Manager
+                          against Yandex.Cloud
                         properties:
                           authorizedKeySecretRef:
                             description: The authorized key used for authentication
@@ -5119,7 +5119,7 @@ spec:
                         type: string
                       auth:
                         description: Auth defines the information necessary to authenticate
-                          against Yandex Lockbox
+                          against Yandex.Cloud
                         properties:
                           authorizedKeySecretRef:
                             description: The authorized key used for authentication

+ 4 - 4
deploy/crds/bundle.yaml

@@ -6737,7 +6737,7 @@ spec:
                           description: Yandex.Cloud API endpoint (e.g. 'api.cloud.yandex.net:443')
                           type: string
                         auth:
-                          description: Auth defines the information necessary to authenticate against Yandex Certificate Manager
+                          description: Auth defines the information necessary to authenticate against Yandex.Cloud
                           properties:
                             authorizedKeySecretRef:
                               description: The authorized key used for authentication
@@ -6808,7 +6808,7 @@ spec:
                           description: Yandex.Cloud API endpoint (e.g. 'api.cloud.yandex.net:443')
                           type: string
                         auth:
-                          description: Auth defines the information necessary to authenticate against Yandex Lockbox
+                          description: Auth defines the information necessary to authenticate against Yandex.Cloud
                           properties:
                             authorizedKeySecretRef:
                               description: The authorized key used for authentication
@@ -17557,7 +17557,7 @@ spec:
                           description: Yandex.Cloud API endpoint (e.g. 'api.cloud.yandex.net:443')
                           type: string
                         auth:
-                          description: Auth defines the information necessary to authenticate against Yandex Certificate Manager
+                          description: Auth defines the information necessary to authenticate against Yandex.Cloud
                           properties:
                             authorizedKeySecretRef:
                               description: The authorized key used for authentication
@@ -17628,7 +17628,7 @@ spec:
                           description: Yandex.Cloud API endpoint (e.g. 'api.cloud.yandex.net:443')
                           type: string
                         auth:
-                          description: Auth defines the information necessary to authenticate against Yandex Lockbox
+                          description: Auth defines the information necessary to authenticate against Yandex.Cloud
                           properties:
                             authorizedKeySecretRef:
                               description: The authorized key used for authentication

+ 16 - 76
docs/api/spec.md

@@ -10843,11 +10843,12 @@ External Secrets meta/v1.SecretKeySelector
 </tr>
 </tbody>
 </table>
-<h3 id="external-secrets.io/v1.YandexCertificateManagerAuth">YandexCertificateManagerAuth
+<h3 id="external-secrets.io/v1.YandexAuth">YandexAuth
 </h3>
 <p>
 (<em>Appears on:</em>
-<a href="#external-secrets.io/v1.YandexCertificateManagerProvider">YandexCertificateManagerProvider</a>)
+<a href="#external-secrets.io/v1.YandexCertificateManagerProvider">YandexCertificateManagerProvider</a>, 
+<a href="#external-secrets.io/v1.YandexLockboxProvider">YandexLockboxProvider</a>)
 </p>
 <p>
 </p>
@@ -10875,11 +10876,12 @@ External Secrets meta/v1.SecretKeySelector
 </tr>
 </tbody>
 </table>
-<h3 id="external-secrets.io/v1.YandexCertificateManagerCAProvider">YandexCertificateManagerCAProvider
+<h3 id="external-secrets.io/v1.YandexCAProvider">YandexCAProvider
 </h3>
 <p>
 (<em>Appears on:</em>
-<a href="#external-secrets.io/v1.YandexCertificateManagerProvider">YandexCertificateManagerProvider</a>)
+<a href="#external-secrets.io/v1.YandexCertificateManagerProvider">YandexCertificateManagerProvider</a>, 
+<a href="#external-secrets.io/v1.YandexLockboxProvider">YandexLockboxProvider</a>)
 </p>
 <p>
 </p>
@@ -10938,21 +10940,21 @@ string
 <td>
 <code>auth</code></br>
 <em>
-<a href="#external-secrets.io/v1.YandexCertificateManagerAuth">
-YandexCertificateManagerAuth
+<a href="#external-secrets.io/v1.YandexAuth">
+YandexAuth
 </a>
 </em>
 </td>
 <td>
-<p>Auth defines the information necessary to authenticate against Yandex Certificate Manager</p>
+<p>Auth defines the information necessary to authenticate against Yandex.Cloud</p>
 </td>
 </tr>
 <tr>
 <td>
 <code>caProvider</code></br>
 <em>
-<a href="#external-secrets.io/v1.YandexCertificateManagerCAProvider">
-YandexCertificateManagerCAProvider
+<a href="#external-secrets.io/v1.YandexCAProvider">
+YandexCAProvider
 </a>
 </em>
 </td>
@@ -10963,68 +10965,6 @@ YandexCertificateManagerCAProvider
 </tr>
 </tbody>
 </table>
-<h3 id="external-secrets.io/v1.YandexLockboxAuth">YandexLockboxAuth
-</h3>
-<p>
-(<em>Appears on:</em>
-<a href="#external-secrets.io/v1.YandexLockboxProvider">YandexLockboxProvider</a>)
-</p>
-<p>
-</p>
-<table>
-<thead>
-<tr>
-<th>Field</th>
-<th>Description</th>
-</tr>
-</thead>
-<tbody>
-<tr>
-<td>
-<code>authorizedKeySecretRef</code></br>
-<em>
-<a href="https://pkg.go.dev/github.com/external-secrets/external-secrets/apis/meta/v1#SecretKeySelector">
-External Secrets meta/v1.SecretKeySelector
-</a>
-</em>
-</td>
-<td>
-<em>(Optional)</em>
-<p>The authorized key used for authentication</p>
-</td>
-</tr>
-</tbody>
-</table>
-<h3 id="external-secrets.io/v1.YandexLockboxCAProvider">YandexLockboxCAProvider
-</h3>
-<p>
-(<em>Appears on:</em>
-<a href="#external-secrets.io/v1.YandexLockboxProvider">YandexLockboxProvider</a>)
-</p>
-<p>
-</p>
-<table>
-<thead>
-<tr>
-<th>Field</th>
-<th>Description</th>
-</tr>
-</thead>
-<tbody>
-<tr>
-<td>
-<code>certSecretRef</code></br>
-<em>
-<a href="https://pkg.go.dev/github.com/external-secrets/external-secrets/apis/meta/v1#SecretKeySelector">
-External Secrets meta/v1.SecretKeySelector
-</a>
-</em>
-</td>
-<td>
-</td>
-</tr>
-</tbody>
-</table>
 <h3 id="external-secrets.io/v1.YandexLockboxProvider">YandexLockboxProvider
 </h3>
 <p>
@@ -11058,21 +10998,21 @@ string
 <td>
 <code>auth</code></br>
 <em>
-<a href="#external-secrets.io/v1.YandexLockboxAuth">
-YandexLockboxAuth
+<a href="#external-secrets.io/v1.YandexAuth">
+YandexAuth
 </a>
 </em>
 </td>
 <td>
-<p>Auth defines the information necessary to authenticate against Yandex Lockbox</p>
+<p>Auth defines the information necessary to authenticate against Yandex.Cloud</p>
 </td>
 </tr>
 <tr>
 <td>
 <code>caProvider</code></br>
 <em>
-<a href="#external-secrets.io/v1.YandexLockboxCAProvider">
-YandexLockboxCAProvider
+<a href="#external-secrets.io/v1.YandexCAProvider">
+YandexCAProvider
 </a>
 </em>
 </td>

+ 3 - 3
pkg/provider/yandex/certificatemanager/certificatemanager_test.go

@@ -57,7 +57,7 @@ func TestNewClient(t *testing.T) {
 		Spec: esv1.SecretStoreSpec{
 			Provider: &esv1.SecretStoreProvider{
 				YandexCertificateManager: &esv1.YandexCertificateManagerProvider{
-					Auth: esv1.YandexCertificateManagerAuth{
+					Auth: esv1.YandexAuth{
 						AuthorizedKey: esmeta.SecretKeySelector{
 							Key:  authorizedKeySecretKey,
 							Name: authorizedKeySecretName,
@@ -80,7 +80,7 @@ func TestNewClient(t *testing.T) {
 
 	const caCertificateSecretName = "caCertificateSecretName"
 	const caCertificateSecretKey = "caCertificateSecretKey"
-	store.Spec.Provider.YandexCertificateManager.CAProvider = &esv1.YandexCertificateManagerCAProvider{
+	store.Spec.Provider.YandexCertificateManager.CAProvider = &esv1.YandexCAProvider{
 		Certificate: esmeta.SecretKeySelector{
 			Key:  caCertificateSecretKey,
 			Name: caCertificateSecretName,
@@ -667,7 +667,7 @@ func newYandexCertificateManagerSecretStore(apiEndpoint, namespace, authorizedKe
 			Provider: &esv1.SecretStoreProvider{
 				YandexCertificateManager: &esv1.YandexCertificateManagerProvider{
 					APIEndpoint: apiEndpoint,
-					Auth: esv1.YandexCertificateManagerAuth{
+					Auth: esv1.YandexAuth{
 						AuthorizedKey: esmeta.SecretKeySelector{
 							Name: authorizedKeySecretName,
 							Key:  authorizedKeySecretKey,

+ 3 - 3
pkg/provider/yandex/lockbox/lockbox_test.go

@@ -57,7 +57,7 @@ func TestNewClient(t *testing.T) {
 		Spec: esv1.SecretStoreSpec{
 			Provider: &esv1.SecretStoreProvider{
 				YandexLockbox: &esv1.YandexLockboxProvider{
-					Auth: esv1.YandexLockboxAuth{
+					Auth: esv1.YandexAuth{
 						AuthorizedKey: esmeta.SecretKeySelector{
 							Key:  authorizedKeySecretKey,
 							Name: authorizedKeySecretName,
@@ -80,7 +80,7 @@ func TestNewClient(t *testing.T) {
 
 	const caCertificateSecretName = "caCertificateSecretName"
 	const caCertificateSecretKey = "caCertificateSecretKey"
-	store.Spec.Provider.YandexLockbox.CAProvider = &esv1.YandexLockboxCAProvider{
+	store.Spec.Provider.YandexLockbox.CAProvider = &esv1.YandexCAProvider{
 		Certificate: esmeta.SecretKeySelector{
 			Key:  caCertificateSecretKey,
 			Name: caCertificateSecretName,
@@ -620,7 +620,7 @@ func newYandexLockboxSecretStore(apiEndpoint, namespace, authorizedKeySecretName
 			Provider: &esv1.SecretStoreProvider{
 				YandexLockbox: &esv1.YandexLockboxProvider{
 					APIEndpoint: apiEndpoint,
-					Auth: esv1.YandexLockboxAuth{
+					Auth: esv1.YandexAuth{
 						AuthorizedKey: esmeta.SecretKeySelector{
 							Name: authorizedKeySecretName,
 							Key:  authorizedKeySecretKey,