diff --git a/charts/prefect-server/README.md b/charts/prefect-server/README.md index ef1c591f..d50a4069 100644 --- a/charts/prefect-server/README.md +++ b/charts/prefect-server/README.md @@ -137,13 +137,13 @@ postgresql+asyncpg://{username}:{password}@{hostname}/{database}?ssl=verify-ca | server.containerSecurityContext.readOnlyRootFilesystem | bool | `true` | set server containers' security context readOnlyRootFilesystem | | server.containerSecurityContext.runAsNonRoot | bool | `true` | set server containers' security context runAsNonRoot | | server.containerSecurityContext.runAsUser | int | `1001` | set server containers' security context runAsUser | +| server.debug | bool | `false` | enable server debug mode | | server.env | list | `[]` | array with environment variables to add to server nodes | | server.extraContainers | list | `[]` | additional sidecar containers | | server.extraEnvVarsCM | string | `""` | name of existing ConfigMap containing extra env vars to add to server nodes | | server.extraEnvVarsSecret | string | `""` | name of existing Secret containing extra env vars to add to server nodes | | server.extraVolumeMounts | list | `[]` | array with extra volumeMounts for the server pod | | server.extraVolumes | list | `[]` | array with extra volumes for the server pod | -| server.image.debug | bool | `false` | enable server image debug mode | | server.image.prefectTag | string | `"2-latest"` | prefect image tag (immutable tags are recommended) | | server.image.pullPolicy | string | `"IfNotPresent"` | server image pull policy | | server.image.pullSecrets | list | `[]` | server image pull secrets | @@ -154,14 +154,16 @@ postgresql+asyncpg://{username}:{password}@{hostname}/{database}?ssl=verify-ca | server.livenessProbe.config.successThreshold | int | `1` | The minimum consecutive successes required to consider the probe successful. | | server.livenessProbe.config.timeoutSeconds | int | `5` | The number of seconds to wait for a probe response before considering it as failed. | | server.livenessProbe.enabled | bool | `false` | | +| server.loggingLevel | string | `"WARNING"` | | | server.nodeSelector | object | `{}` | node labels for server pods assignment | | server.podAnnotations | object | `{}` | extra annotations for server pod | | server.podLabels | object | `{}` | extra labels for server pod | | server.podSecurityContext.fsGroup | int | `1001` | set server pod's security context fsGroup | | server.podSecurityContext.runAsNonRoot | bool | `true` | set server pod's security context runAsNonRoot | | server.podSecurityContext.runAsUser | int | `1001` | set server pod's security context runAsUser | +| server.prefectApiHost | string | `"0.0.0.0"` | sets PREFECT_SERVER_API_HOST | +| server.prefectApiUrl | string | `"http://localhost:4200/api"` | sets PREFECT_API_URL | | server.priorityClassName | string | `""` | priority class name to use for the server pods; if the priority class is empty or doesn't exist, the server pods are scheduled without a priority class | -| server.publicApiUrl | string | `"http://localhost:4200/api"` | sets PREFECT_UI_API_URL; should be publicly accessible API URL | | server.readinessProbe.config.failureThreshold | int | `3` | The number of consecutive failures allowed before considering the probe as failed. | | server.readinessProbe.config.initialDelaySeconds | int | `10` | The number of seconds to wait before starting the first probe. | | server.readinessProbe.config.periodSeconds | int | `10` | The number of seconds to wait between consecutive probes. | @@ -172,12 +174,15 @@ postgresql+asyncpg://{username}:{password}@{hostname}/{database}?ssl=verify-ca | server.resources.limits | object | `{}` | the requested limits for the server container | | server.resources.requests | object | `{}` | the requested resources for the server container | | server.tolerations | list | `[]` | tolerations for server pods assignment | +| server.uiConfig.enabled | bool | `true` | set PREFECT_UI_ENABLED; enable the UI on the server | +| server.uiConfig.prefectUiApiUrl | string | `""` | sets PREFECT_UI_API_URL | +| server.uiConfig.prefectUiUrl | string | `""` | sets PREFECT_UI_URL | | service.annotations | object | `{}` | | | service.clusterIP | string | `""` | service Cluster IP | | 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.targetPort | int | `4200` | target port of the server pod; also sets PREFECT_SERVER_API_PORT | | 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 | diff --git a/charts/prefect-server/templates/NOTES.txt b/charts/prefect-server/templates/NOTES.txt index 7a89cdda..17afef36 100644 --- a/charts/prefect-server/templates/NOTES.txt +++ b/charts/prefect-server/templates/NOTES.txt @@ -13,5 +13,5 @@ http{{ if $.Values.ingress.tls }}s{{ end }}://{{ .Values.ingress.host.hostname } 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.targetPort }}:{{ .Values.service.port }} -Visit http://localhost:4200 to use Prefect! +Visit {{ include "server.uiUrl" . }} to use Prefect! {{- end }} diff --git a/charts/prefect-server/templates/_helpers.tpl b/charts/prefect-server/templates/_helpers.tpl index 4ca0cbf3..55930ff2 100644 --- a/charts/prefect-server/templates/_helpers.tpl +++ b/charts/prefect-server/templates/_helpers.tpl @@ -53,3 +53,11 @@ Create the name of the service account to use {{- printf "%s-%s" $name "postgresql-connection" -}} {{- end -}} {{- end -}} + +{{- define "server.uiUrl" -}} +{{- if .Values.server.uiConfig.prefectUiUrl -}} + {{- .Values.server.uiConfig.prefectUiUrl -}} +{{- else -}} + {{- printf "%s" (replace "/api" "" .Values.server.prefectApiUrl) -}} +{{- end -}} +{{- end -}} diff --git a/charts/prefect-server/templates/deployment.yaml b/charts/prefect-server/templates/deployment.yaml index 7611328c..56be2af9 100644 --- a/charts/prefect-server/templates/deployment.yaml +++ b/charts/prefect-server/templates/deployment.yaml @@ -64,10 +64,6 @@ spec: - prefect - server - start - - --host - - 0.0.0.0 - - --log-level - - WARNING - --port - {{ .Values.service.targetPort | quote }} workingDir: /home/prefect @@ -76,11 +72,25 @@ spec: env: - name: HOME value: /home/prefect + - name: PREFECT_API_URL + value: {{ .Values.server.prefectApiUrl | quote }} - name: PREFECT_DEBUG_MODE - value: {{ .Values.server.image.debug | quote }} - {{- if .Values.server.publicApiUrl }} + value: {{ .Values.server.debug | quote }} + - name: PREFECT_LOGGING_SERVER_LEVEL + value: {{ .Values.server.loggingLevel | quote }} + - name: PREFECT_SERVER_API_HOST + value: {{ .Values.server.prefectApiHost | quote }} + - 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 }} - name: PREFECT_UI_API_URL - value: {{ .Values.server.publicApiUrl | quote }} + value: {{ .Values.server.uiConfig.prefectUiApiUrl | quote }} + {{- end }} + {{- if .Values.server.uiConfig.prefectUiUrl }} + - name: PREFECT_UI_URL + value: {{ .Values.server.uiConfig.prefectUiUrl | quote }} {{- end }} {{- if .Values.postgresql.enabled }} - name: PREFECT_API_DATABASE_CONNECTION_URL diff --git a/charts/prefect-server/values.schema.json b/charts/prefect-server/values.schema.json index effd5d9c..19ffafa4 100644 --- a/charts/prefect-server/values.schema.json +++ b/charts/prefect-server/values.schema.json @@ -72,12 +72,6 @@ "items": { "type": "string" } - }, - "debug": { - "type": "boolean", - "title": "Debug", - "description": "server image debug mode", - "form": true } } }, @@ -87,12 +81,56 @@ "description": "priority class name to use for the server pods; if the priority class is empty or doesn't exist, the server pods are scheduled without a priority class", "form": true }, - "publicApiUrl": { + "debug": { + "type": "boolean", + "title": "Debug", + "description": "server debug mode", + "form": true + }, + "loggingLevel": { + "type": "string", + "title": "Logging Level", + "description": "sets PREFECT_LOGGING_SERVER_LEVEL", + "form": true + }, + "prefectApiUrl": { "type": "string", - "title": "Public API URL", - "description": "sets PREFECT_UI_API_URL; should be publicly accessible API URL", + "title": "Prefect API URL", + "description": "sets PREFECT_API_URL", "form": true }, + "prefectApiHost": { + "type": "string", + "title": "Prefect API Host", + "description": "sets PREFECT_SERVER_API_HOST", + "form": true + }, + "uiConfig": { + "type": "object", + "title": "UI Config", + "description": "Prefect UI Config", + "form": true, + "properties": { + "enabled": { + "type": "boolean", + "title": "Enable Prefect UI", + "description": "set PREFECT_UI_ENABLED; enable the UI on the server", + "form": true + }, + "prefectUiApiUrl": { + "type": "string", + "title": "Prefect API URL", + "description": "sets PREFECT_UI_API_URL", + "form": true + }, + "prefectUiUrl": { + "type": "string", + "title": "Prefect UI URL", + "description": "sets PREFECT_UI_URL", + "form": true + } + } + }, "env": { "type": "array", "title": "Environment Variables", diff --git a/charts/prefect-server/values.yaml b/charts/prefect-server/values.yaml index f840fab2..b08863e9 100644 --- a/charts/prefect-server/values.yaml +++ b/charts/prefect-server/values.yaml @@ -29,21 +29,38 @@ server: ## - myRegistryKeySecretName # -- server image pull secrets pullSecrets: [] - # -- enable server image debug mode - debug: false # ref: https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass # -- priority class name to use for the server pods; if the priority class is empty or doesn't exist, the server pods are scheduled without a priority class priorityClassName: "" - # -- sets PREFECT_UI_API_URL; should be publicly accessible API URL - publicApiUrl: http://localhost:4200/api + # -- enable server debug mode + debug: false + # sets PREFECT_LOGGING_SERVER_LEVEL + loggingLevel: WARNING + + # -- sets PREFECT_API_URL + prefectApiUrl: http://localhost:4200/api + + # -- sets PREFECT_SERVER_API_HOST + prefectApiHost: 0.0.0.0 + + ## If you want to run the UI seperately from the server, you will need to set the UI-specific URLs below + uiConfig: + # -- set PREFECT_UI_ENABLED; enable the UI on the server + enabled: true + # -- sets PREFECT_UI_API_URL + prefectUiApiUrl: "" + # -- sets PREFECT_UI_URL + prefectUiUrl: "" + + # see here for a full list of possible environment variables - https://docs.prefect.io/latest/api-ref/prefect/settings/ # -- array with environment variables to add to server nodes env: [] ## env: - ## - name: PREFECT_LOGGING_SERVER_LEVEL - ## value: WARNING + ## - name: PREFECT_API_ENABLE_HTTP2 + ## value: false # Autoscaling configuration # requests MUST be specified if using an HPA, otherwise the HPA will not know when to trigger a scale event @@ -167,7 +184,7 @@ service: type: ClusterIP # -- service port port: 4200 - # -- target port of the server pod + # -- target port of the server pod; also sets PREFECT_SERVER_API_PORT targetPort: 4200 # -- service Cluster IP clusterIP: ""