Upgrade Operator to 3.0.1 (#201)

This commit is contained in:
Daniel Valdivia
2020-07-25 14:38:16 -07:00
committed by GitHub
parent 3ac64b3848
commit bc8429bd6b
34 changed files with 833 additions and 826 deletions

View File

@@ -19,8 +19,8 @@ package restapi
import (
"context"
v1 "github.com/minio/minio-operator/pkg/apis/operator.min.io/v1"
operatorClientset "github.com/minio/minio-operator/pkg/client/clientset/versioned"
v1 "github.com/minio/operator/pkg/apis/minio.min.io/v1"
operatorClientset "github.com/minio/operator/pkg/client/clientset/versioned"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
)
@@ -29,36 +29,36 @@ import (
// by mock when testing, it should include all OperatorClient respective api calls
// that are used within this project.
type OperatorClient interface {
MinIOInstanceDelete(ctx context.Context, namespace string, instanceName string, options metav1.DeleteOptions) error
MinIOInstanceGet(ctx context.Context, namespace string, instanceName string, options metav1.GetOptions) (*v1.MinIOInstance, error)
MinIOInstancePatch(ctx context.Context, namespace string, instanceName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.MinIOInstance, error)
MinIOInstanceList(ctx context.Context, namespace string, opts metav1.ListOptions) (*v1.MinIOInstanceList, error)
TenantDelete(ctx context.Context, namespace string, instanceName string, options metav1.DeleteOptions) error
TenantGet(ctx context.Context, namespace string, instanceName string, options metav1.GetOptions) (*v1.Tenant, error)
TenantPatch(ctx context.Context, namespace string, instanceName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.Tenant, error)
TenantList(ctx context.Context, namespace string, opts metav1.ListOptions) (*v1.TenantList, error)
}
// Interface implementation
//
// Define the structure of a operator client and define the functions that are actually used
// from the minio-operator.
// from the minio operator.
type operatorClient struct {
client *operatorClientset.Clientset
}
// MinIOInstanceDelete implements the minio instance delete action from minio-operator
func (c *operatorClient) MinIOInstanceDelete(ctx context.Context, namespace string, instanceName string, options metav1.DeleteOptions) error {
return c.client.OperatorV1().MinIOInstances(namespace).Delete(ctx, instanceName, options)
// TenantDelete implements the minio instance delete action from minio operator
func (c *operatorClient) TenantDelete(ctx context.Context, namespace string, instanceName string, options metav1.DeleteOptions) error {
return c.client.MinioV1().Tenants(namespace).Delete(ctx, instanceName, options)
}
// MinIOInstanceGet implements the minio instance get action from minio-operator
func (c *operatorClient) MinIOInstanceGet(ctx context.Context, namespace string, instanceName string, options metav1.GetOptions) (*v1.MinIOInstance, error) {
return c.client.OperatorV1().MinIOInstances(namespace).Get(ctx, instanceName, options)
// TenantGet implements the minio instance get action from minio operator
func (c *operatorClient) TenantGet(ctx context.Context, namespace string, instanceName string, options metav1.GetOptions) (*v1.Tenant, error) {
return c.client.MinioV1().Tenants(namespace).Get(ctx, instanceName, options)
}
// MinIOInstancePatch implements the minio instance patch action from minio-operator
func (c *operatorClient) MinIOInstancePatch(ctx context.Context, namespace string, instanceName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.MinIOInstance, error) {
return c.client.OperatorV1().MinIOInstances(namespace).Patch(ctx, instanceName, pt, data, options)
// TenantPatch implements the minio instance patch action from minio operator
func (c *operatorClient) TenantPatch(ctx context.Context, namespace string, instanceName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.Tenant, error) {
return c.client.MinioV1().Tenants(namespace).Patch(ctx, instanceName, pt, data, options)
}
// MinIOInstanceList implements the minio instance list action from minio-operator
func (c *operatorClient) MinIOInstanceList(ctx context.Context, namespace string, opts metav1.ListOptions) (*v1.MinIOInstanceList, error) {
return c.client.OperatorV1().MinIOInstances(namespace).List(ctx, opts)
// TenantList implements the minio instance list action from minio operator
func (c *operatorClient) TenantList(ctx context.Context, namespace string, opts metav1.ListOptions) (*v1.TenantList, error) {
return c.client.MinioV1().Tenants(namespace).List(ctx, opts)
}