Skip to content

Commit

Permalink
Add support for Resources and custom environment variables (minio#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
nitisht authored Jul 4, 2019
1 parent 1d2a6c4 commit c2d5144
Show file tree
Hide file tree
Showing 27 changed files with 207 additions and 148 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ MinIO is a high performance distributed object storage server, designed for larg

### Prerequisites

- Kubernetes cluster 1.8.0+.
- Kubernetes cluster 1.10.0+.
- `kubectl` configured to refer to relevant Kubernetes cluster.

### Create Operator and related resources
Expand Down
14 changes: 14 additions & 0 deletions docs/minio-examples/minioinstance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ spec:
## Secret with credentials to be used by MinIO instance.
credsSecret:
name: minio-creds-secret
## Add environment variables to be set in MinIO container (https://github.com/minio/minio/tree/master/docs/config)
env:
name: MINIO_BROWSER
value: "on"
name: MINIO_STORAGE_CLASS_RRS
value: "EC:2"
## Configure
resources:
requests:
memory: 256Mi
cpu: 250m
limits:
memory: 512Mi
cpu: 750m
## 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 Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ require (
github.com/modern-go/reflect2 v1.0.1
github.com/peterbourgon/diskv v0.0.0-20180312054125-0646ccaebea1
github.com/spf13/pflag v1.0.3
github.com/stretchr/testify v1.3.0 // indirect
golang.org/x/crypto v0.0.0-20180808211826-de0752318171
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 // indirect
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/ghodss/yaml v0.0.0-20180820084758-c7ce16629ff4 h1:bRzFpEzvausOAt4va+I/22BZ1vXDtERngp0BNYDKej0=
Expand Down Expand Up @@ -33,8 +34,13 @@ github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/peterbourgon/diskv v0.0.0-20180312054125-0646ccaebea1 h1:k/dnb0bixQwWsDLxwr6/w7rtZCVDKdbQnGQkeZGYsws=
github.com/peterbourgon/diskv v0.0.0-20180312054125-0646ccaebea1/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
golang.org/x/crypto v0.0.0-20180808211826-de0752318171 h1:vYogbvSFj2YXcjQxFHu/rASSOt9sLytpCaSkiwQ135I=
golang.org/x/crypto v0.0.0-20180808211826-de0752318171/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/net v0.0.0-20180611182652-db08ff08e862 h1:JZi6BqOZ+iSgmLWe6llhGrNnEnK+YB/MRkStwnEfbqM=
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func main() {

controller := cluster.NewController(kubeClient, controllerClient,
kubeInformerFactory.Apps().V1().StatefulSets(),
minioInformerFactory.MinIO().V1beta1().MinIOInstances(),
minioInformerFactory.Min().V1beta1().MinIOInstances(),
kubeInformerFactory.Core().V1().Services(),
imagePath)

Expand Down
6 changes: 6 additions & 0 deletions pkg/apis/miniocontroller/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ type MinIOInstanceSpec struct {
// Otherwise MinIO server creates dynamic credentials printed on MinIO server startup banner
// +optional
CredsSecret *corev1.LocalObjectReference `json:"credsSecret,omitempty"`
// If provided, use these environment variables for MinIOInstance resource
// +optional
Env []corev1.EnvVar `json:"env,omitempty"`
// If provided, use these requests and limit for cpu/memory resource allocation
// +optional
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
// VolumeClaimTemplate allows a user to specify how volumes inside a MinIOInstance
// +optional
VolumeClaimTemplate *corev1.PersistentVolumeClaim `json:"volumeClaimTemplate,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/miniocontroller/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 9 additions & 17 deletions pkg/client/clientset/versioned/clientset.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions pkg/client/clientset/versioned/fake/clientset_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/client/clientset/versioned/fake/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/client/clientset/versioned/scheme/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c2d5144

Please sign in to comment.