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

Applying same console fix for the subpath issue #1616

Merged
merged 1 commit into from
Jun 12, 2023

Conversation

cniackz
Copy link
Contributor

@cniackz cniackz commented May 26, 2023

Objective:

To fix issue: #1607 and be able to use a sub-path for Operator UI.

Story:

This issue is very similar to minio/console#2045 and maybe same fix should apply here: minio/console#2725

Reasoning:

I think this fix is easier than console because we don't need minio binary for Operator, hence the testing is more straightforward

How to test locally:

  • Put the assets inside to test in port 9090:
cd ~/operator
make swagger-gen

cd ~/operator/web-app
yarn && yarn build
  • Add a sub-path via env var as observed below
Screenshot 2023-05-26 at 8 03 38 AM
  • Compile with the assets of this PR, and you will be able to load the UI from the sub-path as expected:
Screenshot 2023-05-26 at 8 04 07 AM

Thank you https://github.com/polaris-phecda @polaris-phecda for the fix!.

Also tested in k8s environment:

  • Service using node port in kind:
spec:
  ports:
    - name: http
      protocol: TCP
      port: 9090
      targetPort: 9090
      nodePort: 30082
    - name: https
      protocol: TCP
      port: 9443
      targetPort: 9443
      nodePort: 31813
  selector:
    app.kubernetes.io/instance: minio-operator-console
    app.kubernetes.io/name: operator
  clusterIP: 10.96.247.6
  clusterIPs:
    - 10.96.247.6
  type: NodePort
  • Console Deployment:
apiVersion: apps/v1
kind: Deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/instance: minio-operator-console
      app.kubernetes.io/name: operator
  template:
    metadata:
      creationTimestamp: null
      labels:
        app.kubernetes.io/instance: minio-operator-console
        app.kubernetes.io/name: operator
    spec:
      containers:
        - name: operator
          image: docker.io/minio/operator:v5.0.4-13-g041a74ca
          args:
            - ui
            - '--certs-dir=/tmp/certs'
          ports:
            - name: http
              containerPort: 9090
              protocol: TCP
            - name: https
              containerPort: 9443
              protocol: TCP
          env:
            - name: OPERATOR_SUBPATH
              value: /minio-operator/
  • Created the image:
cd ~/operator
make docker

Got

=> => naming to docker.io/minio/operator:v5.0.4-13-g041a74ca

Loaded in the local cluster:

kind load docker-image docker.io/minio/operator:v5.0.4-13-g041a74ca
  • Changed images in the Deployments to test.
Screenshot 2023-05-26 at 8 59 44 AM

@cniackz cniackz requested a review from dvaldivia May 26, 2023 00:02
@cniackz cniackz requested a review from bexsoft May 26, 2023 11:59
@cniackz cniackz self-assigned this May 26, 2023
@cniackz cniackz added the bug Something isn't working label May 26, 2023
@allanrogerr
Copy link
Contributor

Works with operator standalone binary - but in k8s I cant get it to respect the env parameter. It keeps navigating back to http://localhost:9090/login

I validated from within the operator pod:

k -n minio-operator exec -it minio-operator-5fd4bf9857-57xxj -- /bin/bash
bash-4.4$ echo $OPERATOR_SUBPATH
minio-operator

@cniackz
Copy link
Contributor Author

cniackz commented May 26, 2023

Add the var in the console deployment:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: console
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/instance: minio-operator-console
      app.kubernetes.io/name: operator
  template:
    metadata:
      creationTimestamp: null
      labels:
        app.kubernetes.io/instance: minio-operator-console
        app.kubernetes.io/name: operator
    spec:
      containers:
        - name: operator
          image: docker.io/minio/operator:v5.0.4-13-g041a74ca
          args:
            - ui
            - '--certs-dir=/tmp/certs'
          ports:
            - name: http
              containerPort: 9090
              protocol: TCP
            - name: https
              containerPort: 9443
              protocol: TCP
          env:
            - name: OPERATOR_SUBPATH
              value: /minio-operator/

@allanrogerr
Copy link
Contributor

Hop to a tenant doesn't seem to work - when I remove the SUBPATH env variable and restart the console pod, it works again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants