Skip to content

Commit b5784e5

Browse files
committed
fix: use minio operator namespace to assemble CA bundle
- adds minio operator namespace setting as cli argument, env var, and helm chart value - plumbs minio operator namespace to getMinioTenantClientInfo - uses minio operator namespace to fetch operator-ca-tls* and external CA secrets - update README with information
1 parent 275fc71 commit b5784e5

File tree

7 files changed

+107
-55
lines changed

7 files changed

+107
-55
lines changed

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Examples of these resources can be found [here](./manifests/example-resources.ya
2323
>
2424
> Read [this](https://github.com/benfiola/minio-operator-ext/issues/16#issuecomment-2401553200) if you are updating from version 1.X.X to version 2.X.X of the operator.
2525
26-
Use [helm](https://helm.sh/) to install the operator:
26+
Use [helm](https://helm.sh/) to install the operator in the same namespace as the MinIO operator itself. If _minio-operator-ext_ is not deployed to the same namespace as the MinIO operator - you must provide the `minio-operator-namespace` setting as defined below in the 'Configuration' section.
2727

2828
```shell
2929
# add the minio-operator-ext helm chart repository
@@ -40,12 +40,15 @@ Documentation for these helm charts can be found [here](https://benfiola.github.
4040

4141
The operator is hosted on docker hub and can be found at [docker.io/benfiola/minio-operator-ext](https://hub.docker.com/r/benfiola/minio-operator-ext).
4242

43+
### Configuration
44+
4345
The following arguments/environment variables configure the operator:
4446

45-
| CLI | Env | Default | Description |
46-
| --------------- | -------------------------------- | ------- | -------------------------------------------------------------------------------- |
47-
| _--log-level_ | _MINIO_OPERATOR_EXT_LOG_LEVEL_ | `info` | Logging verbosity for the operator |
48-
| _--kube-config_ | _MINIO_OPERATOR_EXT_KUBE_CONFIG_ | `null` | Optional path to a kubeconfig file. When omitted, uses in-cluster configuration. |
47+
| CLI | Env | Helm Chart | Default | Description |
48+
| ---------------------------- | --------------------------------------------- | ------------------------ | ------- | -------------------------------------------------------------------------------- |
49+
| _--log-level_ | _MINIO_OPERATOR_EXT_LOG_LEVEL_ | _logLevel_ | `info` | Logging verbosity for the operator |
50+
| _--kube-config_ | _MINIO_OPERATOR_EXT_KUBE_CONFIG_ | | `null` | Optional path to a kubeconfig file. When omitted, uses in-cluster configuration. |
51+
| _--minio-operator-namespace_ | _MINIO_OPERATOR_EXT_MINIO_OPERATOR_NAMESPACE_ | _minioOperatorNamespace_ | `` | Namespace of MinIO operator. When omitted, uses _minio-operator-ext_ namespace. |
4952

5053
### RBAC
5154

charts/operator/templates/deployment.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ spec:
3737
imagePullPolicy: {{ .Values.image.pullPolicy }}
3838
args:
3939
- run
40+
env:
41+
{{- if .Values.logLevel }}
42+
- name: MINIO_OPERATOR_EXT_LOG_LEVEL
43+
value: "{{ .Values.logLevel }}"
44+
{{- end }}
45+
{{- if .Values.minioOperatorNamespace }}
46+
- name: MINIO_OPERATOR_EXT_MINIO_OPERATOR_NAMESPACE
47+
value: "{{ .Values.minioOperatorNamespace }}"
48+
{{- end }}
4049
livenessProbe:
4150
{{- toYaml .Values.livenessProbe | nindent 12 }}
4251
readinessProbe:

charts/operator/values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,9 @@ tolerations: []
9999

100100
# -- Specify which node's affinities operator workloads will prefer
101101
affinity: {}
102+
103+
# -- Specify the operator's log level
104+
logLevel: ""
105+
106+
# -- Specify the namespace of the MinIO Operator
107+
minioOperatorNamespace: ""

cmd/operator/operator.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ func main() {
8787
EnvVars: []string{"MINIO_OPERATOR_EXT_KUBE_CONFIG"},
8888
Value: "",
8989
},
90+
&cli.StringFlag{
91+
Name: "minio-operator-namespace",
92+
Usage: "namespace of MinIO operator",
93+
EnvVars: []string{"MINIO_OPERATOR_EXT_MINIO_OPERATOR_NAMESPACE"},
94+
Value: "",
95+
},
9096
},
9197
Action: func(c *cli.Context) error {
9298
l, ok := c.Context.Value(ContextLogger{}).(*slog.Logger)
@@ -95,8 +101,9 @@ func main() {
95101
}
96102

97103
s, err := operator.New(&operator.Opts{
98-
KubeConfig: c.String("kube-config"),
99-
Logger: l,
104+
KubeConfig: c.String("kube-config"),
105+
Logger: l,
106+
MinioOperatorNamespace: c.String("minio-operator-namespace"),
100107
})
101108
if err != nil {
102109
return err

dev/dev.go.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ func runOperator() error {
1717
o, err := operator.New(&operator.Opts{
1818
Logger: l,
1919
KubeConfig: filepath.Join("..", ".dev", "kube-config.yaml"),
20+
MinioOperatorNamespace: "default",
2021
})
2122
if err != nil {
2223
return err

internal/operator/main.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ type Main struct {
3232

3333
// Opts define the options used to create a new instance of [Main]
3434
type Opts struct {
35-
Logger *slog.Logger
36-
KubeConfig string
35+
Logger *slog.Logger
36+
KubeConfig string
37+
MinioOperatorNamespace string
3738
}
3839

3940
// Creates a new instance of [Main] with the provided [Opts].
@@ -45,8 +46,9 @@ func New(o *Opts) (*Main, error) {
4546

4647
klog.SetSlogLogger(l.With("name", "klog"))
4748
op, err := NewOperator(&OperatorOpts{
48-
Logger: l.With("name", "operator"),
49-
KubeConfig: o.KubeConfig,
49+
Logger: l.With("name", "operator"),
50+
KubeConfig: o.KubeConfig,
51+
MinioOperatorNamespace: o.MinioOperatorNamespace,
5052
})
5153
if err != nil {
5254
return nil, err

0 commit comments

Comments
 (0)