Skip to content

Commit

Permalink
fix: cleanup MinIOInstance Controller (#85)
Browse files Browse the repository at this point in the history
- Update k8s.io/client-go version to v0.18.2
- Add MirrorInstance Controller
  • Loading branch information
nitisht authored Apr 30, 2020
1 parent b6be062 commit 4fa1c02
Show file tree
Hide file tree
Showing 48 changed files with 1,067 additions and 1,077 deletions.
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ MinIO is a high performance distributed object storage server, designed for larg

### Prerequisites

- Kubernetes version v1.15.5 and above.
- Kubernetes version v1.17.0 and above for compatibility. MinIO Operator uses `k8s/client-go` v0.18.0.
- `kubectl` configured to refer to a Kubernetes cluster.

### Create Operator and related resources
Expand All @@ -26,7 +26,7 @@ kubectl create -f https://raw.githubusercontent.com/minio/minio-operator/master/
This will create all relevant resources required for the Operator to work. Here is a list of resources created by above `yaml` file:

- `Namespace`: Custom namespace for MinIO-Operator. By default it is named as `minio-operator-ns`.
- `CustomResourceDefinition`: Custom resource definition named as `minioinstances.miniocontroller.min.io`.
- `CustomResourceDefinition`: Custom resource definition named as `minioinstances.miniooperator.min.io`.
- `ClusterRole`: A cluster wide role for the controller. It is named as `minio-operator-role`. This is used for RBAC.
- `ServiceAccount`: Service account is used by the custom controller to access the cluster. Account name by default is `minio-operator-sa`.
- `ClusterRoleBinding`: This cluster wide binding binds the service account `minio-operator-sa` to cluster role `minio-operator-role`.
Expand All @@ -36,10 +36,10 @@ This will create all relevant resources required for the Operator to work. Here

These variables may be passed to operator Deployment in order to modify some of its parameters

| name | default | description |
| Name | Default | Description |
| --- | --- | --- |
| `WATCHED_NAMESPACE` | | If set, the operator will watch only MinIO resources deployed in the specified namespace. All namespaces are watched if empty |
| `CLUSTER_DOMAIN` | cluster.local | "cluster domain" of the kubernetes cluster the operator is to be installed on |
| `CLUSTER_DOMAIN` | cluster.local | Cluster Domain of the Kubernetes cluster |

### Create a MinIO instance

Expand All @@ -51,13 +51,21 @@ kubectl create -f https://raw.githubusercontent.com/minio/minio-operator/master/

### Expand a MinIO cluster

After you have a distributed MinIO Cluster running (zones.server > 3), you can expand the MinIO cluster using
After you have a distributed MinIO Cluster running (zones.server >= 4), you can expand the MinIO cluster using

```
kubectl patch minioinstances.miniocontroller.min.io minio --patch "$(cat examples/patch.yaml)" --type=merge
kubectl patch minioinstances.miniooperator.min.io minio --patch "$(cat examples/patch.yaml)" --type=merge
```

You can further keep adding new zones in the `patch.yaml` file and apply the patch, to add new nodes to existing cluster.
You can expand an existing cluster by adding new zones to the `patch.yaml` and run the above `kubectl-patch` command.

**NOTE**: Important point to consider _before_ using cluster expansion:

During cluster expansion, MinIO Operator removes the existing StatefulSet and creates a new StatefulSet with required number of Pods. This means, there is a short downtime during expansion, as the pods are terminated and created again.

As existing StatefulSet pods are terminated, its PVCs are also deleted. It is _very important_ to ensure PVs bound to MinIO StatefulSet PVCs are not deleted at this time to avoid data loss. We recommend configuring every PV with reclaim policy [`retain`](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#retain), to ensure the PV is not deleted.

If you attempt cluster expansion while the PV reclaim policy is set to something else, it may lead to data loss. If you have the reclaim policy set to something else, change it as explained in [Kubernetes documents](https://kubernetes.io/docs/tasks/administer-cluster/change-pv-reclaim-policy/).

## Features

Expand All @@ -71,8 +79,6 @@ Refer [`minioinstance.yaml`](https://raw.githubusercontent.com/minio/minio-opera

## Upcoming features

- Bucket Expansion Support
- Federation and CoreDNS
- Continuous remote site mirroring with [`mc mirror`](https://docs.minio.io/docs/minio-client-complete-guide.html#mirror)

## Explore Further
Expand Down
137 changes: 0 additions & 137 deletions examples/minioinstance-with-external-service.yaml

This file was deleted.

22 changes: 17 additions & 5 deletions examples/minioinstance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,20 @@ data:
accesskey: bWluaW8= # base 64 encoded "minio" (echo -n 'minio' | base64)
secretkey: bWluaW8xMjM= # based 64 encoded "minio123" (echo -n 'minio123' | base64)
---
apiVersion: miniocontroller.min.io/v1beta1
apiVersion: v1
kind: Service
metadata:
name: minio-service
spec:
type: ClusterIP
ports:
- port: 9000
targetPort: 9000
protocol: TCP
selector:
app: minio
---
apiVersion: miniooperator.min.io/v1beta1
kind: MinIOInstance
metadata:
name: minio
Expand All @@ -28,7 +41,7 @@ spec:
prometheus.io/port: "9000"
prometheus.io/scrape: "true"
## Registry location and Tag to download MinIO Server image
image: minio/minio:RELEASE.2020-04-15T00-39-01Z
image: minio/minio:RELEASE.2020-04-23T00-58-49Z
zones:
- name: "zone-0"
## Number of MinIO servers/pods in this zone.
Expand Down Expand Up @@ -101,7 +114,7 @@ spec:
path: /minio/health/live
port: 9000
initialDelaySeconds: 120
periodSeconds: 20
periodSeconds: 60
## Readiness probe detects situations when MinIO server instance
## is not ready to accept traffic. Kubernetes doesn't forward
## traffic to the pod while readiness checks fail.
Expand All @@ -112,7 +125,7 @@ spec:
path: /minio/health/ready
port: 9000
initialDelaySeconds: 120
periodSeconds: 20
periodSeconds: 60
## nodeSelector parameters for MinIO Pods. It specifies a map of key-value pairs. For the pod to be
## eligible to run on a node, the node must have each of the
## indicated key-value pairs as labels.
Expand All @@ -122,4 +135,3 @@ spec:
## Affinity settings for MinIO pods. Read more about affinity
## here: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity.
# affinity:

6 changes: 1 addition & 5 deletions examples/patch.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
apiVersion: miniocontroller.min.io/v1beta1
apiVersion: miniooperator.min.io/v1beta1
kind: MinIOInstance
metadata:
name: minio
## If specified, MinIOInstance pods will be dispatched by specified scheduler.
## If not specified, the pod will be dispatched by default scheduler.
# scheduler:
# name: my-custom-scheduler
spec:
zones:
- name: "zone-0"
Expand Down
30 changes: 6 additions & 24 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,15 @@ module github.com/minio/minio-operator
go 1.13

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/evanphx/json-patch v4.5.0+incompatible // indirect
github.com/ghodss/yaml v0.0.0-20180820084758-c7ce16629ff4 // indirect
github.com/gogo/protobuf v0.0.0-20170702163824-dda3e8acadcc // indirect
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/golang/groupcache v0.0.0-20180924190550-6f2cf27854a4 // indirect
github.com/google/btree v1.0.0 // indirect
github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf // indirect
github.com/googleapis/gnostic v0.0.0-20180520015035-48a0ecefe2e4 // indirect
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
github.com/hashicorp/golang-lru v0.5.0 // indirect
github.com/golang/protobuf v1.3.3 // indirect
github.com/imdario/mergo v0.3.6 // indirect
github.com/json-iterator/go v1.1.5 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/onsi/ginkgo v1.10.1 // indirect
github.com/onsi/gomega v1.7.0 // indirect
github.com/peterbourgon/diskv v0.0.0-20180312054125-0646ccaebea1 // indirect
github.com/pkg/errors v0.8.1 // indirect
github.com/spf13/pflag v1.0.3 // indirect
github.com/stretchr/testify v1.3.0
golang.org/x/crypto v0.0.0-20180808211826-de0752318171 // indirect
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 // indirect
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
k8s.io/api v0.0.0-20181014053814-bbf5c193d86c
k8s.io/apimachinery v0.0.0-20181015213631-60666be32c5d
k8s.io/client-go v0.0.0-20181016014101-70926af6e803
k8s.io/kube-openapi v0.0.0-20180719232738-d8ea2fe547a4 // indirect
github.com/stretchr/testify v1.4.0
k8s.io/api v0.18.0
k8s.io/apimachinery v0.18.0
k8s.io/client-go v0.18.0
k8s.io/kube-openapi v0.0.0-20200316234421-82d701f24f9d // indirect
)
Loading

0 comments on commit 4fa1c02

Please sign in to comment.