forked from minio/operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Readiness Endpoint support (minio#2183)
* Readiness Endpoint support Signed-off-by: Daniel Valdivia <[email protected]> * Lint Signed-off-by: Daniel Valdivia <[email protected]> * Add comments to AttachGeneratedConfig * Update pkg/controller/upgrades.go Co-authored-by: Cesar N. <[email protected]> --------- Signed-off-by: Daniel Valdivia <[email protected]> Co-authored-by: Cesar N. <[email protected]>
- Loading branch information
Showing
10 changed files
with
265 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# MinIO Operator Sidecar | ||
|
||
This document provides information on how to build and test the sidecar container. | ||
|
||
# Testing | ||
|
||
Build this project into a container image and run it with the following command: | ||
|
||
```shell | ||
TAG=miniodev/operator-sidecar:sc GOOS=linux make docker | ||
``` | ||
|
||
Patch the MinIO Operator deployment to include the sidecar container via the `OPERATOR_SIDECAR_IMAGE` environment | ||
variable: | ||
|
||
```shell | ||
kubectl patch deployment minio-operator -n minio-operator --type='json' -p='[{"op": "add", "path": "/spec/template/spec/containers/1", "value": {"name": "sidecar", "image": "miniodev/operator-sidecar:sc"}}]' | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// This file is part of MinIO Operator | ||
// Copyright (c) 2023 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 <http://www.gnu.org/licenses/>. | ||
|
||
package common | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"os" | ||
"strings" | ||
|
||
miniov2 "github.com/minio/operator/pkg/apis/minio.min.io/v2" | ||
"github.com/minio/operator/pkg/resources/statefulsets" | ||
) | ||
|
||
// AttachGeneratedConfig attaches the generated config to the file contents which will be stored in /tmp/minio/config.env | ||
func AttachGeneratedConfig(tenant *miniov2.Tenant, fileContents string) string { | ||
args, err := GetTenantArgs(tenant) | ||
if err != nil { | ||
log.Println(err) | ||
os.Exit(1) | ||
} | ||
|
||
fileContents = fileContents + fmt.Sprintf("export MINIO_ARGS=\"%s\"\n", args) | ||
|
||
return fileContents | ||
} | ||
|
||
// GetTenantArgs returns the arguments for the tenant based on the tenants they have | ||
func GetTenantArgs(tenant *miniov2.Tenant) (string, error) { | ||
if tenant == nil { | ||
return "", fmt.Errorf("tenant is nil") | ||
} | ||
// Validate the MinIO Tenant | ||
if err := tenant.Validate(); err != nil { | ||
log.Println(err) | ||
return "", err | ||
} | ||
args := strings.Join(statefulsets.GetContainerArgs(tenant, ""), " ") | ||
return args, nil | ||
} |
Oops, something went wrong.