From ad3bf65239c2588edf273f3ece756c6af97ca9c5 Mon Sep 17 00:00:00 2001 From: Federico Maleh Date: Thu, 16 Oct 2025 16:46:35 -0300 Subject: [PATCH 01/10] [fix] do not re-apply Job objects --- .../deployment/workflows/blue_green.yaml | 11 ----------- scheduled_task/deployment/workflows/finalize.yaml | 8 -------- scheduled_task/deployment/workflows/rollback.yaml | 15 --------------- 3 files changed, 34 deletions(-) diff --git a/scheduled_task/deployment/workflows/blue_green.yaml b/scheduled_task/deployment/workflows/blue_green.yaml index 95ace297..72535d20 100644 --- a/scheduled_task/deployment/workflows/blue_green.yaml +++ b/scheduled_task/deployment/workflows/blue_green.yaml @@ -14,17 +14,6 @@ steps: - name: SECRET_PATH type: file file: "$OUTPUT_DIR/secret-$SCOPE_ID-$DEPLOYMENT_ID.yaml" - - name: update blue deployment - type: script - file: "$OVERRIDES_PATH/deployment/build_blue_deployment" - action: replace - output: - - name: DEPLOYMENT_PATH - type: file - file: "$OUTPUT_DIR/deployment-$SCOPE_ID-$BLUE_DEPLOYMENT_ID.yaml" - - name: SECRET_PATH - type: file - file: "$OUTPUT_DIR/secret-$SCOPE_ID-$BLUE_DEPLOYMENT_ID.yaml" - name: apply type: script file: "$SERVICE_PATH/apply_templates" diff --git a/scheduled_task/deployment/workflows/finalize.yaml b/scheduled_task/deployment/workflows/finalize.yaml index af783d79..452b27a0 100644 --- a/scheduled_task/deployment/workflows/finalize.yaml +++ b/scheduled_task/deployment/workflows/finalize.yaml @@ -1,12 +1,4 @@ steps: - - name: build green deployment - type: script - action: replace - file: "$OVERRIDES_PATH/deployment/build_deployment" - output: - - name: DEPLOYMENT_PATH - type: file - file: "$OUTPUT_DIR/deployment-$SCOPE_ID-$DEPLOYMENT_ID.yaml" - name: create green deployment post: name: wait deployment active diff --git a/scheduled_task/deployment/workflows/rollback.yaml b/scheduled_task/deployment/workflows/rollback.yaml index 6072fe20..9347fc0f 100644 --- a/scheduled_task/deployment/workflows/rollback.yaml +++ b/scheduled_task/deployment/workflows/rollback.yaml @@ -1,19 +1,4 @@ steps: - - name: update blue deployment - type: script - action: replace - file: "$OVERRIDES_PATH/deployment/build_blue_deployment" - output: - - name: DEPLOYMENT_PATH - type: file - file: "$OUTPUT_DIR/deployment-$SCOPE_ID-$DEPLOYMENT_ID.yaml" - - name: SECRET_PATH - type: file - file: "$OUTPUT_DIR/secret-$SCOPE_ID-$DEPLOYMENT_ID.yaml" - - name: create blue deployment - post: - name: wait deployment active - action: skip - name: build deployment type: script action: replace From 40d8622cefb25eea1f37def5ac57c95dc3722169 Mon Sep 17 00:00:00 2001 From: Federico Maleh Date: Thu, 16 Oct 2025 17:17:44 -0300 Subject: [PATCH 02/10] skip wait deployment active --- scheduled_task/deployment/workflows/blue_green.yaml | 5 +++++ scheduled_task/deployment/workflows/finalize.yaml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/scheduled_task/deployment/workflows/blue_green.yaml b/scheduled_task/deployment/workflows/blue_green.yaml index 72535d20..78f1d7fe 100644 --- a/scheduled_task/deployment/workflows/blue_green.yaml +++ b/scheduled_task/deployment/workflows/blue_green.yaml @@ -14,6 +14,11 @@ steps: - name: SECRET_PATH type: file file: "$OUTPUT_DIR/secret-$SCOPE_ID-$DEPLOYMENT_ID.yaml" + - name: update blue deployment + type: script + post: + name: wait deployment active + action: skip - name: apply type: script file: "$SERVICE_PATH/apply_templates" diff --git a/scheduled_task/deployment/workflows/finalize.yaml b/scheduled_task/deployment/workflows/finalize.yaml index 452b27a0..38f9116e 100644 --- a/scheduled_task/deployment/workflows/finalize.yaml +++ b/scheduled_task/deployment/workflows/finalize.yaml @@ -1,5 +1,5 @@ steps: - - name: create green deployment + - name: build green deployment post: name: wait deployment active action: skip From 98ce54ed3aa7aa46f40a602dba0af052b8a30a22 Mon Sep 17 00:00:00 2001 From: Ignacio Boudgouste <73672747+ignacioboud@users.noreply.github.com> Date: Fri, 17 Oct 2025 11:04:56 -0300 Subject: [PATCH 03/10] Merge pull request #77 from nullplatform/feat/add_file_params feat: Add mount file parameters --- k8s/deployment/templates/deployment.yaml.tpl | 29 +++++++++++++++++++- k8s/deployment/templates/secret.yaml.tpl | 2 +- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/k8s/deployment/templates/deployment.yaml.tpl b/k8s/deployment/templates/deployment.yaml.tpl index d16fdf0d..ab9c237d 100644 --- a/k8s/deployment/templates/deployment.yaml.tpl +++ b/k8s/deployment/templates/deployment.yaml.tpl @@ -223,7 +223,6 @@ spec: {{ end }} {{ end }} {{ end }} - - name: application envFrom: - secretRef: @@ -281,6 +280,34 @@ spec: terminationMessagePath: /dev/termination-log terminationMessagePolicy: File imagePullPolicy: IfNotPresent + volumeMounts: + {{- if .parameters.results }} + {{- range .parameters.results }} + {{- if and (eq .type "file") }} + {{- if gt (len .values) 0 }} + - name: {{ printf "file-%s" (filepath.Base .destination_path | strings.ReplaceAll "." "-") }} + mountPath: {{ .destination_path }} + subPath: {{ filepath.Base .destination_path }} + readOnly: true + {{- end }} + {{- end }} + {{- end }} + {{- end }} + volumes: +{{- if .parameters.results }} + {{- range .parameters.results }} + {{- if and (eq .type "file") }} + {{- if gt (len .values) 0 }} + - name: {{ printf "file-%s" (filepath.Base .destination_path | strings.ReplaceAll "." "-") }} + secret: + secretName: s-{{ $.scope.id }}-d-{{ $.deployment.id }} + items: + - key: {{ printf "app-data-%s" (filepath.Base .destination_path) }} + path: {{ filepath.Base .destination_path }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} restartPolicy: Always terminationGracePeriodSeconds: 30 dnsPolicy: ClusterFirst diff --git a/k8s/deployment/templates/secret.yaml.tpl b/k8s/deployment/templates/secret.yaml.tpl index f5918577..baa9564d 100644 --- a/k8s/deployment/templates/secret.yaml.tpl +++ b/k8s/deployment/templates/secret.yaml.tpl @@ -39,7 +39,7 @@ data: {{- end }} {{- if and (eq .type "file") }} {{- if gt (len .values) 0 }} - {{ printf "app-data-%s" (filepath.Base .destination_path) }}: {{ index .values 0 "value" | strings.TrimPrefix "data:application/json;base64," }} + {{ printf "app-data-%s" (filepath.Base .destination_path) }}: {{ index .values 0 "value" | regexp.Replace "^data:[^;]+;base64," "" }} {{- end }} {{- end }} {{- end }} From 4a612bc43bf80784c4948a5a3ce96811dce215fc Mon Sep 17 00:00:00 2001 From: Federico Maleh Date: Fri, 17 Oct 2025 11:05:50 -0300 Subject: [PATCH 04/10] [logging] remove unnecessary logs (#78) --- k8s/deployment/build_deployment | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/k8s/deployment/build_deployment b/k8s/deployment/build_deployment index 2312ec34..25898437 100755 --- a/k8s/deployment/build_deployment +++ b/k8s/deployment/build_deployment @@ -1,33 +1,5 @@ #!/bin/bash -echo "TEMPLATE DIR: $OUTPUT_DIR, ACTION: $ACTION, DRY_RUN: $DRY_RUN" - -APPLIED_FILES=() - -# Find all .yaml files that were not yet applied / deleted -while IFS= read -r TEMPLATE_FILE; do - echo "kubectl $ACTION $TEMPLATE_FILE" - - if [[ "$DRY_RUN" == "false" ]]; then - kubectl "$ACTION" -f "$TEMPLATE_FILE" - fi - - BASE_DIR="$(dirname "$TEMPLATE_FILE")" - FILENAME="$(basename "$TEMPLATE_FILE")" - DEST_DIR="${BASE_DIR}/$ACTION" - - mkdir -p "$DEST_DIR" - - mv "$TEMPLATE_FILE" "$DEST_DIR/$FILENAME" - - # Add the moved file path to our array - APPLIED_FILES+=("$DEST_DIR/$FILENAME") -done < <(find "$OUTPUT_DIR" \( -path "*/apply" -o -path "*/delete" \) -prune -o -type f -name "*.yaml" -print) - -if [[ "$DRY_RUN" == "true" ]]; then - exit 1 -fi - IAM=${IAM-"{}"} IAM_ENABLED=$(echo "$IAM" | jq -r .ENABLED) From 15d9539a84cc0e36ac0515a18bb22d978df85a0c Mon Sep 17 00:00:00 2001 From: Federico Maleh Date: Thu, 23 Oct 2025 17:30:53 -0300 Subject: [PATCH 05/10] [feature] allow to configure image pull secret for scheduled task (#83) --- k8s/deployment/build_context | 8 +++-- .../deployment/templates/deployment.yaml.tpl | 35 +++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/k8s/deployment/build_context b/k8s/deployment/build_context index fdd0b9f3..db2d3ddc 100755 --- a/k8s/deployment/build_context +++ b/k8s/deployment/build_context @@ -33,8 +33,12 @@ if [ "$DEPLOY_STRATEGY" = "rolling" ] && [ "$DEPLOYMENT_STATUS" = "running" ]; t GREEN_REPLICAS=$(( MIN_REPLICAS > GREEN_REPLICAS ? MIN_REPLICAS : GREEN_REPLICAS )) fi -IMAGE_PULL_SECRETS="${IMAGE_PULL_SECRETS:-"{}"}" -IMAGE_PULL_SECRETS=$(echo "$IMAGE_PULL_SECRETS" | jq .) +if [[ -n "$PULL_SECRETS" ]]; then + IMAGE_PULL_SECRETS=$PULL_SECRETS +else + IMAGE_PULL_SECRETS="${IMAGE_PULL_SECRETS:-"{}"}" + IMAGE_PULL_SECRETS=$(echo "$IMAGE_PULL_SECRETS" | jq .) +fi SCOPE_TRAFFIC_PROTOCOL=$(echo "$CONTEXT" | jq -r .scope.capabilities.protocol) diff --git a/scheduled_task/deployment/templates/deployment.yaml.tpl b/scheduled_task/deployment/templates/deployment.yaml.tpl index 8e52a29c..d9548eb7 100644 --- a/scheduled_task/deployment/templates/deployment.yaml.tpl +++ b/scheduled_task/deployment/templates/deployment.yaml.tpl @@ -125,6 +125,12 @@ spec: {{ data.ToYAML $tolerations | indent 10 }} {{- end }} {{- end }} + {{- if .pull_secrets.ENABLED }} + imagePullSecrets: + {{- range $secret := .pull_secrets.SECRETS }} + - name: {{ $secret }} + {{- end }} + {{- end }} containers: - name: application envFrom: @@ -138,6 +144,35 @@ spec: requests: cpu: {{ .scope.capabilities.cpu_millicores }}m memory: {{ .scope.capabilities.ram_memory }}Mi + imagePullPolicy: IfNotPresent + volumeMounts: + {{- if .parameters.results }} + {{- range .parameters.results }} + {{- if and (eq .type "file") }} + {{- if gt (len .values) 0 }} + - name: {{ printf "file-%s" (filepath.Base .destination_path | strings.ReplaceAll "." "-") }} + mountPath: {{ .destination_path }} + subPath: {{ filepath.Base .destination_path }} + readOnly: true + {{- end }} + {{- end }} + {{- end }} + {{- end }} + volumes: + {{- if .parameters.results }} + {{- range .parameters.results }} + {{- if and (eq .type "file") }} + {{- if gt (len .values) 0 }} + - name: {{ printf "file-%s" (filepath.Base .destination_path | strings.ReplaceAll "." "-") }} + secret: + secretName: s-{{ $.scope.id }}-d-{{ $.deployment.id }} + items: + - key: {{ printf "app-data-%s" (filepath.Base .destination_path) }} + path: {{ filepath.Base .destination_path }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} restartPolicy: OnFailure securityContext: runAsUser: 0 From 566e8dadf9b12db3ca73daaef6f179353c53b464 Mon Sep 17 00:00:00 2001 From: Javi Date: Mon, 27 Oct 2025 14:31:49 -0300 Subject: [PATCH 06/10] feat: azure aro (#84) * [feature]: gateway_type Co-authored-by: Sebastian Nallar --- azure-aro/specs/actions/create-scope.json.tpl | 29 + .../specs/actions/delete-deployment.json.tpl | 33 + azure-aro/specs/actions/delete-scope.json.tpl | 29 + .../actions/finalize-blue-green.json.tpl | 33 + .../specs/actions/kill-instances.json.tpl | 18 + .../specs/actions/pause-autoscaling.json.tpl | 19 + azure-aro/specs/actions/restart-pods.json.tpl | 30 + .../specs/actions/resume-autoscaling.json.tpl | 19 + .../actions/rollback-deployment.json.tpl | 33 + .../set-desired-instance-count.json.tpl | 33 + .../specs/actions/start-blue-green.json.tpl | 33 + .../specs/actions/start-initial.json.tpl | 32 + .../specs/actions/switch-traffic.json.tpl | 37 ++ azure-aro/specs/notification-channel.json.tpl | 34 + .../specs/scope-type-definition.json.tpl | 9 + azure-aro/specs/service-spec.json.tpl | 595 ++++++++++++++++++ azure-aro/values.yaml | 10 + .../aro/blue-green-httproute.yaml.tpl | 58 ++ .../templates/aro/initial-httproute.yaml.tpl | 51 ++ .../networking/dns/az-records/manage_route | 21 +- k8s/scope/networking/dns/build_dns_context | 5 + 21 files changed, 1158 insertions(+), 3 deletions(-) create mode 100644 azure-aro/specs/actions/create-scope.json.tpl create mode 100644 azure-aro/specs/actions/delete-deployment.json.tpl create mode 100644 azure-aro/specs/actions/delete-scope.json.tpl create mode 100644 azure-aro/specs/actions/finalize-blue-green.json.tpl create mode 100644 azure-aro/specs/actions/kill-instances.json.tpl create mode 100644 azure-aro/specs/actions/pause-autoscaling.json.tpl create mode 100644 azure-aro/specs/actions/restart-pods.json.tpl create mode 100644 azure-aro/specs/actions/resume-autoscaling.json.tpl create mode 100644 azure-aro/specs/actions/rollback-deployment.json.tpl create mode 100644 azure-aro/specs/actions/set-desired-instance-count.json.tpl create mode 100644 azure-aro/specs/actions/start-blue-green.json.tpl create mode 100644 azure-aro/specs/actions/start-initial.json.tpl create mode 100644 azure-aro/specs/actions/switch-traffic.json.tpl create mode 100644 azure-aro/specs/notification-channel.json.tpl create mode 100644 azure-aro/specs/scope-type-definition.json.tpl create mode 100644 azure-aro/specs/service-spec.json.tpl create mode 100644 azure-aro/values.yaml create mode 100644 k8s/deployment/templates/aro/blue-green-httproute.yaml.tpl create mode 100644 k8s/deployment/templates/aro/initial-httproute.yaml.tpl diff --git a/azure-aro/specs/actions/create-scope.json.tpl b/azure-aro/specs/actions/create-scope.json.tpl new file mode 100644 index 00000000..4c0fb3a6 --- /dev/null +++ b/azure-aro/specs/actions/create-scope.json.tpl @@ -0,0 +1,29 @@ +{ + "name": "create-scope", + "slug": "create-scope", + "type": "create", + "retryable": false, + "service_specification_id": "{{ env.Getenv "SERVICE_SPECIFICATION_ID" }}", + "parameters": { + "schema": { + "type": "object", + "required": [ + "scope_id" + ], + "properties": { + "scope_id": { + "type": "string" + } + } + }, + "values": {} + }, + "results": { + "schema": { + "type": "object", + "required": [], + "properties": {} + }, + "values": {} + } +} \ No newline at end of file diff --git a/azure-aro/specs/actions/delete-deployment.json.tpl b/azure-aro/specs/actions/delete-deployment.json.tpl new file mode 100644 index 00000000..0334b10c --- /dev/null +++ b/azure-aro/specs/actions/delete-deployment.json.tpl @@ -0,0 +1,33 @@ +{ + "name": "delete-deployment", + "slug": "delete-deployment", + "type": "custom", + "retryable": false, + "service_specification_id": "{{ env.Getenv "SERVICE_SPECIFICATION_ID" }}", + "parameters": { + "schema": { + "type": "object", + "required": [ + "scope_id", + "deployment_id" + ], + "properties": { + "scope_id": { + "type": "string" + }, + "deployment_id": { + "type": "string" + } + } + }, + "values": {} + }, + "results": { + "schema": { + "type": "object", + "required": [], + "properties": {} + }, + "values": {} + } +} \ No newline at end of file diff --git a/azure-aro/specs/actions/delete-scope.json.tpl b/azure-aro/specs/actions/delete-scope.json.tpl new file mode 100644 index 00000000..16d9b992 --- /dev/null +++ b/azure-aro/specs/actions/delete-scope.json.tpl @@ -0,0 +1,29 @@ +{ + "name": "delete-scope", + "slug": "delete-scope", + "type": "custom", + "retryable": false, + "service_specification_id": "{{ env.Getenv "SERVICE_SPECIFICATION_ID" }}", + "parameters": { + "schema": { + "type": "object", + "required": [ + "scope_id" + ], + "properties": { + "scope_id": { + "type": "string" + } + } + }, + "values": {} + }, + "results": { + "schema": { + "type": "object", + "required": [], + "properties": {} + }, + "values": {} + } +} \ No newline at end of file diff --git a/azure-aro/specs/actions/finalize-blue-green.json.tpl b/azure-aro/specs/actions/finalize-blue-green.json.tpl new file mode 100644 index 00000000..4dc780cb --- /dev/null +++ b/azure-aro/specs/actions/finalize-blue-green.json.tpl @@ -0,0 +1,33 @@ +{ + "name": "finalize-blue-green", + "slug": "finalize-blue-green", + "type": "custom", + "retryable": false, + "service_specification_id": "{{ env.Getenv "SERVICE_SPECIFICATION_ID" }}", + "parameters": { + "schema": { + "type": "object", + "required": [ + "scope_id", + "deployment_id" + ], + "properties": { + "scope_id": { + "type": "string" + }, + "deployment_id": { + "type": "string" + } + } + }, + "values": {} + }, + "results": { + "schema": { + "type": "object", + "required": [], + "properties": {} + }, + "values": {} + } +} \ No newline at end of file diff --git a/azure-aro/specs/actions/kill-instances.json.tpl b/azure-aro/specs/actions/kill-instances.json.tpl new file mode 100644 index 00000000..c1351f94 --- /dev/null +++ b/azure-aro/specs/actions/kill-instances.json.tpl @@ -0,0 +1,18 @@ +{ + "name": "Kill instances", + "type": "custom", + "icon": "material-symbols:delete-outline", + "results": { + "schema": { "type": "object", "required": [], "properties": {} }, + "values": {} + }, + "service_specification_id": "{{ env.Getenv "SERVICE_SPECIFICATION_ID" }}", + "parameters": { + "schema": { "type": "object", "required": [], "properties": {} }, + "values": {} + }, + "annotations": { + "show_on": ["performance"], + "runs_over": "scope" + } +} \ No newline at end of file diff --git a/azure-aro/specs/actions/pause-autoscaling.json.tpl b/azure-aro/specs/actions/pause-autoscaling.json.tpl new file mode 100644 index 00000000..7d3808fc --- /dev/null +++ b/azure-aro/specs/actions/pause-autoscaling.json.tpl @@ -0,0 +1,19 @@ +{ + "name": "Pause autoscaling", + "type": "custom", + "icon": "material-symbols:pause-circle-outline", + "results": { + "schema": { "type": "object", "required": [], "properties": {} }, + "values": {} + }, + "service_specification_id": "{{ env.Getenv "SERVICE_SPECIFICATION_ID" }}", + "parameters": { + "schema": { "type": "object", "required": [], "properties": {} }, + "values": {} + }, + "annotations": { + "show_on": ["performance"], + "runs_over": "scope" + }, + "enabled_when": ".service.attributes.scaling_type == \"auto\"" +} \ No newline at end of file diff --git a/azure-aro/specs/actions/restart-pods.json.tpl b/azure-aro/specs/actions/restart-pods.json.tpl new file mode 100644 index 00000000..7e285f35 --- /dev/null +++ b/azure-aro/specs/actions/restart-pods.json.tpl @@ -0,0 +1,30 @@ +{ + "name": "Restart pods", + "type": "custom", + "icon": "material-symbols:refresh", + "results": { + "schema": { + "type": "object", + "required": [], + "properties": {} + }, + "values": {} + }, + "service_specification_id": "{{ env.Getenv "SERVICE_SPECIFICATION_ID" }}", + "parameters": { + "schema": { + "type": "object", + "required": [ + ], + "properties": { + } + }, + "values": {} + }, + "annotations": { + "show_on": [ + "performance" + ], + "runs_over": "scope" + } +} \ No newline at end of file diff --git a/azure-aro/specs/actions/resume-autoscaling.json.tpl b/azure-aro/specs/actions/resume-autoscaling.json.tpl new file mode 100644 index 00000000..091f34b0 --- /dev/null +++ b/azure-aro/specs/actions/resume-autoscaling.json.tpl @@ -0,0 +1,19 @@ +{ + "name": "Resume autoscaling", + "type": "custom", + "icon": "material-symbols:play-circle-outline", + "results": { + "schema": { "type": "object", "required": [], "properties": {} }, + "values": {} + }, + "service_specification_id": "{{ env.Getenv "SERVICE_SPECIFICATION_ID" }}", + "parameters": { + "schema": { "type": "object", "required": [], "properties": {} }, + "values": {} + }, + "annotations": { + "show_on": ["performance"], + "runs_over": "scope" + }, + "enabled_when": ".service.attributes.scaling_type == \"auto\"" +} \ No newline at end of file diff --git a/azure-aro/specs/actions/rollback-deployment.json.tpl b/azure-aro/specs/actions/rollback-deployment.json.tpl new file mode 100644 index 00000000..dcbf4cd1 --- /dev/null +++ b/azure-aro/specs/actions/rollback-deployment.json.tpl @@ -0,0 +1,33 @@ +{ + "name": "rollback-deployment", + "slug": "rollback-deployment", + "type": "custom", + "retryable": false, + "service_specification_id": "{{ env.Getenv "SERVICE_SPECIFICATION_ID" }}", + "parameters": { + "schema": { + "type": "object", + "required": [ + "scope_id", + "deployment_id" + ], + "properties": { + "scope_id": { + "type": "string" + }, + "deployment_id": { + "type": "string" + } + } + }, + "values": {} + }, + "results": { + "schema": { + "type": "object", + "required": [], + "properties": {} + }, + "values": {} + } +} \ No newline at end of file diff --git a/azure-aro/specs/actions/set-desired-instance-count.json.tpl b/azure-aro/specs/actions/set-desired-instance-count.json.tpl new file mode 100644 index 00000000..a792699b --- /dev/null +++ b/azure-aro/specs/actions/set-desired-instance-count.json.tpl @@ -0,0 +1,33 @@ +{ + "name": "Set desired instance count", + "type": "custom", + "icon": "material-symbols:note-add-outline", + "results": { + "schema": { "type": "object", "required": [], "properties": {} }, + "values": {} + }, + "service_specification_id": "{{ env.Getenv "SERVICE_SPECIFICATION_ID" }}", + "parameters": { + "schema": { + "type": "object", + "required": ["desired_instances"], + "properties": { + "desired_instances": { + "type": "integer", + "title": "Desired Instance Count", + "description": "Set the number of instances you want to run", + "additionalKeywords": { + "default": ".service.attributes.autoscaling.min_replicas // 1", + "maximum": ".service.attributes.autoscaling.max_replicas // 10", + "minimum": ".service.attributes.autoscaling.min_replicas // 1" + } + } + } + }, + "values": {} + }, + "annotations": { + "show_on": ["performance"], + "runs_over": "scope" + } +} \ No newline at end of file diff --git a/azure-aro/specs/actions/start-blue-green.json.tpl b/azure-aro/specs/actions/start-blue-green.json.tpl new file mode 100644 index 00000000..a5e387b5 --- /dev/null +++ b/azure-aro/specs/actions/start-blue-green.json.tpl @@ -0,0 +1,33 @@ +{ + "name": "start-blue-green", + "slug": "start-blue-green", + "type": "custom", + "retryable": false, + "service_specification_id": "{{ env.Getenv "SERVICE_SPECIFICATION_ID" }}", + "parameters": { + "schema": { + "type": "object", + "required": [ + "scope_id", + "deployment_id" + ], + "properties": { + "scope_id": { + "type": "string" + }, + "deployment_id": { + "type": "string" + } + } + }, + "values": {} + }, + "results": { + "schema": { + "type": "object", + "required": [], + "properties": {} + }, + "values": {} + } +} \ No newline at end of file diff --git a/azure-aro/specs/actions/start-initial.json.tpl b/azure-aro/specs/actions/start-initial.json.tpl new file mode 100644 index 00000000..b00708e0 --- /dev/null +++ b/azure-aro/specs/actions/start-initial.json.tpl @@ -0,0 +1,32 @@ +{ + "name": "start-initial", + "slug": "start-initial", + "type": "custom", + "service_specification_id": "{{ env.Getenv "SERVICE_SPECIFICATION_ID" }}", + "parameters": { + "schema": { + "type": "object", + "required": [ + "scope_id", + "deployment_id" + ], + "properties": { + "scope_id": { + "type": "string" + }, + "deployment_id": { + "type": "string" + } + } + }, + "values": {} + }, + "results": { + "schema": { + "type": "object", + "required": [], + "properties": {} + }, + "values": {} + } +} \ No newline at end of file diff --git a/azure-aro/specs/actions/switch-traffic.json.tpl b/azure-aro/specs/actions/switch-traffic.json.tpl new file mode 100644 index 00000000..9e853438 --- /dev/null +++ b/azure-aro/specs/actions/switch-traffic.json.tpl @@ -0,0 +1,37 @@ +{ + "name": "switch-traffic", + "slug": "switch-traffic", + "type": "custom", + "retryable": true, + "service_specification_id": "{{ env.Getenv "SERVICE_SPECIFICATION_ID" }}", + "parameters": { + "schema": { + "type": "object", + "required": [ + "scope_id", + "deployment_id", + "desired_traffic" + ], + "properties": { + "scope_id": { + "type": "string" + }, + "deployment_id": { + "type": "string" + }, + "desired_traffic": { + "type": "number" + } + } + }, + "values": {} + }, + "results": { + "schema": { + "type": "object", + "required": [], + "properties": {} + }, + "values": {} + } +} \ No newline at end of file diff --git a/azure-aro/specs/notification-channel.json.tpl b/azure-aro/specs/notification-channel.json.tpl new file mode 100644 index 00000000..f1db58e5 --- /dev/null +++ b/azure-aro/specs/notification-channel.json.tpl @@ -0,0 +1,34 @@ +{ + "nrn": "{{ env.Getenv "NRN" }}", + "status": "active", + "type": "agent", + "source": [ + "telemetry", + "service" + ], + "configuration": { + "api_key": "{{ env.Getenv "NP_API_KEY" }}", + "command": { + "data": { + "cmdline": "{{ env.Getenv "REPO_PATH" }}/entrypoint --service-path={{ env.Getenv "REPO_PATH" }}/k8s --overrides-path={{ env.Getenv "REPO_PATH" }}/{{ env.Getenv "SERVICE_PATH" }}", + "environment": { + "NP_ACTION_CONTEXT": "'${NOTIFICATION_CONTEXT}'" + } + }, + "type": "exec" + }, + "selector": { + "environment": "{{ env.Getenv "ENVIRONMENT" }}" + } + }, + "filters": { + "$or": [ + { + "service.specification.slug": "{{ env.Getenv "SERVICE_SLUG" }}" + }, + { + "arguments.scope_provider": "{{ env.Getenv "SERVICE_SPECIFICATION_ID" }}" + } + ] + } +} \ No newline at end of file diff --git a/azure-aro/specs/scope-type-definition.json.tpl b/azure-aro/specs/scope-type-definition.json.tpl new file mode 100644 index 00000000..9da853fa --- /dev/null +++ b/azure-aro/specs/scope-type-definition.json.tpl @@ -0,0 +1,9 @@ +{ + "description": "Docker containers on pods", + "name": "Containers", + "nrn": "{{ env.Getenv "NRN" }}", + "provider_id": "{{ env.Getenv "SERVICE_SPECIFICATION_ID" }}", + "provider_type": "service", + "status": "active", + "type": "custom" +} \ No newline at end of file diff --git a/azure-aro/specs/service-spec.json.tpl b/azure-aro/specs/service-spec.json.tpl new file mode 100644 index 00000000..c838fd23 --- /dev/null +++ b/azure-aro/specs/service-spec.json.tpl @@ -0,0 +1,595 @@ +{ + "assignable_to": "any", + "attributes": { + "schema":{ + "type":"object", + "required":[ + "ram_memory", + "visibility", + "autoscaling", + "health_check", + "scaling_type", + "cpu_millicores", + "fixed_instances", + "scheduled_stop", + "additional_ports", + "continuous_delivery" + ], + "uiSchema":{ + "type":"VerticalLayout", + "elements":[ + { + "type":"Control", + "label":"RAM Memory", + "scope":"#/properties/ram_memory" + }, + { + "type":"Control", + "label":"Visibility", + "scope":"#/properties/visibility", + "options":{ + "format":"radio" + } + }, + { + "type":"Categorization", + "options":{ + "collapsable":{ + "label":"ADVANCED", + "collapsed":true + } + }, + "elements":[ + { + "type":"Category", + "label":"Processor", + "elements":[ + { + "type":"Control", + "label":"CPU Millicores", + "scope":"#/properties/cpu_millicores" + } + ] + }, + { + "type":"Category", + "label":"Size & Scaling", + "elements":[ + { + "type":"Control", + "scope":"#/properties/scaling_type" + }, + { + "rule":{ + "effect":"SHOW", + "condition":{ + "scope":"#/properties/scaling_type", + "schema":{ + "enum":[ + "fixed" + ] + } + } + }, + "type":"Control", + "scope":"#/properties/fixed_instances" + }, + { + "rule":{ + "effect":"SHOW", + "condition":{ + "scope":"#/properties/scaling_type", + "schema":{ + "enum":[ + "auto" + ] + } + } + }, + "type":"Group", + "label":"Autoscaling Settings", + "elements":[ + { + "type":"Control", + "scope":"#/properties/autoscaling/properties/min_replicas" + }, + { + "type":"Control", + "scope":"#/properties/autoscaling/properties/max_replicas" + }, + { + "type":"Control", + "scope":"#/properties/autoscaling/properties/target_cpu_utilization" + }, + { + "type": "Control", + "scope": "#/properties/autoscaling/properties/target_memory_enabled" + }, + { + "rule": { + "effect": "SHOW", + "condition": { + "scope": "#/properties/autoscaling/properties/target_memory_enabled", + "schema": { + "const": true + } + } + }, + "type": "Control", + "scope": "#/properties/autoscaling/properties/target_memory_utilization" + } + ] + } + ] + }, + { + "type":"Category", + "label":"Additional Ports", + "elements":[ + { + "type":"Control", + "scope":"#/properties/additional_ports", + "options":{ + "detail":{ + "type":"VerticalLayout", + "elements":[ + { + "type":"Control", + "scope":"#/properties/port" + }, + { + "type":"Control", + "scope":"#/properties/type" + } + ] + } + } + } + ] + }, + { + "type":"Category", + "label":"Scheduled Stop", + "elements":[ + { + "type":"Control", + "scope":"#/properties/scheduled_stop/properties/enabled" + }, + { + "rule":{ + "effect":"SHOW", + "condition":{ + "scope":"#/properties/scheduled_stop/properties/enabled", + "schema":{ + "const":true + } + } + }, + "type":"Control", + "scope":"#/properties/scheduled_stop/properties/timer" + } + ] + }, + { + "type":"Category", + "label":"Continuous deployment", + "elements":[ + { + "type":"Control", + "scope":"#/properties/continuous_delivery/properties/enabled" + }, + { + "rule":{ + "effect":"SHOW", + "condition":{ + "scope":"#/properties/continuous_delivery/properties/enabled", + "schema":{ + "const":true + } + } + }, + "type":"Control", + "scope":"#/properties/continuous_delivery/properties/branches" + } + ] + }, + { + "type":"Category", + "label":"Health Check", + "elements":[ + { + "type":"Control", + "scope":"#/properties/health_check/properties/enabled" + }, + { + "rule": { + "effect": "SHOW", + "condition": { + "scope": "#/properties/health_check/properties/enabled", + "schema": { + "const": true + } + } + }, + "type": "Control", + "scope": "#/properties/health_check/properties/type", + "options":{ + "format":"radio" + } + }, + { + "rule": { + "effect": "SHOW", + "condition": { + "type": "AND", + "conditions": [ + { + "scope": "#/properties/health_check/properties/type", + "schema": { + "const": "HTTP" + } + }, + { + "scope": "#/properties/health_check/properties/enabled", + "schema": { + "const": true + } + } + ] + } + }, + "type": "Control", + "scope": "#/properties/health_check/properties/path" + }, + { + "rule":{ + "effect":"SHOW", + "condition":{ + "scope":"#/properties/health_check/properties/enabled", + "schema":{ + "const":true + } + } + }, + "type":"Control", + "scope":"#/properties/health_check/properties/initial_delay_seconds" + }, + { + "rule":{ + "effect":"SHOW", + "condition":{ + "scope":"#/properties/health_check/properties/enabled", + "schema":{ + "const":true + } + } + }, + "type":"Control", + "scope":"#/properties/health_check/properties/period_seconds" + }, + { + "rule":{ + "effect":"SHOW", + "condition":{ + "scope":"#/properties/health_check/properties/enabled", + "schema":{ + "const":true + } + } + }, + "type":"Control", + "scope":"#/properties/health_check/properties/timeout_seconds" + } + ] + } + ] + } + ] + }, + "properties":{ + "asset_type":{ + "type":"string", + "export":false, + "default":"docker-image" + }, + "ram_memory":{ + "type":"integer", + "oneOf":[ + { + "const":64, + "title":"64 MB" + }, + { + "const":128, + "title":"128 MB" + }, + { + "const":256, + "title":"256 MB" + }, + { + "const":512, + "title":"512 MB" + }, + { + "const":1024, + "title":"1 GB" + }, + { + "const":2048, + "title":"2 GB" + }, + { + "const":4096, + "title":"4 GB" + }, + { + "const":8192, + "title":"8 GB" + }, + { + "const":16384, + "title":"16 GB" + } + ], + "title":"RAM Memory", + "default":128, + "description":"Amount of RAM memory to allocate to the container (in MB)" + }, + "visibility":{ + "type":"string", + "oneOf":[ + { + "const":"public", + "title":"Internet", + "description":"Public, reachable by anyone" + }, + { + "const":"internal", + "title":"Main Account", + "description":"Only visible inside your organization" + } + ], + "title":"Visibility", + "default":"public", + "description":"Define whether the scope is publicly accessible or private to your account" + }, + "autoscaling":{ + "type":"object", + "properties":{ + "max_replicas":{ + "type":"integer", + "title":"Maximum Replicas", + "default":5, + "maximum":20, + "minimum":1, + "description":"Maximum number of instances to scale to" + }, + "min_replicas":{ + "type":"integer", + "title":"Minimum Replicas", + "default":1, + "maximum":10, + "minimum":1, + "description":"Minimum number of instances to maintain" + }, + "target_cpu_utilization":{ + "type":"integer", + "title":"Target CPU Utilization (%)", + "default":70, + "maximum":90, + "minimum":50, + "description":"CPU utilization threshold that triggers scaling" + }, + "target_memory_enabled": { + "type": "boolean", + "title": "Scale by memory", + "default": false + }, + "target_memory_utilization": { + "type": "integer", + "title": "Target memory utilization (%)", + "default": 70, + "maximum": 90, + "minimum": 30, + "description": "Memory utilization threshold that triggers scaling" + } + } + }, + "health_check":{ + "type":"object", + "properties":{ + "path":{ + "type":"string", + "title":"Health Check Path", + "default":"/health", + "description":"HTTP path for health check requests" + }, + "enabled":{ + "type":"boolean", + "title":"Enable Health Check", + "default":true + }, + "period_seconds":{ + "type":"integer", + "title":"Check Interval", + "default":10, + "maximum":300, + "minimum":1, + "description":"Seconds between health checks" + }, + "timeout_seconds":{ + "type":"integer", + "title":"Timeout", + "default":5, + "maximum":60, + "minimum":1, + "description":"Seconds to wait for a health check response" + }, + "initial_delay_seconds":{ + "type":"integer", + "title":"Initial Delay", + "default":30, + "maximum":300, + "minimum":0, + "description":"Seconds to wait before starting health checks" + }, + "type": { + "type": "string", + "title": "Health check type", + "default": "HTTP", + "enum": [ + "HTTP", + "TCP" + ], + "description": "To be applied in startup, readiness and liveness probes" + } + } + }, + "scaling_type":{ + "enum":[ + "fixed", + "auto" + ], + "type":"string", + "title":"Scaling Type", + "default":"fixed", + "description":"Choose between fixed number of instances or automatic scaling" + }, + "cpu_millicores":{ + "type":"integer", + "title":"CPU Millicores", + "default":500, + "maximum":4000, + "minimum":100, + "description":"Amount of CPU to allocate (in millicores, 1000m = 1 CPU core)" + }, + "scheduled_stop":{ + "type":"object", + "title":"Scheduled Stop", + "required":[ + "enabled", + "timer" + ], + "properties":{ + "timer":{ + "type":"string", + "oneOf":[ + { + "const":"3600", + "title":"1 hour" + }, + { + "const":"10800", + "title":"3 hours" + }, + { + "const":"21600", + "title":"6 hours" + }, + { + "const":"43200", + "title":"12 hours" + }, + { + "const":"tonight", + "title":"Tonight" + } + ], + "title":"Stop After", + "default":"3600", + "description":"When to automatically stop the service" + }, + "enabled":{ + "type":"boolean", + "title":"Enable Scheduled Stop", + "default":false, + "description":"Automatically stop the service after a specified time" + } + }, + "description":"Configure automatic stopping of the service" + }, + "fixed_instances":{ + "type":"integer", + "title":"Number of Instances", + "default":1, + "maximum":10, + "minimum":1, + "description":"Fixed number of instances to run" + }, + "additional_ports":{ + "type":"array", + "items":{ + "type":"object", + "required":[ + "port", + "type" + ], + "properties":{ + "port":{ + "type":"integer", + "title":"Port Number", + "maximum":65535, + "minimum":1024, + "description":"The port number to expose (1024-65535)" + }, + "type":{ + "enum":[ + "GRPC" + ], + "type":"string", + "title":"Port Type", + "description":"The protocol type for this port" + } + } + }, + "title":"Additional Ports", + "default":[ + + ], + "description":"Configure additional ports for your application" + }, + "continuous_delivery":{ + "type":"object", + "title":"Continuous Delivery", + "required":[ + "enabled", + "branches" + ], + "properties":{ + "enabled":{ + "type":"boolean", + "title":"Enable Continuous Delivery", + "default":false, + "description":"Automatically deploy new versions from specified branches" + }, + "branches":{ + "type":"array", + "items":{ + "type":"string" + }, + "title":"Branches", + "default":[ + "main" + ], + "description":"Git branches to monitor for automatic deployment" + } + }, + "description":"Configure automatic deployment from Git branches" + } + } + } + }, + "name": "Containers", + "selectors": { + "category": "any", + "imported": false, + "provider": "any", + "sub_category": "any" + }, + "type": "scope", + "use_default_actions": false, + "visible_to": [ + "{{ env.Getenv "NRN" }}" + ] +} diff --git a/azure-aro/values.yaml b/azure-aro/values.yaml new file mode 100644 index 00000000..7ff585b6 --- /dev/null +++ b/azure-aro/values.yaml @@ -0,0 +1,10 @@ +configuration: + DNS_TYPE: azure + USE_ACCOUNT_SLUG: false + IMAGE_PULL_SECRETS: + ENABLED: false + DOMAIN: $OVERRIDE_DOMAIN + SERVICE_TEMPLATE: "$SERVICE_PATH/deployment/templates/istio/service.yaml.tpl" + INITIAL_INGRESS_PATH: "$SERVICE_PATH/deployment/templates/aro/initial-httproute.yaml.tpl" + BLUE_GREEN_INGRESS_PATH: "$SERVICE_PATH/deployment/templates/aro/blue-green-httproute.yaml.tpl" + GATEWAY_TYPE: aro_cluster \ No newline at end of file diff --git a/k8s/deployment/templates/aro/blue-green-httproute.yaml.tpl b/k8s/deployment/templates/aro/blue-green-httproute.yaml.tpl new file mode 100644 index 00000000..cc1c9aa3 --- /dev/null +++ b/k8s/deployment/templates/aro/blue-green-httproute.yaml.tpl @@ -0,0 +1,58 @@ +apiVersion: route.openshift.io/v1 +kind: Route +metadata: + name: k-8-s-{{ .scope.slug }}-{{ .scope.id }}-{{ .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 }}" + deployment-strategy: "blue-green" +{{- $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: + route.openshift.io/deployment-strategy: "blue-green" +{{- $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: + host: {{ .scope.domain }} + to: + kind: Service + name: d-{{ .scope.id }}-{{ .blue_deployment_id }} + weight: {{ sub 100 .deployment.strategy_data.desired_switched_traffic }} + port: + targetPort: 80 + alternateBackends: + - kind: Service + name: d-{{ .scope.id }}-{{ .deployment.id }} + weight: {{ .deployment.strategy_data.desired_switched_traffic }} \ No newline at end of file diff --git a/k8s/deployment/templates/aro/initial-httproute.yaml.tpl b/k8s/deployment/templates/aro/initial-httproute.yaml.tpl new file mode 100644 index 00000000..5f13b77e --- /dev/null +++ b/k8s/deployment/templates/aro/initial-httproute.yaml.tpl @@ -0,0 +1,51 @@ +apiVersion: route.openshift.io/v1 +kind: Route +metadata: + name: k-8-s-{{ .scope.slug }}-{{ .scope.id }}-{{ .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: +{{- $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: + host: {{ .scope.domain }} + to: + kind: Service + name: d-{{ .scope.id }}-{{ .deployment.id }} + port: + targetPort: 80 \ No newline at end of file diff --git a/k8s/scope/networking/dns/az-records/manage_route b/k8s/scope/networking/dns/az-records/manage_route index db5d44ab..2ba49ce6 100755 --- a/k8s/scope/networking/dns/az-records/manage_route +++ b/k8s/scope/networking/dns/az-records/manage_route @@ -52,9 +52,24 @@ for arg in "$@"; do esac done -# Get IP from Gateway resource -GATEWAY_IP=$(kubectl get gateway "$GATEWAY_NAME" -n gateways \ - -o jsonpath='{.status.addresses[?(@.type=="IPAddress")].value}' 2>/dev/null) +# Get IP based on gateway type +if [ "${GATEWAY_TYPE:-istio}" = "aro_cluster" ]; then + # Get IP from OpenShift router service + GATEWAY_IP=$(kubectl get svc router-default -n openshift-ingress \ + -o jsonpath='{.status.loadBalancer.ingress[0].ip}' 2>/dev/null) + + if [ -z "$GATEWAY_IP" ]; then + echo "Error: Could not get IP address from ARO router service" >&2 + echo "Falling back to istio gateway..." >&2 + # Fall back to istio gateway + GATEWAY_IP=$(kubectl get gateway "$GATEWAY_NAME" -n gateways \ + -o jsonpath='{.status.addresses[?(@.type=="IPAddress")].value}' 2>/dev/null) + fi +else + # Default: Get IP from Gateway resource (istio) + GATEWAY_IP=$(kubectl get gateway "$GATEWAY_NAME" -n gateways \ + -o jsonpath='{.status.addresses[?(@.type=="IPAddress")].value}' 2>/dev/null) +fi if [ -z "$GATEWAY_IP" ]; then echo "Error: Could not get IP address for gateway $GATEWAY_NAME" >&2 diff --git a/k8s/scope/networking/dns/build_dns_context b/k8s/scope/networking/dns/build_dns_context index 9df57eb5..5cd476e0 100755 --- a/k8s/scope/networking/dns/build_dns_context +++ b/k8s/scope/networking/dns/build_dns_context @@ -9,8 +9,13 @@ case "$DNS_TYPE" in source "$SERVICE_PATH/scope/networking/dns/get_hosted_zones" ;; azure) + # Set default gateway type to istio if not specified + GATEWAY_TYPE="${GATEWAY_TYPE:-istio}" + export GATEWAY_TYPE + # from values.yaml: HOSTED_ZONE_NAME, HOSTED_ZONE_RG, etc. echo "Azure DNS context ready" + echo "GATEWAY_TYPE: $GATEWAY_TYPE" echo "HOSTED_ZONE_NAME: $HOSTED_ZONE_NAME" echo "HOSTED_ZONE_RG: $HOSTED_ZONE_RG" echo "AZURE_SUBSCRIPTION_ID: $AZURE_SUBSCRIPTION_ID" From 6c2d5bc6bb638e4b80b199f5344f8d3405909d4c Mon Sep 17 00:00:00 2001 From: Ignacio Boudgouste <73672747+ignacioboud@users.noreply.github.com> Date: Mon, 27 Oct 2025 16:35:27 -0300 Subject: [PATCH 07/10] fix: adjust component name to k8s requirements (#85) --- k8s/deployment/templates/service.yaml.tpl | 4 ++-- k8s/scope/build_context | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/k8s/deployment/templates/service.yaml.tpl b/k8s/deployment/templates/service.yaml.tpl index 7d369d43..1d1bc516 100644 --- a/k8s/deployment/templates/service.yaml.tpl +++ b/k8s/deployment/templates/service.yaml.tpl @@ -88,7 +88,7 @@ metadata: namespace: {{ $.k8s_namespace }} labels: name: d-{{ $.scope.id }}-{{ $.deployment.id }}-http-{{ .port }} - app.kubernetes.io/part-of: {{ $.namespace.slug }}-{{ $.application.slug }} + app.kubernetes.io/part-of: {{ .component }} app.kubernetes.io/component: application app.kubernetes.io/instance: {{ $.scope.slug }} app.kubernetes.io/name: {{ $.scope.slug }} @@ -169,7 +169,7 @@ metadata: namespace: {{ $.k8s_namespace }} labels: name: d-{{ $.scope.id }}-{{ $.deployment.id }}-grpc-{{ .port }} - app.kubernetes.io/part-of: {{ $.namespace.slug }}-{{ $.application.slug }} + app.kubernetes.io/part-of: {{ .component }} app.kubernetes.io/component: application app.kubernetes.io/instance: {{ $.scope.slug }} app.kubernetes.io/name: {{ $.scope.slug }} diff --git a/k8s/scope/build_context b/k8s/scope/build_context index b49c29ea..08018b9b 100755 --- a/k8s/scope/build_context +++ b/k8s/scope/build_context @@ -58,7 +58,7 @@ fi NAMESPACE_SLUG=$(echo "$CONTEXT" | jq -r .namespace.slug) APPLICATION_SLUG=$(echo "$CONTEXT" | jq -r .application.slug) -COMPONENT=$(echo "$NAMESPACE_SLUG-$APPLICATION_SLUG" | cut -c1-63) +COMPONENT=$(echo "$NAMESPACE_SLUG-$APPLICATION_SLUG" | sed -E 's/^(.{0,62}[a-zA-Z0-9]).*/\1/') CONTEXT=$(echo "$CONTEXT" | jq \ --arg ingress_visibility "$INGRESS_VISIBILITY" \ From 4e88682243fd6fb43a5bdaccae38f0a710ddea67 Mon Sep 17 00:00:00 2001 From: Ignacio Boudgouste <73672747+ignacioboud@users.noreply.github.com> Date: Mon, 27 Oct 2025 17:12:38 -0300 Subject: [PATCH 08/10] fix: change component anotation (#86) --- k8s/deployment/templates/service.yaml.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/k8s/deployment/templates/service.yaml.tpl b/k8s/deployment/templates/service.yaml.tpl index 1d1bc516..a9299fb3 100644 --- a/k8s/deployment/templates/service.yaml.tpl +++ b/k8s/deployment/templates/service.yaml.tpl @@ -88,7 +88,7 @@ metadata: namespace: {{ $.k8s_namespace }} labels: name: d-{{ $.scope.id }}-{{ $.deployment.id }}-http-{{ .port }} - app.kubernetes.io/part-of: {{ .component }} + app.kubernetes.io/part-of: {{ $.component }} app.kubernetes.io/component: application app.kubernetes.io/instance: {{ $.scope.slug }} app.kubernetes.io/name: {{ $.scope.slug }} @@ -169,7 +169,7 @@ metadata: namespace: {{ $.k8s_namespace }} labels: name: d-{{ $.scope.id }}-{{ $.deployment.id }}-grpc-{{ .port }} - app.kubernetes.io/part-of: {{ .component }} + app.kubernetes.io/part-of: {{ $.component }} app.kubernetes.io/component: application app.kubernetes.io/instance: {{ $.scope.slug }} app.kubernetes.io/name: {{ $.scope.slug }} From ad136ada0bb70a866e1ba01a1bc823d71acc4cd7 Mon Sep 17 00:00:00 2001 From: Federico Maleh Date: Tue, 4 Nov 2025 11:24:38 -0300 Subject: [PATCH 09/10] Allow to use any metric with percentile (#81) --- datadog/metric/metric | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/datadog/metric/metric b/datadog/metric/metric index 244c7bcb..656a7cd0 100755 --- a/datadog/metric/metric +++ b/datadog/metric/metric @@ -135,7 +135,13 @@ build_datadog_query() { local p99_interval=$((end_time - start_time)) echo "p99:trace.http.request{service:$service_name,env:$env_name}.rollup(avg, $p99_interval) * 1000" ;; - + p??:*) + local env_name=$(echo "$CONTEXT" | jq -r '.service.dimensions.environment') + local service_name=$(basename $(echo "$CONTEXT" | jq -r '.tags.repository_url'))-kubernetes + + local percentile_interval=$((end_time - start_time)) + echo "$metric{service:$service_name,env:$env_name}.rollup(avg, $percentile_interval) * 1000" + ;; # Generic handler for any other Datadog metric *) echo "avg:$metric{$filters}$group_clause" From db410d5e209f7e131e6f46129d653f1bc0773313 Mon Sep 17 00:00:00 2001 From: Federico Maleh Date: Tue, 11 Nov 2025 10:56:26 -0300 Subject: [PATCH 10/10] Fix naming convention for deployment volumes (#89) --- k8s/deployment/templates/deployment.yaml.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/k8s/deployment/templates/deployment.yaml.tpl b/k8s/deployment/templates/deployment.yaml.tpl index ab9c237d..497b5141 100644 --- a/k8s/deployment/templates/deployment.yaml.tpl +++ b/k8s/deployment/templates/deployment.yaml.tpl @@ -285,7 +285,7 @@ spec: {{- range .parameters.results }} {{- if and (eq .type "file") }} {{- if gt (len .values) 0 }} - - name: {{ printf "file-%s" (filepath.Base .destination_path | strings.ReplaceAll "." "-") }} + - name: {{ printf "file-%s" (filepath.Base .destination_path | strings.ReplaceAll "." "-" | strings.ReplaceAll "_" "-") }} mountPath: {{ .destination_path }} subPath: {{ filepath.Base .destination_path }} readOnly: true @@ -298,7 +298,7 @@ spec: {{- range .parameters.results }} {{- if and (eq .type "file") }} {{- if gt (len .values) 0 }} - - name: {{ printf "file-%s" (filepath.Base .destination_path | strings.ReplaceAll "." "-") }} + - name: {{ printf "file-%s" (filepath.Base .destination_path | strings.ReplaceAll "." "-" | strings.ReplaceAll "_" "-") }} secret: secretName: s-{{ $.scope.id }}-d-{{ $.deployment.id }} items: