7 Commits

Author SHA1 Message Date
e602d9f045 ci: use oci
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2023-05-18 01:14:45 +03:00
1bbfd49265 feat(secret): allow generate hex
All checks were successful
continuous-integration/drone/push Build is passing
2023-03-03 23:59:32 +03:00
93c81fddb9 cs: fix 2023-03-03 23:02:51 +03:00
964f7e9c5d fix: remove duplicated pullSecret
All checks were successful
continuous-integration/drone/push Build is passing
2023-03-03 22:59:07 +03:00
4f80520c7e fix(deployment): envFrom 2023-03-03 22:57:28 +03:00
c850e79d2a fix(starter): add image.registry to values.yaml
All checks were successful
continuous-integration/drone/push Build is passing
2023-03-03 00:05:12 +03:00
eafcf8ba09 chore: increase default password length up to 32
All checks were successful
continuous-integration/drone/push Build is passing
2023-03-02 23:57:38 +03:00
7 changed files with 40 additions and 15 deletions

View File

@@ -6,16 +6,17 @@ name: default
trigger:
event:
- push
- tag
steps:
- name: release
image: cr.grachevko.ru/drone/helm:RELEASE.2023-03-01T13-46-55Z
image: cr.grachevko.ru/drone/helm:24
settings:
tag: ${DRONE_TAG}
username:
from_secret: HELM_REPO_USERNAME
password:
from_secret: HELM_REPO_PASSWORD
when:
branch:
- master
- rc
event:
- tag

View File

@@ -1,6 +1,6 @@
name: Build
on: [ push ]
on: [push]
jobs:

View File

@@ -24,10 +24,6 @@ spec:
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.image.pullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
@@ -37,15 +33,24 @@ spec:
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
envFrom:
{{- if .Values.existingConfigmap }}
- configMapRef:
name: {{ .Values.existingConfigmap }}
{{- else }}
- configMapRef:
name: {{ include "common.fullname" . }}
{{- if .Values.extraEnvVarsSecret }}
{{- end }}
{{- if .Values.existingSecret }}
- secretRef:
name: {{ .Values.extraEnvVarsSecret }}
name: {{ .Values.existingSecret }}
{{- else }}
- secretRef:
name: {{ include "common.fullname" . }}
{{- end }}
{{- if .Values.extraEnvVarsSecret }}
- secretRef:
name: {{ .Values.extraEnvVarsSecret }}
{{- end }}
ports:
- name: http
containerPort: 5678

View File

@@ -10,6 +10,6 @@ spec:
containers:
- name: wget
image: busybox
command: [ 'wget' ]
args: [ '{{ include "common.fullname" . }}:{{ .Values.service.port }}' ]
command: ['wget']
args: ['{{ include "common.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never

View File

@@ -12,9 +12,9 @@ extraEnvVarsSecret:
replicaCount: 1
image:
registry: docker.io
repository: nginx
pullPolicy: IfNotPresent
pullSecrets: []
# Overrides the image tag whose default is the chart appVersion.
tag: ""

View File

@@ -87,7 +87,7 @@ The order in which this function returns a secret password:
{{- $password := "" }}
{{- $subchart := "" }}
{{- $chartName := default "" .chartName }}
{{- $passwordLength := default 10 .length }}
{{- $passwordLength := default 32 .length }}
{{- $providedPasswordKey := include "common.utils.getKeyFromList" (dict "keys" .providedValues "context" $.context) }}
{{- $providedPasswordValue := include "common.utils.getValueFromKey" (dict "key" $providedPasswordKey "context" $.context) }}
{{- $secretData := (lookup "v1" "Secret" (include "common.namespace" .context) .secret).data }}
@@ -115,6 +115,8 @@ The order in which this function returns a secret password:
{{- $password = randAscii $passwordLength }}
{{- $password = regexReplaceAllLiteral "\\W" $password "@" | substr 5 $passwordLength }}
{{- $password = printf "%s%s" $subStr $password | toString | shuffle | b64enc | quote }}
{{- else if .hex }}
{{- $password = include "common.secrets.randHex" $passwordLength | b64enc | quote }}
{{- else }}
{{- $password = randAlphaNum $passwordLength | b64enc | quote }}
{{- end }}
@@ -122,6 +124,23 @@ The order in which this function returns a secret password:
{{- printf "%s" $password -}}
{{- end -}}
{{- /*
Returns given number of random Hex characters.
- randNumeric 4 | atoi generates a random number in [0, 10^4)
This is a range evenly divisble by 16, but even if off by one,
that last partial interval offsetting randomness is only 1 part in 625.
- mod N 16 maps to the range 0-15
- printf "%x" represents a single number 0-15 as a single hex character
*/}}
{{- define "common.secrets.randHex" -}}
{{- $result := "" }}
{{- range $i := until . }}
{{- $rand_hex_char := mod (randNumeric 4 | atoi) 16 | printf "%x" }}
{{- $result = print $result $rand_hex_char }}
{{- end }}
{{- $result }}
{{- end }}
{{/*
Reuses the value from an existing secret, otherwise sets its value to a default value.

0
values.yaml Normal file
View File