move StatefulSet to apps/v1
This commit is contained in:
		
							parent
							
								
									cf97ebb2b8
								
							
						
					
					
						commit
						2e185533d8
					
				|  | @ -12,7 +12,7 @@ import ( | ||||||
| 	"time" | 	"time" | ||||||
| 
 | 
 | ||||||
| 	"github.com/sirupsen/logrus" | 	"github.com/sirupsen/logrus" | ||||||
| 	"k8s.io/api/apps/v1beta1" | 	appsv1 "k8s.io/api/apps/v1" | ||||||
| 	v1 "k8s.io/api/core/v1" | 	v1 "k8s.io/api/core/v1" | ||||||
| 	policybeta1 "k8s.io/api/policy/v1beta1" | 	policybeta1 "k8s.io/api/policy/v1beta1" | ||||||
| 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||||||
|  | @ -52,7 +52,7 @@ type kubeResources struct { | ||||||
| 	Services            map[PostgresRole]*v1.Service | 	Services            map[PostgresRole]*v1.Service | ||||||
| 	Endpoints           map[PostgresRole]*v1.Endpoints | 	Endpoints           map[PostgresRole]*v1.Endpoints | ||||||
| 	Secrets             map[types.UID]*v1.Secret | 	Secrets             map[types.UID]*v1.Secret | ||||||
| 	Statefulset         *v1beta1.StatefulSet | 	Statefulset         *appsv1.StatefulSet | ||||||
| 	PodDisruptionBudget *policybeta1.PodDisruptionBudget | 	PodDisruptionBudget *policybeta1.PodDisruptionBudget | ||||||
| 	//Pods are treated separately
 | 	//Pods are treated separately
 | ||||||
| 	//PVCs are treated separately
 | 	//PVCs are treated separately
 | ||||||
|  | @ -214,7 +214,7 @@ func (c *Cluster) Create() error { | ||||||
| 
 | 
 | ||||||
| 		service *v1.Service | 		service *v1.Service | ||||||
| 		ep      *v1.Endpoints | 		ep      *v1.Endpoints | ||||||
| 		ss      *v1beta1.StatefulSet | 		ss      *appsv1.StatefulSet | ||||||
| 	) | 	) | ||||||
| 
 | 
 | ||||||
| 	defer func() { | 	defer func() { | ||||||
|  | @ -315,7 +315,7 @@ func (c *Cluster) Create() error { | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (c *Cluster) compareStatefulSetWith(statefulSet *v1beta1.StatefulSet) *compareStatefulsetResult { | func (c *Cluster) compareStatefulSetWith(statefulSet *appsv1.StatefulSet) *compareStatefulsetResult { | ||||||
| 	reasons := make([]string, 0) | 	reasons := make([]string, 0) | ||||||
| 	var match, needsRollUpdate, needsReplace bool | 	var match, needsRollUpdate, needsReplace bool | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -7,7 +7,7 @@ import ( | ||||||
| 
 | 
 | ||||||
| 	"github.com/sirupsen/logrus" | 	"github.com/sirupsen/logrus" | ||||||
| 
 | 
 | ||||||
| 	"k8s.io/api/apps/v1beta1" | 	appsv1 "k8s.io/api/apps/v1" | ||||||
| 	v1 "k8s.io/api/core/v1" | 	v1 "k8s.io/api/core/v1" | ||||||
| 	policybeta1 "k8s.io/api/policy/v1beta1" | 	policybeta1 "k8s.io/api/policy/v1beta1" | ||||||
| 	"k8s.io/apimachinery/pkg/api/resource" | 	"k8s.io/apimachinery/pkg/api/resource" | ||||||
|  | @ -711,7 +711,7 @@ func makeResources(cpuRequest, memoryRequest, cpuLimit, memoryLimit string) acid | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (c *Cluster) generateStatefulSet(spec *acidv1.PostgresSpec) (*v1beta1.StatefulSet, error) { | func (c *Cluster) generateStatefulSet(spec *acidv1.PostgresSpec) (*appsv1.StatefulSet, error) { | ||||||
| 
 | 
 | ||||||
| 	var ( | 	var ( | ||||||
| 		err                 error | 		err                 error | ||||||
|  | @ -917,25 +917,25 @@ func (c *Cluster) generateStatefulSet(spec *acidv1.PostgresSpec) (*v1beta1.State | ||||||
| 	// the operator has domain-specific logic on how to do rolling updates of PG clusters
 | 	// the operator has domain-specific logic on how to do rolling updates of PG clusters
 | ||||||
| 	// so we do not use default rolling updates implemented by stateful sets
 | 	// so we do not use default rolling updates implemented by stateful sets
 | ||||||
| 	// that leaves the legacy "OnDelete" update strategy as the only option
 | 	// that leaves the legacy "OnDelete" update strategy as the only option
 | ||||||
| 	updateStrategy := v1beta1.StatefulSetUpdateStrategy{Type: v1beta1.OnDeleteStatefulSetStrategyType} | 	updateStrategy := appsv1.StatefulSetUpdateStrategy{Type: appsv1.OnDeleteStatefulSetStrategyType} | ||||||
| 
 | 
 | ||||||
| 	var podManagementPolicy v1beta1.PodManagementPolicyType | 	var podManagementPolicy appsv1.PodManagementPolicyType | ||||||
| 	if c.OpConfig.PodManagementPolicy == "ordered_ready" { | 	if c.OpConfig.PodManagementPolicy == "ordered_ready" { | ||||||
| 		podManagementPolicy = v1beta1.OrderedReadyPodManagement | 		podManagementPolicy = appsv1.OrderedReadyPodManagement | ||||||
| 	} else if c.OpConfig.PodManagementPolicy == "parallel" { | 	} else if c.OpConfig.PodManagementPolicy == "parallel" { | ||||||
| 		podManagementPolicy = v1beta1.ParallelPodManagement | 		podManagementPolicy = appsv1.ParallelPodManagement | ||||||
| 	} else { | 	} else { | ||||||
| 		return nil, fmt.Errorf("could not set the pod management policy to the unknown value: %v", c.OpConfig.PodManagementPolicy) | 		return nil, fmt.Errorf("could not set the pod management policy to the unknown value: %v", c.OpConfig.PodManagementPolicy) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	statefulSet := &v1beta1.StatefulSet{ | 	statefulSet := &appsv1.StatefulSet{ | ||||||
| 		ObjectMeta: metav1.ObjectMeta{ | 		ObjectMeta: metav1.ObjectMeta{ | ||||||
| 			Name:        c.statefulSetName(), | 			Name:        c.statefulSetName(), | ||||||
| 			Namespace:   c.Namespace, | 			Namespace:   c.Namespace, | ||||||
| 			Labels:      c.labelsSet(true), | 			Labels:      c.labelsSet(true), | ||||||
| 			Annotations: map[string]string{rollingUpdateStatefulsetAnnotationKey: "false"}, | 			Annotations: map[string]string{rollingUpdateStatefulsetAnnotationKey: "false"}, | ||||||
| 		}, | 		}, | ||||||
| 		Spec: v1beta1.StatefulSetSpec{ | 		Spec: appsv1.StatefulSetSpec{ | ||||||
| 			Replicas:             &numberOfInstances, | 			Replicas:             &numberOfInstances, | ||||||
| 			Selector:             c.labelsSelector(), | 			Selector:             c.labelsSelector(), | ||||||
| 			ServiceName:          c.serviceName(Master), | 			ServiceName:          c.serviceName(Master), | ||||||
|  |  | ||||||
|  | @ -4,12 +4,12 @@ import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"math/rand" | 	"math/rand" | ||||||
| 
 | 
 | ||||||
|  | 	appsv1 "k8s.io/api/apps/v1" | ||||||
| 	v1 "k8s.io/api/core/v1" | 	v1 "k8s.io/api/core/v1" | ||||||
| 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||||||
| 
 | 
 | ||||||
| 	"github.com/zalando/postgres-operator/pkg/spec" | 	"github.com/zalando/postgres-operator/pkg/spec" | ||||||
| 	"github.com/zalando/postgres-operator/pkg/util" | 	"github.com/zalando/postgres-operator/pkg/util" | ||||||
| 	"k8s.io/api/apps/v1beta1" |  | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| func (c *Cluster) listPods() ([]v1.Pod, error) { | func (c *Cluster) listPods() ([]v1.Pod, error) { | ||||||
|  | @ -205,7 +205,7 @@ func (c *Cluster) MigrateMasterPod(podName spec.NamespacedName) error { | ||||||
| 	} | 	} | ||||||
| 	// we must have a statefulset in the cluster for the migration to work
 | 	// we must have a statefulset in the cluster for the migration to work
 | ||||||
| 	if c.Statefulset == nil { | 	if c.Statefulset == nil { | ||||||
| 		var sset *v1beta1.StatefulSet | 		var sset *appsv1.StatefulSet | ||||||
| 		if sset, err = c.KubeClient.StatefulSets(c.Namespace).Get(c.statefulSetName(), | 		if sset, err = c.KubeClient.StatefulSets(c.Namespace).Get(c.statefulSetName(), | ||||||
| 			metav1.GetOptions{}); err != nil { | 			metav1.GetOptions{}); err != nil { | ||||||
| 			return fmt.Errorf("could not retrieve cluster statefulset: %v", err) | 			return fmt.Errorf("could not retrieve cluster statefulset: %v", err) | ||||||
|  |  | ||||||
|  | @ -5,7 +5,7 @@ import ( | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"strings" | 	"strings" | ||||||
| 
 | 
 | ||||||
| 	"k8s.io/api/apps/v1beta1" | 	appsv1 "k8s.io/api/apps/v1" | ||||||
| 	batchv1beta1 "k8s.io/api/batch/v1beta1" | 	batchv1beta1 "k8s.io/api/batch/v1beta1" | ||||||
| 	v1 "k8s.io/api/core/v1" | 	v1 "k8s.io/api/core/v1" | ||||||
| 	policybeta1 "k8s.io/api/policy/v1beta1" | 	policybeta1 "k8s.io/api/policy/v1beta1" | ||||||
|  | @ -64,7 +64,7 @@ func (c *Cluster) listResources() error { | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (c *Cluster) createStatefulSet() (*v1beta1.StatefulSet, error) { | func (c *Cluster) createStatefulSet() (*appsv1.StatefulSet, error) { | ||||||
| 	c.setProcessName("creating statefulset") | 	c.setProcessName("creating statefulset") | ||||||
| 	statefulSetSpec, err := c.generateStatefulSet(&c.Spec) | 	statefulSetSpec, err := c.generateStatefulSet(&c.Spec) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
|  | @ -95,7 +95,7 @@ func getPodIndex(podName string) (int32, error) { | ||||||
| 	return int32(res), nil | 	return int32(res), nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (c *Cluster) preScaleDown(newStatefulSet *v1beta1.StatefulSet) error { | func (c *Cluster) preScaleDown(newStatefulSet *appsv1.StatefulSet) error { | ||||||
| 	masterPod, err := c.getRolePods(Master) | 	masterPod, err := c.getRolePods(Master) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return fmt.Errorf("could not get master pod: %v", err) | 		return fmt.Errorf("could not get master pod: %v", err) | ||||||
|  | @ -135,7 +135,7 @@ func (c *Cluster) preScaleDown(newStatefulSet *v1beta1.StatefulSet) error { | ||||||
| 
 | 
 | ||||||
| // setRollingUpdateFlagForStatefulSet sets the indicator or the rolling update requirement
 | // setRollingUpdateFlagForStatefulSet sets the indicator or the rolling update requirement
 | ||||||
| // in the StatefulSet annotation.
 | // in the StatefulSet annotation.
 | ||||||
| func (c *Cluster) setRollingUpdateFlagForStatefulSet(sset *v1beta1.StatefulSet, val bool) { | func (c *Cluster) setRollingUpdateFlagForStatefulSet(sset *appsv1.StatefulSet, val bool) { | ||||||
| 	anno := sset.GetAnnotations() | 	anno := sset.GetAnnotations() | ||||||
| 	if anno == nil { | 	if anno == nil { | ||||||
| 		anno = make(map[string]string) | 		anno = make(map[string]string) | ||||||
|  | @ -160,7 +160,7 @@ func (c *Cluster) applyRollingUpdateFlagforStatefulSet(val bool) error { | ||||||
| 
 | 
 | ||||||
| // getRollingUpdateFlagFromStatefulSet returns the value of the rollingUpdate flag from the passed
 | // getRollingUpdateFlagFromStatefulSet returns the value of the rollingUpdate flag from the passed
 | ||||||
| // StatefulSet, reverting to the default value in case of errors
 | // StatefulSet, reverting to the default value in case of errors
 | ||||||
| func (c *Cluster) getRollingUpdateFlagFromStatefulSet(sset *v1beta1.StatefulSet, defaultValue bool) (flag bool) { | func (c *Cluster) getRollingUpdateFlagFromStatefulSet(sset *appsv1.StatefulSet, defaultValue bool) (flag bool) { | ||||||
| 	anno := sset.GetAnnotations() | 	anno := sset.GetAnnotations() | ||||||
| 	flag = defaultValue | 	flag = defaultValue | ||||||
| 
 | 
 | ||||||
|  | @ -181,7 +181,7 @@ func (c *Cluster) getRollingUpdateFlagFromStatefulSet(sset *v1beta1.StatefulSet, | ||||||
| // mergeRollingUpdateFlagUsingCache returns the value of the rollingUpdate flag from the passed
 | // mergeRollingUpdateFlagUsingCache returns the value of the rollingUpdate flag from the passed
 | ||||||
| // statefulset, however, the value can be cleared if there is a cached flag in the cluster that
 | // statefulset, however, the value can be cleared if there is a cached flag in the cluster that
 | ||||||
| // is set to false (the discrepancy could be a result of a failed StatefulSet update)
 | // is set to false (the discrepancy could be a result of a failed StatefulSet update)
 | ||||||
| func (c *Cluster) mergeRollingUpdateFlagUsingCache(runningStatefulSet *v1beta1.StatefulSet) bool { | func (c *Cluster) mergeRollingUpdateFlagUsingCache(runningStatefulSet *appsv1.StatefulSet) bool { | ||||||
| 	var ( | 	var ( | ||||||
| 		cachedStatefulsetExists, clearRollingUpdateFromCache, podsRollingUpdateRequired bool | 		cachedStatefulsetExists, clearRollingUpdateFromCache, podsRollingUpdateRequired bool | ||||||
| 	) | 	) | ||||||
|  | @ -207,7 +207,7 @@ func (c *Cluster) mergeRollingUpdateFlagUsingCache(runningStatefulSet *v1beta1.S | ||||||
| 	return podsRollingUpdateRequired | 	return podsRollingUpdateRequired | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (c *Cluster) updateStatefulSetAnnotations(annotations map[string]string) (*v1beta1.StatefulSet, error) { | func (c *Cluster) updateStatefulSetAnnotations(annotations map[string]string) (*appsv1.StatefulSet, error) { | ||||||
| 	c.logger.Debugf("updating statefulset annotations") | 	c.logger.Debugf("updating statefulset annotations") | ||||||
| 	patchData, err := metaAnnotationsPatch(annotations) | 	patchData, err := metaAnnotationsPatch(annotations) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
|  | @ -223,7 +223,7 @@ func (c *Cluster) updateStatefulSetAnnotations(annotations map[string]string) (* | ||||||
| 	return result, nil | 	return result, nil | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
| func (c *Cluster) updateStatefulSet(newStatefulSet *v1beta1.StatefulSet) error { | func (c *Cluster) updateStatefulSet(newStatefulSet *appsv1.StatefulSet) error { | ||||||
| 	c.setProcessName("updating statefulset") | 	c.setProcessName("updating statefulset") | ||||||
| 	if c.Statefulset == nil { | 	if c.Statefulset == nil { | ||||||
| 		return fmt.Errorf("there is no statefulset in the cluster") | 		return fmt.Errorf("there is no statefulset in the cluster") | ||||||
|  | @ -264,7 +264,7 @@ func (c *Cluster) updateStatefulSet(newStatefulSet *v1beta1.StatefulSet) error { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // replaceStatefulSet deletes an old StatefulSet and creates the new using spec in the PostgreSQL CRD.
 | // replaceStatefulSet deletes an old StatefulSet and creates the new using spec in the PostgreSQL CRD.
 | ||||||
| func (c *Cluster) replaceStatefulSet(newStatefulSet *v1beta1.StatefulSet) error { | func (c *Cluster) replaceStatefulSet(newStatefulSet *appsv1.StatefulSet) error { | ||||||
| 	c.setProcessName("replacing statefulset") | 	c.setProcessName("replacing statefulset") | ||||||
| 	if c.Statefulset == nil { | 	if c.Statefulset == nil { | ||||||
| 		return fmt.Errorf("there is no statefulset in the cluster") | 		return fmt.Errorf("there is no statefulset in the cluster") | ||||||
|  | @ -676,7 +676,7 @@ func (c *Cluster) GetEndpointReplica() *v1.Endpoints { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // GetStatefulSet returns cluster's kubernetes StatefulSet
 | // GetStatefulSet returns cluster's kubernetes StatefulSet
 | ||||||
| func (c *Cluster) GetStatefulSet() *v1beta1.StatefulSet { | func (c *Cluster) GetStatefulSet() *appsv1.StatefulSet { | ||||||
| 	return c.Statefulset | 	return c.Statefulset | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -4,7 +4,7 @@ import ( | ||||||
| 	"time" | 	"time" | ||||||
| 
 | 
 | ||||||
| 	acidv1 "github.com/zalando/postgres-operator/pkg/apis/acid.zalan.do/v1" | 	acidv1 "github.com/zalando/postgres-operator/pkg/apis/acid.zalan.do/v1" | ||||||
| 	"k8s.io/api/apps/v1beta1" | 	appsv1 "k8s.io/api/apps/v1" | ||||||
| 	"k8s.io/api/core/v1" | 	"k8s.io/api/core/v1" | ||||||
| 	policybeta1 "k8s.io/api/policy/v1beta1" | 	policybeta1 "k8s.io/api/policy/v1beta1" | ||||||
| 	"k8s.io/apimachinery/pkg/types" | 	"k8s.io/apimachinery/pkg/types" | ||||||
|  | @ -60,7 +60,7 @@ type ClusterStatus struct { | ||||||
| 	ReplicaService      *v1.Service | 	ReplicaService      *v1.Service | ||||||
| 	MasterEndpoint      *v1.Endpoints | 	MasterEndpoint      *v1.Endpoints | ||||||
| 	ReplicaEndpoint     *v1.Endpoints | 	ReplicaEndpoint     *v1.Endpoints | ||||||
| 	StatefulSet         *v1beta1.StatefulSet | 	StatefulSet         *appsv1.StatefulSet | ||||||
| 	PodDisruptionBudget *policybeta1.PodDisruptionBudget | 	PodDisruptionBudget *policybeta1.PodDisruptionBudget | ||||||
| 
 | 
 | ||||||
| 	CurrentProcess Process | 	CurrentProcess Process | ||||||
|  |  | ||||||
|  | @ -11,7 +11,7 @@ import ( | ||||||
| 	"strings" | 	"strings" | ||||||
| 	"time" | 	"time" | ||||||
| 
 | 
 | ||||||
| 	"k8s.io/api/apps/v1beta1" | 	appsv1 "k8s.io/api/apps/v1" | ||||||
| 	v1 "k8s.io/api/core/v1" | 	v1 "k8s.io/api/core/v1" | ||||||
| 	policybeta1 "k8s.io/api/policy/v1beta1" | 	policybeta1 "k8s.io/api/policy/v1beta1" | ||||||
| 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||||||
|  | @ -168,7 +168,7 @@ func (c *Cluster) logPDBChanges(old, new *policybeta1.PodDisruptionBudget, isUpd | ||||||
| 	c.logger.Debugf("diff\n%s\n", util.PrettyDiff(old.Spec, new.Spec)) | 	c.logger.Debugf("diff\n%s\n", util.PrettyDiff(old.Spec, new.Spec)) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (c *Cluster) logStatefulSetChanges(old, new *v1beta1.StatefulSet, isUpdate bool, reasons []string) { | func (c *Cluster) logStatefulSetChanges(old, new *appsv1.StatefulSet, isUpdate bool, reasons []string) { | ||||||
| 	if isUpdate { | 	if isUpdate { | ||||||
| 		c.logger.Infof("statefulset %q has been changed", util.NameFromMeta(old.ObjectMeta)) | 		c.logger.Infof("statefulset %q has been changed", util.NameFromMeta(old.ObjectMeta)) | ||||||
| 	} else { | 	} else { | ||||||
|  |  | ||||||
|  | @ -16,8 +16,8 @@ import ( | ||||||
| 	apiextbeta1 "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1" | 	apiextbeta1 "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1" | ||||||
| 	apierrors "k8s.io/apimachinery/pkg/api/errors" | 	apierrors "k8s.io/apimachinery/pkg/api/errors" | ||||||
| 	"k8s.io/client-go/kubernetes" | 	"k8s.io/client-go/kubernetes" | ||||||
| 	"k8s.io/client-go/kubernetes/typed/apps/v1beta1" | 	appsv1 "k8s.io/client-go/kubernetes/typed/apps/v1" | ||||||
| 	v1core "k8s.io/client-go/kubernetes/typed/core/v1" | 	corev1 "k8s.io/client-go/kubernetes/typed/core/v1" | ||||||
| 	policyv1beta1 "k8s.io/client-go/kubernetes/typed/policy/v1beta1" | 	policyv1beta1 "k8s.io/client-go/kubernetes/typed/policy/v1beta1" | ||||||
| 	rbacv1beta1 "k8s.io/client-go/kubernetes/typed/rbac/v1beta1" | 	rbacv1beta1 "k8s.io/client-go/kubernetes/typed/rbac/v1beta1" | ||||||
| 	"k8s.io/client-go/rest" | 	"k8s.io/client-go/rest" | ||||||
|  | @ -29,17 +29,17 @@ import ( | ||||||
| 
 | 
 | ||||||
| // KubernetesClient describes getters for Kubernetes objects
 | // KubernetesClient describes getters for Kubernetes objects
 | ||||||
| type KubernetesClient struct { | type KubernetesClient struct { | ||||||
| 	v1core.SecretsGetter | 	corev1.SecretsGetter | ||||||
| 	v1core.ServicesGetter | 	corev1.ServicesGetter | ||||||
| 	v1core.EndpointsGetter | 	corev1.EndpointsGetter | ||||||
| 	v1core.PodsGetter | 	corev1.PodsGetter | ||||||
| 	v1core.PersistentVolumesGetter | 	corev1.PersistentVolumesGetter | ||||||
| 	v1core.PersistentVolumeClaimsGetter | 	corev1.PersistentVolumeClaimsGetter | ||||||
| 	v1core.ConfigMapsGetter | 	corev1.ConfigMapsGetter | ||||||
| 	v1core.NodesGetter | 	corev1.NodesGetter | ||||||
| 	v1core.NamespacesGetter | 	corev1.NamespacesGetter | ||||||
| 	v1core.ServiceAccountsGetter | 	corev1.ServiceAccountsGetter | ||||||
| 	v1beta1.StatefulSetsGetter | 	appsv1.StatefulSetsGetter | ||||||
| 	rbacv1beta1.RoleBindingsGetter | 	rbacv1beta1.RoleBindingsGetter | ||||||
| 	policyv1beta1.PodDisruptionBudgetsGetter | 	policyv1beta1.PodDisruptionBudgetsGetter | ||||||
| 	apiextbeta1.CustomResourceDefinitionsGetter | 	apiextbeta1.CustomResourceDefinitionsGetter | ||||||
|  | @ -50,14 +50,14 @@ type KubernetesClient struct { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| type mockSecret struct { | type mockSecret struct { | ||||||
| 	v1core.SecretInterface | 	corev1.SecretInterface | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| type MockSecretGetter struct { | type MockSecretGetter struct { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| type mockConfigMap struct { | type mockConfigMap struct { | ||||||
| 	v1core.ConfigMapInterface | 	corev1.ConfigMapInterface | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| type MockConfigMapsGetter struct { | type MockConfigMapsGetter struct { | ||||||
|  | @ -101,7 +101,7 @@ func NewFromConfig(cfg *rest.Config) (KubernetesClient, error) { | ||||||
| 	kubeClient.PersistentVolumesGetter = client.CoreV1() | 	kubeClient.PersistentVolumesGetter = client.CoreV1() | ||||||
| 	kubeClient.NodesGetter = client.CoreV1() | 	kubeClient.NodesGetter = client.CoreV1() | ||||||
| 	kubeClient.NamespacesGetter = client.CoreV1() | 	kubeClient.NamespacesGetter = client.CoreV1() | ||||||
| 	kubeClient.StatefulSetsGetter = client.AppsV1beta1() | 	kubeClient.StatefulSetsGetter = client.AppsV1() | ||||||
| 	kubeClient.PodDisruptionBudgetsGetter = client.PolicyV1beta1() | 	kubeClient.PodDisruptionBudgetsGetter = client.PolicyV1beta1() | ||||||
| 	kubeClient.RESTClient = client.CoreV1().RESTClient() | 	kubeClient.RESTClient = client.CoreV1().RESTClient() | ||||||
| 	kubeClient.RoleBindingsGetter = client.RbacV1beta1() | 	kubeClient.RoleBindingsGetter = client.RbacV1beta1() | ||||||
|  | @ -215,12 +215,12 @@ func (c *mockConfigMap) Get(name string, options metav1.GetOptions) (*v1.ConfigM | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Secrets to be mocked
 | // Secrets to be mocked
 | ||||||
| func (c *MockSecretGetter) Secrets(namespace string) v1core.SecretInterface { | func (c *MockSecretGetter) Secrets(namespace string) corev1.SecretInterface { | ||||||
| 	return &mockSecret{} | 	return &mockSecret{} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // ConfigMaps to be mocked
 | // ConfigMaps to be mocked
 | ||||||
| func (c *MockConfigMapsGetter) ConfigMaps(namespace string) v1core.ConfigMapInterface { | func (c *MockConfigMapsGetter) ConfigMaps(namespace string) corev1.ConfigMapInterface { | ||||||
| 	return &mockConfigMap{} | 	return &mockConfigMap{} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -82,7 +82,7 @@ def request_delete(cluster, path, **kwargs): | ||||||
| def resource_api_version(resource_type): | def resource_api_version(resource_type): | ||||||
|     return { |     return { | ||||||
|         'postgresqls': 'apis/acid.zalan.do/v1', |         'postgresqls': 'apis/acid.zalan.do/v1', | ||||||
|         'statefulsets': 'apis/apps/v1beta1', |         'statefulsets': 'apis/apps/v1', | ||||||
|     }.get(resource_type, 'api/v1') |     }.get(resource_type, 'api/v1') | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue