Skip to content

Commit

Permalink
Update Spark Infrastructure naming convention
Browse files Browse the repository at this point in the history
Spark infrastructure now uses .Values.app.name for the naming convention
instead of .Release.name. Update helm tests and generated JDBC
connections.
  • Loading branch information
cwoods-cpointe authored and ewilkins-csi committed Oct 22, 2024
1 parent cdc8269 commit c2ab354
Show file tree
Hide file tree
Showing 20 changed files with 111 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ _**NOTE:**_ *the version should match the aiSSEMBLE project version.*

| Property | Description | Default |
|----------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------|
| app.name | Sets label for app.kubernetes.io/name | Chart.Name (aissemble-spark-history-chart) |
| enable | Enable or disable the entirety of the spark-history-server deployment. When false, equivalent to not installing the chart. | true |
| deployment.annotations | Annotations to apply to the Spark History Server Deployment. | {} |
| deployment.labels | Labels to apply to the Spark History Server Deployment. | {} |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-shs-spark-config
name: {{ .Values.app.name }}-spark-config
data:
sparkConf:
{{- toYaml .Values.sparkConf | nindent 8 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-shs
name: "{{ .Values.app.name | default .Chart.Name }}"
{{- if .Values.deployment.annotations }}
annotations:
{{ toYaml .Values.deployment.annotations | default "" }}
{{- end }}
labels:
app: {{ .Release.Name }}
{{- if .Values.deployment.labels }}
{{ toYaml .Values.deployment.labels }}
{{- end }}
app.kubernetes.io/instance: "{{ .Values.app.name | default .Chart.Name }}"
app.kubernetes.io/name: "{{ .Values.app.name | default .Chart.Name }}"
{{- if .Values.deployment.labels }}
{{ toYaml .Values.deployment.labels }}
{{- end }}
spec:
replicas: {{ .Values.deployment.replicas }}
selector:
matchLabels:
app: {{ .Release.Name }}
app.kubernetes.io/instance: "{{ .Values.app.name | default .Chart.Name }}"
app.kubernetes.io/name: "{{ .Values.app.name | default .Chart.Name }}"
{{- if .Values.deployment.labels }}
{{ toYaml .Values.deployment.labels }}
{{- end }}
Expand All @@ -27,7 +29,8 @@ spec:
{{ toYaml .Values.deployment.annotations | default "" }}
{{- end }}
labels:
app: {{ .Release.Name }}
app.kubernetes.io/instance: "{{ .Values.app.name | default .Chart.Name }}"
app.kubernetes.io/name: "{{ .Values.app.name | default .Chart.Name }}"
{{- if .Values.deployment.labels }}
{{ toYaml .Values.deployment.labels }}
{{- end }}
Expand Down Expand Up @@ -112,7 +115,7 @@ spec:
{{- if not (eq .Values.sparkConf "") }}
- name: spark-config
configMap:
name: {{ .Release.Name }}-shs-spark-config
name: {{ .Values.app.name }}-spark-config
items:
- key: sparkConf
path: spark-defaults.conf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Release.Name }}-shs-ingress
name: {{ .Values.app.name | default .Chart.Name }}
{{- with .Values.ingress.metadata.annotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
ingressClassName: {{ .Values.ingress.ingressClassName }}
rules:
{{- $releasename := printf "%s-service" .Release.Name }}
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
Expand All @@ -20,7 +19,7 @@ spec:
pathType: {{ .pathType }}
backend:
service:
name: {{ .backend.service.name | default $releasename }}
name: {{ required "A valid .backend.service.name entry required." .backend.service.name }}
port:
number: {{ .backend.service.port.number }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-shs-service
labels:
app.kubernetes.io/instance: {{ .Values.app.name | default .Chart.Name }}
app.kubernetes.io/name: {{ .Values.app.name | default .Chart.Name }}
name: {{ .Values.app.name | default .Chart.Name }}
{{- if .Values.service.annotations }}
annotations: {{ .Values.service.annotations }}
{{- end }}
spec:
type: {{.Values.service.type }}
selector:
app: {{ .Release.Name }}
app.kubernetes.io/instance: {{ .Values.app.name | default .Chart.Name }}
app.kubernetes.io/name: {{ .Values.app.name | default .Chart.Name }}
ports:
- name: {{ .Values.service.port.name }}
protocol: TCP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,23 @@ tests:
deployment.labels.label1: label2
asserts:
- equal:
path: metadata.labels.app
value: RELEASE-NAME
path: spec.selector.matchLabels["app.kubernetes.io/instance"]
value: aissemble-spark-history-chart
- equal:
path: spec.template.metadata.labels.app
value: RELEASE-NAME
path: spec.selector.matchLabels["app.kubernetes.io/name"]
value: aissemble-spark-history-chart
- equal:
path: spec.selector.matchLabels.app
value: RELEASE-NAME
path: metadata.labels["app.kubernetes.io/instance"]
value: aissemble-spark-history-chart
- equal:
path: metadata.labels["app.kubernetes.io/name"]
value: aissemble-spark-history-chart
- equal:
path: spec.template.metadata.labels["app.kubernetes.io/instance"]
value: aissemble-spark-history-chart
- equal:
path: spec.template.metadata.labels["app.kubernetes.io/name"]
value: aissemble-spark-history-chart

- it: Should apply requested annotations
set:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ tests:
asserts:
- equal:
path: metadata.name
value: RELEASE-NAME-shs-ingress
value: aissemble-spark-history-chart
- notExists:
path: metadata.annotations

Expand Down Expand Up @@ -78,7 +78,7 @@ tests:
value: Prefix
- equal:
path: spec.rules[0].http.paths[0].backend.service.name
value: RELEASE-NAME-service
value: spark-history
- equal:
path: spec.rules[0].http.paths[0].backend.service.port.number
value: 18080
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,18 @@ tests:
count: 1
- equal:
path: metadata.name
value: RELEASE-NAME-shs-service
value: aissemble-spark-history-chart
- notExists:
path: metadata.annotations
- equal:
path: spec.type
value: LoadBalancer
- equal:
path: spec.selector.app
value: RELEASE-NAME
path: spec.selector["app.kubernetes.io/instance"]
value: aissemble-spark-history-chart
- equal:
path: spec.selector["app.kubernetes.io/name"]
value: aissemble-spark-history-chart
- contains:
path: spec.ports
content:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ tests:
- it: If spark conf is specified, the ConfigMap should be created with the provided values
set:
sparkConf: "spark.executor.instances: 2"
app.name: "spark-history"
templates:
- configmap.yaml
asserts:
Expand All @@ -25,14 +26,15 @@ tests:
- notFailedTemplate: {}
- equal:
path: metadata.name
value: "RELEASE-NAME-shs-spark-config"
value: "spark-history-spark-config"
- equal:
path: data.sparkConf
value: "spark.executor.instances: 2"

- it: If spark conf is specified, a volume should be created from the created configmap
set:
sparkConf: "spark.executor.instances: 2"
app.name: "spark-history"
templates:
- deployment.yaml
asserts:
Expand All @@ -41,7 +43,7 @@ tests:
content:
name: spark-config
configMap:
name: RELEASE-NAME-shs-spark-config
name: spark-history-spark-config
items:
- key: sparkConf
path: spark-defaults.conf
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# This file contains the default values for the aiSSEMBLE Spark History Helm chart.
app:
# Sets labels for app.kubernetes.io/name Default is Chart.Name (aissemble-spark-history-chart)
name: ''

enable: true

Expand Down Expand Up @@ -40,6 +43,7 @@ ingress:
pathType: Prefix
backend:
service:
name: spark-history
port:
number: 18080

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ _**NOTE:**_ *the version should match the aiSSEMBLE project version.*

| Property | Description | Default |
|----------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------|
| app.name | Sets label for app.kubernetes.io/name | Chart.Name (aissemble-thrift-server-chart) |
| enable | Enable or disable the entirety of the spark-thrift-server deployment. When false, equivalent to not installing the chart. | true |
| deployment.annotations | Annotations to apply to the Spark Thrift Server Deployment. | {} |
| deployment.labels | Labels to apply to the Spark Thrift Server Deployment. | {} |
Expand Down Expand Up @@ -48,6 +49,10 @@ _**NOTE:**_ *the version should match the aiSSEMBLE project version.*
If you are migrating from the v1 version of the spark-infrastructure chart, use the tables below to apply any
existing customizations from the old chart to the new v2 chart.

Any connections to the thrift server will need to be updated to include the new `.Values.app.name` as the host name for
the connection. Previously the default name was `spark-infrastructure`. For instance the Data Access JDBC url will need
to be updated to match the app name.

## Property Location

All properties listed below have been moved to the parent chart. If any properties are set to the default value, we
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-sts
name: "{{ .Values.app.name | default .Chart.Name }}"
{{- if .Values.deployment.annotations }}
annotations:
{{ toYaml .Values.deployment.annotations | default "" }}
{{- end }}
labels:
app: {{ .Release.Name }}
{{- if .Values.deployment.labels }}
{{ toYaml .Values.deployment.labels }}
{{- end }}
app.kubernetes.io/instance: "{{ .Values.app.name | default .Chart.Name }}"
app.kubernetes.io/name: "{{ .Values.app.name | default .Chart.Name }}"
{{- if .Values.deployment.labels }}
{{ toYaml .Values.deployment.labels }}
{{- end }}
spec:
replicas: {{ .Values.deployment.replicas }}
selector:
matchLabels:
app: {{ .Release.Name }}
app.kubernetes.io/instance: "{{ .Values.app.name | default .Chart.Name }}"
app.kubernetes.io/name: "{{ .Values.app.name | default .Chart.Name }}"
{{- if .Values.deployment.labels }}
{{ toYaml .Values.deployment.labels }}
{{- end }}
Expand All @@ -27,14 +29,15 @@ spec:
{{ toYaml .Values.deployment.annotations | default "" }}
{{- end }}
labels:
app: {{ .Release.Name }}
app.kubernetes.io/instance: "{{ .Values.app.name | default .Chart.Name }}"
app.kubernetes.io/name: "{{ .Values.app.name | default .Chart.Name }}"
{{- if .Values.deployment.labels }}
{{ toYaml .Values.deployment.labels }}
{{- end }}
spec:
{{- if or (not (empty .Values.dependencies.packages)) (not (empty .Values.dependencies.jars)) }}
initContainers:
- name: "populate-sts-jar-volume"
- name: "populate-thrift-service-jar-volume"
image: {{ .Values.deployment.image.repository }}:{{ .Values.deployment.image.tag }}
imagePullPolicy: {{ .Values.deployment.image.imagePullPolicy | default "IfNotPresent" }}
command: ["sh", "-c", "cp /opt/spark/jars/* /tmp/jars/"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Release.Name }}-sts-ingress
name: {{ .Values.app.name | default .Chart.Name }}
{{- with .Values.ingress.metadata.annotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
ingressClassName: {{ .Values.ingress.ingressClassName }}
rules:
{{- $releasename := printf "%s-service" .Release.Name }}
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
Expand All @@ -20,7 +19,7 @@ spec:
pathType: {{ .pathType }}
backend:
service:
name: {{ .backend.service.name | default $releasename }}
name: {{ .backend.service.name }}
port:
number: {{ .backend.service.port.number }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-sts-service
labels:
app.kubernetes.io/instance: {{ .Values.app.name | default .Chart.Name }}
app.kubernetes.io/name: {{ .Values.app.name | default .Chart.Name }}
name: {{ .Values.app.name | default .Chart.Name }}
{{- if .Values.service.annotations }}
annotations: {{ .Values.service.annotations }}
{{- end }}
spec:
type: {{.Values.service.type }}
selector:
app: {{ .Release.Name }}
app.kubernetes.io/instance: {{ .Values.app.name | default .Chart.Name }}
app.kubernetes.io/name: {{ .Values.app.name | default .Chart.Name }}
ports:
{{ .Values.service.ports | toYaml | nindent 4}}
{{- end }}
Loading

0 comments on commit c2ab354

Please sign in to comment.