diff --git a/examples/minioinstance.yaml b/examples/minioinstance.yaml index 61cffba0e64..f2d238616ab 100644 --- a/examples/minioinstance.yaml +++ b/examples/minioinstance.yaml @@ -40,13 +40,11 @@ metadata: # scheduler: # name: my-custom-scheduler spec: - selector: - matchLabels: - app: minio # Should match spec.metadata.labels ## Add metadata to the all pods created by the StatefulSet metadata: - labels: - app: minio # Should match spec.selector.matchLabels + ## Optionally pass labels to be applied to the statefulset pods + #labels: + # app: minio annotations: prometheus.io/path: /minio/prometheus/metrics prometheus.io/port: "9000" @@ -114,12 +112,10 @@ spec: replicas: 2 mcsSecret: name: minio-mcs-secret - selector: - matchLabels: - app: mcs # Should match spec.mcs.metadata.labels - metadata: - labels: - app: mcs # Should match spec.mcs.selector.matchLabels + ## Optionally metadata can be attached to the mcs pod + # metadata: + # labels: + # extra: labels ## Add environment variables to be set in MinIO container (https://github.com/minio/minio/tree/master/docs/config) env: - name: MINIO_BROWSER diff --git a/minio-operator.yaml b/minio-operator.yaml index 269eb7271df..14140942df1 100644 --- a/minio-operator.yaml +++ b/minio-operator.yaml @@ -28,16 +28,52 @@ spec: type: integer minimum: 1 maximum: 32 + image: + type: string + serviceName: + type: string + volumesPerServer: + type: integer + mountPath: + type: string + podManagementPolicy: + type: string + enum: [Parallel,OrderedReady] + default: Parallel + requestAutoCert: + type: boolean + default: false version: type: string mountpath: type: string subpath: type: string + mcs: + type: object + properties: + image: + type: string + replicas: + type: integer + default: 2 + mcsSecret: + type: object + properties: + name: + type: string + status: + type: object + properties: + currentState: + type: string + subresources: + # status enables the status subresource. + status: {} additionalPrinterColumns: - - name: Replicas - type: integer - jsonPath: ".spec.replicas" + - name: Current State + type: string + jsonPath: ".status.currentState" --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition diff --git a/pkg/apis/operator.min.io/v1/names.go b/pkg/apis/operator.min.io/v1/names.go index 92d54ded0e8..53b9e564b72 100644 --- a/pkg/apis/operator.min.io/v1/names.go +++ b/pkg/apis/operator.min.io/v1/names.go @@ -127,5 +127,5 @@ func (mi *MinIOInstance) MCSDeploymentName() string { // MCSCIServiceName returns the name for MCS Cluster IP Service func (mi *MinIOInstance) MCSCIServiceName() string { - return mi.Name + MCSName + "-service" + return mi.Name + MCSName } diff --git a/pkg/apis/operator.min.io/v1/types.go b/pkg/apis/operator.min.io/v1/types.go index 509b031fce3..c3a983e928e 100644 --- a/pkg/apis/operator.min.io/v1/types.go +++ b/pkg/apis/operator.min.io/v1/types.go @@ -130,7 +130,8 @@ type MinIOInstanceSpec struct { // MinIOInstanceStatus is the status for a MinIOInstance resource type MinIOInstanceStatus struct { - AvailableReplicas int32 `json:"availableReplicas"` + CurrentState string `json:"currentState"` + AvailableReplicas int32 `json:"availableReplicas"` } // CertificateConfig is a specification for certificate contents diff --git a/pkg/apis/operator.min.io/v1/zz_generated.deepcopy.go b/pkg/apis/operator.min.io/v1/zz_generated.deepcopy.go index 043e942cece..faf46e6cd1d 100644 --- a/pkg/apis/operator.min.io/v1/zz_generated.deepcopy.go +++ b/pkg/apis/operator.min.io/v1/zz_generated.deepcopy.go @@ -1,20 +1,20 @@ // +build !ignore_autogenerated -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// This file is part of MinIO Operator +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . // Code generated by deepcopy-gen. DO NOT EDIT. diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index 70df44e1620..b5057b8b4ee 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -1,18 +1,18 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// This file is part of MinIO Operator +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . // Code generated by client-gen. DO NOT EDIT. diff --git a/pkg/client/clientset/versioned/doc.go b/pkg/client/clientset/versioned/doc.go index 41721ca52d4..1391cffc921 100644 --- a/pkg/client/clientset/versioned/doc.go +++ b/pkg/client/clientset/versioned/doc.go @@ -1,18 +1,18 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// This file is part of MinIO Operator +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . // Code generated by client-gen. DO NOT EDIT. diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index 0ee2948fcfd..63b6e531b79 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -1,18 +1,18 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// This file is part of MinIO Operator +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . // Code generated by client-gen. DO NOT EDIT. diff --git a/pkg/client/clientset/versioned/fake/doc.go b/pkg/client/clientset/versioned/fake/doc.go index 9b99e716709..ac005f16d0b 100644 --- a/pkg/client/clientset/versioned/fake/doc.go +++ b/pkg/client/clientset/versioned/fake/doc.go @@ -1,18 +1,18 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// This file is part of MinIO Operator +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . // Code generated by client-gen. DO NOT EDIT. diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index 2262b4dab7b..5429ee87e34 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -1,18 +1,18 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// This file is part of MinIO Operator +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . // Code generated by client-gen. DO NOT EDIT. @@ -29,7 +29,7 @@ import ( var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) -var parameterCodec = runtime.NewParameterCodec(scheme) + var localSchemeBuilder = runtime.SchemeBuilder{ operatorv1.AddToScheme, } diff --git a/pkg/client/clientset/versioned/scheme/doc.go b/pkg/client/clientset/versioned/scheme/doc.go index 7dc3756168f..7218a52ae6c 100644 --- a/pkg/client/clientset/versioned/scheme/doc.go +++ b/pkg/client/clientset/versioned/scheme/doc.go @@ -1,18 +1,18 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// This file is part of MinIO Operator +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . // Code generated by client-gen. DO NOT EDIT. diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index eb124b22721..ae99af7e4ce 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -1,18 +1,18 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// This file is part of MinIO Operator +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . // Code generated by client-gen. DO NOT EDIT. diff --git a/pkg/client/clientset/versioned/typed/operator.min.io/v1/doc.go b/pkg/client/clientset/versioned/typed/operator.min.io/v1/doc.go index 3af5d054f10..045f9080d46 100644 --- a/pkg/client/clientset/versioned/typed/operator.min.io/v1/doc.go +++ b/pkg/client/clientset/versioned/typed/operator.min.io/v1/doc.go @@ -1,18 +1,18 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// This file is part of MinIO Operator +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . // Code generated by client-gen. DO NOT EDIT. diff --git a/pkg/client/clientset/versioned/typed/operator.min.io/v1/fake/doc.go b/pkg/client/clientset/versioned/typed/operator.min.io/v1/fake/doc.go index 16f44399065..3867d2033eb 100644 --- a/pkg/client/clientset/versioned/typed/operator.min.io/v1/fake/doc.go +++ b/pkg/client/clientset/versioned/typed/operator.min.io/v1/fake/doc.go @@ -1,18 +1,18 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// This file is part of MinIO Operator +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . // Code generated by client-gen. DO NOT EDIT. diff --git a/pkg/client/clientset/versioned/typed/operator.min.io/v1/fake/fake_minioinstance.go b/pkg/client/clientset/versioned/typed/operator.min.io/v1/fake/fake_minioinstance.go index ca6f30ed73f..ab3c1237784 100644 --- a/pkg/client/clientset/versioned/typed/operator.min.io/v1/fake/fake_minioinstance.go +++ b/pkg/client/clientset/versioned/typed/operator.min.io/v1/fake/fake_minioinstance.go @@ -1,18 +1,18 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// This file is part of MinIO Operator +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . // Code generated by client-gen. DO NOT EDIT. diff --git a/pkg/client/clientset/versioned/typed/operator.min.io/v1/fake/fake_mirrorinstance.go b/pkg/client/clientset/versioned/typed/operator.min.io/v1/fake/fake_mirrorinstance.go index 3e855ce7121..8efb1f373c6 100644 --- a/pkg/client/clientset/versioned/typed/operator.min.io/v1/fake/fake_mirrorinstance.go +++ b/pkg/client/clientset/versioned/typed/operator.min.io/v1/fake/fake_mirrorinstance.go @@ -1,18 +1,18 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// This file is part of MinIO Operator +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . // Code generated by client-gen. DO NOT EDIT. diff --git a/pkg/client/clientset/versioned/typed/operator.min.io/v1/fake/fake_operator.min.io_client.go b/pkg/client/clientset/versioned/typed/operator.min.io/v1/fake/fake_operator.min.io_client.go index 4e2db48e794..77b78e4b715 100644 --- a/pkg/client/clientset/versioned/typed/operator.min.io/v1/fake/fake_operator.min.io_client.go +++ b/pkg/client/clientset/versioned/typed/operator.min.io/v1/fake/fake_operator.min.io_client.go @@ -1,18 +1,18 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// This file is part of MinIO Operator +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . // Code generated by client-gen. DO NOT EDIT. diff --git a/pkg/client/clientset/versioned/typed/operator.min.io/v1/generated_expansion.go b/pkg/client/clientset/versioned/typed/operator.min.io/v1/generated_expansion.go index 9af6bd73205..7be3bf74d32 100644 --- a/pkg/client/clientset/versioned/typed/operator.min.io/v1/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/operator.min.io/v1/generated_expansion.go @@ -1,18 +1,18 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// This file is part of MinIO Operator +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . // Code generated by client-gen. DO NOT EDIT. diff --git a/pkg/client/clientset/versioned/typed/operator.min.io/v1/minioinstance.go b/pkg/client/clientset/versioned/typed/operator.min.io/v1/minioinstance.go index 95d08b54a7c..67cf755375f 100644 --- a/pkg/client/clientset/versioned/typed/operator.min.io/v1/minioinstance.go +++ b/pkg/client/clientset/versioned/typed/operator.min.io/v1/minioinstance.go @@ -1,18 +1,18 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// This file is part of MinIO Operator +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . // Code generated by client-gen. DO NOT EDIT. diff --git a/pkg/client/clientset/versioned/typed/operator.min.io/v1/mirrorinstance.go b/pkg/client/clientset/versioned/typed/operator.min.io/v1/mirrorinstance.go index 22cd5cd82a7..073fe805ef9 100644 --- a/pkg/client/clientset/versioned/typed/operator.min.io/v1/mirrorinstance.go +++ b/pkg/client/clientset/versioned/typed/operator.min.io/v1/mirrorinstance.go @@ -1,18 +1,18 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// This file is part of MinIO Operator +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . // Code generated by client-gen. DO NOT EDIT. diff --git a/pkg/client/clientset/versioned/typed/operator.min.io/v1/operator.min.io_client.go b/pkg/client/clientset/versioned/typed/operator.min.io/v1/operator.min.io_client.go index 7e1bf7f88b3..a6e9533cfd5 100644 --- a/pkg/client/clientset/versioned/typed/operator.min.io/v1/operator.min.io_client.go +++ b/pkg/client/clientset/versioned/typed/operator.min.io/v1/operator.min.io_client.go @@ -1,18 +1,18 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// This file is part of MinIO Operator +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . // Code generated by client-gen. DO NOT EDIT. diff --git a/pkg/client/informers/externalversions/factory.go b/pkg/client/informers/externalversions/factory.go index daca4716619..62b14c1ef7c 100644 --- a/pkg/client/informers/externalversions/factory.go +++ b/pkg/client/informers/externalversions/factory.go @@ -1,18 +1,18 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// This file is part of MinIO Operator +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . // Code generated by informer-gen. DO NOT EDIT. diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 9696b47e954..5aecb393fb4 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -1,18 +1,18 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// This file is part of MinIO Operator +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . // Code generated by informer-gen. DO NOT EDIT. diff --git a/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go index 592250e6dd3..34889f49265 100644 --- a/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go +++ b/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -1,18 +1,18 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// This file is part of MinIO Operator +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . // Code generated by informer-gen. DO NOT EDIT. diff --git a/pkg/client/informers/externalversions/operator.min.io/interface.go b/pkg/client/informers/externalversions/operator.min.io/interface.go index d10185c8da8..602eefff084 100644 --- a/pkg/client/informers/externalversions/operator.min.io/interface.go +++ b/pkg/client/informers/externalversions/operator.min.io/interface.go @@ -1,18 +1,18 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// This file is part of MinIO Operator +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . // Code generated by informer-gen. DO NOT EDIT. diff --git a/pkg/client/informers/externalversions/operator.min.io/v1/interface.go b/pkg/client/informers/externalversions/operator.min.io/v1/interface.go index 70e7fb154fc..7ad29fc4884 100644 --- a/pkg/client/informers/externalversions/operator.min.io/v1/interface.go +++ b/pkg/client/informers/externalversions/operator.min.io/v1/interface.go @@ -1,18 +1,18 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// This file is part of MinIO Operator +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . // Code generated by informer-gen. DO NOT EDIT. diff --git a/pkg/client/informers/externalversions/operator.min.io/v1/minioinstance.go b/pkg/client/informers/externalversions/operator.min.io/v1/minioinstance.go index b08da8a5242..d7a6a9ae040 100644 --- a/pkg/client/informers/externalversions/operator.min.io/v1/minioinstance.go +++ b/pkg/client/informers/externalversions/operator.min.io/v1/minioinstance.go @@ -1,18 +1,18 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// This file is part of MinIO Operator +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . // Code generated by informer-gen. DO NOT EDIT. diff --git a/pkg/client/informers/externalversions/operator.min.io/v1/mirrorinstance.go b/pkg/client/informers/externalversions/operator.min.io/v1/mirrorinstance.go index 63b373468cb..9dda49073ed 100644 --- a/pkg/client/informers/externalversions/operator.min.io/v1/mirrorinstance.go +++ b/pkg/client/informers/externalversions/operator.min.io/v1/mirrorinstance.go @@ -1,18 +1,18 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// This file is part of MinIO Operator +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . // Code generated by informer-gen. DO NOT EDIT. diff --git a/pkg/client/listers/operator.min.io/v1/expansion_generated.go b/pkg/client/listers/operator.min.io/v1/expansion_generated.go index 29639246843..8642fe1ac12 100644 --- a/pkg/client/listers/operator.min.io/v1/expansion_generated.go +++ b/pkg/client/listers/operator.min.io/v1/expansion_generated.go @@ -1,18 +1,18 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// This file is part of MinIO Operator +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . // Code generated by lister-gen. DO NOT EDIT. diff --git a/pkg/client/listers/operator.min.io/v1/minioinstance.go b/pkg/client/listers/operator.min.io/v1/minioinstance.go index 721bec67a3e..443d8cb0d7a 100644 --- a/pkg/client/listers/operator.min.io/v1/minioinstance.go +++ b/pkg/client/listers/operator.min.io/v1/minioinstance.go @@ -1,18 +1,18 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// This file is part of MinIO Operator +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . // Code generated by lister-gen. DO NOT EDIT. diff --git a/pkg/client/listers/operator.min.io/v1/mirrorinstance.go b/pkg/client/listers/operator.min.io/v1/mirrorinstance.go index ad53e116ba5..85889fb649b 100644 --- a/pkg/client/listers/operator.min.io/v1/mirrorinstance.go +++ b/pkg/client/listers/operator.min.io/v1/mirrorinstance.go @@ -1,18 +1,18 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// This file is part of MinIO Operator +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . // Code generated by lister-gen. DO NOT EDIT. diff --git a/pkg/controller/cluster/main-controller.go b/pkg/controller/cluster/main-controller.go index 43ebe7c06ce..3cec21a1a26 100644 --- a/pkg/controller/cluster/main-controller.go +++ b/pkg/controller/cluster/main-controller.go @@ -341,6 +341,11 @@ func (c *Controller) syncHandler(key string) error { svc, err := c.serviceLister.Services(mi.Namespace).Get(mi.MinIOCIServiceName()) // If the service doesn't exist, we'll create it if apierrors.IsNotFound(err) { + currentState := "Provisioning Service" + mi, err = c.updateMinIOInstanceStatus(ctx, mi, currentState, 0) + if err != nil { + return err + } klog.V(2).Infof("Creating a new Cluster IP Service for cluster %q", nsName) svc = services.NewClusterIPForMinIO(mi) _, err = c.kubeClientSet.CoreV1().Services(mi.Namespace).Create(ctx, svc, cOpts) @@ -349,6 +354,11 @@ func (c *Controller) syncHandler(key string) error { hlSvc, err := c.serviceLister.Services(mi.Namespace).Get(mi.MinIOHLServiceName()) // If the headless service doesn't exist, we'll create it if apierrors.IsNotFound(err) { + currentState := "Provisining Headless Service" + mi, err = c.updateMinIOInstanceStatus(ctx, mi, currentState, 0) + if err != nil { + return err + } klog.V(2).Infof("Creating a new Headless Service for cluster %q", nsName) hlSvc = services.NewHeadlessForMinIO(mi) _, err = c.kubeClientSet.CoreV1().Services(mi.Namespace).Create(ctx, hlSvc, cOpts) @@ -370,11 +380,17 @@ func (c *Controller) syncHandler(key string) error { } if mi.RequiresAutoCertSetup() { - _, err := c.certClient.CertificateSigningRequests().Get(ctx, mi.MinIOCSRName(), metav1.GetOptions{}) + + _, err = c.certClient.CertificateSigningRequests().Get(ctx, mi.MinIOCSRName(), metav1.GetOptions{}) if err != nil { // If the CSR doesn't exist, we'll create it if apierrors.IsNotFound(err) { klog.V(2).Infof("Creating a new Certificate Signing Request for cluster %q", nsName) + currentState := "Requesting Certificate" + mi, err = c.updateMinIOInstanceStatus(ctx, mi, currentState, 0) + if err != nil { + return err + } // create CSR here c.createCSR(ctx, mi) } else { @@ -386,6 +402,11 @@ func (c *Controller) syncHandler(key string) error { if err != nil { // If the CSR doesn't exist, we'll create it if apierrors.IsNotFound(err) { + currentState := "Creating TLS CSR for KES" + mi, err = c.updateMinIOInstanceStatus(ctx, mi, currentState, 0) + if err != nil { + return err + } klog.V(2).Infof("Creating a new Certificate Signing Request for cluster %q", nsName) err = c.createKESTLSCSR(ctx, mi) if err != nil { @@ -399,6 +420,11 @@ func (c *Controller) syncHandler(key string) error { if err != nil { // If the CSR doesn't exist, we'll create it if apierrors.IsNotFound(err) { + currentState := "Creating Client TLS CSR" + mi, err = c.updateMinIOInstanceStatus(ctx, mi, currentState, 0) + if err != nil { + return err + } klog.V(2).Infof("Creating a new Certificate Signing Request for cluster %q", nsName) err = c.createMinIOClientTLSCSR(ctx, mi) if err != nil { @@ -415,6 +441,11 @@ func (c *Controller) syncHandler(key string) error { ss, err := c.statefulSetLister.StatefulSets(mi.Namespace).Get(mi.Name) // If the resource doesn't exist, we'll create it if apierrors.IsNotFound(err) { + currentState := "Provisioning Statefulset" + mi, err = c.updateMinIOInstanceStatus(ctx, mi, currentState, 0) + if err != nil { + return err + } ss = statefulsets.NewForMinIO(mi, hlSvc.Name) ss, err = c.kubeClientSet.AppsV1().StatefulSets(mi.Namespace).Create(ctx, ss, cOpts) } @@ -450,6 +481,11 @@ func (c *Controller) syncHandler(key string) error { } // Check if any one replica is READY if ss.Status.ReadyReplicas > 0 { + currentState := "Provisioning MCS" + mi, err = c.updateMinIOInstanceStatus(ctx, mi, currentState, ss.Status.Replicas) + if err != nil { + return err + } if pErr := mi.CreateMCSUser(minioSecret.Data, mcsSecret.Data); pErr != nil { klog.V(2).Infof(pErr.Error()) return pErr @@ -468,6 +504,12 @@ func (c *Controller) syncHandler(key string) error { klog.V(2).Infof(err.Error()) return err } + } else { + currentState := "Waiting for Pods to be ready" + mi, err = c.updateMinIOInstanceStatus(ctx, mi, currentState, ss.Status.Replicas) + if err != nil { + return err + } } } else { return err @@ -475,6 +517,11 @@ func (c *Controller) syncHandler(key string) error { } if mi.HasKESEnabled() && !(mi.RequiresAutoCertSetup() || mi.RequiresExternalCertSetup()) { + currentState := "waiting on TLS for KES" + mi, err = c.updateMinIOInstanceStatus(ctx, mi, currentState, ss.Status.Replicas) + if err != nil { + return err + } msg := "KES Setup Requires MinIO to be configured with TLS" klog.V(2).Infof(msg) return fmt.Errorf(msg) @@ -521,6 +568,11 @@ func (c *Controller) syncHandler(key string) error { // If the StatefulSet is not controlled by this MinIOInstance resource, we should log // a warning to the event recorder and ret if !metav1.IsControlledBy(ss, mi) { + currentState := "Statefulset not controlled by operator" + mi, err = c.updateMinIOInstanceStatus(ctx, mi, currentState, ss.Status.Replicas) + if err != nil { + return err + } msg := fmt.Sprintf(MessageResourceExists, ss.Name) c.recorder.Event(mi, corev1.EventTypeWarning, ErrResourceExists, msg) return fmt.Errorf(msg) @@ -546,6 +598,10 @@ func (c *Controller) syncHandler(key string) error { // version does not equal the current desired version in the StatefulSet, we // should update the StatefulSet resource. if mi.Spec.Image != ss.Spec.Template.Spec.Containers[0].Image { + mi, err = c.updateMinIOInstanceStatus(ctx, mi, "Updating MinIO Version", ss.Status.Replicas) + if err != nil { + return err + } klog.V(4).Infof("Updating MinIOInstance %s MinIO server version %s, to: %s", name, mi.Spec.Image, ss.Spec.Template.Spec.Containers[0].Image) ss = statefulsets.NewForMinIO(mi, hlSvc.Name) _, err = c.kubeClientSet.AppsV1().StatefulSets(mi.Namespace).Update(ctx, ss, uOpts) @@ -559,6 +615,10 @@ func (c *Controller) syncHandler(key string) error { } if mi.HasMCSEnabled() && d != nil && mi.Spec.MCS.Image != d.Spec.Template.Spec.Containers[0].Image { + mi, err = c.updateMinIOInstanceStatus(ctx, mi, "Updating MCS Version", ss.Status.Replicas) + if err != nil { + return err + } klog.V(4).Infof("Updating MinIOInstance %s mcs version %s, to: %s", name, mi.Spec.MCS.Image, d.Spec.Template.Spec.Containers[0].Image) d = deployments.NewForMCS(mi) _, err = c.kubeClientSet.AppsV1().Deployments(mi.Namespace).Update(ctx, d, uOpts) @@ -572,26 +632,28 @@ func (c *Controller) syncHandler(key string) error { // Finally, we update the status block of the MinIOInstance resource to reflect the // current state of the world - err = c.updateMinIOInstanceStatus(ctx, mi, ss) + _, err = c.updateMinIOInstanceStatus(ctx, mi, "Ready", ss.Status.Replicas) if err != nil { return err } return nil } -func (c *Controller) updateMinIOInstanceStatus(ctx context.Context, minioInstance *miniov1.MinIOInstance, statefulSet *appsv1.StatefulSet) error { +func (c *Controller) updateMinIOInstanceStatus(ctx context.Context, minioInstance *miniov1.MinIOInstance, currentState string, availableReplicas int32) (*miniov1.MinIOInstance, error) { opts := metav1.UpdateOptions{} // NEVER modify objects from the store. It's a read-only, local cache. // You can use DeepCopy() to make a deep copy of original object and modify this copy // Or create a copy manually for better performance minioInstanceCopy := minioInstance.DeepCopy() - minioInstanceCopy.Status.AvailableReplicas = statefulSet.Status.Replicas + minioInstanceCopy.Status.AvailableReplicas = availableReplicas + minioInstanceCopy.Status.CurrentState = currentState // If the CustomResourceSubresources feature gate is not enabled, // we must use Update instead of UpdateStatus to update the Status block of the MinIOInstance resource. // UpdateStatus will not allow changes to the Spec of the resource, // which is ideal for ensuring nothing other than resource status has been updated. - _, err := c.minioClientSet.OperatorV1().MinIOInstances(minioInstance.Namespace).Update(ctx, minioInstanceCopy, opts) - return err + mi, err := c.minioClientSet.OperatorV1().MinIOInstances(minioInstance.Namespace).UpdateStatus(ctx, minioInstanceCopy, opts) + time.Sleep(time.Second * 2) + return mi, err } // enqueueMinIOInstance takes a MinIOInstance resource and converts it into a namespace/name diff --git a/pkg/resources/deployments/mcs-deployment.go b/pkg/resources/deployments/mcs-deployment.go index e82f6c63a12..ac4e2022002 100644 --- a/pkg/resources/deployments/mcs-deployment.go +++ b/pkg/resources/deployments/mcs-deployment.go @@ -114,7 +114,12 @@ func NewForMCS(mi *miniov1.MinIOInstance) *appsv1.Deployment { }, Spec: appsv1.DeploymentSpec{ Replicas: &mi.Spec.MCS.Replicas, - Selector: mi.Spec.MCS.Selector, + // MCS is always matched via MinIOInstance Name + mcs prefix + Selector: &metav1.LabelSelector{ + MatchLabels: map[string]string{ + miniov1.MCSInstanceLabel: mi.MCSDeploymentName(), + }, + }, Template: corev1.PodTemplateSpec{ ObjectMeta: mcsMetadata(mi), Spec: corev1.PodSpec{ diff --git a/pkg/resources/statefulsets/minio-statefulset.go b/pkg/resources/statefulsets/minio-statefulset.go index 3ea582f4dc1..9bfcee72bfd 100644 --- a/pkg/resources/statefulsets/minio-statefulset.go +++ b/pkg/resources/statefulsets/minio-statefulset.go @@ -320,9 +320,13 @@ func NewForMinIO(mi *miniov1.MinIOInstance, serviceName string) *appsv1.Stateful Type: miniov1.DefaultUpdateStrategy, }, PodManagementPolicy: mi.Spec.PodManagementPolicy, - Selector: mi.Spec.Selector, - ServiceName: serviceName, - Replicas: &replicas, + Selector: &metav1.LabelSelector{ + MatchLabels: map[string]string{ + miniov1.InstanceLabel: mi.MinIOStatefulSetName(), + }, + }, + ServiceName: serviceName, + Replicas: &replicas, Template: corev1.PodTemplateSpec{ ObjectMeta: minioMetadata(mi), Spec: corev1.PodSpec{