Skip to content
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

start working on progressive delivery #30

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion common/unified-chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: unified-chart
description: Frontegg Unified Chart
type: application

version: 4.0.32
version: 4.0.34

maintainers:
- name: "platform"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- $top := . -}}
{{- $values := .Values -}}
{{- if .Values.argoRollouts.progressiveDelivery.enabled }}
---
apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata:
name: {{ include "hp.name" . }}
spec:
args:
- name: service-name
value: {{ include "hp.name" . }}
metrics:
- name: succesful-black-box-test
successCondition: result == true
provider:
web:
{{- with .Values.argoRollouts.progressiveDelivery }}
method: {{ .blackBox.methoo | default "POST" }}
url: {{ .blackBox.url | default "http://nexus.frontegg.svc.cluster.local/blackbox" }}
timeoutSeconds: {{ .blackBox.timeout | default "1200" }}
headers:
{{- range $header := .blackBox.headers }}
- key: {{ $header.key }}
value: {{ $header.value }}
{{- end }}
jsonBody:
service-name: {{ include "hp.name" $top }}
version: {{ include "appVersion" $top }}
{{- end }}
jsonPath: "{$.status}"
mqxter marked this conversation as resolved.
Show resolved Hide resolved
{{- end }}
10 changes: 8 additions & 2 deletions common/unified-chart/templates/high-priority/hp-pdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@ spec:
matchLabels:
{{- include "hp.selector.labels" . | nindent 6 }}
{{- if .Values.argoRollouts.enabled }}
{{- with .Values.argoRollouts.activeMetadata }}
{{- toYaml .labels | nindent 6 }}
{{- if .Values.argoRollouts.progressiveDelivery.enabled }}
{{- with .Values.argoRollouts.progressiveDelivery }}
{{- toYaml .stableMetadata.labels | nindent 6 }}
{{- end }}
{{else}}
{{- with .Values.argoRollouts.activeMetadata }}
{{- toYaml .labels | nindent 6 }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
Expand Down
27 changes: 24 additions & 3 deletions common/unified-chart/templates/high-priority/hp-rollout.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,33 @@ spec:
matchLabels:
{{- include "hp.selector.labels" . | nindent 6 }}
strategy:
{{- if .Values.argoRollouts.progressiveDelivery.enabled }}
canary:
{{- with .Values.argoRollouts.progressiveDelivery }}
stableMetadata:
{{- toYaml .stableMetadata | nindent 8 }}
canaryMetadata:
{{- toYaml .canaryMetadata | nindent 8 }}
{{- end }}
canaryService: {{ include "hp.name" . }}-canary
stableService: {{ include "hp.name" . }}-stable
trafficRouting:
plugins:
argoproj-labs/gatewayAPI:
httpRoute: {{ include "hp.name" . }}
namespace: {{ .Release.Namespace }}
{{- with .Values.argoRollouts.progressiveDelivery.steps }}
steps:
{{- toYaml . | nindent 12 }}
{{- end }}
AlonGluz marked this conversation as resolved.
Show resolved Hide resolved
{{- else}}
blueGreen:
{{- with .Values.argoRollouts.activeMetadata }}
{{- with .Values.argoRollouts.activeMetadata }}
activeMetadata:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- toYaml . | nindent 8 }}
{{- end }}
activeService: {{ include "hp.name" . }}
autoPromotionEnabled: true
{{- end}}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ $values.hp.service.type }}
type: {{ $values.hp.service.type | default "ClusterIP" }}
ports:
{{- range $values.hp.service.ports }}
- port: {{ required ".Values.hp.service.ports[*].port number is required" .port }}
Expand Down
27 changes: 27 additions & 0 deletions common/unified-chart/templates/high-priority/httproute.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{- $top := . -}}
{{- $values := .Values -}}
{{- if .Values.argoRollouts.progressiveDelivery.enabled }}
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: {{ include "hp.name" $top }}
spec:
parentRefs:
{{- range $values.hp.service.ports }}
- group: "core"
name: {{ include "hp.name" $top }}
kind: Service
port: {{ required ".Values.hp.service.ports[*].port number is required" .port }}
{{- end }}
rules:
- backendRefs:
{{- range $type := tuple "canary" "stable" }}
{{- range $values.hp.service.ports }}
- name: {{ include "hp.name" $top }}-{{ $type }}
group: "core"
port: {{ required ".Values.hp.service.ports[*].port number is required" .port }}
kind: Service
{{- end }}
{{- end }}
{{- end }}
28 changes: 28 additions & 0 deletions common/unified-chart/templates/high-priority/services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{- $top := . -}}
{{- $values := .Values -}}
{{- if .Values.argoRollouts.progressiveDelivery.enabled }}
{{- range $type := tuple "canary" "stable" }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "hp.name" $top }}-{{ $type }}
labels:
{{- include "hp.labels" $top | nindent 4 }}
{{- with $values.hp.service.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ $values.hp.service.type }}
AlonGluz marked this conversation as resolved.
Show resolved Hide resolved
ports:
{{- range $values.hp.service.ports }}
- port: {{ required ".Values.hp.service.ports[*].port number is required" .port }}
targetPort: {{ required "need to know if someone listening: .Values.hp.service.ports[*].targetPort is required" .targetPort }}
protocol: {{ .protocol | default "TCP" }}
name: {{ .name | default "http" }}
{{- end }}
selector:
{{- include "hp.selector.labels" $top | nindent 4 }}
{{- end }}
{{- end }}

25 changes: 25 additions & 0 deletions common/unified-chart/test.values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,31 @@ team: shitballz
envID: local
appVersion: production-global-19900101.101010-zxc111y

argoRollouts:
enabled: true
activeMetadata:
labels:
role: active
progressiveDelivery:
enabled: true
stableMetadata:
labels:
role: stable
canaryMetadata:
labels:
role: canary
blackBox:
url: http://nexus.frontegg.svc.cluster.local/blackbox
timeout: 1200
method: POST
headers:
- key: Content-Type # if body is a json, it is recommended to set the Content-Type
value: "application/json"
steps:
- pause: {}
- setWeight: 100
- pause: { duration: 60s }

image:
repository: frontegg/crappy-service

Expand Down
19 changes: 19 additions & 0 deletions common/unified-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,25 @@ argoRollouts:
activeMetadata:
labels:
role: active
progressiveDelivery:
enabled: false
stableMetadata:
labels:
role: stable
canaryMetadata:
labels:
role: canary
blackBox:
url: http://nexus.frontegg.svc.cluster.local/blackbox
timeout: 1200
method: POST
headers:
- key: Content-Type # if body is a json, it is recommended to set the Content-Type
value: "application/json"
steps:
- pause: {}
- setWeight: 100
- pause: { duration: 60s }

image:
repository:
Expand Down