-
Notifications
You must be signed in to change notification settings - Fork 0
Migrate Helm chart from Deployment to StatefulSet with per-pod services #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
95af076
Initial plan
Copilot a94d06d
Implement StatefulSet with per-pod services
Copilot be92913
Update NOTES.txt for StatefulSet architecture
Copilot 17c35b7
Fix per-pod services with autoscaling
Copilot 60941dc
Add clarifying comments to templates
Copilot b2231fd
Enhance documentation to clarify DNS, ports, and LoadBalancer usage
Copilot 9254091
Merge branch 'main' into copilot/update-helm-charts-statefulset
rrobetti 6c05757
Bump chart version to 0.1.5
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,27 @@ | ||
| Test the installation with the steps below: | ||
|
|
||
| 1. Port-forward Server service: | ||
| 1. Port-forward to a specific OJP Server pod: | ||
|
|
||
| {{- if .Values.server.opentelemetry.enabled }} | ||
| kubectl -n {{ .Release.Namespace }} port-forward svc/ojp-server {{ .Values.server.prometheusPort }}:{{ .Values.server.prometheusPort }} & | ||
| kubectl -n {{ .Release.Namespace }} port-forward {{ include "ojp-server.fullname" . }}-0 {{ .Values.server.prometheusPort }}:{{ .Values.server.prometheusPort }} & | ||
| {{- end }} | ||
| kubectl -n {{ .Release.Namespace }} port-forward svc/ojp-server {{ .Values.service.port }}:{{ .Values.service.port }} & | ||
| kubectl -n {{ .Release.Namespace }} port-forward {{ include "ojp-server.fullname" . }}-0 {{ .Values.service.port }}:{{ .Values.service.port }} & | ||
|
|
||
| 2. Happy Proxying with OJP! | ||
| {{- if .Values.service.perPodService.enabled }} | ||
|
|
||
| 2. Access individual OJP Server instances via their per-pod services: | ||
|
|
||
| {{- if eq .Values.service.perPodService.type "LoadBalancer" }} | ||
| # Get LoadBalancer external IPs for each pod | ||
| {{- range $i := until (int .Values.replicaCount) }} | ||
| kubectl -n {{ $.Release.Namespace }} get svc {{ include "ojp-server.fullname" $ }}-{{ $i }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}' | ||
| {{- end }} | ||
| {{- else if eq .Values.service.perPodService.type "NodePort" }} | ||
| # Get NodePort for each pod service | ||
| {{- range $i := until (int .Values.replicaCount) }} | ||
| kubectl -n {{ $.Release.Namespace }} get svc {{ include "ojp-server.fullname" $ }}-{{ $i }} -o jsonpath='{.spec.ports[0].nodePort}' | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- end }} | ||
|
|
||
| 3. Happy Proxying with OJP! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| {{- /* | ||
| Per-pod services are only created when autoscaling is disabled because: | ||
| - Autoscaling dynamically changes the number of pods | ||
| - Per-pod services are created based on a static replicaCount value | ||
| - This prevents service/pod mismatches (missing services for new pods or orphaned services) | ||
| */ -}} | ||
| {{- if and .Values.service.perPodService.enabled (not .Values.autoscaling.enabled) }} | ||
| {{- $fullName := include "ojp-server.fullname" . -}} | ||
| {{- $serviceType := .Values.service.perPodService.type -}} | ||
| {{- $serverPort := .Values.server.port -}} | ||
| {{- $prometheusPort := .Values.server.prometheusPort -}} | ||
| {{- $labels := include "ojp-server.labels" . -}} | ||
| {{- $selectorLabels := include "ojp-server.selectorLabels" . -}} | ||
| {{- $namespace := .Release.Namespace -}} | ||
| {{- range $i := until (int .Values.replicaCount) }} | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| namespace: {{ $namespace }} | ||
| name: {{ $fullName }}-{{ $i }} | ||
| labels: | ||
| {{- $labels | nindent 4 }} | ||
| statefulset.kubernetes.io/pod-name: {{ $fullName }}-{{ $i }} | ||
| spec: | ||
| type: {{ $serviceType }} | ||
| ports: | ||
| - port: {{ $serverPort }} | ||
| targetPort: http | ||
| protocol: TCP | ||
| name: http | ||
| - port: {{ $prometheusPort }} | ||
| targetPort: prometheus | ||
| protocol: TCP | ||
| name: prometheus | ||
| selector: | ||
| {{- $selectorLabels | nindent 4 }} | ||
| statefulset.kubernetes.io/pod-name: {{ $fullName }}-{{ $i }} | ||
| {{- end }} | ||
| {{- end }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Does this means that each pod of OJP server gets its own loadbalancer in front? what is the advantage here? is it to just have a DNS name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, each pod gets its own LoadBalancer. The advantages are:
This enables use cases where clients need to maintain connections to specific OJP instances rather than load-balanced connections. See the new "Why Per-Pod Services?" section in the README (commit b2231fd).