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

enhancement: add the ability to customize the target port of the server deployment #257

Merged
merged 6 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/deploy-latest-helm-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ jobs:
update_helm_releases:
runs-on: ubuntu-latest
steps:
- name: Sleep for 3 minutes to allow time for the helm package to be available
Copy link
Contributor

Choose a reason for hiding this comment

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

ouch. so the package doesn't become available on the helm registry for a bit?

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 it just takes a minute or two

run: sleep 180s
shell: bash

- name: update helm releases
run: |
gh workflow run updatecli-helm-integration-tests.yaml \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Workers each have a type corresponding to the execution environment to which the
## [Prefect agent](charts/prefect-agent/)

### Note: Workers are recommended

Agents are part of the block-based deployment model. [Work Pools and Workers](/concepts/work-pools/) simplify the specification of a flow's infrastructure and runtime environment. If you have existing agents, you can [upgrade from agents to workers](/guides/upgrade-guide-agents-to-workers/) to significantly enhance the experience of deploying flows.

[Agent](https://docs.prefect.io/latest/concepts/agents/) processes are lightweight polling services that get scheduled work from a work pool and deploy the corresponding flow runs.
Expand Down
1 change: 1 addition & 0 deletions charts/prefect-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ postgresql+asyncpg://{username}:{password}@{hostname}/{database}?ssl=verify-ca
| service.externalTrafficPolicy | string | `"Cluster"` | service external traffic policy |
| service.nodePort | string | `""` | service port if defining service as type nodeport |
| service.port | int | `4200` | service port |
| service.targetPort | int | `4200` | target port of the server pod |
| service.type | string | `"ClusterIP"` | service type |
| serviceAccount.annotations | object | `{}` | additional service account annotations (evaluated as a template) |
| serviceAccount.create | bool | `true` | specifies whether a ServiceAccount should be created |
Expand Down
2 changes: 1 addition & 1 deletion charts/prefect-server/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ http{{ if $.Values.ingress.tls }}s{{ end }}://{{ .Values.ingress.host.hostname }
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
Run the following command to port-forward the UI to your localhost:
$ kubectl --namespace {{ .Release.Namespace }} port-forward svc/{{ template "common.names.fullname" . }} {{ .Values.service.port }}:4200
$ kubectl --namespace {{ .Release.Namespace }} port-forward svc/{{ template "common.names.fullname" . }} {{ .Values.service.targetPort }}:{{ .Values.service.port }}

Visit http://localhost:4200 to use Prefect!
{{- end }}
8 changes: 4 additions & 4 deletions charts/prefect-server/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ spec:
- --log-level
- WARNING
- --port
- {{ .Values.service.port | quote }}
- {{ .Values.service.targetPort | quote }}
workingDir: /home/prefect
ports:
- containerPort: {{ int .Values.service.port }}
- containerPort: {{ int .Values.service.targetPort }}
env:
- name: HOME
value: /home/prefect
Expand Down Expand Up @@ -111,14 +111,14 @@ spec:
livenessProbe:
httpGet:
path: /api/health
port: {{ .Values.service.port }}
port: {{ .Values.service.targetPort }}
{{- toYaml .Values.server.livenessProbe.config | nindent 12 }}
{{- end }}
{{- if .Values.server.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: /api/ready
port: {{ .Values.service.port }}
port: {{ .Values.service.targetPort }}
{{- toYaml .Values.server.readinessProbe.config | nindent 12 }}
{{- end }}
volumeMounts:
Expand Down
1 change: 1 addition & 0 deletions charts/prefect-server/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ spec:
- name: server-svc-port
port: {{ .Values.service.port }}
protocol: TCP
targetPort: {{ .Values.service.targetPort }}
{{- if and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort)) }}
nodePort: {{ .Values.service.nodePort }}
{{- else if eq .Values.service.type "ClusterIP" }}
Expand Down
13 changes: 9 additions & 4 deletions charts/prefect-server/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -493,11 +493,17 @@
"form": true
},
"nodePort": {
"type": "string",
"type": ["integer","string"],
"title": "Node Port",
"description": "service port if defining service as type nodeport",
"form": true
},
"targetPort": {
"type": "integer",
"title": "Target Port",
"description": "target port on the server pod",
"form": true
},
"externalTrafficPolicy": {
"type": "string",
"title": "External Traffic Policy",
Expand Down Expand Up @@ -619,7 +625,7 @@
"title": "PostgreSQL",
"description": "Postgresql configuration",
"form": true,
"properties": {
"properties": {
"enabled": {
"type": "boolean",
"title": "Enabled",
Expand Down Expand Up @@ -695,7 +701,6 @@
"title": "Primary",
"description": "Initdb configuration",
"form": true,

"properties": {
"initdb": {
"type": "object",
Expand Down Expand Up @@ -756,4 +761,4 @@
"form": true
}
}
}
}
2 changes: 2 additions & 0 deletions charts/prefect-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ service:
type: ClusterIP
# -- service port
port: 4200
# -- target port of the server pod
targetPort: 4200
# -- service Cluster IP
clusterIP: ""
# -- service port if defining service as type nodeport
Expand Down