From 82c7dad6c8ac5d573eb396a379cd212ff781fa0f Mon Sep 17 00:00:00 2001 From: Daniel Hougaard Date: Thu, 1 May 2025 06:45:40 +0400 Subject: [PATCH 1/5] feat(helm): infisical helm --- .github/workflows/release_docker_gateway.yaml | 44 +++++++++++++ .github/workflows/release_helm_gateway.yaml | 27 ++++++++ Dockerfile.gateway | 24 +++++++ helm-charts/infisical-gateway/.helmignore | 23 +++++++ helm-charts/infisical-gateway/CHANGELOG.md | 3 + helm-charts/infisical-gateway/Chart.yaml | 24 +++++++ .../infisical-gateway/templates/_helpers.tpl | 62 ++++++++++++++++++ .../templates/deployment.yaml | 64 +++++++++++++++++++ .../infisical-gateway/templates/service.yaml | 15 +++++ .../templates/serviceaccount.yaml | 13 ++++ helm-charts/infisical-gateway/values.yaml | 41 ++++++++++++ helm-charts/upload-gateway-cloudsmith.sh | 8 +++ 12 files changed, 348 insertions(+) create mode 100644 .github/workflows/release_docker_gateway.yaml create mode 100644 .github/workflows/release_helm_gateway.yaml create mode 100644 Dockerfile.gateway create mode 100644 helm-charts/infisical-gateway/.helmignore create mode 100644 helm-charts/infisical-gateway/CHANGELOG.md create mode 100644 helm-charts/infisical-gateway/Chart.yaml create mode 100644 helm-charts/infisical-gateway/templates/_helpers.tpl create mode 100644 helm-charts/infisical-gateway/templates/deployment.yaml create mode 100644 helm-charts/infisical-gateway/templates/service.yaml create mode 100644 helm-charts/infisical-gateway/templates/serviceaccount.yaml create mode 100644 helm-charts/infisical-gateway/values.yaml create mode 100755 helm-charts/upload-gateway-cloudsmith.sh diff --git a/.github/workflows/release_docker_gateway.yaml b/.github/workflows/release_docker_gateway.yaml new file mode 100644 index 000000000..666b2c46c --- /dev/null +++ b/.github/workflows/release_docker_gateway.yaml @@ -0,0 +1,44 @@ +name: Release Gateway Docker Image +on: + push: + tags: + - "infisical-gateway/v*.*.*" + +permissions: + contents: write + pull-requests: write + +jobs: + release-image: + name: Release Gateway Docker Image + runs-on: ubuntu-latest + steps: + - name: Extract version from tag + id: extract_version + run: echo "::set-output name=version::${GITHUB_REF_NAME#infisical-gateway/}" + + - name: Checkout code + uses: actions/checkout@v2 + + - name: 🔧 Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: 🔧 Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: 🐋 Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + context: . + push: true + platforms: linux/amd64,linux/arm64 + tags: | + infisical/gateway:latest + infisical/gateway:${{ steps.extract_version.outputs.version }} diff --git a/.github/workflows/release_helm_gateway.yaml b/.github/workflows/release_helm_gateway.yaml new file mode 100644 index 000000000..466849a2d --- /dev/null +++ b/.github/workflows/release_helm_gateway.yaml @@ -0,0 +1,27 @@ +name: Release Gateway Helm Chart +on: + workflow_dispatch: + +jobs: + release-helm: + name: Release Helm Chart + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install Helm + uses: azure/setup-helm@v3 + with: + version: v3.10.0 + + - name: Install python + uses: actions/setup-python@v4 + + - name: Install Cloudsmith CLI + run: pip install --upgrade cloudsmith-cli + + - name: Build and push helm package to CloudSmith + run: cd helm-charts && sh upload-gateway-cloudsmith.sh + env: + CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} diff --git a/Dockerfile.gateway b/Dockerfile.gateway new file mode 100644 index 000000000..dd4b3f0fe --- /dev/null +++ b/Dockerfile.gateway @@ -0,0 +1,24 @@ +# Build stage +FROM golang:1.23.0-alpine AS builder + +WORKDIR /app + +COPY ./cli . + +RUN go build -o infisical-cli . + +FROM alpine:latest + +ENV TOKEN="" +ENV INFISICAL_API_URL="https://app.infisical.com" + + + +WORKDIR /app + +COPY --from=builder /app/infisical-cli . + +# Make the binary executable +RUN chmod +x /app/infisical-cli + +CMD ["sh", "-c", "if [ -z \"${TOKEN}\" ]; then echo 'ERROR: TOKEN environment variable must be set'; exit 1; fi && ./infisical-cli gateway --token ${TOKEN} --domain ${INFISICAL_API_URL}"] \ No newline at end of file diff --git a/helm-charts/infisical-gateway/.helmignore b/helm-charts/infisical-gateway/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/helm-charts/infisical-gateway/.helmignore @@ -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/ diff --git a/helm-charts/infisical-gateway/CHANGELOG.md b/helm-charts/infisical-gateway/CHANGELOG.md new file mode 100644 index 000000000..832423082 --- /dev/null +++ b/helm-charts/infisical-gateway/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.0.1 (May 1, 2025) + +* Initial helm release \ No newline at end of file diff --git a/helm-charts/infisical-gateway/Chart.yaml b/helm-charts/infisical-gateway/Chart.yaml new file mode 100644 index 000000000..382acd3e1 --- /dev/null +++ b/helm-charts/infisical-gateway/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: infisical-gateway +description: A Helm chart to deploy Infisical Gateway + +# 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.0.1 + +# 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: "0.0.1" diff --git a/helm-charts/infisical-gateway/templates/_helpers.tpl b/helm-charts/infisical-gateway/templates/_helpers.tpl new file mode 100644 index 000000000..b983e79df --- /dev/null +++ b/helm-charts/infisical-gateway/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "infisical-gateway.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 "infisical-gateway.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 "infisical-gateway.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "infisical-gateway.labels" -}} +helm.sh/chart: {{ include "infisical-gateway.chart" . }} +{{ include "infisical-gateway.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "infisical-gateway.selectorLabels" -}} +app.kubernetes.io/name: {{ include "infisical-gateway.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "infisical-gateway.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "infisical-gateway.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/helm-charts/infisical-gateway/templates/deployment.yaml b/helm-charts/infisical-gateway/templates/deployment.yaml new file mode 100644 index 000000000..99b107ef5 --- /dev/null +++ b/helm-charts/infisical-gateway/templates/deployment.yaml @@ -0,0 +1,64 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "infisical-gateway.fullname" . }} + labels: + {{- include "infisical-gateway.labels" . | nindent 4 }} +spec: + selector: + matchLabels: + {{- include "infisical-gateway.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "infisical-gateway.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "infisical-gateway.serviceAccountName" . }} + {{- with .Values.podSecurityContext }} + securityContext: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: {{ .Chart.Name }} + {{- with .Values.securityContext }} + securityContext: + {{- toYaml . | nindent 12 }} + {{- end }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + {{- range $key, $value := .Values.env }} + - name: {{ $key }} + value: {{ $value | quote }} + {{- end }} + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + {{- with .Values.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/helm-charts/infisical-gateway/templates/service.yaml b/helm-charts/infisical-gateway/templates/service.yaml new file mode 100644 index 000000000..c1457f80e --- /dev/null +++ b/helm-charts/infisical-gateway/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "infisical-gateway.fullname" . }} + labels: + {{- include "infisical-gateway.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "infisical-gateway.selectorLabels" . | nindent 4 }} diff --git a/helm-charts/infisical-gateway/templates/serviceaccount.yaml b/helm-charts/infisical-gateway/templates/serviceaccount.yaml new file mode 100644 index 000000000..c0040963f --- /dev/null +++ b/helm-charts/infisical-gateway/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "infisical-gateway.serviceAccountName" . }} + labels: + {{- include "infisical-gateway.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/helm-charts/infisical-gateway/values.yaml b/helm-charts/infisical-gateway/values.yaml new file mode 100644 index 000000000..e2bb8e9ad --- /dev/null +++ b/helm-charts/infisical-gateway/values.yaml @@ -0,0 +1,41 @@ +image: + repository: infisical/infisical-gateway + pullPolicy: IfNotPresent + tag: "latest" + +# Environment variables for the gateway +env: + TOKEN: "" + INFISICAL_API_URL: "https://app.infisical.com/api" + +resources: + limits: + cpu: 100m + memory: 128Mi + requests: + cpu: 100m + memory: 128Mi + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + create: true + automount: true + annotations: {} + name: "" + +podAnnotations: {} +podLabels: {} +podSecurityContext: {} +securityContext: {} +affinity: {} +tolerations: {} +nodeSelector: {} +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false diff --git a/helm-charts/upload-gateway-cloudsmith.sh b/helm-charts/upload-gateway-cloudsmith.sh new file mode 100755 index 000000000..0d6fd11c4 --- /dev/null +++ b/helm-charts/upload-gateway-cloudsmith.sh @@ -0,0 +1,8 @@ +cd infisical-gateway +helm dependency update +helm package . +for i in *.tgz; do + [ -f "$i" ] || break + cloudsmith push helm --republish infisical/helm-charts "$i" +done +cd .. \ No newline at end of file From 835b2fba9c7beb45221962f0b5615a516a3548e9 Mon Sep 17 00:00:00 2001 From: Daniel Hougaard Date: Thu, 1 May 2025 18:02:27 +0400 Subject: [PATCH 2/5] requested changes --- .github/workflows/release_docker_gateway.yaml | 3 +-- .github/workflows/release_helm_gateway.yaml | 2 +- Dockerfile.gateway | 2 +- .../templates/deployment.yaml | 8 +++--- .../infisical-gateway/templates/secret.yaml | 13 ++++++++++ helm-charts/infisical-gateway/values.yaml | 26 +++++++++++++------ 6 files changed, 37 insertions(+), 17 deletions(-) create mode 100644 helm-charts/infisical-gateway/templates/secret.yaml diff --git a/.github/workflows/release_docker_gateway.yaml b/.github/workflows/release_docker_gateway.yaml index 666b2c46c..da1e105e3 100644 --- a/.github/workflows/release_docker_gateway.yaml +++ b/.github/workflows/release_docker_gateway.yaml @@ -6,7 +6,6 @@ on: permissions: contents: write - pull-requests: write jobs: release-image: @@ -18,7 +17,7 @@ jobs: run: echo "::set-output name=version::${GITHUB_REF_NAME#infisical-gateway/}" - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: 🔧 Set up QEMU uses: docker/setup-qemu-action@v1 diff --git a/.github/workflows/release_helm_gateway.yaml b/.github/workflows/release_helm_gateway.yaml index 466849a2d..1b067bd73 100644 --- a/.github/workflows/release_helm_gateway.yaml +++ b/.github/workflows/release_helm_gateway.yaml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install Helm uses: azure/setup-helm@v3 diff --git a/Dockerfile.gateway b/Dockerfile.gateway index dd4b3f0fe..24c03e3e0 100644 --- a/Dockerfile.gateway +++ b/Dockerfile.gateway @@ -7,7 +7,7 @@ COPY ./cli . RUN go build -o infisical-cli . -FROM alpine:latest +FROM alpine:3.19 ENV TOKEN="" ENV INFISICAL_API_URL="https://app.infisical.com" diff --git a/helm-charts/infisical-gateway/templates/deployment.yaml b/helm-charts/infisical-gateway/templates/deployment.yaml index 99b107ef5..636e88d35 100644 --- a/helm-charts/infisical-gateway/templates/deployment.yaml +++ b/helm-charts/infisical-gateway/templates/deployment.yaml @@ -37,11 +37,9 @@ spec: {{- end }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} - env: - {{- range $key, $value := .Values.env }} - - name: {{ $key }} - value: {{ $value | quote }} - {{- end }} + envFrom: + - secretRef: + name: {{ .Values.secret.name }} ports: - name: http containerPort: {{ .Values.service.port }} diff --git a/helm-charts/infisical-gateway/templates/secret.yaml b/helm-charts/infisical-gateway/templates/secret.yaml new file mode 100644 index 000000000..f186b8ec4 --- /dev/null +++ b/helm-charts/infisical-gateway/templates/secret.yaml @@ -0,0 +1,13 @@ +{{- if .Values.secret.create -}} +apiVersion: v1 +kind: Secret +metadata: + name: {{ .Values.secret.name }} + labels: + {{- include "infisical-gateway.labels" . | nindent 4 }} +type: Opaque +data: + {{- range $key, $value := .Values.secret.data }} + {{ $key }}: {{ $value | b64enc }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm-charts/infisical-gateway/values.yaml b/helm-charts/infisical-gateway/values.yaml index e2bb8e9ad..bb63a82a8 100644 --- a/helm-charts/infisical-gateway/values.yaml +++ b/helm-charts/infisical-gateway/values.yaml @@ -1,16 +1,22 @@ image: repository: infisical/infisical-gateway pullPolicy: IfNotPresent - tag: "latest" + tag: "v0.0.1" -# Environment variables for the gateway -env: - TOKEN: "" - INFISICAL_API_URL: "https://app.infisical.com/api" +secret: + # create a new secret (if true) or use existing (if false) + create: true + # name of the secret to use/create + name: "infisical-gateway-secrets" + + # Secret data (only used if create: true) + data: + TOKEN: "" + INFISICAL_API_URL: "https://app.infisical.com" resources: limits: - cpu: 100m + cpu: 500m memory: 128Mi requests: cpu: 100m @@ -28,8 +34,12 @@ serviceAccount: podAnnotations: {} podLabels: {} -podSecurityContext: {} -securityContext: {} +podSecurityContext: + runAsNonRoot: true + +securityContext: + runAsNonRoot: true + affinity: {} tolerations: {} nodeSelector: {} From a80d5f10e5d5833845881dadb312e92936b7c673 Mon Sep 17 00:00:00 2001 From: Daniel Hougaard Date: Fri, 2 May 2025 16:38:02 +0400 Subject: [PATCH 3/5] fix(gateway-helm): requested changes --- .github/workflows/release_docker_gateway.yaml | 43 ------------------- .../templates/deployment.yaml | 10 ++++- .../infisical-gateway/templates/secret.yaml | 13 ------ helm-charts/infisical-gateway/values.yaml | 15 ++----- 4 files changed, 13 insertions(+), 68 deletions(-) delete mode 100644 .github/workflows/release_docker_gateway.yaml delete mode 100644 helm-charts/infisical-gateway/templates/secret.yaml diff --git a/.github/workflows/release_docker_gateway.yaml b/.github/workflows/release_docker_gateway.yaml deleted file mode 100644 index da1e105e3..000000000 --- a/.github/workflows/release_docker_gateway.yaml +++ /dev/null @@ -1,43 +0,0 @@ -name: Release Gateway Docker Image -on: - push: - tags: - - "infisical-gateway/v*.*.*" - -permissions: - contents: write - -jobs: - release-image: - name: Release Gateway Docker Image - runs-on: ubuntu-latest - steps: - - name: Extract version from tag - id: extract_version - run: echo "::set-output name=version::${GITHUB_REF_NAME#infisical-gateway/}" - - - name: Checkout code - uses: actions/checkout@v4 - - - name: 🔧 Set up QEMU - uses: docker/setup-qemu-action@v1 - - - name: 🔧 Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: 🐋 Login to Docker Hub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push - id: docker_build - uses: docker/build-push-action@v2 - with: - context: . - push: true - platforms: linux/amd64,linux/arm64 - tags: | - infisical/gateway:latest - infisical/gateway:${{ steps.extract_version.outputs.version }} diff --git a/helm-charts/infisical-gateway/templates/deployment.yaml b/helm-charts/infisical-gateway/templates/deployment.yaml index 636e88d35..2671c0665 100644 --- a/helm-charts/infisical-gateway/templates/deployment.yaml +++ b/helm-charts/infisical-gateway/templates/deployment.yaml @@ -35,8 +35,16 @@ spec: securityContext: {{- toYaml . | nindent 12 }} {{- end }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + image: "infisical/cli:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} + command: ["/sbin/tini", "--", "/bin/sh", "-c"] + args: + - >- + if [ -z "${TOKEN}" ]; then + echo 'ERROR: TOKEN environment variable must be set'; + exit 1; + fi && + /bin/infisical gateway --token ${TOKEN} envFrom: - secretRef: name: {{ .Values.secret.name }} diff --git a/helm-charts/infisical-gateway/templates/secret.yaml b/helm-charts/infisical-gateway/templates/secret.yaml deleted file mode 100644 index f186b8ec4..000000000 --- a/helm-charts/infisical-gateway/templates/secret.yaml +++ /dev/null @@ -1,13 +0,0 @@ -{{- if .Values.secret.create -}} -apiVersion: v1 -kind: Secret -metadata: - name: {{ .Values.secret.name }} - labels: - {{- include "infisical-gateway.labels" . | nindent 4 }} -type: Opaque -data: - {{- range $key, $value := .Values.secret.data }} - {{ $key }}: {{ $value | b64enc }} - {{- end }} -{{- end }} \ No newline at end of file diff --git a/helm-charts/infisical-gateway/values.yaml b/helm-charts/infisical-gateway/values.yaml index bb63a82a8..b1d55c0fc 100644 --- a/helm-charts/infisical-gateway/values.yaml +++ b/helm-charts/infisical-gateway/values.yaml @@ -1,18 +1,10 @@ image: - repository: infisical/infisical-gateway pullPolicy: IfNotPresent - tag: "v0.0.1" + tag: "0.41.1" secret: - # create a new secret (if true) or use existing (if false) - create: true - # name of the secret to use/create - name: "infisical-gateway-secrets" - - # Secret data (only used if create: true) - data: - TOKEN: "" - INFISICAL_API_URL: "https://app.infisical.com" + # The secret that contains the environment variables to be used by the gateway, such as INFISICAL_API_URL and TOKEN + name: "infisical-gateway-environment" resources: limits: @@ -39,6 +31,7 @@ podSecurityContext: securityContext: runAsNonRoot: true + runAsUser: 1000 affinity: {} tolerations: {} From 5dbded60f4c07981320de600da8b2c8887ebb46b Mon Sep 17 00:00:00 2001 From: Daniel Hougaard Date: Fri, 2 May 2025 16:38:31 +0400 Subject: [PATCH 4/5] Delete Dockerfile.gateway --- Dockerfile.gateway | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 Dockerfile.gateway diff --git a/Dockerfile.gateway b/Dockerfile.gateway deleted file mode 100644 index 24c03e3e0..000000000 --- a/Dockerfile.gateway +++ /dev/null @@ -1,24 +0,0 @@ -# Build stage -FROM golang:1.23.0-alpine AS builder - -WORKDIR /app - -COPY ./cli . - -RUN go build -o infisical-cli . - -FROM alpine:3.19 - -ENV TOKEN="" -ENV INFISICAL_API_URL="https://app.infisical.com" - - - -WORKDIR /app - -COPY --from=builder /app/infisical-cli . - -# Make the binary executable -RUN chmod +x /app/infisical-cli - -CMD ["sh", "-c", "if [ -z \"${TOKEN}\" ]; then echo 'ERROR: TOKEN environment variable must be set'; exit 1; fi && ./infisical-cli gateway --token ${TOKEN} --domain ${INFISICAL_API_URL}"] \ No newline at end of file From dcb7215b7d58d6b8c72e4fb7c227f032342baede Mon Sep 17 00:00:00 2001 From: Daniel Hougaard Date: Sat, 3 May 2025 00:20:25 +0400 Subject: [PATCH 5/5] requested changes --- .../infisical-gateway/templates/deployment.yaml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/helm-charts/infisical-gateway/templates/deployment.yaml b/helm-charts/infisical-gateway/templates/deployment.yaml index 2671c0665..223bdabd8 100644 --- a/helm-charts/infisical-gateway/templates/deployment.yaml +++ b/helm-charts/infisical-gateway/templates/deployment.yaml @@ -37,17 +37,20 @@ spec: {{- end }} image: "infisical/cli:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} - command: ["/sbin/tini", "--", "/bin/sh", "-c"] args: - - >- - if [ -z "${TOKEN}" ]; then - echo 'ERROR: TOKEN environment variable must be set'; - exit 1; - fi && - /bin/infisical gateway --token ${TOKEN} + - gateway + - --token + - $(TOKEN) envFrom: - secretRef: name: {{ .Values.secret.name }} + env: + - name: TOKEN_VALIDATION + valueFrom: + secretKeyRef: + name: {{ .Values.secret.name }} + key: TOKEN + optional: false ports: - name: http containerPort: {{ .Values.service.port }}