-
Notifications
You must be signed in to change notification settings - Fork 1
Thusara nginx service service #2
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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/ |
| 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" |
| 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 |
| 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 }} |
| 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", | ||
| "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 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Parameterize Hardcoding 🤖 Prompt for AI Agents |
||
| 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add default fallback for empty image tag image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"🤖 Prompt for AI Agents |
||
| ports: | ||
| - containerPort: 80 | ||
| name: http | ||
| 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 }} |
| 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: {} |
| 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 |
| 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Indentation & default-safety for
-resources:
- {{ nginxService.resources | to_yaml | indent(2) }}
+resources:
+ {{ nginxService.resources | default({}) | to_yaml | indent(2, true) }}
📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
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.
Fix Datadog metrics port to match container port
The
prometheus_urlis currently targeting port8081, but the nginx container listens on port80. This mismatch will break metric scraping—update it to use:80/metrics.🤖 Prompt for AI Agents