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

update port names for Services for istio compliance #170

Merged
merged 4 commits into from
May 22, 2024

Conversation

avimoondra
Copy link
Contributor

@avimoondra avimoondra commented May 20, 2024

Addresses #144, alternate to #151

Addresses: #155, alternate to #156

Lighter weight approach than #154

https://istio.io/v1.0/docs/setup/kubernetes/spec-requirements/

Named ports: Service ports must be named. The port names must be of the form [-] with http, http2, grpc, mongo, or redis as the in order to take advantage of Istio's routing features. For example, name: http2-foo or name: http are valid port names, but name: http2foo is not. If the port name does not begin with a recognized prefix or if the port is unnamed, traffic on the port will be treated as plain TCP traffic (unless the port explicitly uses Protocol: UDP to signify a UDP port).

https://istio.io/latest/docs/ops/configuration/traffic-management/protocol-selection/, could also use appProtocol if prefix in names is not desirable.

Tested in internal (balloon) instances.

(also fixes #155)

@avimoondra avimoondra force-pushed the avimoondra/update-port-names-for-istio--2 branch from 8b39c05 to 76e43f8 Compare May 20, 2024 20:28
@@ -175,7 +175,7 @@ metadata:
{{- include "retool.telemetry.labels" . | nindent 4 }}
spec:
ports:
- name: statsd-udp
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not needed, but just doing for consistency

Non-TCP based protocols, such as UDP, are not proxied. These protocols will continue to function as normal, without any interception by the Istio proxy but cannot be used in proxy-only components such as ingress or egress gateways.

https://istio.io/latest/docs/ops/configuration/traffic-management/protocol-selection/

@avimoondra avimoondra force-pushed the avimoondra/update-port-names-for-istio--2 branch 3 times, most recently from afbeef3 to 289018a Compare May 20, 2024 21:43
@avimoondra avimoondra force-pushed the avimoondra/update-port-names-for-istio--2 branch from 289018a to f52c53a Compare May 21, 2024 04:17
*/}}
{{- define "retool.multiplayer.name" -}}
{{ template "retool.fullname" . }}-multiplayer-ws
{{- end -}}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

was using this originally to name ports, but port names can be max 15 characters

https://stackoverflow.com/questions/73330773/is-there-any-way-to-disable-or-increase-port-name-length-in-kubernetes

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO it could just be multiplayer-ws as port name, since it will already be on a Service object which has the retool.fullname namespace in its own name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i think the service portName just had to have http- prefix, but will just keep as is for consistency

and then you can have "retool.name" be longer than 15 chars i suppose 😅

Copy link
Contributor

Choose a reason for hiding this comment

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

OH I thought this was still being used as port name, but didn't realize you stopped for that reason. good good.

@avimoondra avimoondra force-pushed the avimoondra/update-port-names-for-istio--2 branch from 6349293 to f0798a9 Compare May 21, 2024 05:50
@@ -241,7 +241,7 @@ spec:
{{- end }}
ports:
- containerPort: {{ .Values.service.internalPort }}
name: {{ template "retool.name" . }}
name: http-server
protocol: TCP
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

there is no service defined here - attempted to add, but wasn't able to get it to compile template w/out error 👀

@avimoondra avimoondra marked this pull request as ready for review May 21, 2024 06:06
@@ -198,7 +198,7 @@ spec:
- name: membership
containerPort: {{ include (printf "temporal.%s.membershipPort" $service) $ }}
protocol: TCP
- name: metrics
- name: http-metrics
Copy link
Contributor

Choose a reason for hiding this comment

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

don't think we need this since this is the pod's port

protocol: TCP
name: metrics
name: http-metrics
Copy link
Contributor

Choose a reason for hiding this comment

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

would change this if also change above comment

Copy link
Contributor

Choose a reason for hiding this comment

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

does changing it complicate anything? I was wondering the same, but OTOH I don't have the change if only for consistency of naming scheme, if it doesn't hurt anything.

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe a very minor downtime if service port changes before new pod comes up?
but yeah agree if we make them consistent we should do for all (e.g. the two ports defined above)

Copy link
Contributor

Choose a reason for hiding this comment

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

oh right, we're using a named targetPort here. good point.

Copy link
Contributor

Choose a reason for hiding this comment

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

actually I think technically, if this causes minor downtime, it's downtime either way, since we have to update targetPort to match the pod's new port name which comes from the Deployment template. we could choose to or not to update name here on the Service object to match purely for consistency, but I don't think that would have any downtime since the Service port number (port here) doesn't change. I think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it seems like the ports that only need naming are on service and pod

https://istio.io/v1.0/docs/setup/kubernetes/spec-requirements/

I think will stick with the current changes then 👍

@avimoondra
Copy link
Contributor Author

@alexlo03 Re-visiting this, I think it should work istio compliance requirements?

Copy link
Contributor

@alexlo03 alexlo03 left a comment

Choose a reason for hiding this comment

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

LGTM, I think this is a better/cleaner/clearer approach 🙏

I do not know what the upgrade looks like for existing deployments - renaming a port "should be a no-op" but IDK for sure.

@avimoondra avimoondra merged commit ac9499d into main May 22, 2024
12 checks passed
@avimoondra avimoondra deleted the avimoondra/update-port-names-for-istio--2 branch May 22, 2024 14:57
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.

Code executor does not expose metrics endpoint but does have metrics annotations
4 participants