Skip to content

Commit 707431a

Browse files
authored
Organize Examples to use a consitent name (#1496)
* Organize Examples to use a consitent name Signed-off-by: Daniel Valdivia <[email protected]> * react lint Signed-off-by: Daniel Valdivia <[email protected]> --------- Signed-off-by: Daniel Valdivia <[email protected]>
1 parent 2416357 commit 707431a

File tree

67 files changed

+392
-458
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+392
-458
lines changed

.github/workflows/ui.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ jobs:
368368
curl -sLO "https://dl.k8s.io/release/v1.23.1/bin/linux/amd64/kubectl" -o kubectl
369369
chmod +x kubectl
370370
mv kubectl /usr/local/bin
371-
"${GITHUB_WORKSPACE}/tests/deploy-tenant.sh"
371+
"${GITHUB_WORKSPACE}/tests/start-tests-tenant.sh"
372372
echo "start ---> make test-operator-integration";
373373
make test-operator-integration;
374374

README.md

+98-65
Large diffs are not rendered by default.

api/tenants_test.go

+13-13
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ func Test_UpdateTenantAction(t *testing.T) {
10121012
operatorClient: opClient,
10131013
httpCl: httpClientM,
10141014
nameSpace: "default",
1015-
tenantName: "minio-tenant",
1015+
tenantName: "myminio",
10161016
mockTenantPatch: func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*miniov2.Tenant, error) {
10171017
return &miniov2.Tenant{}, nil
10181018
},
@@ -1037,7 +1037,7 @@ func Test_UpdateTenantAction(t *testing.T) {
10371037
operatorClient: opClient,
10381038
httpCl: httpClientM,
10391039
nameSpace: "default",
1040-
tenantName: "minio-tenant",
1040+
tenantName: "myminio",
10411041
mockTenantPatch: func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*miniov2.Tenant, error) {
10421042
return &miniov2.Tenant{}, nil
10431043
},
@@ -1062,7 +1062,7 @@ func Test_UpdateTenantAction(t *testing.T) {
10621062
operatorClient: opClient,
10631063
httpCl: httpClientM,
10641064
nameSpace: "default",
1065-
tenantName: "minio-tenant",
1065+
tenantName: "myminio",
10661066
mockTenantPatch: func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*miniov2.Tenant, error) {
10671067
return nil, errors.New("error-get")
10681068
},
@@ -1073,7 +1073,7 @@ func Test_UpdateTenantAction(t *testing.T) {
10731073
return &http.Response{}, nil
10741074
},
10751075
params: operator_api.UpdateTenantParams{
1076-
Tenant: "minio-tenant",
1076+
Tenant: "myminio",
10771077
Body: &models.UpdateTenantRequest{
10781078
Image: "minio/minio:RELEASE.2023-01-06T18-11-18Z",
10791079
},
@@ -1088,7 +1088,7 @@ func Test_UpdateTenantAction(t *testing.T) {
10881088
operatorClient: opClient,
10891089
httpCl: httpClientM,
10901090
nameSpace: "default",
1091-
tenantName: "minio-tenant",
1091+
tenantName: "myminio",
10921092
mockTenantPatch: func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*miniov2.Tenant, error) {
10931093
return &miniov2.Tenant{}, nil
10941094
},
@@ -1102,7 +1102,7 @@ func Test_UpdateTenantAction(t *testing.T) {
11021102
}, nil
11031103
},
11041104
params: operator_api.UpdateTenantParams{
1105-
Tenant: "minio-tenant",
1105+
Tenant: "myminio",
11061106
Body: &models.UpdateTenantRequest{
11071107
Image: "",
11081108
},
@@ -1117,7 +1117,7 @@ func Test_UpdateTenantAction(t *testing.T) {
11171117
operatorClient: opClient,
11181118
httpCl: httpClientM,
11191119
nameSpace: "default",
1120-
tenantName: "minio-tenant",
1120+
tenantName: "myminio",
11211121
mockTenantPatch: func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*miniov2.Tenant, error) {
11221122
return &miniov2.Tenant{}, nil
11231123
},
@@ -1128,7 +1128,7 @@ func Test_UpdateTenantAction(t *testing.T) {
11281128
return nil, errors.New("error")
11291129
},
11301130
params: operator_api.UpdateTenantParams{
1131-
Tenant: "minio-tenant",
1131+
Tenant: "myminio",
11321132
Body: &models.UpdateTenantRequest{
11331133
Image: "",
11341134
},
@@ -1143,7 +1143,7 @@ func Test_UpdateTenantAction(t *testing.T) {
11431143
operatorClient: opClient,
11441144
httpCl: httpClientM,
11451145
nameSpace: "default",
1146-
tenantName: "minio-tenant",
1146+
tenantName: "myminio",
11471147
mockTenantPatch: func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*miniov2.Tenant, error) {
11481148
return &miniov2.Tenant{}, nil
11491149
},
@@ -1199,7 +1199,7 @@ func Test_UpdateDomainsResponse(t *testing.T) {
11991199
ctx: context.Background(),
12001200
operatorClient: opClient,
12011201
nameSpace: "default",
1202-
tenantName: "minio-tenant",
1202+
tenantName: "myminio",
12031203
mockTenantUpdate: func(ctx context.Context, tenant *miniov2.Tenant, options metav1.UpdateOptions) (*miniov2.Tenant, error) {
12041204
return &miniov2.Tenant{}, nil
12051205
},
@@ -1219,7 +1219,7 @@ func Test_UpdateDomainsResponse(t *testing.T) {
12191219
ctx: context.Background(),
12201220
operatorClient: opClient,
12211221
nameSpace: "default",
1222-
tenantName: "minio-tenant",
1222+
tenantName: "myminio",
12231223
mockTenantUpdate: func(ctx context.Context, tenant *miniov2.Tenant, options metav1.UpdateOptions) (*miniov2.Tenant, error) {
12241224
return &miniov2.Tenant{}, nil
12251225
},
@@ -1239,7 +1239,7 @@ func Test_UpdateDomainsResponse(t *testing.T) {
12391239
ctx: context.Background(),
12401240
operatorClient: opClient,
12411241
nameSpace: "default",
1242-
tenantName: "minio-tenant",
1242+
tenantName: "myminio",
12431243
mockTenantUpdate: func(ctx context.Context, tenant *miniov2.Tenant, options metav1.UpdateOptions) (*miniov2.Tenant, error) {
12441244
return &miniov2.Tenant{}, nil
12451245
},
@@ -1273,7 +1273,7 @@ func Test_UpdateDomainsResponse(t *testing.T) {
12731273
ctx: context.Background(),
12741274
operatorClient: opClient,
12751275
nameSpace: "default",
1276-
tenantName: "minio-tenant",
1276+
tenantName: "myminio",
12771277
mockTenantUpdate: func(ctx context.Context, tenant *miniov2.Tenant, options metav1.UpdateOptions) (*miniov2.Tenant, error) {
12781278
return &miniov2.Tenant{}, nil
12791279
},

docs/cert-manager.md

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
# MinIO tenant with cert-manager [![Slack](https://slack.min.io/slack?type=svg)](https://slack.min.io)
22

3-
This document explains how to deploy a MinIO tenant using certificates generated by [cert-manager](https://cert-manager.io/).
3+
This document explains how to deploy a MinIO tenant using certificates generated
4+
by [cert-manager](https://cert-manager.io/).
45

56
## Getting Started
67

78
### Prerequisites
89

9-
- Kubernetes version `+v1.19`. While cert-manager supports [earlier K8s versions](https://cert-manager.io/docs/installation/supported-releases/), the MinIO Operator requires 1.19 or later.
10+
- Kubernetes version `+v1.19`. While cert-manager
11+
supports [earlier K8s versions](https://cert-manager.io/docs/installation/supported-releases/), the MinIO Operator
12+
requires 1.19 or later.
1013
- MinIO Operator installed
1114
- `kubectl` access to your `k8s` cluster
1215
- [cert-manager](https://cert-manager.io/docs/installation/) 1.7.X or later installed
16+
1317
```bash
1418
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.7.2/cert-manager.yaml
1519
```
20+
1621
- [kustomize](https://kustomize.io/) installed
1722

1823
### Deploy tenant
@@ -24,7 +29,6 @@ the operator project and run the following command.
2429
kustomize build examples/kustomization/tenant-certmanager | kubectl apply -f -
2530
```
2631

27-
2832
This file request `cert-manager` to issue a new certificate based on the following internal domains.
2933

3034
```yaml
@@ -36,12 +40,13 @@ metadata:
3640
spec:
3741
dnsNames:
3842
- "*.tenant-certmanager.svc.cluster.local"
39-
- "*.storage-certmanager.tenant-certmanager.svc.cluster.local"
40-
- "*.storage-certmanager-hl.tenant-certmanager.svc.cluster.local"
43+
- "*.myminio.tenant-certmanager.svc.cluster.local"
44+
- "*.myminio-hl.tenant-certmanager.svc.cluster.local"
4145
secretName: tenant-certmanager-tls
4246
issuerRef:
4347
name: tenant-certmanager-issuer
4448
```
49+
4550
Then it creates a new tenant including the new `tenant-certmanager-tls` secret in the `externalCertSecret` field.
4651

4752
```yaml

docs/custom-name-templates.md

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
# Custom Hostname Discovery [![Slack](https://slack.min.io/slack?type=svg)](https://slack.min.io)
22

3-
This document explains how to control the names used for host discovery. This allows us to discover hosts using external name services, which is useful for serving with trusted certificates.
3+
This document explains how to control the names used for host discovery. This allows us to discover hosts using external
4+
name services, which is useful for serving with trusted certificates.
45

56
## Getting Started
67

7-
If MinIO Tenant is named `tenant1`, then the four servers will be called `tenant1-pool-0-0`, `tenant1-pool-0-1`, `tenant1-pool-0-2`, and `tenant1-pool-0-3`. If all of your hosts are available at the domain `example.com` then you can use the `--hosts-template` flag in [MinIO Operator Deployment yaml](https://github.com/minio/operator/blob/master/minio-operator.yaml) to update discovery. This will generate the discovery string `tenant1-pool-0-{0...3}.example.com`.
8+
If MinIO Tenant is named `tenant1`, then the four servers will be
9+
called `myminio-pool-0-0`, `myminio-pool-0-1`, `myminio-pool-0-2`, and `myminio-pool-0-3`. If all of your hosts are
10+
available at the domain `example.com` then you can use the `--hosts-template` flag
11+
in [MinIO Operator Deployment yaml](https://github.com/minio/operator/blob/master/minio-operator.yaml) to update
12+
discovery. This will generate the discovery string `myminio-pool-0-{0...3}.example.com`.
813

914
```yaml
1015
containers:
11-
- command:
12-
- /operator
13-
- --hosts-template
14-
- '{{.StatefulSet}}-{{.Ellipsis}}.example.com'
16+
- command:
17+
- /operator
18+
- --hosts-template
19+
- '{{.StatefulSet}}-{{.Ellipsis}}.example.com'
1520
```
1621
1722
The following fields can be configured:

docs/examples.md

+44-23
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
# Tenant deployment examples with kustomize
22

3-
This document explains various yaml files listed in the [examples directory](https://github.com/minio/operator/tree/master/examples/kustomization) used to deploy a Tenant using MinIO Operator.
3+
This document explains various yaml files listed in
4+
the [examples directory](https://github.com/minio/operator/tree/master/examples/kustomization) used to deploy a Tenant
5+
using MinIO Operator.
46

57
### Prerequisites
68

79
- kustomize/v4.3.0 https://kubectl.docs.kubernetes.io/installation/kustomize/
810

911
## MinIO Tenant with AutoCert TLS
1012

11-
MinIO Operator can automatically generate TLS secrets and mount these secrets to the MinIO, Console, and/or KES pods (enabled by default). To disable this, set the `requestAutoCert` field to `false`.
13+
MinIO Operator can automatically generate TLS secrets and mount these secrets to the MinIO, Console, and/or KES pods (
14+
enabled by default). To disable this, set the `requestAutoCert` field to `false`.
1215

1316
You can deploy the pre-configured example by running the following command:
1417

@@ -35,14 +38,16 @@ This example will deploy a MinIO tenant with Server Side Encryption using KES an
3538
- Enable role auth: `vault auth enable approle`
3639
- Enable secrets k/v: `vault secrets enable kv`
3740
- Create a new `KES` policy: `vault policy write kes-policy examples/vault/kes-policy.hcl`
38-
- Create a new `KES` role based on the `KES` policy: `vault write auth/approle/role/kes-role token_num_uses=0 secret_id_num_uses=0 period=5m policies=kes-policy`
41+
- Create a new `KES` role based on the `KES`
42+
policy: `vault write auth/approle/role/kes-role token_num_uses=0 secret_id_num_uses=0 period=5m policies=kes-policy`
3943
- Get the `app-role-id` and write it down: `vault read auth/approle/role/kes-role/role-id`
4044
- Get the `app-role-secret-id` and write it down: `vault write -f auth/approle/role/kes-role/secret-id`
4145

4246
### Getting Started
4347

4448
- Open `examples/kustomization/tenant-kes-encryption/kes-configuration-secret.yaml`
45-
- In the `Vault` configuration replace `<YOUR APPROLE ID HERE>` for your `app-role-id`, `<YOUR APPROLE SECRET ID HERE>` for your `app-role-secret-id`.
49+
- In the `Vault` configuration replace `<YOUR APPROLE ID HERE>` for your `app-role-id`, `<YOUR APPROLE SECRET ID HERE>`
50+
for your `app-role-secret-id`.
4651

4752
You can deploy a preconfigured example by running the following command:
4853

@@ -67,24 +72,27 @@ This example will deploy a MinIO tenant with TLS using certificates provided by
6772

6873
### Prerequisites
6974

70-
- You can generate certificates using `Vault CA`, `Openssl` or `Mkcert`, for this example we will use https://github.com/FiloSottile/mkcert
71-
- Assuming your Tenant name is `storage` and your namespace is `minio-tenant` you should generate the following certificate keypairs:
75+
- You can generate certificates using `Vault CA`, `Openssl` or `Mkcert`, for this example we will
76+
use https://github.com/FiloSottile/mkcert
77+
- Assuming your Tenant name is `myminio` and your namespace is `minio-tenant` you should generate the following
78+
certificate keypairs:
7279

7380
```sh
7481
mkcert "*.minio-tenant.svc.cluster.local"
75-
mkcert "*.storage.minio-tenant.svc.cluster.local"
76-
mkcert "*.storage-hl.minio-tenant.svc.cluster.local"
82+
mkcert "*.myminio.minio-tenant.svc.cluster.local"
83+
mkcert "*.myminio-hl.minio-tenant.svc.cluster.local"
7784
```
78-
79-
`MinIO` will use `*.minio-tenant.svc.cluster.local`, `*.storage.minio-tenant.svc.cluster.local` and `*.storage-hl.minio-tenant.svc.cluster.local` certificates for
85+
86+
`MinIO` will use `*.minio-tenant.svc.cluster.local`, `*.myminio.minio-tenant.svc.cluster.local`
87+
and `*.myminio-hl.minio-tenant.svc.cluster.local` certificates for
8088
inter-node communication.
8189

8290
Create `kubernetes secrets` based on the previous certificates
8391

8492
```$xslt
8593
kubectl create secret tls minio-tls-cert --key="_wildcard.minio-tenant.svc.cluster.local-key.pem" --cert="_wildcard.minio-tenant.svc.cluster.local.pem" -n minio-tenant
86-
kubectl create secret tls minio-buckets-cert --key="_wildcard.storage.minio-tenant.svc.cluster.local-key.pem" --cert="_wildcard.storage.minio-tenant.svc.cluster.local.pem" -n minio-tenant
87-
kubectl create secret tls minio-hl-cert --key="_wildcard.storage-hl.minio-tenant.svc.cluster.local-key.pem" --cert="_wildcard.storage-hl.minio-tenant.svc.cluster.local.pem" -n minio-tenant
94+
kubectl create secret tls minio-buckets-cert --key="_wildcard.myminio.minio-tenant.svc.cluster.local-key.pem" --cert="_wildcard.myminio.minio-tenant.svc.cluster.local.pem" -n minio-tenant
95+
kubectl create secret tls minio-hl-cert --key="_wildcard.myminio-hl.minio-tenant.svc.cluster.local-key.pem" --cert="_wildcard.myminio-hl.minio-tenant.svc.cluster.local.pem" -n minio-tenant
8896
```
8997

9098
You need to provide those `kubernetes secrets` in your Tenant `YAML` overlay using the `externalCertSecret` fields, ie:
@@ -104,25 +112,32 @@ You can deploy a preconfigured example by running the following command:
104112
```$xslt
105113
kustomize build examples/kustomization/base | kubectl apply -f -
106114
```
107-
You can include all the certificates that you want in your Tenant and `MinIO` will serve them to its client via [SNI](https://en.wikipedia.org/wiki/Server_Name_Indication)
115+
116+
You can include all the certificates that you want in your Tenant and `MinIO` will serve them to its client
117+
via [SNI](https://en.wikipedia.org/wiki/Server_Name_Indication)
108118

109119
## MinIO Tenant with TLS via customer provided certificates and Encryption enabled via Vault KMS
110120

111-
This example will deploy a minio tenant using mTLS certificates (authentication between `MinIO` and `KES`) provided by the user, the data will be encrypted at rest
121+
This example will deploy a minio tenant using mTLS certificates (authentication between `MinIO` and `KES`) provided by
122+
the user, the data will be encrypted at rest
112123

113124
### Prerequisites
114125

115126
- Configure `Vault` the same way as in the first example
116127
- Set the `app-role-id`, the `app-role-secret-id` and `key-prefix` in your KES configuration `YAML` file
117-
- Assuming your Tenant name is `storage-kms-encrypted` and namespace is `tenant-kms-encrypted` create all the certificates and secrets as in the previous step
118-
- Generate new `KES` identity keypair (https://github.com/minio/kes), this is needed it for the authentication, `mTLS` between `MinIO` and `KES`:
128+
- Assuming your Tenant name is `myminio` and namespace is `tenant-kms-encrypted` create all the certificates and
129+
secrets as in the previous step
130+
- Generate new `KES` identity keypair (https://github.com/minio/kes), this is needed it for the authentication, `mTLS`
131+
between `MinIO` and `KES`:
119132

120133
```sh
121134
kes tool identity new --key="./app.key" --cert="app.cert" app
122135
```
123136

124-
- Using the generated `app.key` and `app.cert` create a new kubernetes secret: `kubectl create secret tls minio-kes-mtls --key="app.key" --cert="app.cert"` -n tenant-kms-encrypted
125-
and provide that secret in the `externalClientCertSecret` field of your tenant `YAML` overlay (if the field doesn't exist add it)
137+
- Using the generated `app.key` and `app.cert` create a new kubernetes
138+
secret: `kubectl create secret tls minio-kes-mtls --key="app.key" --cert="app.cert"` -n tenant-kms-encrypted
139+
and provide that secret in the `externalClientCertSecret` field of your tenant `YAML` overlay (if the field doesn't
140+
exist add it)
126141

127142
```$xslt
128143
spec:
@@ -133,7 +148,8 @@ This example will deploy a minio tenant using mTLS certificates (authentication
133148
```
134149

135150
- Calculate the `app.cert` identity using `KES`: `kes tool identity of app.cert`, copy the resulting hash and open your
136-
KES configuration `YAML` (`kes-configuration-secret.yaml`) file and replace `${MINIO_KES_IDENTITY}` for the `bda5d8b6531d2f3bcd64e5ec73841bcb23ecb57b19c5f814e491ea2b2088995c` string, you can
151+
KES configuration `YAML` (`kes-configuration-secret.yaml`) file and replace `${MINIO_KES_IDENTITY}` for
152+
the `bda5d8b6531d2f3bcd64e5ec73841bcb23ecb57b19c5f814e491ea2b2088995c` string, you can
137153
add additional identities using this array, ie:
138154

139155
```$xslt
@@ -146,7 +162,7 @@ This example will deploy a minio tenant using mTLS certificates (authentication
146162
identities:
147163
- bda5d8b6531d2f3bcd64e5ec73841bcb23ecb57b19c5f814e491ea2b2088995c
148164
```
149-
165+
150166
### Getting Started
151167

152168
You can deploy a pre-configured example by running the following command:
@@ -158,13 +174,18 @@ kustomize build examples/kustomization/tenant-kes-encryption | kubectl apply -f
158174
## MinIO Tenant with Services expose through NodePort
159175

160176
MinIO Operator can automatically generate `LoadBalancer` and `ClusterIP` type services when deploying tenants, however
161-
there is one more way to expose your services in case you don't want to deal with `load balancers` or `ingress` configurations and
162-
that is `NodePort`. NodePort type services will be accessible by opening a port on each Kubernetes cluster node, read more about [NodePort](https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport).
177+
there is one more way to expose your services in case you don't want to deal with `load balancers` or `ingress`
178+
configurations and
179+
that is `NodePort`. NodePort type services will be accessible by opening a port on each Kubernetes cluster node, read
180+
more about [NodePort](https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport).
163181

164182
```$xslt
165183
kustomize build examples/kustomization/tenant-nodeport | kubectl apply -f -
166184
```
167185

168186
### Additional Examples
169187

170-
For additional examples on how to deploy a tenant with [LDAP](https://min.io/docs/minio/kubernetes/upstream/operations/external-iam/configure-ad-ldap-external-identity-management.html) or [OIDC](https://min.io/docs/minio/kubernetes/upstream/operations/external-iam/configure-openid-external-identity-management.html) you can look at the [examples directory](https://github.com/minio/operator/tree/master/examples/kustomization)
188+
For additional examples on how to deploy a tenant
189+
with [LDAP](https://min.io/docs/minio/kubernetes/upstream/operations/external-iam/configure-ad-ldap-external-identity-management.html)
190+
or [OIDC](https://min.io/docs/minio/kubernetes/upstream/operations/external-iam/configure-openid-external-identity-management.html)
191+
you can look at the [examples directory](https://github.com/minio/operator/tree/master/examples/kustomization)

0 commit comments

Comments
 (0)