Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont create default secret if existingSecret value set #1663

Merged
merged 3 commits into from
Jun 27, 2023

Conversation

shtripat
Copy link
Contributor

@shtripat shtripat commented Jun 27, 2023

This allows to set an already created env configuration secret to the tenant. Set secrets.existingSecret to the name of pre created env configuration. Also value needs to be set at tenant.configuration.name to make sure tenant uses it.

Fixes: #1556

How to test the PR

  1. Push these changes to a private helm repo
  2. Create a local values.yaml as below content
## Secret with default environment variable configurations to be used by MinIO Tenant.
## Not recommended for production deployments! Create the secret manually instead.
secrets:
  name: myminio-env-configuration
  # MinIO root user and password
  accessKey: minio
  secretKey: minio123
  existingSecret: random-env-configuration

## MinIO Tenant Definition
tenant:
  # Tenant name
  name: myminio
  ## Registry location and Tag to download MinIO Server image
  image:
    repository: quay.io/minio/minio
    tag: RELEASE.2023-05-27T05-56-19Z
    pullPolicy: IfNotPresent
  ## Customize any private registry image pull secret.
  ## currently only one secret registry is supported
  imagePullSecret: { }
  ## If a scheduler is specified here, Tenant pods will be dispatched by specified scheduler.
  ## If not specified, the Tenant pods will be dispatched by default scheduler.
  scheduler: { }
  ## Secret name that contains additional environment variable configurations.
  ## The secret is expected to have a key named config.env containing environment variables exports.
  configuration:
    name: random-env-configuration
..........
  1. Create a kind cluster
  2. Deploy minio-operator
$ kubectl apply -k github.com/minio/operator
  1. Create a custom env configuration secret.yaml with below content
apiVersion: v1
kind: Secret
metadata:
  name: random-env-configuration
  namespace: tenant-ns
type: Opaque
data:
  config.env: ZXhwb3J0IE1JTklPX1JPT1RfVVNFUj10ZXN0dXNlcgpleHBvcnQgTUlOSU9fUk9PVF9QQVNTV09SRD10ZXN0dXNlcjEyMwo=

where

$ echo "ZXhwb3J0IE1JTklPX1JPT1RfVVNFUj10ZXN0dXNlcgpleHBvcnQgTUlOSU9fUk9PVF9QQVNTV09SRD10ZXN0dXNlcjEyMwo=" | base64 -d
export MINIO_ROOT_USER=testuser
export MINIO_ROOT_PASSWORD=testuser123
$ kubectl create ns tenant-ns
$ kubectl appy -f secret.yaml
  1. Deploy the minio tenant using local values.yaml from step-1
$ helm install minio1 --namespace tenant-ns <your-private-helm-repo>/tenant --values ./values.yaml
  1. Verify that tenant pods come online properly
$ kubectl get pods -n tenant-ns
NAME               READY   STATUS    RESTARTS   AGE
myminio-pool-0-0   2/2     Running   0          19m
myminio-pool-0-1   2/2     Running   0          19m
myminio-pool-0-2   2/2     Running   0          19m
myminio-pool-0-3   2/2     Running   0          19m

8, Verify that the default tenant env configuration secret myminio-env-configuration is not crated

$ kubectl get secrets -n tenant-ns
NAME                           TYPE                 DATA   AGE
myminio-tls                    Opaque               2      21m
random-env-configuration       Opaque               1      21m
sh.helm.release.v1.minio1.v1   helm.sh/release.v1   1      21m

This allows to set an already created env configuration secret to
the tenant. Set `secrets.existingSecret` to the name of pre created
env configuration. Also value needs to be set at `tenant.configuration.name`
to make sure tenant uses it.

Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Env configuration issues
4 participants