Upgrade Operator to 3.0.0
This commit is contained in:
4
go.mod
4
go.mod
@@ -18,10 +18,10 @@ require (
|
||||
github.com/json-iterator/go v1.1.10
|
||||
github.com/minio/cli v1.22.0
|
||||
github.com/minio/mc v0.0.0-20200719194630-c8a3b7bff08c
|
||||
github.com/minio/minio v0.0.0-20200714163805-778e9c864f67
|
||||
github.com/minio/minio v0.0.0-20200723003940-b9be841fd222
|
||||
github.com/minio/minio-go/v6 v6.0.58-0.20200612001654-a57fec8037ec
|
||||
github.com/minio/minio-go/v7 v7.0.2-0.20200718235721-f0e2f3ae3678
|
||||
github.com/minio/minio-operator v0.0.0-20200713191021-de7c5283f7e5
|
||||
github.com/minio/minio-operator v0.0.0-20200723204759-26762d65da84
|
||||
github.com/pquerna/cachecontrol v0.0.0-20180517163645-1555304b9b35 // indirect
|
||||
github.com/satori/go.uuid v1.2.0
|
||||
github.com/stretchr/testify v1.6.1
|
||||
|
||||
10
go.sum
10
go.sum
@@ -156,6 +156,7 @@ github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 h1:Mn26/9ZMNWSw9C9ER
|
||||
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32/go.mod h1:GIjDIg/heH5DOkXY3YJ/wNhfHsQHoXGjl8G8amsYQ1I=
|
||||
github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=
|
||||
github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=
|
||||
github.com/go-ini/ini v1.57.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
|
||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-ldap/ldap v3.0.2+incompatible h1:kD5HQcAzlQ7yrhfn+h+MSABeAy/jAJhvIJ/QDllP44g=
|
||||
github.com/go-ldap/ldap v3.0.2+incompatible/go.mod h1:qfd9rJvER9Q0/D/Sqn1DfHRoBp40uXYvFoEVrNEPqRc=
|
||||
@@ -512,16 +513,19 @@ github.com/minio/md5-simd v1.1.0/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77Z
|
||||
github.com/minio/minio v0.0.0-20200501124117-09571d03a531/go.mod h1:Vhlqz7Se0EgpgFiVxpvzF4Zz/h2LMx+EPKH96Aera5U=
|
||||
github.com/minio/minio v0.0.0-20200714163805-778e9c864f67 h1:xMg87xvLhrw2jeE6xGx/uuFr2iIksfszITGdHhWURnA=
|
||||
github.com/minio/minio v0.0.0-20200714163805-778e9c864f67/go.mod h1:0WThPBMICOt5eEGT3XyaUy0cxYmoGhmJEvvRbiVqbYU=
|
||||
github.com/minio/minio v0.0.0-20200723003940-b9be841fd222 h1:+XFGpEsqmA033nDX8LtjyPZy01Shivf6E2OL67WoGiE=
|
||||
github.com/minio/minio v0.0.0-20200723003940-b9be841fd222/go.mod h1:Eu2KC2p+vW03rnYY/6R/D+QduPB7/j4kBaVA/EDLjWM=
|
||||
github.com/minio/minio-go/v6 v6.0.53 h1:8jzpwiOzZ5Iz7/goFWqNZRICbyWYShbb5rARjrnSCNI=
|
||||
github.com/minio/minio-go/v6 v6.0.53/go.mod h1:DIvC/IApeHX8q1BAMVCXSXwpmrmM+I+iBvhvztQorfI=
|
||||
github.com/minio/minio-go/v6 v6.0.55-0.20200424204115-7506d2996b22/go.mod h1:KQMM+/44DSlSGSQWSfRrAZ12FVMmpWNuX37i2AX0jfI=
|
||||
github.com/minio/minio-go/v6 v6.0.58-0.20200612001654-a57fec8037ec h1:my1ShPzUyV5BSteRVdm/YoEhd4ycLImlN4xDX17pd8A=
|
||||
github.com/minio/minio-go/v6 v6.0.58-0.20200612001654-a57fec8037ec/go.mod h1:5+R/nM9Pwrh0vqF+HbYYDQ84wdUFPyXHkrdT4AIkifM=
|
||||
github.com/minio/minio-go/v7 v7.0.0-20200714085548-47e386e2cde8/go.mod h1:QTstSRgetEDVpqiEpFniLoCslH4d9cNAa4BtjuRQrwE=
|
||||
github.com/minio/minio-go/v7 v7.0.1/go.mod h1:dJ80Mv2HeGkYLH1sqS/ksz07ON6csH3S6JUMSQ2zAns=
|
||||
github.com/minio/minio-go/v7 v7.0.2-0.20200718235721-f0e2f3ae3678 h1:vV6dhx+KI1YfQTqlYYUa2dh8MUhecITo1XXhFDTl6fU=
|
||||
github.com/minio/minio-go/v7 v7.0.2-0.20200718235721-f0e2f3ae3678/go.mod h1:dJ80Mv2HeGkYLH1sqS/ksz07ON6csH3S6JUMSQ2zAns=
|
||||
github.com/minio/minio-operator v0.0.0-20200713191021-de7c5283f7e5 h1:ycH+JjgYkiaO02XDk1UPXjyauXw1N4nKojod6Cw2tcw=
|
||||
github.com/minio/minio-operator v0.0.0-20200713191021-de7c5283f7e5/go.mod h1:hNvWo/RuktTqhjKVnKmmZA8chdAxcPdi8jFJXZmioLI=
|
||||
github.com/minio/minio-operator v0.0.0-20200723204759-26762d65da84 h1:chr56VwbyGM6rqbKtVJiQ+pgrxh1rbus9HEmAx5Tcys=
|
||||
github.com/minio/minio-operator v0.0.0-20200723204759-26762d65da84/go.mod h1:auKSx2m2jfN8DqHwDZWZm4eW6bHYXW1haUBIerVvA6w=
|
||||
github.com/minio/parquet-go v0.0.0-20200414234858-838cfa8aae61 h1:pUSI/WKPdd77gcuoJkSzhJ4wdS8OMDOsOu99MtpXEQA=
|
||||
github.com/minio/parquet-go v0.0.0-20200414234858-838cfa8aae61/go.mod h1:4trzEJ7N1nBTd5Tt7OCZT5SEin+WiAXpdJ/WgPkESA8=
|
||||
github.com/minio/sha256-simd v0.1.1 h1:5QHSlgo3nt5yKOJrC7W8w7X+NFl8cMPZm96iu8kKUJU=
|
||||
@@ -1032,6 +1036,8 @@ k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8=
|
||||
k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I=
|
||||
k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c h1:/KUFqjjqAcY4Us6luF5RDNZ16KJtb49HfR3ZHB9qYXM=
|
||||
k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E=
|
||||
k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6 h1:Oh3Mzx5pJ+yIumsAD0MOECPVeXsVot0UkiaCGVyfGQY=
|
||||
k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E=
|
||||
k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89 h1:d4vVOjXm687F1iLSP2q3lyPPuyvTUt3aVoBpi2DqRsU=
|
||||
k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew=
|
||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
||||
|
||||
@@ -64,7 +64,7 @@ rules:
|
||||
- create
|
||||
- get
|
||||
- apiGroups:
|
||||
- operator.min.io
|
||||
- minio.min.io
|
||||
resources:
|
||||
- "*"
|
||||
verbs:
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: minio-operator
|
||||
---
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: minioinstances.operator.min.io
|
||||
name: tenants.minio.min.io
|
||||
spec:
|
||||
group: operator.min.io
|
||||
group: minio.min.io
|
||||
scope: Namespaced
|
||||
names:
|
||||
kind: MinIOInstance
|
||||
singular: minioinstance
|
||||
plural: minioinstances
|
||||
kind: Tenant
|
||||
singular: tenant
|
||||
plural: tenants
|
||||
versions:
|
||||
- name: v1
|
||||
served: true
|
||||
@@ -24,49 +29,109 @@ spec:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
properties:
|
||||
replicas:
|
||||
type: integer
|
||||
minimum: 1
|
||||
maximum: 32
|
||||
metadata:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
image:
|
||||
type: string
|
||||
serviceName:
|
||||
type: string
|
||||
volumesPerServer:
|
||||
type: integer
|
||||
serviceAccountName:
|
||||
type: string
|
||||
zones:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
servers:
|
||||
type: integer
|
||||
volumesPerServer:
|
||||
type: integer
|
||||
volumeClaimTemplate:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
resources:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
nodeSelector:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
affinity:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
tolerations:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
mountPath:
|
||||
type: string
|
||||
podManagementPolicy:
|
||||
type: string
|
||||
enum: [Parallel, OrderedReady]
|
||||
enum: [Parallel,OrderedReady]
|
||||
default: Parallel
|
||||
requestAutoCert:
|
||||
type: boolean
|
||||
default: false
|
||||
certConfig:
|
||||
type: object
|
||||
properties:
|
||||
commonName:
|
||||
type: string
|
||||
organizationName:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
dnsNames:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
version:
|
||||
type: string
|
||||
mountpath:
|
||||
type: string
|
||||
subpath:
|
||||
type: string
|
||||
mcs:
|
||||
nodeSelector:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
credsSecret:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
env:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
console:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
properties:
|
||||
metadata:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
image:
|
||||
type: string
|
||||
replicas:
|
||||
type: integer
|
||||
default: 2
|
||||
mcsSecret:
|
||||
consoleSecret:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
resources:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
env:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
kes:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
properties:
|
||||
metadata:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
image:
|
||||
type: string
|
||||
replicas:
|
||||
@@ -77,6 +142,15 @@ spec:
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
liveness:
|
||||
type: object
|
||||
properties:
|
||||
initialDelaySeconds:
|
||||
type: integer
|
||||
periodSeconds:
|
||||
type: integer
|
||||
timeoutSeconds:
|
||||
type: integer
|
||||
status:
|
||||
type: object
|
||||
properties:
|
||||
@@ -90,6 +164,12 @@ spec:
|
||||
type: string
|
||||
jsonPath: ".status.currentState"
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: minio-operator
|
||||
namespace: default
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
@@ -135,37 +215,40 @@ rules:
|
||||
- update
|
||||
- delete
|
||||
- apiGroups:
|
||||
- "certificates.k8s.io"
|
||||
- certificates.k8s.io
|
||||
resources:
|
||||
- "certificatesigningrequests"
|
||||
- "certificatesigningrequests/approval"
|
||||
- "certificatesigningrequests/status"
|
||||
- certificatesigningrequests
|
||||
- certificatesigningrequests/approval
|
||||
- certificatesigningrequests/status
|
||||
verbs:
|
||||
- update
|
||||
- create
|
||||
- get
|
||||
- delete
|
||||
- apiGroups:
|
||||
- operator.min.io
|
||||
- certificates.k8s.io
|
||||
resourceNames:
|
||||
- kubernetes.io/legacy-unknown
|
||||
resources:
|
||||
- "*"
|
||||
- signers
|
||||
verbs:
|
||||
- "*"
|
||||
- approve
|
||||
- sign
|
||||
- apiGroups:
|
||||
- minio.min.io
|
||||
resources:
|
||||
- '*'
|
||||
verbs:
|
||||
- '*'
|
||||
- apiGroups:
|
||||
- min.io
|
||||
resources:
|
||||
- "*"
|
||||
- '*'
|
||||
verbs:
|
||||
- "*"
|
||||
- '*'
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: minio-operator
|
||||
namespace: default
|
||||
---
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: minio-operator-binding
|
||||
roleRef:
|
||||
@@ -192,12 +275,8 @@ spec:
|
||||
labels:
|
||||
name: minio-operator
|
||||
spec:
|
||||
serviceAccountName: minio-operator
|
||||
containers:
|
||||
- name: minio-operator
|
||||
image: minio/k8s-operator:2.0.9
|
||||
- image: minio/k8s-operator:3.0.0
|
||||
imagePullPolicy: IfNotPresent
|
||||
# To specify cluster domain, un comment the following:
|
||||
# env:
|
||||
# - name: CLUSTER_DOMAIN
|
||||
# value: mycluster.mydomain
|
||||
name: minio-operator
|
||||
serviceAccountName: minio-operator
|
||||
|
||||
@@ -64,7 +64,7 @@ rules:
|
||||
- create
|
||||
- get
|
||||
- apiGroups:
|
||||
- operator.min.io
|
||||
- minio.min.io
|
||||
resources:
|
||||
- "*"
|
||||
verbs:
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: minio-operator
|
||||
---
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: minioinstances.operator.min.io
|
||||
name: tenants.minio.min.io
|
||||
spec:
|
||||
group: operator.min.io
|
||||
group: minio.min.io
|
||||
scope: Namespaced
|
||||
names:
|
||||
kind: MinIOInstance
|
||||
singular: minioinstance
|
||||
plural: minioinstances
|
||||
kind: Tenant
|
||||
singular: tenant
|
||||
plural: tenants
|
||||
versions:
|
||||
- name: v1
|
||||
served: true
|
||||
@@ -24,49 +29,109 @@ spec:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
properties:
|
||||
replicas:
|
||||
type: integer
|
||||
minimum: 1
|
||||
maximum: 32
|
||||
metadata:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
image:
|
||||
type: string
|
||||
serviceName:
|
||||
type: string
|
||||
volumesPerServer:
|
||||
type: integer
|
||||
serviceAccountName:
|
||||
type: string
|
||||
zones:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
servers:
|
||||
type: integer
|
||||
volumesPerServer:
|
||||
type: integer
|
||||
volumeClaimTemplate:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
resources:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
nodeSelector:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
affinity:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
tolerations:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
mountPath:
|
||||
type: string
|
||||
podManagementPolicy:
|
||||
type: string
|
||||
enum: [Parallel, OrderedReady]
|
||||
enum: [Parallel,OrderedReady]
|
||||
default: Parallel
|
||||
requestAutoCert:
|
||||
type: boolean
|
||||
default: false
|
||||
certConfig:
|
||||
type: object
|
||||
properties:
|
||||
commonName:
|
||||
type: string
|
||||
organizationName:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
dnsNames:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
version:
|
||||
type: string
|
||||
mountpath:
|
||||
type: string
|
||||
subpath:
|
||||
type: string
|
||||
mcs:
|
||||
nodeSelector:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
credsSecret:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
env:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
console:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
properties:
|
||||
metadata:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
image:
|
||||
type: string
|
||||
replicas:
|
||||
type: integer
|
||||
default: 2
|
||||
mcsSecret:
|
||||
consoleSecret:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
resources:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
env:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
kes:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
properties:
|
||||
metadata:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
image:
|
||||
type: string
|
||||
replicas:
|
||||
@@ -77,6 +142,15 @@ spec:
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
liveness:
|
||||
type: object
|
||||
properties:
|
||||
initialDelaySeconds:
|
||||
type: integer
|
||||
periodSeconds:
|
||||
type: integer
|
||||
timeoutSeconds:
|
||||
type: integer
|
||||
status:
|
||||
type: object
|
||||
properties:
|
||||
@@ -90,6 +164,12 @@ spec:
|
||||
type: string
|
||||
jsonPath: ".status.currentState"
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: minio-operator
|
||||
namespace: default
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
@@ -135,37 +215,40 @@ rules:
|
||||
- update
|
||||
- delete
|
||||
- apiGroups:
|
||||
- "certificates.k8s.io"
|
||||
- certificates.k8s.io
|
||||
resources:
|
||||
- "certificatesigningrequests"
|
||||
- "certificatesigningrequests/approval"
|
||||
- "certificatesigningrequests/status"
|
||||
- certificatesigningrequests
|
||||
- certificatesigningrequests/approval
|
||||
- certificatesigningrequests/status
|
||||
verbs:
|
||||
- update
|
||||
- create
|
||||
- get
|
||||
- delete
|
||||
- apiGroups:
|
||||
- operator.min.io
|
||||
- certificates.k8s.io
|
||||
resourceNames:
|
||||
- kubernetes.io/legacy-unknown
|
||||
resources:
|
||||
- "*"
|
||||
- signers
|
||||
verbs:
|
||||
- "*"
|
||||
- approve
|
||||
- sign
|
||||
- apiGroups:
|
||||
- minio.min.io
|
||||
resources:
|
||||
- '*'
|
||||
verbs:
|
||||
- '*'
|
||||
- apiGroups:
|
||||
- min.io
|
||||
resources:
|
||||
- "*"
|
||||
- '*'
|
||||
verbs:
|
||||
- "*"
|
||||
- '*'
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: minio-operator
|
||||
namespace: default
|
||||
---
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: minio-operator-binding
|
||||
roleRef:
|
||||
@@ -192,12 +275,8 @@ spec:
|
||||
labels:
|
||||
name: minio-operator
|
||||
spec:
|
||||
serviceAccountName: minio-operator
|
||||
containers:
|
||||
- name: minio-operator
|
||||
image: minio/k8s-operator:2.0.9
|
||||
- image: minio/k8s-operator:3.0.0
|
||||
imagePullPolicy: IfNotPresent
|
||||
# To specify cluster domain, un comment the following:
|
||||
# env:
|
||||
# - name: CLUSTER_DOMAIN
|
||||
# value: mycluster.mydomain
|
||||
name: minio-operator
|
||||
serviceAccountName: minio-operator
|
||||
|
||||
@@ -42,8 +42,8 @@ type CreateTenantRequest struct {
|
||||
// annotations
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
|
||||
// enable mcs
|
||||
EnableMcs *bool `json:"enable_mcs,omitempty"`
|
||||
// enable console
|
||||
EnableConsole *bool `json:"enable_console,omitempty"`
|
||||
|
||||
// enable ssl
|
||||
EnableSsl *bool `json:"enable_ssl,omitempty"`
|
||||
@@ -69,14 +69,8 @@ type CreateTenantRequest struct {
|
||||
// service name
|
||||
ServiceName string `json:"service_name,omitempty"`
|
||||
|
||||
// volume configuration
|
||||
// Required: true
|
||||
VolumeConfiguration *CreateTenantRequestVolumeConfiguration `json:"volume_configuration"`
|
||||
|
||||
// volumes per server
|
||||
VolumesPerServer int64 `json:"volumes_per_server,omitempty"`
|
||||
|
||||
// zones
|
||||
// Required: true
|
||||
Zones []*Zone `json:"zones"`
|
||||
}
|
||||
|
||||
@@ -92,10 +86,6 @@ func (m *CreateTenantRequest) Validate(formats strfmt.Registry) error {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateVolumeConfiguration(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateZones(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
@@ -128,28 +118,10 @@ func (m *CreateTenantRequest) validateNamespace(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CreateTenantRequest) validateVolumeConfiguration(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("volume_configuration", "body", m.VolumeConfiguration); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if m.VolumeConfiguration != nil {
|
||||
if err := m.VolumeConfiguration.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("volume_configuration")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CreateTenantRequest) validateZones(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(m.Zones) { // not required
|
||||
return nil
|
||||
if err := validate.Required("zones", "body", m.Zones); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.Zones); i++ {
|
||||
@@ -188,57 +160,3 @@ func (m *CreateTenantRequest) UnmarshalBinary(b []byte) error {
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
|
||||
// CreateTenantRequestVolumeConfiguration create tenant request volume configuration
|
||||
//
|
||||
// swagger:model CreateTenantRequestVolumeConfiguration
|
||||
type CreateTenantRequestVolumeConfiguration struct {
|
||||
|
||||
// size
|
||||
// Required: true
|
||||
Size *string `json:"size"`
|
||||
|
||||
// storage class
|
||||
StorageClass string `json:"storage_class,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this create tenant request volume configuration
|
||||
func (m *CreateTenantRequestVolumeConfiguration) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateSize(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CreateTenantRequestVolumeConfiguration) validateSize(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("volume_configuration"+"."+"size", "body", m.Size); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *CreateTenantRequestVolumeConfiguration) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *CreateTenantRequestVolumeConfiguration) UnmarshalBinary(b []byte) error {
|
||||
var res CreateTenantRequestVolumeConfiguration
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -44,36 +44,18 @@ type Tenant struct {
|
||||
// image
|
||||
Image string `json:"image,omitempty"`
|
||||
|
||||
// instance count
|
||||
InstanceCount int64 `json:"instance_count,omitempty"`
|
||||
|
||||
// name
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// namespace
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
|
||||
// storage class
|
||||
StorageClass string `json:"storage_class,omitempty"`
|
||||
|
||||
// total size
|
||||
TotalSize int64 `json:"total_size,omitempty"`
|
||||
|
||||
// used size
|
||||
UsedSize int64 `json:"used_size,omitempty"`
|
||||
|
||||
// volume count
|
||||
VolumeCount int64 `json:"volume_count,omitempty"`
|
||||
|
||||
// volume size
|
||||
VolumeSize int64 `json:"volume_size,omitempty"`
|
||||
|
||||
// volumes per server
|
||||
VolumesPerServer int64 `json:"volumes_per_server,omitempty"`
|
||||
|
||||
// zone count
|
||||
ZoneCount int64 `json:"zone_count,omitempty"`
|
||||
|
||||
// zones
|
||||
Zones []*Zone `json:"zones"`
|
||||
}
|
||||
|
||||
@@ -35,23 +35,34 @@ import (
|
||||
type Zone struct {
|
||||
|
||||
// name
|
||||
// Required: true
|
||||
Name *string `json:"name"`
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// servers
|
||||
// Required: true
|
||||
Servers *int64 `json:"servers"`
|
||||
|
||||
// volume configuration
|
||||
// Required: true
|
||||
VolumeConfiguration *ZoneVolumeConfiguration `json:"volume_configuration"`
|
||||
|
||||
// volumes per server
|
||||
// Required: true
|
||||
VolumesPerServer *int32 `json:"volumes_per_server"`
|
||||
}
|
||||
|
||||
// Validate validates this zone
|
||||
func (m *Zone) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateName(formats); err != nil {
|
||||
if err := m.validateServers(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateServers(formats); err != nil {
|
||||
if err := m.validateVolumeConfiguration(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateVolumesPerServer(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
@@ -61,18 +72,36 @@ func (m *Zone) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Zone) validateName(formats strfmt.Registry) error {
|
||||
func (m *Zone) validateServers(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("name", "body", m.Name); err != nil {
|
||||
if err := validate.Required("servers", "body", m.Servers); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Zone) validateServers(formats strfmt.Registry) error {
|
||||
func (m *Zone) validateVolumeConfiguration(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("servers", "body", m.Servers); err != nil {
|
||||
if err := validate.Required("volume_configuration", "body", m.VolumeConfiguration); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if m.VolumeConfiguration != nil {
|
||||
if err := m.VolumeConfiguration.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("volume_configuration")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Zone) validateVolumesPerServer(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("volumes_per_server", "body", m.VolumesPerServer); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -96,3 +125,57 @@ func (m *Zone) UnmarshalBinary(b []byte) error {
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
|
||||
// ZoneVolumeConfiguration zone volume configuration
|
||||
//
|
||||
// swagger:model ZoneVolumeConfiguration
|
||||
type ZoneVolumeConfiguration struct {
|
||||
|
||||
// size
|
||||
// Required: true
|
||||
Size *int64 `json:"size"`
|
||||
|
||||
// storage class name
|
||||
StorageClassName string `json:"storage_class_name,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this zone volume configuration
|
||||
func (m *ZoneVolumeConfiguration) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateSize(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ZoneVolumeConfiguration) validateSize(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("volume_configuration"+"."+"size", "body", m.Size); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *ZoneVolumeConfiguration) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *ZoneVolumeConfiguration) UnmarshalBinary(b []byte) error {
|
||||
var res ZoneVolumeConfiguration
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ type operatorClientTest struct {
|
||||
|
||||
var operatorAuthenticateMock func(ctx context.Context) ([]byte, error)
|
||||
|
||||
// MinIOInstanceDelete implements the minio instance delete action from minio-operator
|
||||
// TenantDelete implements the minio instance delete action from minio-operator
|
||||
func (c *operatorClientTest) Authenticate(ctx context.Context) ([]byte, error) {
|
||||
return operatorAuthenticateMock(ctx)
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ import (
|
||||
"github.com/minio/mcs/models"
|
||||
"github.com/minio/mcs/restapi/operations"
|
||||
"github.com/minio/mcs/restapi/operations/admin_api"
|
||||
operator "github.com/minio/minio-operator/pkg/apis/operator.min.io/v1"
|
||||
operator "github.com/minio/minio-operator/pkg/apis/minio.min.io/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
@@ -115,7 +115,7 @@ func registerTenantHandlers(api *operations.McsAPI) {
|
||||
|
||||
// deleteTenantAction performs the actions of deleting a tenant
|
||||
func deleteTenantAction(ctx context.Context, operatorClient OperatorClient, nameSpace, instanceName string) error {
|
||||
err := operatorClient.MinIOInstanceDelete(ctx, nameSpace, instanceName, metav1.DeleteOptions{})
|
||||
err := operatorClient.TenantDelete(ctx, nameSpace, instanceName, metav1.DeleteOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -134,7 +134,7 @@ func getDeleteTenantResponse(session *models.Principal, params admin_api.DeleteT
|
||||
return deleteTenantAction(context.Background(), opClient, params.Namespace, params.Tenant)
|
||||
}
|
||||
|
||||
func getMinioInstanceScheme(mi *operator.MinIOInstance) string {
|
||||
func getTenantScheme(mi *operator.Tenant) string {
|
||||
scheme := "http"
|
||||
if mi.AutoCert() || mi.ExternalCert() {
|
||||
scheme = "https"
|
||||
@@ -169,52 +169,60 @@ func getTenantAdminClient(ctx context.Context, client K8sClient, namespace, tena
|
||||
return mAdmin, nil
|
||||
}
|
||||
|
||||
func getMinioInstance(ctx context.Context, operatorClient OperatorClient, namespace, tenantName string) (*operator.MinIOInstance, error) {
|
||||
minInst, err := operatorClient.MinIOInstanceGet(ctx, namespace, tenantName, metav1.GetOptions{})
|
||||
func getTenant(ctx context.Context, operatorClient OperatorClient, namespace, tenantName string) (*operator.Tenant, error) {
|
||||
minInst, err := operatorClient.TenantGet(ctx, namespace, tenantName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return minInst, nil
|
||||
}
|
||||
|
||||
func getTenantInfo(minioInstance *operator.MinIOInstance, tenantInfo *usageInfo) *models.Tenant {
|
||||
func getTenantInfo(tenant *operator.Tenant, tenantInfo *usageInfo) *models.Tenant {
|
||||
var instanceCount int64
|
||||
var volumeCount int64
|
||||
for _, zone := range minioInstance.Spec.Zones {
|
||||
for _, zone := range tenant.Spec.Zones {
|
||||
instanceCount = instanceCount + int64(zone.Servers)
|
||||
volumeCount = volumeCount + int64(zone.Servers*int32(minioInstance.Spec.VolumesPerServer))
|
||||
volumeCount = volumeCount + int64(zone.Servers*zone.VolumesPerServer)
|
||||
}
|
||||
|
||||
var zones []*models.Zone
|
||||
|
||||
for _, z := range minioInstance.Spec.Zones {
|
||||
zones = append(zones, &models.Zone{
|
||||
Name: swag.String(z.Name),
|
||||
Servers: swag.Int64(int64(z.Servers)),
|
||||
})
|
||||
var totalSize int64
|
||||
for _, z := range tenant.Spec.Zones {
|
||||
zoneModel := &models.Zone{
|
||||
Name: z.Name,
|
||||
Servers: swag.Int64(int64(z.Servers)),
|
||||
VolumesPerServer: &z.VolumesPerServer,
|
||||
VolumeConfiguration: &models.ZoneVolumeConfiguration{},
|
||||
}
|
||||
|
||||
if z.VolumeClaimTemplate != nil {
|
||||
zoneModel.VolumeConfiguration.Size = swag.Int64(z.VolumeClaimTemplate.Spec.Resources.Requests.Storage().Value())
|
||||
if z.VolumeClaimTemplate.Spec.StorageClassName != nil {
|
||||
zoneModel.VolumeConfiguration.StorageClassName = *z.VolumeClaimTemplate.Spec.StorageClassName
|
||||
}
|
||||
}
|
||||
|
||||
zones = append(zones, zoneModel)
|
||||
zoneSize := int64(z.Servers) * int64(z.VolumesPerServer) * z.VolumeClaimTemplate.Spec.Resources.Requests.Storage().Value()
|
||||
totalSize = totalSize + zoneSize
|
||||
}
|
||||
|
||||
return &models.Tenant{
|
||||
CreationDate: minioInstance.ObjectMeta.CreationTimestamp.String(),
|
||||
InstanceCount: instanceCount,
|
||||
Name: minioInstance.Name,
|
||||
VolumesPerServer: int64(minioInstance.Spec.VolumesPerServer),
|
||||
VolumeCount: volumeCount,
|
||||
VolumeSize: minioInstance.Spec.VolumeClaimTemplate.Spec.Resources.Requests.Storage().Value(),
|
||||
TotalSize: int64(minioInstance.Spec.VolumeClaimTemplate.Spec.Resources.Requests.Storage().Value() * volumeCount),
|
||||
ZoneCount: int64(len(minioInstance.Spec.Zones)),
|
||||
CurrentState: minioInstance.Status.CurrentState,
|
||||
Zones: zones,
|
||||
Namespace: minioInstance.ObjectMeta.Namespace,
|
||||
Image: minioInstance.Spec.Image,
|
||||
UsedSize: tenantInfo.DisksUsage,
|
||||
StorageClass: swag.StringValue(minioInstance.Spec.VolumeClaimTemplate.Spec.StorageClassName),
|
||||
CreationDate: tenant.ObjectMeta.CreationTimestamp.String(),
|
||||
Name: tenant.Name,
|
||||
TotalSize: totalSize,
|
||||
CurrentState: tenant.Status.CurrentState,
|
||||
Zones: zones,
|
||||
Namespace: tenant.ObjectMeta.Namespace,
|
||||
Image: tenant.Spec.Image,
|
||||
UsedSize: tenantInfo.DisksUsage,
|
||||
}
|
||||
}
|
||||
|
||||
func getTenantInfoResponse(session *models.Principal, params admin_api.TenantInfoParams) (*models.Tenant, error) {
|
||||
// 20 seconds timeout
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
|
||||
// 5 seconds timeout
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
|
||||
opClientClientSet, err := cluster.OperatorClient(session.SessionToken)
|
||||
@@ -234,13 +242,28 @@ func getTenantInfoResponse(session *models.Principal, params admin_api.TenantInf
|
||||
client: clientset,
|
||||
}
|
||||
|
||||
minInst, err := getMinioInstance(ctx, opClient, params.Namespace, params.Tenant)
|
||||
minTenant, err := getTenant(ctx, opClient, params.Namespace, params.Tenant)
|
||||
if err != nil {
|
||||
log.Println("error getting minioInstance:", err)
|
||||
log.Println("error getting minioTenant:", err)
|
||||
return nil, err
|
||||
}
|
||||
minioInstanceScheme := getMinioInstanceScheme(minInst)
|
||||
mAdmin, err := getTenantAdminClient(ctx, k8sClient, params.Namespace, params.Tenant, minInst.Spec.ServiceName, minioInstanceScheme)
|
||||
tenantScheme := getTenantScheme(minTenant)
|
||||
|
||||
svcName := minTenant.Spec.ServiceName
|
||||
if svcName == "" {
|
||||
svcName = minTenant.Name
|
||||
// TODO:
|
||||
// 1 get tenant services
|
||||
// 2 filter out cluster ip svc
|
||||
}
|
||||
|
||||
mAdmin, err := getTenantAdminClient(
|
||||
ctx,
|
||||
k8sClient,
|
||||
params.Namespace,
|
||||
params.Tenant,
|
||||
svcName,
|
||||
tenantScheme)
|
||||
if err != nil {
|
||||
log.Println("error getting tenant's admin client:", err)
|
||||
return nil, err
|
||||
@@ -254,7 +277,7 @@ func getTenantInfoResponse(session *models.Principal, params admin_api.TenantInf
|
||||
log.Println("error getting admin info:", err)
|
||||
return nil, err
|
||||
}
|
||||
info := getTenantInfo(minInst, adminInfo)
|
||||
info := getTenantInfo(minTenant, adminInfo)
|
||||
return info, nil
|
||||
}
|
||||
|
||||
@@ -267,20 +290,20 @@ func listTenants(ctx context.Context, operatorClient OperatorClient, namespace s
|
||||
listOpts.Limit = int64(*limit)
|
||||
}
|
||||
|
||||
minInstances, err := operatorClient.MinIOInstanceList(ctx, namespace, listOpts)
|
||||
minTenants, err := operatorClient.TenantList(ctx, namespace, listOpts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var tenants []*models.TenantList
|
||||
|
||||
for _, minInst := range minInstances.Items {
|
||||
for _, minInst := range minTenants.Items {
|
||||
|
||||
var instanceCount int64
|
||||
var volumeCount int64
|
||||
for _, zone := range minInst.Spec.Zones {
|
||||
instanceCount = instanceCount + int64(zone.Servers)
|
||||
volumeCount = volumeCount + int64(zone.Servers*int32(minInst.Spec.VolumesPerServer))
|
||||
volumeCount = volumeCount + int64(zone.Servers*zone.VolumesPerServer)
|
||||
}
|
||||
|
||||
tenants = append(tenants, &models.TenantList{
|
||||
@@ -289,7 +312,6 @@ func listTenants(ctx context.Context, operatorClient OperatorClient, namespace s
|
||||
ZoneCount: int64(len(minInst.Spec.Zones)),
|
||||
InstanceCount: instanceCount,
|
||||
VolumeCount: volumeCount,
|
||||
VolumeSize: minInst.Spec.VolumeClaimTemplate.Spec.Resources.Requests.Storage().Value(),
|
||||
CurrentState: minInst.Status.CurrentState,
|
||||
Namespace: minInst.ObjectMeta.Namespace,
|
||||
})
|
||||
@@ -380,59 +402,33 @@ func getTenantCreatedResponse(session *models.Principal, params admin_api.Create
|
||||
return nil, err
|
||||
}
|
||||
|
||||
enableSSL := true
|
||||
enableSSL := false
|
||||
if params.Body.EnableSsl != nil {
|
||||
enableSSL = *params.Body.EnableSsl
|
||||
}
|
||||
enableMCS := true
|
||||
if params.Body.EnableMcs != nil {
|
||||
enableMCS = *params.Body.EnableMcs
|
||||
}
|
||||
|
||||
volumeSize, err := resource.ParseQuantity(*params.Body.VolumeConfiguration.Size)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
if params.Body.EnableConsole != nil {
|
||||
enableMCS = *params.Body.EnableConsole
|
||||
}
|
||||
|
||||
// TODO: Calculate this ourselves?
|
||||
memorySize, err := resource.ParseQuantity(getTenantMemorySize())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
volTemp := corev1.PersistentVolumeClaimSpec{
|
||||
AccessModes: []corev1.PersistentVolumeAccessMode{
|
||||
corev1.ReadWriteOnce,
|
||||
},
|
||||
Resources: corev1.ResourceRequirements{
|
||||
Requests: corev1.ResourceList{
|
||||
corev1.ResourceStorage: volumeSize,
|
||||
corev1.ResourceMemory: memorySize,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
if params.Body.VolumeConfiguration.StorageClass != "" {
|
||||
volTemp.StorageClassName = ¶ms.Body.VolumeConfiguration.StorageClass
|
||||
}
|
||||
|
||||
//Construct a MinIO Instance with everything we are getting from parameters
|
||||
minInst := operator.MinIOInstance{
|
||||
minInst := operator.Tenant{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: *params.Body.Name,
|
||||
},
|
||||
Spec: operator.MinIOInstanceSpec{
|
||||
Spec: operator.TenantSpec{
|
||||
Image: minioImage,
|
||||
Mountpath: "/export",
|
||||
CredsSecret: &corev1.LocalObjectReference{
|
||||
Name: secretName,
|
||||
},
|
||||
RequestAutoCert: enableSSL,
|
||||
VolumeClaimTemplate: &corev1.PersistentVolumeClaim{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "data",
|
||||
},
|
||||
Spec: volTemp,
|
||||
},
|
||||
},
|
||||
}
|
||||
// optionals are set below
|
||||
@@ -460,10 +456,11 @@ func getTenantCreatedResponse(session *models.Principal, params admin_api.Create
|
||||
return nil, err
|
||||
}
|
||||
|
||||
minInst.Spec.MCS = &operator.MCSConfig{
|
||||
Replicas: 2,
|
||||
Image: "minio/mcs:v0.1.1",
|
||||
MCSSecret: &corev1.LocalObjectReference{Name: mcsSecretName},
|
||||
const consoleVersion = "minio/mcs:v0.2.1"
|
||||
minInst.Spec.Console = &operator.ConsoleConfiguration{
|
||||
Replicas: 2,
|
||||
Image: consoleVersion,
|
||||
ConsoleSecret: &corev1.LocalObjectReference{Name: mcsSecretName},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -474,18 +471,39 @@ func getTenantCreatedResponse(session *models.Principal, params admin_api.Create
|
||||
// set the zones if they are provided
|
||||
if len(params.Body.Zones) > 0 {
|
||||
for _, zone := range params.Body.Zones {
|
||||
volumeSize := resource.NewQuantity(*zone.VolumeConfiguration.Size, resource.DecimalExponent)
|
||||
volTemp := corev1.PersistentVolumeClaimSpec{
|
||||
AccessModes: []corev1.PersistentVolumeAccessMode{
|
||||
corev1.ReadWriteOnce,
|
||||
},
|
||||
Resources: corev1.ResourceRequirements{
|
||||
Requests: corev1.ResourceList{
|
||||
corev1.ResourceStorage: *volumeSize,
|
||||
},
|
||||
},
|
||||
}
|
||||
if zone.VolumeConfiguration.StorageClassName != "" {
|
||||
volTemp.StorageClassName = &zone.VolumeConfiguration.StorageClassName
|
||||
}
|
||||
minInst.Spec.Zones = append(minInst.Spec.Zones, operator.Zone{
|
||||
Name: *zone.Name,
|
||||
Servers: int32(*zone.Servers),
|
||||
Name: zone.Name,
|
||||
Servers: int32(*zone.Servers),
|
||||
VolumesPerServer: *zone.VolumesPerServer,
|
||||
VolumeClaimTemplate: &corev1.PersistentVolumeClaim{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "data",
|
||||
},
|
||||
Spec: volTemp,
|
||||
},
|
||||
Resources: corev1.ResourceRequirements{
|
||||
Requests: corev1.ResourceList{
|
||||
corev1.ResourceMemory: memorySize,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Set Volumes Per Server if provided, default 1
|
||||
minInst.Spec.VolumesPerServer = 1
|
||||
if params.Body.VolumesPerServer > 0 {
|
||||
minInst.Spec.VolumesPerServer = int(params.Body.VolumesPerServer)
|
||||
}
|
||||
// Set Mount Path if provided
|
||||
if params.Body.MounthPath != "" {
|
||||
minInst.Spec.Mountpath = params.Body.MounthPath
|
||||
@@ -503,7 +521,7 @@ func getTenantCreatedResponse(session *models.Principal, params admin_api.Create
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_, err = opClient.OperatorV1().MinIOInstances(ns).Create(context.Background(), &minInst, metav1.CreateOptions{})
|
||||
_, err = opClient.MinioV1().Tenants(ns).Create(context.Background(), &minInst, metav1.CreateOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -522,10 +540,10 @@ func getTenantCreatedResponse(session *models.Principal, params admin_api.Create
|
||||
}, nil
|
||||
}
|
||||
|
||||
// updateTenantAction does an update on the minioInstance by patching the desired changes
|
||||
// updateTenantAction does an update on the minioTenant by patching the desired changes
|
||||
func updateTenantAction(ctx context.Context, operatorClient OperatorClient, httpCl cluster.HTTPClientI, nameSpace string, params admin_api.UpdateTenantParams) error {
|
||||
imageToUpdate := params.Body.Image
|
||||
minInst, err := operatorClient.MinIOInstanceGet(ctx, nameSpace, params.Tenant, metav1.GetOptions{})
|
||||
minInst, err := operatorClient.TenantGet(ctx, nameSpace, params.Tenant, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -545,7 +563,7 @@ func updateTenantAction(ctx context.Context, operatorClient OperatorClient, http
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = operatorClient.MinIOInstancePatch(ctx, nameSpace, minInst.Name, types.MergePatchType, payloadBytes, metav1.PatchOptions{})
|
||||
_, err = operatorClient.TenantPatch(ctx, nameSpace, minInst.Name, types.MergePatchType, payloadBytes, metav1.PatchOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -569,7 +587,7 @@ func getUpdateTenantResponse(session *models.Principal, params admin_api.UpdateT
|
||||
},
|
||||
}
|
||||
if err := updateTenantAction(ctx, opClient, httpC, params.Namespace, params); err != nil {
|
||||
log.Println("error patching MinioInstance:", err)
|
||||
log.Println("error patching Tenant:", err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
@@ -577,13 +595,13 @@ func getUpdateTenantResponse(session *models.Principal, params admin_api.UpdateT
|
||||
|
||||
// addTenantZone creates a zone to a defined tenant
|
||||
func addTenantZone(ctx context.Context, operatorClient OperatorClient, params admin_api.TenantAddZoneParams) error {
|
||||
minInst, err := operatorClient.MinIOInstanceGet(ctx, params.Namespace, params.Tenant, metav1.GetOptions{})
|
||||
minInst, err := operatorClient.TenantGet(ctx, params.Namespace, params.Tenant, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
minInst.Spec.Zones = append(minInst.Spec.Zones, operator.Zone{
|
||||
Name: *params.Body.Name,
|
||||
Name: params.Body.Name,
|
||||
Servers: int32(*params.Body.Servers),
|
||||
})
|
||||
|
||||
@@ -592,7 +610,7 @@ func addTenantZone(ctx context.Context, operatorClient OperatorClient, params ad
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = operatorClient.MinIOInstancePatch(ctx, params.Namespace, minInst.Name, types.MergePatchType, payloadBytes, metav1.PatchOptions{})
|
||||
_, err = operatorClient.TenantPatch(ctx, params.Namespace, minInst.Name, types.MergePatchType, payloadBytes, metav1.PatchOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -610,7 +628,7 @@ func getTenantAddZoneResponse(session *models.Principal, params admin_api.Tenant
|
||||
client: opClientClientSet,
|
||||
}
|
||||
if err := addTenantZone(ctx, opClient, params); err != nil {
|
||||
log.Println("error patching MinioInstance:", err)
|
||||
log.Println("error patching Tenant:", err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -19,6 +19,7 @@ package restapi
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
@@ -29,40 +30,40 @@ import (
|
||||
"github.com/minio/mcs/cluster"
|
||||
"github.com/minio/mcs/models"
|
||||
"github.com/minio/mcs/restapi/operations/admin_api"
|
||||
operator "github.com/minio/minio-operator/pkg/apis/operator.min.io/v1"
|
||||
v1 "github.com/minio/minio-operator/pkg/apis/operator.min.io/v1"
|
||||
operator "github.com/minio/minio-operator/pkg/apis/minio.min.io/v1"
|
||||
v1 "github.com/minio/minio-operator/pkg/apis/minio.min.io/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
)
|
||||
|
||||
var opClientMinioInstanceDeleteMock func(ctx context.Context, namespace string, instanceName string, options metav1.DeleteOptions) error
|
||||
var opClientMinioInstanceGetMock func(ctx context.Context, namespace string, instanceName string, options metav1.GetOptions) (*v1.MinIOInstance, error)
|
||||
var opClientMinioInstancePatchMock func(ctx context.Context, namespace string, instanceName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.MinIOInstance, error)
|
||||
var opClientMinioInstanceListMock func(ctx context.Context, namespace string, opts metav1.ListOptions) (*v1.MinIOInstanceList, error)
|
||||
var opClientTenantDeleteMock func(ctx context.Context, namespace string, tenantName string, options metav1.DeleteOptions) error
|
||||
var opClientTenantGetMock func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*v1.Tenant, error)
|
||||
var opClientTenantPatchMock func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.Tenant, error)
|
||||
var opClientTenantListMock func(ctx context.Context, namespace string, opts metav1.ListOptions) (*v1.TenantList, error)
|
||||
var httpClientGetMock func(url string) (resp *http.Response, err error)
|
||||
var k8sclientGetSecretMock func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error)
|
||||
var k8sclientGetServiceMock func(ctx context.Context, namespace, serviceName string, opts metav1.GetOptions) (*corev1.Service, error)
|
||||
|
||||
// mock function of MinioInstanceDelete()
|
||||
func (ac opClientMock) MinIOInstanceDelete(ctx context.Context, namespace string, instanceName string, options metav1.DeleteOptions) error {
|
||||
return opClientMinioInstanceDeleteMock(ctx, namespace, instanceName, options)
|
||||
// mock function of TenantDelete()
|
||||
func (ac opClientMock) TenantDelete(ctx context.Context, namespace string, tenantName string, options metav1.DeleteOptions) error {
|
||||
return opClientTenantDeleteMock(ctx, namespace, tenantName, options)
|
||||
}
|
||||
|
||||
// mock function of MinIOInstanceGet()
|
||||
func (ac opClientMock) MinIOInstanceGet(ctx context.Context, namespace string, instanceName string, options metav1.GetOptions) (*v1.MinIOInstance, error) {
|
||||
return opClientMinioInstanceGetMock(ctx, namespace, instanceName, options)
|
||||
// mock function of TenantGet()
|
||||
func (ac opClientMock) TenantGet(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*v1.Tenant, error) {
|
||||
return opClientTenantGetMock(ctx, namespace, tenantName, options)
|
||||
}
|
||||
|
||||
// mock function of MinioInstancePatch()
|
||||
func (ac opClientMock) MinIOInstancePatch(ctx context.Context, namespace string, instanceName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.MinIOInstance, error) {
|
||||
return opClientMinioInstancePatchMock(ctx, namespace, instanceName, pt, data, options)
|
||||
// mock function of TenantPatch()
|
||||
func (ac opClientMock) TenantPatch(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.Tenant, error) {
|
||||
return opClientTenantPatchMock(ctx, namespace, tenantName, pt, data, options)
|
||||
}
|
||||
|
||||
// mock function of MinioInstanceList()
|
||||
func (ac opClientMock) MinIOInstanceList(ctx context.Context, namespace string, opts metav1.ListOptions) (*v1.MinIOInstanceList, error) {
|
||||
return opClientMinioInstanceListMock(ctx, namespace, opts)
|
||||
// mock function of TenantList()
|
||||
func (ac opClientMock) TenantList(ctx context.Context, namespace string, opts metav1.ListOptions) (*v1.TenantList, error) {
|
||||
return opClientTenantListMock(ctx, namespace, opts)
|
||||
}
|
||||
|
||||
// mock function of get()
|
||||
@@ -250,8 +251,8 @@ func Test_TenantInfoTenantAdminClient(t *testing.T) {
|
||||
func Test_TenantInfo(t *testing.T) {
|
||||
testTimeStamp := metav1.Now()
|
||||
type args struct {
|
||||
minioInstance *operator.MinIOInstance
|
||||
tenantInfo *usageInfo
|
||||
minioTenant *operator.Tenant
|
||||
tenantInfo *usageInfo
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -261,33 +262,34 @@ func Test_TenantInfo(t *testing.T) {
|
||||
{
|
||||
name: "Get tenant Info",
|
||||
args: args{
|
||||
minioInstance: &operator.MinIOInstance{
|
||||
minioTenant: &operator.Tenant{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
CreationTimestamp: testTimeStamp,
|
||||
Name: "tenant1",
|
||||
Namespace: "minio-ns",
|
||||
},
|
||||
Spec: operator.MinIOInstanceSpec{
|
||||
Spec: operator.TenantSpec{
|
||||
Zones: []operator.Zone{
|
||||
{
|
||||
Name: "zone1",
|
||||
Servers: int32(2),
|
||||
},
|
||||
},
|
||||
VolumesPerServer: 4,
|
||||
VolumeClaimTemplate: &corev1.PersistentVolumeClaim{
|
||||
Spec: corev1.PersistentVolumeClaimSpec{
|
||||
Resources: corev1.ResourceRequirements{
|
||||
Requests: map[corev1.ResourceName]resource.Quantity{
|
||||
corev1.ResourceStorage: resource.MustParse("1Mi"),
|
||||
Name: "zone1",
|
||||
Servers: int32(2),
|
||||
VolumesPerServer: 4,
|
||||
VolumeClaimTemplate: &corev1.PersistentVolumeClaim{
|
||||
Spec: corev1.PersistentVolumeClaimSpec{
|
||||
Resources: corev1.ResourceRequirements{
|
||||
Requests: map[corev1.ResourceName]resource.Quantity{
|
||||
corev1.ResourceStorage: resource.MustParse("1Mi"),
|
||||
},
|
||||
},
|
||||
StorageClassName: swag.String("standard"),
|
||||
},
|
||||
},
|
||||
StorageClassName: swag.String("standard"),
|
||||
},
|
||||
},
|
||||
|
||||
Image: "minio/minio:RELEASE.2020-06-14T18-32-17Z",
|
||||
},
|
||||
Status: operator.MinIOInstanceStatus{
|
||||
Status: operator.TenantStatus{
|
||||
CurrentState: "ready",
|
||||
},
|
||||
},
|
||||
@@ -296,33 +298,34 @@ func Test_TenantInfo(t *testing.T) {
|
||||
},
|
||||
},
|
||||
want: &models.Tenant{
|
||||
CreationDate: testTimeStamp.String(),
|
||||
InstanceCount: 2, // number of servers
|
||||
Name: "tenant1",
|
||||
VolumesPerServer: int64(4),
|
||||
VolumeCount: int64(8),
|
||||
VolumeSize: int64(1048576),
|
||||
TotalSize: int64(8388608),
|
||||
ZoneCount: int64(1),
|
||||
CurrentState: "ready",
|
||||
CreationDate: testTimeStamp.String(),
|
||||
Name: "tenant1",
|
||||
TotalSize: int64(8388608),
|
||||
CurrentState: "ready",
|
||||
Zones: []*models.Zone{
|
||||
{
|
||||
Name: swag.String("zone1"),
|
||||
Servers: swag.Int64(int64(2)),
|
||||
Name: "zone1",
|
||||
Servers: swag.Int64(int64(2)),
|
||||
VolumesPerServer: swag.Int32(4),
|
||||
VolumeConfiguration: &models.ZoneVolumeConfiguration{
|
||||
StorageClassName: "standard",
|
||||
Size: swag.Int64(1024 * 1024),
|
||||
},
|
||||
},
|
||||
},
|
||||
Namespace: "minio-ns",
|
||||
Image: "minio/minio:RELEASE.2020-06-14T18-32-17Z",
|
||||
UsedSize: int64(1024),
|
||||
StorageClass: "standard",
|
||||
Namespace: "minio-ns",
|
||||
Image: "minio/minio:RELEASE.2020-06-14T18-32-17Z",
|
||||
UsedSize: int64(1024),
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got := getTenantInfo(tt.args.minioInstance, tt.args.tenantInfo)
|
||||
got := getTenantInfo(tt.args.minioTenant, tt.args.tenantInfo)
|
||||
if !reflect.DeepEqual(got, tt.want) {
|
||||
t.Errorf("got %v want %v", got, tt.want)
|
||||
ji, _ := json.Marshal(got)
|
||||
vi, _ := json.Marshal(tt.want)
|
||||
t.Errorf("got %s want %s", ji, vi)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -332,11 +335,11 @@ func Test_deleteTenantAction(t *testing.T) {
|
||||
opClient := opClientMock{}
|
||||
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
operatorClient OperatorClient
|
||||
nameSpace string
|
||||
instanceName string
|
||||
mockMinioInstanceDelete func(ctx context.Context, namespace string, instanceName string, options metav1.DeleteOptions) error
|
||||
ctx context.Context
|
||||
operatorClient OperatorClient
|
||||
nameSpace string
|
||||
tenantName string
|
||||
mockTenantDelete func(ctx context.Context, namespace string, tenantName string, options metav1.DeleteOptions) error
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -349,8 +352,8 @@ func Test_deleteTenantAction(t *testing.T) {
|
||||
ctx: context.Background(),
|
||||
operatorClient: opClient,
|
||||
nameSpace: "default",
|
||||
instanceName: "minio-instance",
|
||||
mockMinioInstanceDelete: func(ctx context.Context, namespace string, instanceName string, options metav1.DeleteOptions) error {
|
||||
tenantName: "minio-tenant",
|
||||
mockTenantDelete: func(ctx context.Context, namespace string, tenantName string, options metav1.DeleteOptions) error {
|
||||
return nil
|
||||
},
|
||||
},
|
||||
@@ -362,8 +365,8 @@ func Test_deleteTenantAction(t *testing.T) {
|
||||
ctx: context.Background(),
|
||||
operatorClient: opClient,
|
||||
nameSpace: "default",
|
||||
instanceName: "minio-instance",
|
||||
mockMinioInstanceDelete: func(ctx context.Context, namespace string, instanceName string, options metav1.DeleteOptions) error {
|
||||
tenantName: "minio-tenant",
|
||||
mockTenantDelete: func(ctx context.Context, namespace string, tenantName string, options metav1.DeleteOptions) error {
|
||||
return errors.New("something happened")
|
||||
},
|
||||
},
|
||||
@@ -371,9 +374,9 @@ func Test_deleteTenantAction(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
opClientMinioInstanceDeleteMock = tt.args.mockMinioInstanceDelete
|
||||
opClientTenantDeleteMock = tt.args.mockTenantDelete
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if err := deleteTenantAction(tt.args.ctx, tt.args.operatorClient, tt.args.nameSpace, tt.args.instanceName); (err != nil) != tt.wantErr {
|
||||
if err := deleteTenantAction(tt.args.ctx, tt.args.operatorClient, tt.args.nameSpace, tt.args.tenantName); (err != nil) != tt.wantErr {
|
||||
t.Errorf("deleteTenantAction() error = %v, wantErr %v", err, tt.wantErr)
|
||||
}
|
||||
})
|
||||
@@ -384,12 +387,12 @@ func Test_TenantAddZone(t *testing.T) {
|
||||
opClient := opClientMock{}
|
||||
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
operatorClient OperatorClient
|
||||
nameSpace string
|
||||
mockMinioInstancePatch func(ctx context.Context, namespace string, instanceName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.MinIOInstance, error)
|
||||
mockMinioInstanceGet func(ctx context.Context, namespace string, instanceName string, options metav1.GetOptions) (*v1.MinIOInstance, error)
|
||||
params admin_api.TenantAddZoneParams
|
||||
ctx context.Context
|
||||
operatorClient OperatorClient
|
||||
nameSpace string
|
||||
mockTenantPatch func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.Tenant, error)
|
||||
mockTenantGet func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*v1.Tenant, error)
|
||||
params admin_api.TenantAddZoneParams
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -402,15 +405,15 @@ func Test_TenantAddZone(t *testing.T) {
|
||||
ctx: context.Background(),
|
||||
operatorClient: opClient,
|
||||
nameSpace: "default",
|
||||
mockMinioInstancePatch: func(ctx context.Context, namespace string, instanceName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.MinIOInstance, error) {
|
||||
return &v1.MinIOInstance{}, nil
|
||||
mockTenantPatch: func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.Tenant, error) {
|
||||
return &v1.Tenant{}, nil
|
||||
},
|
||||
mockMinioInstanceGet: func(ctx context.Context, namespace string, instanceName string, options metav1.GetOptions) (*v1.MinIOInstance, error) {
|
||||
return &v1.MinIOInstance{}, nil
|
||||
mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*v1.Tenant, error) {
|
||||
return &v1.Tenant{}, nil
|
||||
},
|
||||
params: admin_api.TenantAddZoneParams{
|
||||
Body: &models.Zone{
|
||||
Name: swag.String("zone-1"),
|
||||
Name: "zone-1",
|
||||
Servers: swag.Int64(int64(4)),
|
||||
},
|
||||
},
|
||||
@@ -423,15 +426,15 @@ func Test_TenantAddZone(t *testing.T) {
|
||||
ctx: context.Background(),
|
||||
operatorClient: opClient,
|
||||
nameSpace: "default",
|
||||
mockMinioInstancePatch: func(ctx context.Context, namespace string, instanceName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.MinIOInstance, error) {
|
||||
mockTenantPatch: func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.Tenant, error) {
|
||||
return nil, errors.New("errors")
|
||||
},
|
||||
mockMinioInstanceGet: func(ctx context.Context, namespace string, instanceName string, options metav1.GetOptions) (*v1.MinIOInstance, error) {
|
||||
return &v1.MinIOInstance{}, nil
|
||||
mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*v1.Tenant, error) {
|
||||
return &v1.Tenant{}, nil
|
||||
},
|
||||
params: admin_api.TenantAddZoneParams{
|
||||
Body: &models.Zone{
|
||||
Name: swag.String("zone-1"),
|
||||
Name: "zone-1",
|
||||
Servers: swag.Int64(int64(4)),
|
||||
},
|
||||
},
|
||||
@@ -444,15 +447,15 @@ func Test_TenantAddZone(t *testing.T) {
|
||||
ctx: context.Background(),
|
||||
operatorClient: opClient,
|
||||
nameSpace: "default",
|
||||
mockMinioInstancePatch: func(ctx context.Context, namespace string, instanceName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.MinIOInstance, error) {
|
||||
mockTenantPatch: func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.Tenant, error) {
|
||||
return nil, errors.New("errors")
|
||||
},
|
||||
mockMinioInstanceGet: func(ctx context.Context, namespace string, instanceName string, options metav1.GetOptions) (*v1.MinIOInstance, error) {
|
||||
mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*v1.Tenant, error) {
|
||||
return nil, errors.New("errors")
|
||||
},
|
||||
params: admin_api.TenantAddZoneParams{
|
||||
Body: &models.Zone{
|
||||
Name: swag.String("zone-1"),
|
||||
Name: "zone-1",
|
||||
Servers: swag.Int64(int64(4)),
|
||||
},
|
||||
},
|
||||
@@ -461,8 +464,8 @@ func Test_TenantAddZone(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
opClientMinioInstanceGetMock = tt.args.mockMinioInstanceGet
|
||||
opClientMinioInstancePatchMock = tt.args.mockMinioInstancePatch
|
||||
opClientTenantGetMock = tt.args.mockTenantGet
|
||||
opClientTenantPatchMock = tt.args.mockTenantPatch
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if err := addTenantZone(tt.args.ctx, tt.args.operatorClient, tt.args.params); (err != nil) != tt.wantErr {
|
||||
t.Errorf("addTenantZone() error = %v, wantErr %v", err, tt.wantErr)
|
||||
@@ -476,15 +479,15 @@ func Test_UpdateTenantAction(t *testing.T) {
|
||||
httpClientM := httpClientMock{}
|
||||
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
operatorClient OperatorClient
|
||||
httpCl cluster.HTTPClientI
|
||||
nameSpace string
|
||||
instanceName string
|
||||
mockMinioInstancePatch func(ctx context.Context, namespace string, instanceName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.MinIOInstance, error)
|
||||
mockMinioInstanceGet func(ctx context.Context, namespace string, instanceName string, options metav1.GetOptions) (*v1.MinIOInstance, error)
|
||||
mockHTTPClientGet func(url string) (resp *http.Response, err error)
|
||||
params admin_api.UpdateTenantParams
|
||||
ctx context.Context
|
||||
operatorClient OperatorClient
|
||||
httpCl cluster.HTTPClientI
|
||||
nameSpace string
|
||||
tenantName string
|
||||
mockTenantPatch func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.Tenant, error)
|
||||
mockTenantGet func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*v1.Tenant, error)
|
||||
mockHTTPClientGet func(url string) (resp *http.Response, err error)
|
||||
params admin_api.UpdateTenantParams
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -498,12 +501,12 @@ func Test_UpdateTenantAction(t *testing.T) {
|
||||
operatorClient: opClient,
|
||||
httpCl: httpClientM,
|
||||
nameSpace: "default",
|
||||
instanceName: "minio-instance",
|
||||
mockMinioInstancePatch: func(ctx context.Context, namespace string, instanceName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.MinIOInstance, error) {
|
||||
return &v1.MinIOInstance{}, nil
|
||||
tenantName: "minio-tenant",
|
||||
mockTenantPatch: func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.Tenant, error) {
|
||||
return &v1.Tenant{}, nil
|
||||
},
|
||||
mockMinioInstanceGet: func(ctx context.Context, namespace string, instanceName string, options metav1.GetOptions) (*v1.MinIOInstance, error) {
|
||||
return &v1.MinIOInstance{}, nil
|
||||
mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*v1.Tenant, error) {
|
||||
return &v1.Tenant{}, nil
|
||||
},
|
||||
mockHTTPClientGet: func(url string) (resp *http.Response, err error) {
|
||||
return &http.Response{}, nil
|
||||
@@ -517,17 +520,17 @@ func Test_UpdateTenantAction(t *testing.T) {
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "Error occurs getting minioInstance",
|
||||
name: "Error occurs getting minioTenant",
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
operatorClient: opClient,
|
||||
httpCl: httpClientM,
|
||||
nameSpace: "default",
|
||||
instanceName: "minio-instance",
|
||||
mockMinioInstancePatch: func(ctx context.Context, namespace string, instanceName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.MinIOInstance, error) {
|
||||
return &v1.MinIOInstance{}, nil
|
||||
tenantName: "minio-tenant",
|
||||
mockTenantPatch: func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.Tenant, error) {
|
||||
return &v1.Tenant{}, nil
|
||||
},
|
||||
mockMinioInstanceGet: func(ctx context.Context, namespace string, instanceName string, options metav1.GetOptions) (*v1.MinIOInstance, error) {
|
||||
mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*v1.Tenant, error) {
|
||||
return nil, errors.New("error-get")
|
||||
},
|
||||
mockHTTPClientGet: func(url string) (resp *http.Response, err error) {
|
||||
@@ -542,18 +545,18 @@ func Test_UpdateTenantAction(t *testing.T) {
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "Error occurs patching minioInstance",
|
||||
name: "Error occurs patching minioTenant",
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
operatorClient: opClient,
|
||||
httpCl: httpClientM,
|
||||
nameSpace: "default",
|
||||
instanceName: "minio-instance",
|
||||
mockMinioInstancePatch: func(ctx context.Context, namespace string, instanceName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.MinIOInstance, error) {
|
||||
tenantName: "minio-tenant",
|
||||
mockTenantPatch: func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.Tenant, error) {
|
||||
return nil, errors.New("error-get")
|
||||
},
|
||||
mockMinioInstanceGet: func(ctx context.Context, namespace string, instanceName string, options metav1.GetOptions) (*v1.MinIOInstance, error) {
|
||||
return &v1.MinIOInstance{}, nil
|
||||
mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*v1.Tenant, error) {
|
||||
return &v1.Tenant{}, nil
|
||||
},
|
||||
mockHTTPClientGet: func(url string) (resp *http.Response, err error) {
|
||||
return &http.Response{}, nil
|
||||
@@ -573,12 +576,12 @@ func Test_UpdateTenantAction(t *testing.T) {
|
||||
operatorClient: opClient,
|
||||
httpCl: httpClientM,
|
||||
nameSpace: "default",
|
||||
instanceName: "minio-instance",
|
||||
mockMinioInstancePatch: func(ctx context.Context, namespace string, instanceName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.MinIOInstance, error) {
|
||||
return &v1.MinIOInstance{}, nil
|
||||
tenantName: "minio-tenant",
|
||||
mockTenantPatch: func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.Tenant, error) {
|
||||
return &v1.Tenant{}, nil
|
||||
},
|
||||
mockMinioInstanceGet: func(ctx context.Context, namespace string, instanceName string, options metav1.GetOptions) (*v1.MinIOInstance, error) {
|
||||
return &v1.MinIOInstance{}, nil
|
||||
mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*v1.Tenant, error) {
|
||||
return &v1.Tenant{}, nil
|
||||
},
|
||||
mockHTTPClientGet: func(url string) (resp *http.Response, err error) {
|
||||
r := ioutil.NopCloser(bytes.NewReader([]byte(`./minio.RELEASE.2020-06-18T02-23-35Z"`)))
|
||||
@@ -601,12 +604,12 @@ func Test_UpdateTenantAction(t *testing.T) {
|
||||
operatorClient: opClient,
|
||||
httpCl: httpClientM,
|
||||
nameSpace: "default",
|
||||
instanceName: "minio-instance",
|
||||
mockMinioInstancePatch: func(ctx context.Context, namespace string, instanceName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.MinIOInstance, error) {
|
||||
return &v1.MinIOInstance{}, nil
|
||||
tenantName: "minio-tenant",
|
||||
mockTenantPatch: func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.Tenant, error) {
|
||||
return &v1.Tenant{}, nil
|
||||
},
|
||||
mockMinioInstanceGet: func(ctx context.Context, namespace string, instanceName string, options metav1.GetOptions) (*v1.MinIOInstance, error) {
|
||||
return &v1.MinIOInstance{}, nil
|
||||
mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*v1.Tenant, error) {
|
||||
return &v1.Tenant{}, nil
|
||||
},
|
||||
mockHTTPClientGet: func(url string) (resp *http.Response, err error) {
|
||||
return nil, errors.New("error")
|
||||
@@ -621,8 +624,8 @@ func Test_UpdateTenantAction(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
opClientMinioInstanceGetMock = tt.args.mockMinioInstanceGet
|
||||
opClientMinioInstancePatchMock = tt.args.mockMinioInstancePatch
|
||||
opClientTenantGetMock = tt.args.mockTenantGet
|
||||
opClientTenantPatchMock = tt.args.mockTenantPatch
|
||||
httpClientGetMock = tt.args.mockHTTPClientGet
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if err := updateTenantAction(tt.args.ctx, tt.args.operatorClient, tt.args.httpCl, tt.args.nameSpace, tt.args.params); (err != nil) != tt.wantErr {
|
||||
|
||||
@@ -40,7 +40,7 @@ var TLSPort = "9443"
|
||||
var TLSRedirect = "off"
|
||||
|
||||
// defaultTenantMemorySize default value used
|
||||
// when generating minioInstance request
|
||||
// when generating minioTenant request
|
||||
var defaultTenantMemorySize = "16Gi"
|
||||
|
||||
func getAccessKey() string {
|
||||
@@ -234,7 +234,7 @@ func getSecureExpectCTHeader() string {
|
||||
}
|
||||
|
||||
// getTenantMemorySize Memory size value to be used when generating the
|
||||
// MinioInstance request
|
||||
// Tenant request
|
||||
func getTenantMemorySize() string {
|
||||
return env.Get(McsTenantMemorySize, defaultTenantMemorySize)
|
||||
}
|
||||
|
||||
@@ -17,6 +17,6 @@
|
||||
package restapi
|
||||
|
||||
const (
|
||||
// McsTenantMemorySize Memory size to be used when creating MinioInstance request
|
||||
// McsTenantMemorySize Memory size to be used when creating Tenant request
|
||||
McsTenantMemorySize = "MCS_TENANT_MEMORY_SIZE"
|
||||
)
|
||||
|
||||
@@ -726,7 +726,7 @@ func init() {
|
||||
"tags": [
|
||||
"UserAPI"
|
||||
],
|
||||
"summary": "Login to mcs",
|
||||
"summary": "Login to Console",
|
||||
"operationId": "Login",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -827,7 +827,7 @@ func init() {
|
||||
"tags": [
|
||||
"UserAPI"
|
||||
],
|
||||
"summary": "Logout from mcs.",
|
||||
"summary": "Logout from Console.",
|
||||
"operationId": "Logout",
|
||||
"responses": {
|
||||
"200": {
|
||||
@@ -1929,8 +1929,8 @@ func init() {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"volume_configuration",
|
||||
"namespace"
|
||||
"namespace",
|
||||
"zones"
|
||||
],
|
||||
"properties": {
|
||||
"access_key": {
|
||||
@@ -1942,7 +1942,7 @@ func init() {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"enable_mcs": {
|
||||
"enable_console": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
@@ -1969,23 +1969,6 @@ func init() {
|
||||
"service_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"volume_configuration": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"size"
|
||||
],
|
||||
"properties": {
|
||||
"size": {
|
||||
"type": "string"
|
||||
},
|
||||
"storage_class": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"volumes_per_server": {
|
||||
"type": "integer"
|
||||
},
|
||||
"zones": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
@@ -2575,18 +2558,12 @@ func init() {
|
||||
"image": {
|
||||
"type": "string"
|
||||
},
|
||||
"instance_count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"namespace": {
|
||||
"type": "string"
|
||||
},
|
||||
"storage_class": {
|
||||
"type": "string"
|
||||
},
|
||||
"total_size": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
@@ -2595,19 +2572,6 @@ func init() {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"volume_count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"volume_size": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"volumes_per_server": {
|
||||
"type": "integer"
|
||||
},
|
||||
"zone_count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"zones": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
@@ -2727,8 +2691,9 @@ func init() {
|
||||
"zone": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"servers"
|
||||
"servers",
|
||||
"volumes_per_server",
|
||||
"volume_configuration"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
@@ -2736,6 +2701,24 @@ func init() {
|
||||
},
|
||||
"servers": {
|
||||
"type": "integer"
|
||||
},
|
||||
"volume_configuration": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"size"
|
||||
],
|
||||
"properties": {
|
||||
"size": {
|
||||
"type": "integer"
|
||||
},
|
||||
"storage_class_name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"volumes_per_server": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3446,7 +3429,7 @@ func init() {
|
||||
"tags": [
|
||||
"UserAPI"
|
||||
],
|
||||
"summary": "Login to mcs",
|
||||
"summary": "Login to Console",
|
||||
"operationId": "Login",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -3547,7 +3530,7 @@ func init() {
|
||||
"tags": [
|
||||
"UserAPI"
|
||||
],
|
||||
"summary": "Logout from mcs.",
|
||||
"summary": "Logout from Console.",
|
||||
"operationId": "Logout",
|
||||
"responses": {
|
||||
"200": {
|
||||
@@ -4463,16 +4446,16 @@ func init() {
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"CreateTenantRequestVolumeConfiguration": {
|
||||
"ZoneVolumeConfiguration": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"size"
|
||||
],
|
||||
"properties": {
|
||||
"size": {
|
||||
"type": "string"
|
||||
"type": "integer"
|
||||
},
|
||||
"storage_class": {
|
||||
"storage_class_name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
@@ -4663,8 +4646,8 @@ func init() {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"volume_configuration",
|
||||
"namespace"
|
||||
"namespace",
|
||||
"zones"
|
||||
],
|
||||
"properties": {
|
||||
"access_key": {
|
||||
@@ -4676,7 +4659,7 @@ func init() {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"enable_mcs": {
|
||||
"enable_console": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
@@ -4703,23 +4686,6 @@ func init() {
|
||||
"service_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"volume_configuration": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"size"
|
||||
],
|
||||
"properties": {
|
||||
"size": {
|
||||
"type": "string"
|
||||
},
|
||||
"storage_class": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"volumes_per_server": {
|
||||
"type": "integer"
|
||||
},
|
||||
"zones": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
@@ -5309,18 +5275,12 @@ func init() {
|
||||
"image": {
|
||||
"type": "string"
|
||||
},
|
||||
"instance_count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"namespace": {
|
||||
"type": "string"
|
||||
},
|
||||
"storage_class": {
|
||||
"type": "string"
|
||||
},
|
||||
"total_size": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
@@ -5329,19 +5289,6 @@ func init() {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"volume_count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"volume_size": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"volumes_per_server": {
|
||||
"type": "integer"
|
||||
},
|
||||
"zone_count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"zones": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
@@ -5461,8 +5408,9 @@ func init() {
|
||||
"zone": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"servers"
|
||||
"servers",
|
||||
"volumes_per_server",
|
||||
"volume_configuration"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
@@ -5470,6 +5418,24 @@ func init() {
|
||||
},
|
||||
"servers": {
|
||||
"type": "integer"
|
||||
},
|
||||
"volume_configuration": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"size"
|
||||
],
|
||||
"properties": {
|
||||
"size": {
|
||||
"type": "integer"
|
||||
},
|
||||
"storage_class_name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"volumes_per_server": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ func NewLogin(ctx *middleware.Context, handler LoginHandler) *Login {
|
||||
|
||||
/*Login swagger:route POST /login UserAPI login
|
||||
|
||||
Login to mcs
|
||||
Login to Console
|
||||
|
||||
*/
|
||||
type Login struct {
|
||||
|
||||
@@ -50,7 +50,7 @@ func NewLogout(ctx *middleware.Context, handler LogoutHandler) *Logout {
|
||||
|
||||
/*Logout swagger:route POST /logout UserAPI logout
|
||||
|
||||
Logout from mcs.
|
||||
Logout from Console.
|
||||
|
||||
*/
|
||||
type Logout struct {
|
||||
|
||||
@@ -19,7 +19,7 @@ package restapi
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "github.com/minio/minio-operator/pkg/apis/operator.min.io/v1"
|
||||
v1 "github.com/minio/minio-operator/pkg/apis/minio.min.io/v1"
|
||||
operatorClientset "github.com/minio/minio-operator/pkg/client/clientset/versioned"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
@@ -29,10 +29,10 @@ 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
|
||||
@@ -43,22 +43,22 @@ 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)
|
||||
}
|
||||
|
||||
47
swagger.yml
47
swagger.yml
@@ -39,7 +39,7 @@ paths:
|
||||
tags:
|
||||
- UserAPI
|
||||
post:
|
||||
summary: Login to mcs
|
||||
summary: Login to Console
|
||||
operationId: Login
|
||||
parameters:
|
||||
- name: body
|
||||
@@ -108,7 +108,7 @@ paths:
|
||||
|
||||
/logout:
|
||||
post:
|
||||
summary: Logout from mcs.
|
||||
summary: Logout from Console.
|
||||
operationId: Logout
|
||||
responses:
|
||||
200:
|
||||
@@ -1689,17 +1689,6 @@ definitions:
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
zone_count:
|
||||
type: integer
|
||||
instance_count:
|
||||
type: integer
|
||||
volume_size:
|
||||
type: integer
|
||||
format: int64
|
||||
volume_count:
|
||||
type: integer
|
||||
volumes_per_server:
|
||||
type: integer
|
||||
creation_date:
|
||||
type: string
|
||||
currentState:
|
||||
@@ -1718,8 +1707,6 @@ definitions:
|
||||
used_size:
|
||||
type: integer
|
||||
format: int64
|
||||
storage_class:
|
||||
type: string
|
||||
|
||||
tenantList:
|
||||
type: object
|
||||
@@ -1762,8 +1749,8 @@ definitions:
|
||||
type: object
|
||||
required:
|
||||
- name
|
||||
- volume_configuration
|
||||
- namespace
|
||||
- zones
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
@@ -1776,24 +1763,13 @@ definitions:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/definitions/zone"
|
||||
volumes_per_server:
|
||||
type: integer
|
||||
volume_configuration:
|
||||
type: object
|
||||
required:
|
||||
- size
|
||||
properties:
|
||||
size:
|
||||
type: string
|
||||
storage_class:
|
||||
type: string
|
||||
mounth_path:
|
||||
type: string
|
||||
access_key:
|
||||
type: string
|
||||
secret_key:
|
||||
type: string
|
||||
enable_mcs:
|
||||
enable_console:
|
||||
type: boolean
|
||||
default: true
|
||||
enable_ssl:
|
||||
@@ -1815,13 +1791,26 @@ definitions:
|
||||
zone:
|
||||
type: object
|
||||
required:
|
||||
- name
|
||||
- servers
|
||||
- volumes_per_server
|
||||
- volume_configuration
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
servers:
|
||||
type: integer
|
||||
volumes_per_server:
|
||||
type: integer
|
||||
format: int32
|
||||
volume_configuration:
|
||||
type: object
|
||||
required:
|
||||
- size
|
||||
properties:
|
||||
size:
|
||||
type: integer
|
||||
storage_class_name:
|
||||
type: string
|
||||
|
||||
resourceQuota:
|
||||
type: object
|
||||
|
||||
Reference in New Issue
Block a user