about summary refs log tree commit diff
path: root/k8s
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2024-05-25 00:33:29 +0200
committerBaitinq <manuelpalenzuelamerino@gmail.com>2024-05-25 00:45:24 +0200
commit5fc94dd8904ee9e5027ef97c82bb8dedc876d6ea (patch)
tree1d4e455b52c2fd6551d53b28372c595193e9da3a /k8s
parentcleanup (diff)
downloadfs-tracer-backend-5fc94dd8904ee9e5027ef97c82bb8dedc876d6ea.tar.gz
fs-tracer-backend-5fc94dd8904ee9e5027ef97c82bb8dedc876d6ea.tar.bz2
fs-tracer-backend-5fc94dd8904ee9e5027ef97c82bb8dedc876d6ea.zip
rest-api: deploy with bazel
Diffstat (limited to 'k8s')
-rw-r--r--k8s/rest-api/BUILD.bazel11
-rw-r--r--k8s/rest-api/templates/NOTES.txt8
-rw-r--r--k8s/rest-api/templates/deployment.yaml5
-rw-r--r--k8s/rest-api/templates/ingress.yaml61
-rw-r--r--k8s/rest-api/templates/serviceaccount.yaml12
-rw-r--r--k8s/rest-api/values.yaml72
6 files changed, 17 insertions, 152 deletions
diff --git a/k8s/rest-api/BUILD.bazel b/k8s/rest-api/BUILD.bazel
new file mode 100644
index 0000000..9ebdaf9
--- /dev/null
+++ b/k8s/rest-api/BUILD.bazel
@@ -0,0 +1,11 @@
+load("@rules_helm//helm:defs.bzl", "helm_chart")
+
+helm_chart(
+    name = "chart",
+    chart = "Chart.yaml",
+    images = ["//src/rest-api/cmd:push"],
+    install_name = "rest-api",
+    stamp = 1,
+    substitutions = {"IMAGE_TAG": "rest-api-{STABLE_GIT_SHA}"},
+    values = "values.yaml",
+)
diff --git a/k8s/rest-api/templates/NOTES.txt b/k8s/rest-api/templates/NOTES.txt
index 343c764..fa5e840 100644
--- a/k8s/rest-api/templates/NOTES.txt
+++ b/k8s/rest-api/templates/NOTES.txt
@@ -1,11 +1,5 @@
 1. Get the application URL by running these commands:
-{{- if .Values.ingress.enabled }}
-{{- range $host := .Values.ingress.hosts }}
-  {{- range .paths }}
-  http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
-  {{- end }}
-{{- end }}
-{{- else if contains "NodePort" .Values.service.type }}
+{{- if contains "NodePort" .Values.service.type }}
   export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "rest-api.fullname" . }})
   export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
   echo http://$NODE_IP:$NODE_PORT
diff --git a/k8s/rest-api/templates/deployment.yaml b/k8s/rest-api/templates/deployment.yaml
index 5951f59..f2b15d8 100644
--- a/k8s/rest-api/templates/deployment.yaml
+++ b/k8s/rest-api/templates/deployment.yaml
@@ -5,9 +5,7 @@ metadata:
   labels:
     {{- include "rest-api.labels" . | nindent 4 }}
 spec:
-  {{- if not .Values.autoscaling.enabled }}
   replicas: {{ .Values.replicaCount }}
-  {{- end }}
   selector:
     matchLabels:
       {{- include "rest-api.selectorLabels" . | nindent 6 }}
@@ -24,14 +22,13 @@ spec:
       imagePullSecrets:
         {{- toYaml . | nindent 8 }}
       {{- end }}
-      serviceAccountName: {{ include "rest-api.serviceAccountName" . }}
       securityContext:
         {{- toYaml .Values.podSecurityContext | nindent 8 }}
       containers:
         - name: {{ .Chart.Name }}
           securityContext:
             {{- toYaml .Values.securityContext | nindent 12 }}
-          image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
+          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
           imagePullPolicy: {{ .Values.image.pullPolicy }}
           ports:
             - name: http
diff --git a/k8s/rest-api/templates/ingress.yaml b/k8s/rest-api/templates/ingress.yaml
deleted file mode 100644
index 63c77d2..0000000
--- a/k8s/rest-api/templates/ingress.yaml
+++ /dev/null
@@ -1,61 +0,0 @@
-{{- if .Values.ingress.enabled -}}
-{{- $fullName := include "rest-api.fullname" . -}}
-{{- $svcPort := .Values.service.port -}}
-{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
-  {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
-  {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
-  {{- end }}
-{{- end }}
-{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
-apiVersion: networking.k8s.io/v1
-{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
-apiVersion: networking.k8s.io/v1beta1
-{{- else -}}
-apiVersion: extensions/v1beta1
-{{- end }}
-kind: Ingress
-metadata:
-  name: {{ $fullName }}
-  labels:
-    {{- include "rest-api.labels" . | nindent 4 }}
-  {{- with .Values.ingress.annotations }}
-  annotations:
-    {{- toYaml . | nindent 4 }}
-  {{- end }}
-spec:
-  {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
-  ingressClassName: {{ .Values.ingress.className }}
-  {{- end }}
-  {{- if .Values.ingress.tls }}
-  tls:
-    {{- range .Values.ingress.tls }}
-    - hosts:
-        {{- range .hosts }}
-        - {{ . | quote }}
-        {{- end }}
-      secretName: {{ .secretName }}
-    {{- end }}
-  {{- end }}
-  rules:
-    {{- range .Values.ingress.hosts }}
-    - host: {{ .host | quote }}
-      http:
-        paths:
-          {{- range .paths }}
-          - path: {{ .path }}
-            {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
-            pathType: {{ .pathType }}
-            {{- end }}
-            backend:
-              {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
-              service:
-                name: {{ $fullName }}
-                port:
-                  number: {{ $svcPort }}
-              {{- else }}
-              serviceName: {{ $fullName }}
-              servicePort: {{ $svcPort }}
-              {{- end }}
-          {{- end }}
-    {{- end }}
-{{- end }}
diff --git a/k8s/rest-api/templates/serviceaccount.yaml b/k8s/rest-api/templates/serviceaccount.yaml
deleted file mode 100644
index 84dd6dd..0000000
--- a/k8s/rest-api/templates/serviceaccount.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-{{- if .Values.serviceAccount.create -}}
-apiVersion: v1
-kind: ServiceAccount
-metadata:
-  name: {{ include "rest-api.serviceAccountName" . }}
-  labels:
-    {{- include "rest-api.labels" . | nindent 4 }}
-  {{- with .Values.serviceAccount.annotations }}
-  annotations:
-    {{- toYaml . | nindent 4 }}
-  {{- end }}
-{{- end }}
diff --git a/k8s/rest-api/values.yaml b/k8s/rest-api/values.yaml
index 550eb82..f79e04f 100644
--- a/k8s/rest-api/values.yaml
+++ b/k8s/rest-api/values.yaml
@@ -2,81 +2,17 @@
 # This is a YAML-formatted file.
 # Declare variables to be passed into your templates.
 
+# NOTE: This string "@@//src/rest-api/cmd:push" needs to be present
+# in order to limtations of the helm_rules bazel package
+
 replicaCount: 1
 
 image:
   repository: docker.io/baitinq/fs-tracer
   pullPolicy: IfNotPresent
   # Overrides the image tag whose default is the chart appVersion.
-  tag: ""
-
-imagePullSecrets: []
-nameOverride: ""
-fullnameOverride: ""
-
-serviceAccount:
-  # Specifies whether a service account should be created
-  create: true
-  # Annotations to add to the service account
-  annotations: {}
-  # The name of the service account to use.
-  # If not set and create is true, a name is generated using the fullname template
-  name: ""
-
-podAnnotations: {}
-
-podSecurityContext: {}
-  # fsGroup: 2000
-
-securityContext: {}
-  # capabilities:
-  #   drop:
-  #   - ALL
-  # readOnlyRootFilesystem: true
-  # runAsNonRoot: true
-  # runAsUser: 1000
+  tag: "{IMAGE_TAG}"
 
 service:
   type: LoadBalancer
   port: 8080
-
-ingress:
-  enabled: false
-  className: ""
-  annotations: {}
-    # kubernetes.io/ingress.class: nginx
-    # kubernetes.io/tls-acme: "true"
-  hosts:
-    - host: chart-example.local
-      paths:
-        - path: /
-          pathType: ImplementationSpecific
-  tls: []
-  #  - secretName: chart-example-tls
-  #    hosts:
-  #      - chart-example.local
-
-resources: {}
-  # We usually recommend not to specify default resources and to leave this as a conscious
-  # choice for the user. This also increases chances charts run on environments with little
-  # resources, such as Minikube. If you do want to specify resources, uncomment the following
-  # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
-  # limits:
-  #   cpu: 100m
-  #   memory: 128Mi
-  # requests:
-  #   cpu: 100m
-  #   memory: 128Mi
-
-autoscaling:
-  enabled: false
-  minReplicas: 1
-  maxReplicas: 100
-  targetCPUUtilizationPercentage: 80
-  # targetMemoryUtilizationPercentage: 80
-
-nodeSelector: {}
-
-tolerations: []
-
-affinity: {}