Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
c73fbfb
Add support for additional ports in service template
fedemaleh Sep 10, 2025
1095afe
feat: add GRPC support
javi-null Sep 12, 2025
8597dd0
feat: add GRPC support - print context
javi-null Sep 12, 2025
b1fc6e6
fix: port colission
javi-null Sep 15, 2025
5acfc45
fix: port colission
javi-null Sep 15, 2025
bce2139
fix: port colission
javi-null Sep 15, 2025
824a5fe
fix: port colission
javi-null Sep 15, 2025
d1ffd1f
fix: port colission
javi-null Sep 15, 2025
57cd0af
fix: ports
javi-null Sep 16, 2025
17dfee9
wip
sebasnallar Sep 16, 2025
2ccf58f
fix: merge files
javi-null Sep 16, 2025
7220988
chore: remove echo
javi-null Sep 16, 2025
4a96823
feat: merge bg ingress
javi-null Sep 16, 2025
06a0555
feat: revert scaling and secret changes
javi-null Sep 17, 2025
05f611f
feat: revert scaling and secret changes
javi-null Sep 17, 2025
9e76fdc
feat: revert scaling and secret changes
javi-null Sep 17, 2025
318e937
feat: revert scaling and secret changes
javi-null Sep 17, 2025
cca1198
feat: custom domain
javi-null Sep 17, 2025
1f8efc7
Merge branch 'beta' into feature/grpc
javi-null Sep 17, 2025
309ad7f
chore: add reference to image traffic var
javi-null Sep 18, 2025
9af1afc
feat: remove pm2 and add grpc
javi-null Sep 18, 2025
437e2e8
fix: initial ingress
javi-null Sep 18, 2025
a18ff85
fix: initial ingress
javi-null Sep 18, 2025
342f324
fix: initial ingress
javi-null Sep 18, 2025
1ab40e1
fix: k8s modifier
javi-null Sep 18, 2025
b357873
fix: k8s modifier
javi-null Sep 18, 2025
cfec878
fix: alb for grpc
javi-null Sep 18, 2025
8d7662c
chore: uncomment apply
javi-null Sep 18, 2025
b71602d
chore: remove extra char
javi-null Sep 18, 2025
d538dca
chore: remove extra char
javi-null Sep 18, 2025
23f46c3
chore: remove echo
javi-null Sep 18, 2025
6bb8fa6
chore: rollback custom name
javi-null Sep 19, 2025
bd5e1e1
chore: fix indent
javi-null Sep 19, 2025
ec208c8
chore: fix indent
javi-null Sep 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 114 additions & 0 deletions k8s/deployment/templates/blue-green-ingress.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,117 @@ spec:
port:
name: use-annotation
{{- end }}

{{ if .scope.capabilities.additional_ports }}
{{ range .scope.capabilities.additional_ports }}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: k-8-s-{{ $.scope.slug }}-{{ $.scope.id }}-{{ if eq .type "HTTP" }}http{{ else }}grpc{{ end }}-{{ .port }}-{{ $.ingress_visibility }}
namespace: {{ $.k8s_namespace }}
labels:
nullplatform: "true"
account: {{ $.account.slug }}
account_id: "{{ $.account.id }}"
namespace: {{ $.namespace.slug }}
namespace_id: "{{ $.namespace.id }}"
application: {{ $.application.slug }}
application_id: "{{ $.application.id }}"
scope: {{ $.scope.slug }}
scope_id: "{{ $.scope.id }}"
{{- $global := index $.k8s_modifiers "global" }}
{{- if $global }}
{{- $labels := index $global "labels" }}
{{- if $labels }}
{{ data.ToYAML $labels | indent 4 }}
{{- end }}
{{- end }}
{{- $ingress := index $.k8s_modifiers "ingress" }}
{{- if $ingress }}
{{- $labels := index $ingress "labels" }}
{{- if $labels }}
{{ data.ToYAML $labels | indent 4 }}
{{- end }}
{{- end }}
annotations:
alb.ingress.kubernetes.io/actions.bg-deployment-{{ if eq .type "HTTP" }}http{{ else }}grpc{{ end }}-{{ .port }}: >-
{"type":"forward","forwardConfig":{"targetGroups":[
{"serviceName":"d-{{ $.scope.id }}-{{ $.blue_deployment_id }}-{{ if eq .type "HTTP" }}http{{ else }}grpc{{ end }}-{{ .port }}","servicePort":{{ .port }},"weight":{{ sub 100 $.deployment.strategy_data.desired_switched_traffic }}},
{"serviceName":"d-{{ $.scope.id }}-{{ $.deployment.id }}-{{ if eq .type "HTTP" }}http{{ else }}grpc{{ end }}-{{ .port }}","servicePort":{{ .port }},"weight":{{ $.deployment.strategy_data.desired_switched_traffic }}}
]}}
alb.ingress.kubernetes.io/actions.response-404: '{"type":"fixed-response","fixedResponseConfig":{"contentType":"text/plain","statusCode":"404","messageBody":"404 scope not found or has not been deployed yet"}}'
alb.ingress.kubernetes.io/group.name: {{ $.alb_name }}
alb.ingress.kubernetes.io/load-balancer-name: {{ $.alb_name }}
alb.ingress.kubernetes.io/scheme: {{ $.ingress_visibility }}
alb.ingress.kubernetes.io/target-node-labels: account={{ $.account.slug }},namespace={{ $.namespace.slug }},application={{ $.application.slug }},account_id={{ $.account.id }},namespace_id={{ $.namespace.id }},application_id={{ $.application.id }},scope={{ $.scope.slug }},scope_id={{ $.scope.id }},nullplatform=true
alb.ingress.kubernetes.io/target-type: ip
{{ if eq .type "HTTP" }}
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP":80},{"HTTPS":443}]'
alb.ingress.kubernetes.io/ssl-redirect: "443"
{{ else if eq .type "GRPC" }}
alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS":{{ .port }}}]'
alb.ingress.kubernetes.io/backend-protocol-version: GRPC
alb.ingress.kubernetes.io/load-balancer-attributes: routing.http2.enabled=true
{{- $global := index $.k8s_modifiers "global" }}
{{- if $global }}
{{- $annotations := index $global "annotations" }}
{{- if $annotations }}
{{ data.ToYAML $annotations | indent 4 }}
{{- end }}
{{- end }}
{{- $ingress := index $.k8s_modifiers "ingress" }}
{{- if $ingress }}
{{- $annotations := index $ingress "annotations" }}
{{- if $annotations }}
{{ data.ToYAML $annotations | indent 4 }}
{{- end }}
{{- end }}
{{ end }}
spec:
ingressClassName: alb
rules:
- host: {{ $.scope.domain }}
http:
paths:
{{ if eq .type "HTTP" }}
- path: /{{ .port }}
pathType: Prefix
backend:
service:
name: bg-deployment-{{ if eq .type "HTTP" }}http{{ else }}grpc{{ end }}-{{ .port }}
port:
name: use-annotation
{{ else if eq .type "GRPC" }}
- path: /
pathType: Prefix
backend:
service:
name: bg-deployment-{{ if eq .type "HTTP" }}http{{ else }}grpc{{ end }}-{{ .port }}
port:
name: use-annotation
{{ end }}
{{- range $.scope.domains }}
- host: {{ .name }}
http:
paths:
{{ if eq $.type "HTTP" }}
- path: /{{ $.port }}
pathType: Prefix
backend:
service:
name: bg-deployment-{{ if eq $.type "HTTP" }}http{{ else }}grpc{{ end }}-{{ $.port }}
port:
name: use-annotation
{{ else if eq $.type "GRPC" }}
- path: /
pathType: Prefix
backend:
service:
name: bg-deployment-{{ if eq $.type "HTTP" }}http{{ else }}grpc{{ end }}-{{ $.port }}
port:
name: use-annotation
{{ end }}
{{- end }}
{{ end }}
{{ end }}
65 changes: 64 additions & 1 deletion k8s/deployment/templates/deployment.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ spec:
- name: http
securityContext:
runAsUser: 0
image: public.ecr.aws/nullplatform/k8s-traffic-manager:latest
image: {{ .traffic_image }}
ports:
- containerPort: 80
protocol: TCP
Expand Down Expand Up @@ -158,6 +158,63 @@ spec:
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: Always

{{ if .scope.capabilities.additional_ports }}
{{ range .scope.capabilities.additional_ports }}
{{ if eq .type "GRPC" }}
- name: grpc-{{ .port }}
securityContext:
runAsUser: 0
image: {{ $.traffic_image }}
ports:
- containerPort: {{ .port }}
protocol: TCP
env:
- name: HEALTH_CHECK_TYPE
value: grpc
- name: GRACE_PERIOD
value: '15'
- name: LISTENER_PROTOCOL
value: grpc
- name: LISTENER_PORT
value: '{{ .port }}'
resources:
limits:
cpu: 93m
memory: 64Mi
requests:
cpu: 31m
livenessProbe:
grpc:
port: {{ .port }}
timeoutSeconds: 5
periodSeconds: 10
initialDelaySeconds: {{ $.scope.capabilities.health_check.initial_delay_seconds }}
successThreshold: 1
failureThreshold: 9
readinessProbe:
grpc:
port: {{ .port }}
timeoutSeconds: 5
periodSeconds: 10
initialDelaySeconds: {{ $.scope.capabilities.health_check.initial_delay_seconds }}
successThreshold: 1
failureThreshold: 3
startupProbe:
grpc:
port: {{ .port }}
timeoutSeconds: 5
periodSeconds: 10
initialDelaySeconds: {{ $.scope.capabilities.health_check.initial_delay_seconds }}
successThreshold: 1
failureThreshold: 90
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: Always
{{ end }}
{{ end }}
{{ end }}

- name: application
envFrom:
- secretRef:
Expand All @@ -169,6 +226,12 @@ spec:
ports:
- containerPort: 8080
protocol: TCP
{{ if .scope.capabilities.additional_ports }}
{{ range .scope.capabilities.additional_ports }}
- containerPort: {{ .port }}
protocol: TCP
{{ end }}
{{ end }}
resources:
limits:
cpu: {{ .scope.capabilities.cpu_millicores }}m
Expand Down
88 changes: 87 additions & 1 deletion k8s/deployment/templates/initial-ingress.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,90 @@ spec:
name: d-{{ $.scope.id }}-{{ $.deployment.id }}
port:
number: 8080
{{- end }}
{{- end }}
{{ if .scope.capabilities.additional_ports }}
{{ range .scope.capabilities.additional_ports }}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: k-8-s-{{ $.scope.slug }}-{{ $.scope.id }}-{{ if eq .type "HTTP" }}http{{ else }}grpc{{ end }}-{{ .port }}-{{ $.ingress_visibility }}
namespace: {{ $.k8s_namespace }}
labels:
nullplatform: "true"
account: {{ $.account.slug }}
account_id: "{{ $.account.id }}"
namespace: {{ $.namespace.slug }}
namespace_id: "{{ $.namespace.id }}"
application: {{ $.application.slug }}
application_id: "{{ $.application.id }}"
scope: {{ $.scope.slug }}
scope_id: "{{ $.scope.id }}"
{{- $global := index $.k8s_modifiers "global" }}
{{- if $global }}
{{- $labels := index $global "labels" }}
{{- if $labels }}
{{ data.ToYAML $labels | indent 4 }}
{{- end }}
{{- end }}
{{- $ingress := index $.k8s_modifiers "ingress" }}
{{- if $ingress }}
{{- $labels := index $ingress "labels" }}
{{- if $labels }}
{{ data.ToYAML $labels | indent 4 }}
{{- end }}
{{- end }}
annotations:
alb.ingress.kubernetes.io/group.name: {{ $.alb_name }}
{{ if eq .type "HTTP" }}
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP":80},{"HTTPS":443}]'
{{ else if eq .type "GRPC" }}
alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS":{{ .port }}}]'
alb.ingress.kubernetes.io/backend-protocol-version: GRPC
alb.ingress.kubernetes.io/load-balancer-attributes: routing.http2.enabled=true
{{ end }}
alb.ingress.kubernetes.io/load-balancer-name: {{ $.alb_name }}
alb.ingress.kubernetes.io/scheme: {{ $.ingress_visibility }}
alb.ingress.kubernetes.io/target-node-labels: account={{ $.account.slug }},namespace={{ $.namespace.slug }},application={{ $.application.slug }},account_id={{ $.account.id }},namespace_id={{ $.namespace.id }},application_id={{ $.application.id }},scope={{ $.scope.slug }},scope_id={{ $.scope.id }},nullplatform=true
alb.ingress.kubernetes.io/target-type: ip
{{- $global := index $.k8s_modifiers "global" }}
{{- if $global }}
{{- $annotations := index $global "annotations" }}
{{- if $annotations }}
{{ data.ToYAML $annotations | indent 4 }}
{{- end }}
{{- end }}
{{- $ingress := index $.k8s_modifiers "ingress" }}
{{- if $ingress }}
{{- $annotations := index $ingress "annotations" }}
{{- if $annotations }}
{{ data.ToYAML $annotations | indent 4 }}
{{- end }}
{{- end }}
spec:
ingressClassName: alb
rules:
- host: {{ $.scope.domain }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: d-{{ $.scope.id }}-{{ $.deployment.id }}-{{ if eq .type "HTTP" }}http{{ else }}grpc{{ end }}-{{ .port }}
port:
number: {{ .port }}
{{- range $.scope.domains }}
- host: {{ .name }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: d-{{ $.scope.id }}-{{ $.deployment.id }}-{{ if eq .type "HTTP" }}http{{ else }}grpc{{ end }}-{{ .port }}
port:
number: {{ .port }}
{{- end }}
{{ end }}
{{ end }}
Loading