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

console-api Helm chart #311

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
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/console-api/.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/
24 changes: 24 additions & 0 deletions charts/console-api/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: console-app
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: "2.53.0"
7 changes: 7 additions & 0 deletions charts/console-api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Deploy using

# For mainnet
helm install console-api-mainnet . -f values.yaml -f values-mainnet.yaml

# For sandbox
helm install console-api-sandbox . -f values.yaml -f values-sandbox.yaml
63 changes: 63 additions & 0 deletions charts/console-api/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "console-api.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).
*/}}
{{- define "console-api.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- printf "%s-%s-%s" .Release.Name $name .Values.environment | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}

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

{{/*
Common labels
*/}}
{{- define "console-api.labels" -}}
helm.sh/chart: {{ include "console-api.chart" . }}
{{ include "console-api.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/part-of: console-api
app.kubernetes.io/environment: {{ .Values.environment }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "console-api.selectorLabels" -}}
app.kubernetes.io/name: {{ include "console-api.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of doppler secret
*/}}
{{- define "console-api.dopplerSecretName" -}}
{{- printf "%s-secret" (include "console-api.fullname" .) }}
{{- end }}

{{/*
Create the doppler config name based on environment
*/}}
{{- define "console-api.dopplerConfig" -}}
{{- printf "staging-%s" .Values.environment }}
{{- end }}
33 changes: 33 additions & 0 deletions charts/console-api/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "console-api.fullname" . }}
namespace: {{ .Values.namespace | default "staging" }}
labels:
{{- include "console-api.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount | default 1 }}
selector:
matchLabels:
{{- include "console-api.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "console-api.selectorLabels" . | nindent 8 }}
spec:
containers:
- name: {{ include "console-api.name" . }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}

Choose a reason for hiding this comment

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

I think my prev commend might have been misleading. Apologies. I think we'll need to be able to override the command if needed.

Current use case:
we used doppler secrets via doppler cli inside the image, now it's syncing to k8s secrets. So we need to override image cmd to migrate from prev infra to k8s:

doppler run -- node server.js -> node server.js

ports:
- containerPort: 3000
name: api-port
protocol: TCP
env:
- name: PORT
value: "3000"
resources:
{{- toYaml .Values.resources | nindent 12 }}
envFrom:
- secretRef:
name: {{ include "console-api.dopplerSecretName" . }}
17 changes: 17 additions & 0 deletions charts/console-api/templates/doppler-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: secrets.doppler.com/v1alpha1
kind: DopplerSecret
metadata:
name: {{ include "console-api.fullname" . }}-dopplersecret
namespace: doppler-operator-system
labels:
{{- include "console-api.labels" . | nindent 4 }}
spec:
project: {{ .Values.doppler.project | default "console-api" }}
config: {{ include "console-api.dopplerConfig" . }}
managedSecret:
name: {{ include "console-api.dopplerSecretName" . }}
namespace: {{ .Values.namespace | default "staging" }}
type: Opaque
tokenSecret:
name: {{ .Values.doppler.tokenSecret | default "console-token-secret" }}
verifyTLS: {{ .Values.doppler.verifyTLS | default true }}
30 changes: 30 additions & 0 deletions charts/console-api/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "console-api.fullname" . }}-ingress
namespace: {{ .Values.namespace | default "staging" }}
labels:
{{- include "console-api.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
ingressClassName: {{ .Values.ingress.className }}
rules:
- host: {{ .Values.ingress.host }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ include "console-api.fullname" . }}-service
port:
name: api-port
{{- if .Values.ingress.tls }}
tls:
- hosts:
- {{ .Values.ingress.host }}
secretName: {{ .Values.ingress.tls.secretName }}
{{- end }}
16 changes: 16 additions & 0 deletions charts/console-api/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "console-api.fullname" . }}-service
namespace: {{ .Values.namespace | default "staging" }}
labels:
{{- include "console-api.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type | default "ClusterIP" }}
selector:
{{- include "console-api.selectorLabels" . | nindent 4 }}
ports:
- protocol: TCP
port: {{ .Values.service.port | default 3000 }}
targetPort: api-port
name: api-port
5 changes: 5 additions & 0 deletions charts/console-api/values-mainnet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
environment: mainnet
ingress:
host: console-api-mainnet.akash.network
tls:
secretName: console-api-mainnet-akash-network-tls
5 changes: 5 additions & 0 deletions charts/console-api/values-sandbox.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
environment: sandbox
ingress:
host: console-api-sandbox.akash.network
tls:
secretName: console-api-sandbox-akash-network-tls
70 changes: 70 additions & 0 deletions charts/console-api/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Default values for console-api chart

# Chart name override configurations
nameOverride: ""
fullnameOverride: ""

# Environment (mainnet or sandbox)
environment: mainnet

# Namespace for the application
namespace: staging

# Deployment configurations
replicaCount: 1

# Image configurations
image:
repository: ghcr.io/akash-network/console-api
tag: "2.53.0"
pullPolicy: Always

# Service configurations
service:
type: ClusterIP
port: 3000

# Resource requirements
resources:
requests:
cpu: "1"
memory: "2Gi"
ephemeral-storage: "2Gi"
limits:
cpu: "1"
memory: "2Gi"
ephemeral-storage: "2Gi"

# Ingress configurations
ingress:
enabled: true
className: nginx
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: 100m
nginx.ingress.kubernetes.io/proxy-connect-timeout: "140"
nginx.ingress.kubernetes.io/proxy-read-timeout: "140"
nginx.ingress.kubernetes.io/proxy-send-timeout: "140"
nginx.ingress.kubernetes.io/ssl-redirect: "true"
host: console-api-staging-next.akash.network
tls:
secretName: console-api-staging-akash-network-tls

# Doppler secret configurations
doppler:
namespace: doppler-operator-system
project: console-api
tokenSecret: console-token-secret
verifyTLS: true

# Application specific configurations
app:
port: "3000"

# Node selector configurations
nodeSelector: {}

# Tolerations configurations
tolerations: []

# Affinity configurations
affinity: {}
23 changes: 23 additions & 0 deletions charts/provider-console-api/.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/
24 changes: 24 additions & 0 deletions charts/provider-console-api/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: provider-console-api
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.16.0"
33 changes: 33 additions & 0 deletions charts/provider-console-api/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: provider-console-api
namespace: staging
labels:
app: provider-console-api
spec:
replicas: 1
selector:
matchLabels:
app: provider-console-api
template:
metadata:
labels:
app: provider-console-api
spec:
containers:
- name: provider-console-api
image: arc10/provider-console-api:0.0.18
imagePullPolicy: "Always"
resources:
limits:
cpu: "1"
memory: "2Gi"
ephemeral-storage: "2Gi"
requests:
cpu: "500m"
memory: "512Mi"
ephemeral-storage: "2Gi"
envFrom:
- secretRef:
name: provider-console-api-secret
Loading
Loading