Skip to content

Commit

Permalink
(fix): Allow helm chart to support arbitrary nodePort value
Browse files Browse the repository at this point in the history
fixes: apache#981
  • Loading branch information
kameshsampath committed Feb 11, 2025
1 parent be343f1 commit 330f0a3
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 29 deletions.
4 changes: 2 additions & 2 deletions helm/polaris/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ spec:
mountPath: /eclipselink-config
{{- end }}
ports:
{{- range $portName, $portNumber := .Values.service.ports }}
{{- range $portName, $port := .Values.service.ports }}
- name: {{ $portName }}
containerPort: {{ $portNumber }}
containerPort: {{ $port.port }}
protocol: TCP
{{- end }}
livenessProbe:
Expand Down
11 changes: 7 additions & 4 deletions helm/polaris/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,16 @@ metadata:
{{- tpl (toYaml .Values.service.annotations) . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
type: {{ .Values.service.type | default "ClusterIP" }}
selector:
{{- include "polaris.selectorLabels" . | nindent 4 }}
ports:
{{- range $portName, $portNumber := .Values.service.ports }}
- port: {{ $portNumber }}
targetPort: {{ $portNumber }}
{{- range $portName, $port := .Values.service.ports }}
- port: {{ $port.port }}
targetPort: {{ $port.port }}
{{- if and (eq $.Values.service.type "NodePort") $port.nodePort }}
nodePort: {{ $port.nodePort }}
{{- end }}
protocol: TCP
name: {{ $portName }}
{{- end }}
Expand Down
38 changes: 31 additions & 7 deletions helm/polaris/tests/service_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ templates:
- service.yaml

tests:

# metadata.name
- it: should set service name
asserts:
Expand Down Expand Up @@ -126,18 +125,45 @@ tests:
set:
service:
ports:
polaris-service: 18181
polaris-metrics: 18182
polaris-service:
port: 18181
polaris-metrics:
port: 18182
asserts:
- equal:
path: spec.ports
value:
- port: 18182
targetPort: 18182
protocol: TCP
name: polaris-metrics
- port: 18181
targetPort: 18181
protocol: TCP
name: polaris-service
- it: should set service nodeports
set:
service:
type: NodePort
ports:
polaris-service:
port: 18181
nodePort: 32181
polaris-metrics:
port: 18182
nodePort: 32182
asserts:
- equal:
path: spec.ports
value:
- port: 18182
targetPort: 18182
nodePort: 32181
protocol: TCP
name: polaris-metrics
- port: 18181
targetPort: 18181
nodePort: 32182
protocol: TCP
name: polaris-service

Expand All @@ -146,13 +172,11 @@ tests:
asserts:
- equal:
path: spec.sessionAffinity
value:
None
value: None
- it: should set service session affinity
set:
service.sessionAffinity: ClientIP
asserts:
- equal:
path: spec.sessionAffinity
value:
ClientIP
value: ClientIP
33 changes: 17 additions & 16 deletions helm/polaris/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ toolsImage:
imagePullSecrets: []
# - registry-creds


serviceAccount:
# -- Specifies whether a service account should be created.
create: true
Expand All @@ -55,7 +54,6 @@ serviceAccount:
# If not set and create is true, a name is generated using the fullname template.
name: ""


# -- Annotations to apply to polaris pods.
podAnnotations: {}

Expand Down Expand Up @@ -85,16 +83,20 @@ securityContext:

# Polaris service settings.
service:
# -- The type of service to create.
# -- The type of service to create. ClusterIP/NodePort/LoadBalancer
type: ClusterIP
# -- The ports the service will listen on. Two ports are required: one for the Polaris service and
# one for the metrics API.
# Note: port names must be unique and no more than 15 characters long.
ports:
# polaris-server: The port the Polaris server listens on for API requests.
polaris-service: 8181
polaris-service:
port: 8181
nodePort: ""
# polaris-metrics: The port the Polaris server listens on for metrics API requests (health checks, metrics, etc.).
polaris-metrics: 8182
polaris-metrics:
port: 8182
nodePort: ""
# -- The session affinity for the service. Valid values are: None, ClientIP.
# ClientIP enables sticky sessions based on the client's IP address.
# This is generally beneficial to Polaris deployments, but some testing may be
Expand All @@ -118,9 +120,8 @@ ingress:
# -- Specifies whether an ingress should be created.
enabled: false
# -- Annotations to add to the ingress.
annotations: {
# nginx.ingress.kubernetes.io/upstream-hash-by: "$binary_remote_addr"
}
annotations: {}
# nginx.ingress.kubernetes.io/upstream-hash-by: "$binary_remote_addr"
# -- A list of host paths used to configure the ingress.
hosts:
- host: chart-example.local
Expand Down Expand Up @@ -218,8 +219,7 @@ readinessProbe:
# You can pass here any valid EnvVar object:
# https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#envvar-v1-core
# This can be useful to get configuration values from Kubernetes secrets or config maps.
extraEnv:
[]
extraEnv: []
# - name: AWS_STORAGE_BUCKET
# value: s3://xxxxx/
# - name: AWS_ACCESS_KEY_ID
Expand Down Expand Up @@ -324,9 +324,9 @@ polarisServerConfig:
oauth2:
type: test
# type: default # - uncomment to support Auth0 JWT tokens
# tokenBroker:
# type: symmetric-key
# secret: polaris
# tokenBroker:
# type: symmetric-key
# secret: polaris

authenticator:
class: org.apache.polaris.service.auth.TestInlineBearerTokenPolarisAuthenticator
Expand Down Expand Up @@ -356,7 +356,6 @@ polarisServerConfig:
# Logging settings.

logging:

# The default level of all loggers. Can be OFF, ERROR, WARN, INFO, DEBUG, TRACE, or ALL.
level: INFO

Expand All @@ -366,14 +365,16 @@ polarisServerConfig:
org.apache.polaris: DEBUG

appenders:

- type: console
# If true, write log statements to stdout.
# enabled: true
# Do not display log statements below this threshold to stdout.
threshold: ALL
# Custom Logback PatternLayout with threadname.
logFormat: "%-5p [%d{ISO8601} - %-6r] [%t] [%X{aid}%X{sid}%X{tid}%X{wid}%X{oid}%X{srv}%X{job}%X{rid}] %c{30}: %m %kvp%n%ex"
logFormat:
"%-5p [%d{ISO8601} - %-6r] [%t]
[%X{aid}%X{sid}%X{tid}%X{wid}%X{oid}%X{srv}%X{job}%X{rid}] %c{30}: %m
%kvp%n%ex"

# # Settings for logging to a file.
# - type: file
Expand Down

0 comments on commit 330f0a3

Please sign in to comment.