mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-17 23:15:48 +02:00
auto-generate configuration CRD (#3102)
* auto-generate configuration CRD * make all subconfig optional * remove field enable crd validation * update field descriptions which use proxy types
This commit is contained in:
+10
-2
@@ -32,18 +32,26 @@ import (
|
||||
|
||||
// fakeOperatorConfigurations implements OperatorConfigurationInterface
|
||||
type fakeOperatorConfigurations struct {
|
||||
*gentype.FakeClient[*v1.OperatorConfiguration]
|
||||
*gentype.FakeClientWithList[*v1.OperatorConfiguration, *v1.OperatorConfigurationList]
|
||||
Fake *FakeAcidV1
|
||||
}
|
||||
|
||||
func newFakeOperatorConfigurations(fake *FakeAcidV1, namespace string) acidzalandov1.OperatorConfigurationInterface {
|
||||
return &fakeOperatorConfigurations{
|
||||
gentype.NewFakeClient[*v1.OperatorConfiguration](
|
||||
gentype.NewFakeClientWithList[*v1.OperatorConfiguration, *v1.OperatorConfigurationList](
|
||||
fake.Fake,
|
||||
namespace,
|
||||
v1.SchemeGroupVersion.WithResource("operatorconfigurations"),
|
||||
v1.SchemeGroupVersion.WithKind("OperatorConfiguration"),
|
||||
func() *v1.OperatorConfiguration { return &v1.OperatorConfiguration{} },
|
||||
func() *v1.OperatorConfigurationList { return &v1.OperatorConfigurationList{} },
|
||||
func(dst, src *v1.OperatorConfigurationList) { dst.ListMeta = src.ListMeta },
|
||||
func(list *v1.OperatorConfigurationList) []*v1.OperatorConfiguration {
|
||||
return gentype.ToPointerSlice(list.Items)
|
||||
},
|
||||
func(list *v1.OperatorConfigurationList, items []*v1.OperatorConfiguration) {
|
||||
list.Items = gentype.FromPointerSlice(items)
|
||||
},
|
||||
),
|
||||
fake,
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ import (
|
||||
acidzalandov1 "github.com/zalando/postgres-operator/pkg/apis/acid.zalan.do/v1"
|
||||
scheme "github.com/zalando/postgres-operator/pkg/generated/clientset/versioned/scheme"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
gentype "k8s.io/client-go/gentype"
|
||||
)
|
||||
|
||||
@@ -41,24 +43,32 @@ type OperatorConfigurationsGetter interface {
|
||||
|
||||
// OperatorConfigurationInterface has methods to work with OperatorConfiguration resources.
|
||||
type OperatorConfigurationInterface interface {
|
||||
Create(ctx context.Context, operatorConfiguration *acidzalandov1.OperatorConfiguration, opts metav1.CreateOptions) (*acidzalandov1.OperatorConfiguration, error)
|
||||
Update(ctx context.Context, operatorConfiguration *acidzalandov1.OperatorConfiguration, opts metav1.UpdateOptions) (*acidzalandov1.OperatorConfiguration, error)
|
||||
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts metav1.GetOptions) (*acidzalandov1.OperatorConfiguration, error)
|
||||
List(ctx context.Context, opts metav1.ListOptions) (*acidzalandov1.OperatorConfigurationList, error)
|
||||
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *acidzalandov1.OperatorConfiguration, err error)
|
||||
OperatorConfigurationExpansion
|
||||
}
|
||||
|
||||
// operatorConfigurations implements OperatorConfigurationInterface
|
||||
type operatorConfigurations struct {
|
||||
*gentype.Client[*acidzalandov1.OperatorConfiguration]
|
||||
*gentype.ClientWithList[*acidzalandov1.OperatorConfiguration, *acidzalandov1.OperatorConfigurationList]
|
||||
}
|
||||
|
||||
// newOperatorConfigurations returns a OperatorConfigurations
|
||||
func newOperatorConfigurations(c *AcidV1Client, namespace string) *operatorConfigurations {
|
||||
return &operatorConfigurations{
|
||||
gentype.NewClient[*acidzalandov1.OperatorConfiguration](
|
||||
gentype.NewClientWithList[*acidzalandov1.OperatorConfiguration, *acidzalandov1.OperatorConfigurationList](
|
||||
"operatorconfigurations",
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *acidzalandov1.OperatorConfiguration { return &acidzalandov1.OperatorConfiguration{} },
|
||||
func() *acidzalandov1.OperatorConfigurationList { return &acidzalandov1.OperatorConfigurationList{} },
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user