Alan
05/29/2024, 10:57 PMresource "helm_release" "prefect_server" {
name = "prefect-server"
namespace = "${var.environment}-prefect"
chart = "prefect-server"
repository = "<https://prefecthq.github.io/prefect-helm>"
version = "2024.5.23194919"
values = [templatefile("${path.module}/values.yaml", {
PREFECT_API_URL = "prefect.${var.product_name}-${var.environment}.********:4200/api"
EXISTING_SECRET = kubernetes_secret.db_secret.metadata[0].name
EXTERNAL_HOST = data.aws_db_instance.selected.address
HOST_NAME = "${var.product_name}-${var.environment}.*******.com"
CERTIFICATE_ARN = data.aws_acm_certificate.env.arn
HOST_NAME = "prefect.${var.product_name}-${var.environment}.*****.com"
})]
}
Marvin
05/29/2024, 10:58 PMportNumber
for the service in the ingress for the Prefect Helm chart. However, based on standard Helm chart configurations, you can specify such settings via the values.yaml
file.
Here's a potential way to include the port settings in your values.yaml
file:
yaml
ingress:
enabled: true
hosts:
- host: "prefect.${var.product_name}-${var.environment}.*******.com"
paths:
- path: /
pathType: Prefix
service:
name: prefect-server
port:
number: 4200
annotations:
# Add your ingress annotations here
tls:
- hosts:
- "prefect.${var.product_name}-${var.environment}.*******.com"
secretName: "${var.product_name}-${var.environment}-tls"
You can then reference this values.yaml
file in your Terraform code:
hcl
resource "helm_release" "prefect_server" {
name = "prefect-server"
namespace = "${var.environment}-prefect"
chart = "prefect-server"
repository = "<https://prefecthq.github.io/prefect-helm>"
version = "2024.5.23194919"
values = [templatefile("${path.module}/values.yaml", {
PREFECT_API_URL = "prefect.${var.product_name}-${var.environment}.********:4200/api"
EXISTING_SECRET = kubernetes_secret.db_secret.metadata[0].name
EXTERNAL_HOST = data.aws_db_instance.selected.address
HOST_NAME = "${var.product_name}-${var.environment}.*******.com"
CERTIFICATE_ARN = data.aws_acm_certificate.env.arn
# No need to set HOST_NAME again, it's already defined above
})]
}
Adjust the name
, namespace
, and other variables accordingly to fit your setup.
For further details or if you encounter issues, consider checking out the Prefect Helm chart repository and their GitHub documentation for any updates or community advice.Alan
05/29/2024, 11:23 PMingress:
# -- enable ingress record generation for server
enabled: true
# -- port for the ingress' main path
#servicePort: 4200
## This is supported in Kubernetes 1.18+ and required if you have more than one IngressClass marked as the default for your cluster .
## ref: <https://kubernetes.io/blog/2020/04/02/improvements-to-the-ingress-api-in-kubernetes-1.18/>
# -- IngressClass that will be used to implement the Ingress (Kubernetes 1.18+)
className: ""
host:
# -- default host for the ingress record
hostname: ${HOST_NAME}
# -- default path for the ingress record
path: /
# -- ingress path type
pathType: Prefix
Marvin
05/29/2024, 11:27 PMvalues.yaml
snippet, it appears that the field responsible for setting the service port number for the ingress is commented out:
yaml
# -- port for the ingress' main path
#servicePort: 4200
You need to uncomment and set the servicePort
to the desired value. Here's the adjusted configuration:
yaml
ingress:
# -- enable ingress record generation for server
enabled: true
# -- port for the ingress' main path
servicePort: 4200
# This is supported in Kubernetes 1.18+ and required if you have more than one IngressClass marked as the default for your cluster .
# ref: <https://kubernetes.io/blog/2020/04/02/improvements-to-the-ingress-api-in-kubernetes-1.18/>
# -- IngressClass that will be used to implement the Ingress (Kubernetes 1.18+)
className: ""
host:
# -- default host for the ingress record
hostname: ${HOST_NAME}
# -- default path for the ingress record
path: /
# -- ingress path type
pathType: Prefix
Make sure to modify your values.yaml
to include servicePort: 4200
and adjust the port number as required for your service.Alan
05/29/2024, 11:29 PMmodule.prefect.helm_release.prefect_server: Modifying... [id=prefect-server]
╷
│ Error: values don't meet the specifications of the schema(s) in the following chart(s):
│ prefect-server:
│ - ingress: Additional property servicePort is not allowed
│
│
│ with module.prefect.helm_release.prefect_server,
│ on ../../tfmodules/prefect/main.tf line 1, in resource "helm_release" "prefect_server":
│ 1: resource "helm_release" "prefect_server" {
│
╵
Marvin
05/29/2024, 11:29 PMservicePort
property is not recognized by the Helm chart's schema for the ingress
section, suggesting that this field may not be used or supported in the values.yaml
file for the Prefect Helm chart.
Let's re-examine the values in the Helm chart and review the official Prefect Helm chart's `values.yaml` file directly for how ports are typically configured.
To set the service port for ingress, we should configure the service
section instead:
yaml
ingress:
# Enable ingress record generation for server
enabled: true
# This is supported in Kubernetes 1.18+ and required if you have more than one IngressClass marked as the default for your cluster .
# ref: <https://kubernetes.io/blog/2020/04/02/improvements-to-the-ingress-api-in-kubernetes-1.18/>
# IngressClass that will be used to implement the Ingress (Kubernetes 1.18+)
className: ""
host:
# Default host for the ingress record
hostname: ${HOST_NAME}
# Default path for the ingress record
path: /
# Ingress path type
pathType: Prefix
service:
# type of service
type: ClusterIP
# Commented out: port and targetPort for the ingress
ports:
- name: http
port: 80
targetPort: 4200
In the above configuration, the service.ports[0].targetPort
should be set to the desired port, which in your case is 4200
.
Ensure your Terraform template file reflects this correctly:
hcl
resource "helm_release" "prefect_server" {
name = "prefect-server"
namespace = "${var.environment}-prefect"
chart = "prefect-server"
repository = "<https://prefecthq.github.io/prefect-helm>"
version = "2024.5.23194919"
values = [templatefile("${path.module}/values.yaml", {
PREFECT_API_URL = "prefect.${var.product_name}-${var.environment}.********:4200/api"
EXISTING_SECRET = kubernetes_secret.db_secret.metadata[0].name
EXTERNAL_HOST = data.aws_db_instance.selected.address
HOST_NAME = "${var.product_name}-${var.environment}.*******.com"
CERTIFICATE_ARN = data.aws_acm_certificate.env.arn
})]
}
Ensure your values.yaml
file has the correct service
configuration. If you encounter issues, check for an updated or more detailed example from the official repository.