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

[fix] add configurable port names for istio compatibility #154

Closed
wants to merge 4 commits into from

Conversation

avimoondra
Copy link
Contributor

@avimoondra avimoondra commented Feb 28, 2024

Addresses #144, alternate to #151

Addresses: #155, alternate to #156

helm template -f ~/retool-helm/charts/retool/values.yaml foo ~/retool-helm/charts/retool --set config.encryptionKey="foo" --set image.tag="5.6.11" --set codeExecutor.portName=http-bloop --set workflows.backend.portName=http-bar --set workflows.worker.portName=http-bleep --set workflows.worker.metricsPortName=http-bleep2 | rg "http-bloop|http-bar|http-bleep" -C 5
  ports:
  - protocol: TCP
    port: 80
    targetPort: 3004

    name: http-bloop
---
# Source: retool/templates/deployment_workflows.yaml
---
apiVersion: v1
kind: Service
--
  ports:
  - protocol: TCP
    port: 80
    targetPort: 3000

    name: http-bar
---
# Source: retool/templates/deployment_workflows_worker.yaml
---
apiVersion: v1
kind: Service
--
  ports:
  - protocol: TCP
    port: 3005
    targetPort: 3005

    name: http-bleep

  - protocol: TCP
    port: 9090
    targetPort: http-bleep2
    name: http-bleep2
---
# Source: retool/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
--
          - name: NODE_OPTIONS
            value: --max_old_space_size=1024
        ports:
        - containerPort: 3004

          name: http-bloop

          protocol: TCP
        livenessProbe:
          httpGet:
            path: /api/checkHealth
--
                name: foo-retool
                key: google-client-secret
        ports:
        - containerPort: 3000

          name: http-bar

          protocol: TCP
        livenessProbe:
          httpGet:
            path: /api/checkHealth
--
                name: foo-retool
                key: google-client-secret
        ports:
        - containerPort: 3005

          name: http-bleep

          protocol: TCP
        - containerPort: 9090
          name: http-bleep2
          protocol: TCP
        livenessProbe:
          httpGet:
            path: /api/checkHealth
            port: 3005

(also fixes #155)

@avimoondra avimoondra force-pushed the avimoondra/update-port-names-for-istio branch from 3be31ab to e75527f Compare February 28, 2024 21:24
@avimoondra avimoondra marked this pull request as ready for review February 29, 2024 00:49
Comment on lines +345 to 346
{{ else }}
name: {{ template "retool.name" . }}

This comment was marked as resolved.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 346 is the fallback if .Values.workflows.worker.portName is not set, so we should be good here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean like you do above - the conditional L343-L347 becomes one line

name: {{ .Values.workflows.worker.portName | default (template "retool.name" .) }}

@alexlo03
Copy link
Contributor

LGTM

  1. you need to update values.yaml OR document these possible values
  2. IMO there should be a default port name all the time, I believe that is a non-breaking change

Comment on lines -141 to -144
- protocol: TCP
port: 9090
targetPort: metrics
name: metrics
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused, no need to expose this.

@avimoondra avimoondra linked an issue Mar 1, 2024 that may be closed by this pull request
@avimoondra avimoondra force-pushed the avimoondra/update-port-names-for-istio branch from 8411bf1 to e7ed494 Compare March 1, 2024 11:44
@avimoondra avimoondra requested review from alexlo03, ryanartecona, BenjamynBaker and roberto-retool and removed request for alexlo03 March 1, 2024 11:44
Comment on lines +141 to +145
{{ if .Values.codeExecutor.portName }}
name: {{ .Values.codeExecutor.portName }}
{{ else }}
name: {{ template "retool.name" . }}
- protocol: TCP
port: 9090
targetPort: metrics
name: metrics
{{ end }}

This comment was marked as resolved.

Comment on lines +86 to +90
{{ if .Values.codeExecutor.portName }}
name: {{ .Values.codeExecutor.portName }}
{{ else }}
name: {{ template "retool.name" . }}
protocol: TCP
- containerPort: 9090
name: metrics
{{ end }}

This comment was marked as resolved.

@alexlo03
Copy link
Contributor

alexlo03 commented Mar 1, 2024

LGTM, the defaulting comments are not necessary but I think you could collapse the conditionals down

@avimoondra
Copy link
Contributor Author

avimoondra commented Mar 1, 2024

LGTM, the defaulting comments are not necessary but I think you could collapse the conditionals down

The if/else is giving that default - but I ran into an issue using default with "template"... e.g. this wasn't working:

{{ .Values.codeExecutor.portName | default (template "retool.name" .) }}

neither this

{{ default  .Values.codeExecutor.portName (template "retool.name" .) }}

lmk if you have a different suggestion @alexlo03 ! thanks for review.

@avimoondra avimoondra changed the title add configurable port names for istio compatibility [fix] add configurable port names for istio compatibility Mar 4, 2024
Copy link
Contributor

@ryanartecona ryanartecona left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't looked through the whole chart in this branch, but do we want to use these new port names for the corresponding Service resources? i.e. https://kubernetes.io/docs/concepts/services-networking/service/#field-spec-ports. I believe a Service can be associated with a port either via port number or port name, so we don't have to, but we'd have the option now with this change. Not a big deal to skip tho.

@@ -329,12 +329,15 @@ workflows:
# Scaling this number will increase the number of workflow workers, e.g. a replicaCount of 4
# will launch 9 pods -- 1 workflow backend, 4 workflow workers, and 4 for temporal cluster
replicaCount: 1
# portName: custom-port-name, e.g. http-workflows-worker; defaults to "retool.name"
# metricsPortName: custom-port-name, e.g. http-workflow-worker-metrics; defaults to "metrics"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For all the defaults in our values.yaml, I think it would make sense to just pick a default port name and possibly just drop the template "retool.name" . and | default "metrics" dynamic fallbacks. The defaults can be static (i.e. no point to using template "retool.name" anyway) and we can even just use the istio naming convention for them. This would remove the need for those conditionals in templates and just simplify a bit. Adding port names is a non-breaking change anyway I am pretty sure, so extremely low risk.

@ryanartecona
Copy link
Contributor

ryanartecona commented Mar 5, 2024

I ran into an issue using default with "template"...

oh I didn't notice this comment before, but that's because template doesn't return the value, it just prints it out to the output. you can just change template to include, which returns instead of printing, and then it will work as expected with the default pipeline. usually include is preferred over template in helm for exactly this reason.

@avimoondra
Copy link
Contributor Author

I ran into an issue using default with "template"...

oh I didn't notice this comment before, but that's because template doesn't return the value, it just prints it out to the output. you can just change template to include, which returns instead of printing, and then it will work as expected with the default pipeline. usually include is preferred over template in helm for exactly this reason.

Ah thanks @ryanartecona - will address all of it w/your feedback today! 🙏

@alexlo03
Copy link
Contributor

gentle ping. would like to see this in before we upgrade charts. thanks 🙏

@avimoondra
Copy link
Contributor Author

Closing in favor of #170

@avimoondra avimoondra closed this May 22, 2024
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.

Support Istio Clusters Code executor does not expose metrics endpoint but does have metrics annotations
3 participants