Skip to content

Commit

Permalink
Revert "feat(helm): bump minimum supported kubernetes version to 0.19 (
Browse files Browse the repository at this point in the history
…#7925)" (#7968)

This reverts commit fb025dc.
  • Loading branch information
rexledesma committed May 19, 2022
1 parent 738799d commit b66a915
Show file tree
Hide file tree
Showing 8 changed files with 167 additions and 12 deletions.
2 changes: 1 addition & 1 deletion helm/dagster/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v2
name: dagster
version: 0.0.1-dev
kubeVersion: ">= 1.19.0-0"
kubeVersion: ">= 1.18.0-0"
description: The data orchestration platform built for productivity.
type: application
keywords:
Expand Down
2 changes: 1 addition & 1 deletion helm/dagster/charts/dagster-user-deployments/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v2
name: dagster-user-deployments
version: 0.0.1-dev
kubeVersion: ">= 1.19.0-0"
kubeVersion: ">= 1.18.0-0"
description: A chart to deploy code servers for your Dagster deployment.
type: application
keywords:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class FlowerIngressConfiguration(BaseModel):

class Ingress(BaseModel):
enabled: bool
apiVersion: Optional[str]
annotations: kubernetes.Annotations
dagit: DagitIngressConfiguration
readOnlyDagit: DagitIngressConfiguration
Expand Down
67 changes: 59 additions & 8 deletions helm/dagster/schema/schema_tests/test_ingress.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,37 @@
from schema.utils.helm_template import HelmTemplate


@pytest.fixture(name="template")
def helm_template() -> HelmTemplate:
return HelmTemplate(
@pytest.fixture(name="template_function")
def helm_template_function():
return lambda output, model: HelmTemplate(
helm_dir_path="helm/dagster",
subchart_paths=["charts/dagster-user-deployments"],
output="templates/ingress.yaml",
model=models.V1Ingress,
output=output,
model=model,
)


def test_ingress(template):
@pytest.mark.parametrize(
argnames=["output", "model", "api_version"],
argvalues=[
(
"templates/ingress-v1beta1.yaml",
models.ExtensionsV1beta1Ingress,
"extensions/v1beta1/Ingress",
),
(
"templates/ingress.yaml",
models.V1Ingress,
"networking.k8s.io/v1/Ingress",
),
],
)
def test_ingress(template_function, output, model, api_version):
template = template_function(output, model)
helm_values = DagsterHelmValues.construct(
ingress=Ingress.construct(
enabled=True,
apiVersion=api_version,
dagit=DagitIngressConfiguration.construct(
host="foobar.com",
path="bing",
Expand All @@ -53,10 +70,27 @@ def test_ingress(template):
assert rule.host == "foobar.com"


def test_ingress_read_only(template):
@pytest.mark.parametrize(
argnames=["output", "model", "api_version"],
argvalues=[
(
"templates/ingress-v1beta1.yaml",
models.ExtensionsV1beta1Ingress,
"extensions/v1beta1/Ingress",
),
(
"templates/ingress.yaml",
models.V1Ingress,
"networking.k8s.io/v1/Ingress",
),
],
)
def test_ingress_read_only(template_function, output, model, api_version):
template = template_function(output, model)
helm_values = DagsterHelmValues.construct(
ingress=Ingress.construct(
enabled=True,
apiVersion=api_version,
dagit=DagitIngressConfiguration.construct(
host="foobar.com",
path="bing",
Expand Down Expand Up @@ -93,7 +127,23 @@ def test_ingress_read_only(template):
assert [rule.host for rule in ingress.spec.rules] == ["foobar.com", "dagster.io"]


def test_ingress_tls(template):
@pytest.mark.parametrize(
argnames=["output", "model", "api_version"],
argvalues=[
(
"templates/ingress-v1beta1.yaml",
models.ExtensionsV1beta1Ingress,
"extensions/v1beta1/Ingress",
),
(
"templates/ingress.yaml",
models.V1Ingress,
"networking.k8s.io/v1/Ingress",
),
],
)
def test_ingress_tls(template_function, output, model, api_version):
template = template_function(output, model)
dagit_host = "dagit.com"
dagit_readonly_host = "dagit-readonly.com"
flower_host = "flower.com"
Expand All @@ -105,6 +155,7 @@ def test_ingress_tls(template):
helm_values = DagsterHelmValues.construct(
ingress=Ingress.construct(
enabled=True,
apiVersion=api_version,
dagit=DagitIngressConfiguration.construct(
host=dagit_host,
pathType=IngressPathType.IMPLEMENTATION_SPECIFIC,
Expand Down
3 changes: 2 additions & 1 deletion helm/dagster/schema/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
install_requires=["click", "pydantic"],
extras_require={
"test": [
"kubernetes",
# remove pin once minimum supported kubernetes version is 1.19
"kubernetes<22.6.0"
]
},
entry_points={
Expand Down
95 changes: 95 additions & 0 deletions helm/dagster/templates/ingress-v1beta1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{{- $apiVersion := .Values.ingress.apiVersion | default "" }}
{{- $hasApiVersion := (not (.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress")) }}
{{- $hasOverrideApiVersion := eq $apiVersion "extensions/v1beta1/Ingress" }}
{{- if and (.Values.ingress.enabled) (or $hasApiVersion $hasOverrideApiVersion) }}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ include "dagster.fullname" . }}-ingress
labels:
{{- include "dagster.labels" . | nindent 4 }}
annotations:
{{- range $key, $value := .Values.ingress.annotations }}
{{ $key }}: {{ $value | squote }}
{{- end }}
spec:
# See: https://github.com/helm/charts/blob/master/stable/airflow/templates/ingress-web.yaml
tls:
{{- if .Values.ingress.dagit.tls.enabled }}
- hosts:
- {{ .Values.ingress.dagit.host }}
secretName: {{ .Values.ingress.dagit.tls.secretName }}
{{- end }}
{{- if .Values.ingress.readOnlyDagit.tls.enabled }}
- hosts:
- {{ .Values.ingress.readOnlyDagit.host }}
secretName: {{ .Values.ingress.readOnlyDagit.tls.secretName }}
{{- end }}
{{- if .Values.ingress.flower.tls.enabled }}
- hosts:
- {{ .Values.ingress.flower.host }}
secretName: {{ .Values.ingress.flower.tls.secretName }}
{{- end }}
rules:
- host: {{ .Values.ingress.dagit.host }}
http:
paths:
{{- range .Values.ingress.dagit.precedingPaths }}
- path: {{ .path }}
backend:
serviceName: {{ .serviceName }}
servicePort: {{ .servicePort }}
{{- end }}
- path: {{ .Values.ingress.dagit.path | default "/*" }}
backend:
serviceName: {{ include "dagster.dagit.fullname" . }}
servicePort: {{ .Values.dagit.service.port | default 80 }}
{{- range .Values.ingress.dagit.succeedingPaths }}
- path: {{ .path }}
backend:
serviceName: {{ .serviceName }}
servicePort: {{ .servicePort }}
{{- end }}
{{- if .Values.dagit.enableReadOnly }}
- host: {{ .Values.ingress.readOnlyDagit.host }}
http:
paths:
{{- range .Values.ingress.readOnlyDagit.precedingPaths }}
- path: {{ .path }}
backend:
serviceName: {{ .serviceName }}
servicePort: {{ .servicePort }}
{{- end }}
- path: {{ .Values.ingress.readOnlyDagit.path | default "/*" }}
backend:
serviceName: {{ template "dagster.dagit.fullname" dict "Values" .Values "Release" .Release "dagitReadOnly" true }}
servicePort: {{ .Values.dagit.service.port | default 80 }}
{{- range .Values.ingress.readOnlyDagit.succeedingPaths }}
- path: {{ .path }}
backend:
serviceName: {{ .serviceName }}
servicePort: {{ .servicePort }}
{{- end }}
{{end}}
{{- if .Values.flower.enabled }}
- host: {{ .Values.ingress.flower.host }}
http:
paths:
{{- range .Values.ingress.flower.precedingPaths }}
- path: {{ .path }}
backend:
serviceName: {{ .serviceName }}
servicePort: {{ .servicePort }}
{{- end }}
- path: {{ .Values.ingress.flower.path | default "/*" }}
backend:
serviceName: {{ template "dagster.fullname" . }}-flower-service
servicePort: {{ .Values.flower.service.port }}
{{- range .Values.ingress.flower.succeedingPaths }}
- path: {{ .path }}
backend:
serviceName: {{ .serviceName }}
servicePort: {{ .servicePort }}
{{- end }}
{{end}}
{{end}}
5 changes: 4 additions & 1 deletion helm/dagster/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{{- if .Values.ingress.enabled }}
{{- $apiVersion := .Values.ingress.apiVersion | default "" }}
{{- $hasApiVersion := (.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress") }}
{{- $hasOverrideApiVersion := eq $apiVersion "networking.k8s.io/v1/Ingress" }}
{{- if and (.Values.ingress.enabled) (or $hasApiVersion $hasOverrideApiVersion) }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
Expand Down
4 changes: 4 additions & 0 deletions helm/dagster/values.schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b66a915

Please sign in to comment.