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

breaking(prefect-server): remove confusing & duplicative environment variables #450

Merged
merged 24 commits into from
Feb 25, 2025

Conversation

jamiezieziula
Copy link
Contributor

@jamiezieziula jamiezieziula commented Feb 14, 2025

This PR contains a breaking change. See the upgrading document for details on how to upgrade. Specifically, this PR removes the prefectApiUrl and prefectApiHost values. Instead, the chart will now use the prefectUiApiUrl value to define the URL that is provided to the UI by and for the API


Testing

  1. Authenticate to any Kubernetes cluster
  2. Clone the repo locally, checkout this branch and change directory to the prefect-server chart
git clone git@github.com:PrefectHQ/prefect-helm.git
git checkout adjust-prefect-server-settings
cd prefect-helm/charts/prefect-server
  1. Install the helm chart without adjusting anything on the values.yaml file
helm install prefect-server .
  1. You should observe the prefect-server and postgresql pods come up healthy. You can port forward the server service and interact with the UI
  2. Modify the values.yaml file to enable a separate deployment for the background services
backgroundServices:
  runAsSeparateDeployment: true
  1. Upgrade the helm chart
helm upgrade prefect-server .
  1. You should see all three pods (now including a dedicated one for the background services) come up healthy.

Resolves https://linear.app/prefect/issue/PLA-1051/fix-prefect-helm-server-values-and-docs-re-server-env-vars

prefectUiApiUrl: ""
# -- sets PREFECT_UI_URL
prefectUiUrl: ""
# -- sets PREFECT_UI_API_URL; If you want to connect to the UI form somewhere external to the cluster (like via an ingress), you need to set this value to the ingress URL (e.g. http://app.internal.prefect.com/api).
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zzstoatzz @desertaxle - let me know if my description makes sense here

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense to me!

# -- sets PREFECT_UI_API_URL
prefectUiApiUrl: ""
# -- sets PREFECT_UI_URL
prefectUiUrl: ""
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was used solely to display the connection url in the notes.txt. I've updated this to infer the UI url from the prefectUiApiUrl

Comment on lines -35 to -38
prefectApiUrl: http://localhost:4200/api

# -- sets PREFECT_SERVER_API_HOST
prefectApiHost: 0.0.0.0
Copy link
Contributor Author

@jamiezieziula jamiezieziula Feb 20, 2025

Choose a reason for hiding this comment

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

these are both redundant because:

  • PREFECT_SERVER_API_HOST it is only used to construct the PREFECT_UI_API_URL if not provided
  • PREFECT_API_URL is primarily used by the client, and is only used server side if PREFECT_UI_API_URL is not set

Copy link
Contributor

Choose a reason for hiding this comment

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

With these removed, maybe we can add a template to _validation.tpl to return an error/warning if the user tries to configure these removed values.

Comment on lines -163 to -172
"prefectApiUrl": {
"type": "string",
"title": "Prefect API URL",
"description": "sets PREFECT_API_URL"
},
"prefectApiHost": {
"type": "string",
"title": "Prefect API Host",
"description": "sets PREFECT_SERVER_API_HOST"
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these we're left over and should have been removed in a previous PR

- name: PREFECT_SERVER_API_PORT
value: {{ .Values.service.targetPort | quote }}
- name: PREFECT_UI_ENABLED
value: {{ .Values.server.uiConfig.enabled | quote }}
{{- if .Values.server.uiConfig.prefectUiApiUrl }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

remove if/then configuration as this is now a required setting

@@ -71,14 +71,10 @@ spec:
env:
- name: HOME
value: /home/prefect
- name: PREFECT_API_URL
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we never needed to set these env vars on the background services depoyment

@jamiezieziula jamiezieziula changed the title chore: remove unnecessary environment variables and clear up documentation chore: remove confusing & duplicative environment variables Feb 20, 2025
jamie zieziula added 2 commits February 20, 2025 17:27
@jamiezieziula jamiezieziula marked this pull request as ready for review February 21, 2025 17:07
@jamiezieziula jamiezieziula requested a review from a team as a code owner February 21, 2025 17:07
Copy link
Member

@desertaxle desertaxle left a comment

Choose a reason for hiding this comment

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

LGTM!

jimid27

This comment was marked as duplicate.

Copy link
Contributor

@jimid27 jimid27 left a comment

Choose a reason for hiding this comment

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

lgtm

{{- if or (lt $major 3) (and (eq $major 3) (lt $minor 1)) (and (eq $major 3) (eq $minor 1) (lt $patch 13)) -}}
{{- fail "When running background services separately, Prefect version must be 3.1.13 or higher" -}}
{{- end -}}
{{- define "prefect-server.validatePrefectServerApiSettings" -}}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

if any of these three values are set, the validation will fail the install/upgrade and alert the user on what needs to be changed

@@ -1,4 +1,5 @@
{{- if .Values.backgroundServices.runAsSeparateDeployment }}
{{- include "prefect-server.validatePrefectVersion" . }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this calls the validation helper

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we just call the validation helper in NOTES.txt? It's been a little while since I've used this, but I think that's where I've called it in the past so it's in a central location instead of being tied to a specific template.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure!

@@ -1,3 +1,4 @@
{{- include "prefect-server.validatePrefectServerApiSettings" . }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this calls the validation helper

@@ -42,7 +42,7 @@
"type": "object",
"title": "Prefect",
"description": "global prefect configuration",
"additionalProperties": false,
"additionalProperties": true,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this allows for the validation helper to be the one to fail the helm install/upgrade, rather than the json schema. It will provide more direct guidance.

jamie zieziula added 2 commits February 24, 2025 14:18
@@ -1,4 +1,5 @@
{{- if .Values.backgroundServices.runAsSeparateDeployment }}
{{- include "prefect-server.validatePrefectVersion" . }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we just call the validation helper in NOTES.txt? It's been a little while since I've used this, but I think that's where I've called it in the past so it's in a central location instead of being tied to a specific template.

jamie zieziula and others added 7 commits February 24, 2025 15:02
Co-authored-by: Mitchell Nielsen <mitchnielsen@users.noreply.github.com>
Co-authored-by: Mitchell Nielsen <mitchnielsen@users.noreply.github.com>
Co-authored-by: Mitchell Nielsen <mitchnielsen@users.noreply.github.com>
@jamiezieziula jamiezieziula changed the title chore: remove confusing & duplicative environment variables breaking change: remove confusing & duplicative environment variables Feb 24, 2025
@jamiezieziula jamiezieziula removed the request for review from mitchnielsen February 25, 2025 01:41
@jamiezieziula jamiezieziula merged commit 00fb799 into main Feb 25, 2025
13 checks passed
@jamiezieziula jamiezieziula deleted the adjust-prefect-server-settings branch February 25, 2025 01:42
@jamiezieziula jamiezieziula changed the title breaking change: remove confusing & duplicative environment variables breaking(prefect-server): remove confusing & duplicative environment variables Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants