Client go upgrade v6 (#352)

There are shortcuts in this code, i.e. we created the deepcopy function
by using the deepcopy package instead of the generated code, that will
be addressed once migrated to client-go v8. Also, some objects,
particularly statefulsets, are still taken from v1beta, this will also
be addressed in further commits once the changes are stabilized.
This commit is contained in:
Oleksii Kliukin
2018-08-01 11:08:01 +02:00
committed by zerg-junior
parent f27833b5eb
commit d2d3f21dc2
25 changed files with 244 additions and 154 deletions
+45
View File
@@ -6,6 +6,8 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/zalando-incubator/postgres-operator/pkg/spec"
"github.com/mohae/deepcopy"
"k8s.io/apimachinery/pkg/runtime"
)
type OperatorConfiguration struct {
@@ -160,3 +162,46 @@ func (opcl *OperatorConfigurationList) UnmarshalJSON(data []byte) error {
*opcl = OperatorConfigurationList(ref)
return nil
}
func (in *OperatorConfiguration) DeepCopyInto(out *OperatorConfiguration) {
if in != nil {
out = deepcopy.Copy(in).(*OperatorConfiguration)
}
return
}
func (in *OperatorConfiguration) DeepCopy() *OperatorConfiguration {
if in == nil { return nil }
out := new(OperatorConfiguration)
in.DeepCopyInto(out)
return out
}
func (in *OperatorConfiguration) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
func (in *OperatorConfigurationList) DeepCopyInto(out *OperatorConfigurationList) {
if in != nil {
out = deepcopy.Copy(in).(*OperatorConfigurationList)
}
return
}
func (in *OperatorConfigurationList) DeepCopy() *OperatorConfigurationList {
if in == nil { return nil }
out := new(OperatorConfigurationList)
in.DeepCopyInto(out)
return out
}
func (in *OperatorConfigurationList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
+5 -4
View File
@@ -4,19 +4,19 @@ import (
"fmt"
"reflect"
"k8s.io/api/core/v1"
policybeta1 "k8s.io/api/policy/v1beta1"
apiextclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
apiextbeta1 "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/kubernetes/typed/apps/v1beta1"
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
policyv1beta1 "k8s.io/client-go/kubernetes/typed/policy/v1beta1"
rbacv1beta1 "k8s.io/client-go/kubernetes/typed/rbac/v1beta1"
"k8s.io/client-go/pkg/api"
"k8s.io/client-go/pkg/api/v1"
policybeta1 "k8s.io/client-go/pkg/apis/policy/v1beta1"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
@@ -93,7 +93,8 @@ func NewFromConfig(cfg *rest.Config) (KubernetesClient, error) {
Version: constants.CRDApiVersion,
}
cfg2.APIPath = constants.K8sAPIPath
cfg2.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: api.Codecs}
// MIGRATION: api.codecs -> scheme.Codecs?
cfg2.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs}
crd, err := rest.RESTClientFor(&cfg2)
if err != nil {
+1 -1
View File
@@ -9,7 +9,7 @@ import (
"time"
"github.com/Sirupsen/logrus"
"k8s.io/client-go/pkg/api/v1"
"k8s.io/api/core/v1"
)
const (
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
"k8s.io/client-go/pkg/api/v1"
"k8s.io/api/core/v1"
"github.com/zalando-incubator/postgres-operator/pkg/util/constants"
"github.com/zalando-incubator/postgres-operator/pkg/util/retryutil"
+1 -1
View File
@@ -1,7 +1,7 @@
package volumes
import (
"k8s.io/client-go/pkg/api/v1"
"k8s.io/api/core/v1"
)
// VolumeResizer defines the set of methods used to implememnt provider-specific resizing of persistent volumes.