Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
23 changes: 23 additions & 0 deletions charts/nginx-service/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions charts/nginx-service/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: nginx
repository: https://charts.bitnami.com/bitnami
version: 20.1.0
digest: sha256:c9eabfa2af92e4a37034020151d3e373d5316dc265712a2c3490ba12f0f62553
generated: "2025-06-10T16:52:38.890077-04:00"
29 changes: 29 additions & 0 deletions charts/nginx-service/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: v2
name: nginx-service
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.0.0"

dependencies:
- name: nginx
version: 20.1.0
repository: https://charts.bitnami.com/bitnami
55 changes: 55 additions & 0 deletions charts/nginx-service/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "nginx-service.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "nginx-service.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "nginx-service.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{- define "nginx-service.ddTags" -}}
{{- printf "env:%s, service:%s" $.Values.global.environmentName "nginx-service" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "nginx-service.labels" -}}
helm.sh/chart: {{ include "nginx-service.chart" . }}
{{ include "nginx-service.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "nginx-service.selectorLabels" -}}
app.kubernetes.io/name: {{ include "nginx-service.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
51 changes: 51 additions & 0 deletions charts/nginx-service/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "nginx-service.fullname" . }}
labels:
{{- include "nginx-service.labels" . | nindent 4 }}
spec:
replicas: 2
strategy:
type: Recreate #Tell k8s to recreate the pod when the deployment is updated
selector:
matchLabels:
{{- include "nginx-service.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
ad.datadoghq.com/nginx-service.logs: '[{"service": "nginx-service"}]'
ad.datadoghq.com/nginx-service.checks: |
{
"openmetrics": {
"instances": [
{
"prometheus_url": "http://%%host%%:8081/metrics",
Comment on lines +17 to +23

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix Datadog metrics port to match container port

The prometheus_url is currently targeting port 8081, but the nginx container listens on port 80. This mismatch will break metric scraping—update it to use :80/metrics.

🤖 Prompt for AI Agents
In charts/nginx-service/templates/deployment.yaml between lines 17 and 23,
update the prometheus_url port from 8081 to 80 to match the nginx container's
listening port. Change the URL from "http://%%host%%:8081/metrics" to
"http://%%host%%:80/metrics" to ensure proper metric scraping by Datadog.

"namespace": "nginx-service",
"metrics": ["*"]
}
]
}
}
labels:
{{- include "nginx-service.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
serviceAccountName: main-service-account

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Parameterize serviceAccountName for greater flexibility

Hardcoding main-service-account limits reuse. Consider pulling this from .Values.serviceAccountName with a sensible default.

🤖 Prompt for AI Agents
In charts/nginx-service/templates/deployment.yaml at line 42, the
serviceAccountName is hardcoded as "main-service-account", which reduces
flexibility. Modify this line to use a Helm template expression that references
.Values.serviceAccountName with a default fallback value, allowing users to
override the service account name via values.yaml while maintaining a sensible
default.

containers:
- name: nginx
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
Comment on lines +47 to +48

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add default fallback for empty image tag
If Values.image.tag is blank, the image reference becomes invalid. Apply a default filter to fall back on .Chart.AppVersion:

image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
🤖 Prompt for AI Agents
In charts/nginx-service/templates/deployment.yaml at lines 47-48, the image tag
is used directly from .Values.image.tag which can be empty, causing an invalid
image reference. Fix this by applying the default filter to .Values.image.tag so
that if it is empty, it falls back to .Chart.AppVersion. Update the image line
to use: {{ .Values.image.tag | default .Chart.AppVersion }} to ensure a valid
tag is always used.

ports:
- containerPort: 80
name: http
15 changes: 15 additions & 0 deletions charts/nginx-service/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "nginx-service.fullname" . }}
labels:
{{- include "nginx-service.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: 80
targetPort: http
protocol: TCP
name: http
selector:
{{- include "nginx-service.selectorLabels" . | nindent 4 }}
82 changes: 82 additions & 0 deletions charts/nginx-service/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Default values for nginx-service.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

# This will set the replicaset count more information can be found here: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/
replicaCount: 1

# This sets the container image more information can be found here: https://kubernetes.io/docs/concepts/containers/images/
image:
repository: bitnami/nginx
# This sets the pull policy for images.
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""

# This is for the secretes for pulling an image from a private repository more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
imagePullSecrets: []
# This is to override the chart name.
nameOverride: ""
fullnameOverride: ""

# This is for setting Kubernetes Annotations to a Pod.
# For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
podAnnotations: {}
# This is for setting Kubernetes Labels to a Pod.
# For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
podLabels: {}

podSecurityContext:
{}
# fsGroup: 2000

securityContext:
{}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000

# This is for setting up a service more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/
service:
# This sets the service type more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
type: LoadBalancer

# This block is for setting up the ingress for more information can be found here: https://kubernetes.io/docs/concepts/services-networking/ingress/

resources:
limits:
cpu: 1
memory: 8Gi
requests:
cpu: 1
memory: 8Gi

# This section is for setting up autoscaling more information can be found here: https://kubernetes.io/docs/concepts/workloads/autoscaling/
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80

# Additional volumes on the output Deployment definition.
volumes: []
# - name: foo
# secret:
# secretName: mysecret
# optional: false

# Additional volumeMounts on the output Deployment definition.
volumeMounts: []
# - name: foo
# mountPath: "/etc/foo"
# readOnly: true

nodeSelector: {}

tolerations: []

affinity: {}
8 changes: 8 additions & 0 deletions environments/gamma/rendered/app-of-apps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,11 @@ appOfApps:
- ./values.yaml
- ../../environments/gamma/rendered/global.yaml
- ../../environments/gamma/rendered/app-registry-service.yaml

- name: nginx-service
disable: true
namespace: default
valueFiles:
- ./values.yaml
- ../../environments/gamma/rendered/global.yaml
- ../../environments/gamma/rendered/nginx-service.yaml
13 changes: 13 additions & 0 deletions environments/gamma/rendered/nginx-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
############### WARNING ####################
# This file is generated by the environment.py script. Do not edit this file directly.
# Instead, edit the corresponding template file in the templates directory and run the environment.py script.

image:
tag: "latest"
resources:
limits:
cpu: 500m
memory: 2Gi
requests:
cpu: 100m
memory: 1Gi
14 changes: 14 additions & 0 deletions environments/gamma/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ appRegistryService:
cpu: 1
memory: 2Gi

nginxService:
image:
tag: latest
resources:
requests:
cpu: '100m'
memory: 1Gi
limits:
cpu: '500m'
memory: 2Gi

rpcGateway:
image:
tag: "5b23033"
Expand Down Expand Up @@ -114,3 +125,6 @@ appOfApps:
- name: app-registry-service
namespace: default
disable: true
- name: nginx-service
namespace: default
disable: true
3 changes: 2 additions & 1 deletion templates/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
'xchain-monitor',
'river-node',
'rpc-gateway',
'subgraph'
'subgraph',
'nginx-service'
)

GENERATED_FILE_WARNING_MESSAGE = """############### WARNING ####################
Expand Down
4 changes: 4 additions & 0 deletions templates/nginx-service.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
image:
tag: "{{ nginxService.image.tag }}"
resources:
{{ nginxService.resources | to_yaml | indent(2) }}
Comment on lines +3 to +4

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Indentation & default-safety for resources block

  1. indent(2) does not indent the first line, causing limits: to be indented two spaces while its children are indented four. Valid YAML but untidy and inconsistent with other templates.
  2. If nginxService.resources is omitted, Jinja will raise an exception.
-resources:
-  {{ nginxService.resources | to_yaml | indent(2) }}
+resources:
+  {{ nginxService.resources | default({}) | to_yaml | indent(2, true) }}

indent(2, true) keeps all lines aligned, and default({}) prevents template explosions when the key is absent.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
resources:
{{ nginxService.resources | to_yaml | indent(2) }}
resources:
{{ nginxService.resources | default({}) | to_yaml | indent(2, true) }}
🤖 Prompt for AI Agents
In templates/nginx-service.j2 at lines 3-4, the resources block uses indent(2)
which does not indent the first line, causing inconsistent YAML indentation, and
it lacks a default value for nginxService.resources which can cause exceptions
if the key is missing. Fix this by changing the filter to indent(2, true) to
indent all lines consistently and wrap nginxService.resources with default({})
to provide a safe fallback when the key is absent.