-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
718 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# 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 | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
|
||
# OWNERS file for Kubernetes | ||
OWNERS | ||
# example production yaml | ||
values-production.yaml | ||
# ci files | ||
ci/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
dependencies: | ||
- name: common | ||
repository: https://charts.bitnami.com/bitnami | ||
version: 1.11.1 | ||
- name: redis | ||
repository: https://charts.bitnami.com/bitnami | ||
version: 16.4.0 | ||
digest: sha256:18eac17e69c4871e29365d14fe5822d00dfeb97c5a2624407ad6c506b6542937 | ||
generated: "2022-02-22T00:08:54.6743331+01:00" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
apiVersion: v2 | ||
version: 0.0.1 | ||
name: function | ||
description: Serverless Function | ||
appVersion: "1.0.0" | ||
type: application | ||
keywords: | ||
- shortener | ||
- url | ||
- bitly | ||
home: https://yourls.org | ||
icon: https://yourls.org/images/yourls-logo.png | ||
sources: | ||
- https://github.com/YOURLS/function | ||
- https://github.com/YOURLS/charts | ||
maintainers: | ||
- name: YOURLS | ||
email: yourls@yourls.org | ||
- name: LeoColomb | ||
email: git@colombaro.fr | ||
kubeVersion: ">=1.20.0-0" | ||
dependencies: | ||
- name: common | ||
repository: https://charts.bitnami.com/bitnami | ||
version: ^1.11.1 | ||
tags: | ||
- bitnami-common | ||
- condition: redis.enabled | ||
name: redis | ||
repository: https://charts.bitnami.com/bitnami | ||
version: ^16.4.0 | ||
tags: | ||
- function-database | ||
annotations: | ||
artifacthub.io/license: MIT | ||
artifacthub.io/links: | | ||
- name: Upstream Project | ||
url: https://github.com/YOURLS/function | ||
artifacthub.io/signKey: | | ||
fingerprint: 6FCD850E18E4A4FF76DD1184A3A42A61961E423F | ||
url: https://yourls.org/.well-known/openpgpkey/hu/6e4gbtp15q1znf3unweeducn7urty4mr | ||
artifacthub.io/changes: | | ||
- kind: added | ||
description: First version |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
|
||
{{/* | ||
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 "function.redis.fullname" -}} | ||
{{- include "common.names.dependency.fullname" (dict "chartName" "redis" "chartValues" .Values.redis "context" $) -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the proper YOURLS image name | ||
*/}} | ||
{{- define "function.image" -}} | ||
{{- $imageRoot := .Values.image -}} | ||
{{- if not .Values.image.tag }} | ||
{{- $tag := (dict "tag" .Chart.AppVersion) -}} | ||
{{- $imageRoot := merge .Values.image $tag -}} | ||
{{- end -}} | ||
{{- include "common.images.image" (dict "imageRoot" $imageRoot "global" .Values.global) -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the Function Secret Name | ||
*/}} | ||
{{- define "function.secretName" -}} | ||
{{- if .Values.function.existingSecret }} | ||
{{- printf "%s" .Values.function.existingSecret -}} | ||
{{- else -}} | ||
{{- printf "%s" (include "common.names.fullname" .) -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the Redis™ hostname | ||
*/}} | ||
{{- define "function.redisHost" -}} | ||
{{- if .Values.redis.enabled }} | ||
{{- printf "%s-master" (include "function.redis.fullname" .) -}} | ||
{{- else -}} | ||
{{- printf "%s" .Values.externalDatabase.host -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the Redis™ port | ||
*/}} | ||
{{- define "function.redisPort" -}} | ||
{{- if .Values.redis.enabled }} | ||
{{- printf "6379" | quote -}} | ||
{{- else -}} | ||
{{- .Values.externalDatabase.port | quote -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return true if a secret object for Redis™ should be created | ||
*/}} | ||
{{- define "function.redis.createSecret" -}} | ||
{{- if and (not .Values.redis.enabled) (not .Values.externalDatabase.existingSecret) .Values.externalDatabase.password }} | ||
{{- true -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the Redis™ secret name | ||
*/}} | ||
{{- define "function.redis.secretName" -}} | ||
{{- if .Values.redis.enabled }} | ||
{{- if .Values.redis.auth.existingSecret }} | ||
{{- printf "%s" .Values.redis.auth.existingSecret -}} | ||
{{- else -}} | ||
{{- printf "%s" (include "function.redis.fullname" .) -}} | ||
{{- end -}} | ||
{{- else if .Values.externalDatabase.existingSecret }} | ||
{{- printf "%s" .Values.externalDatabase.existingSecret -}} | ||
{{- else -}} | ||
{{- printf "%s-redis" (include "common.names.fullname" .) -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the Redis™ secret key | ||
*/}} | ||
{{- define "function.redis.secretPasswordKey" -}} | ||
{{- if and .Values.redis.enabled .Values.redis.auth.existingSecret }} | ||
{{- required "You need to provide existingSecretPasswordKey when an existingSecret is specified in redis" .Values.redis.auth.existingSecretPasswordKey | printf "%s" }} | ||
{{- else if and (not .Values.redis.enabled) .Values.externalDatabase.existingSecret }} | ||
{{- required "You need to provide existingSecretPasswordKey when an existingSecret is specified in redis" .Values.externalDatabase.existingSecretPasswordKey | printf "%s" }} | ||
{{- else -}} | ||
{{- printf "redis-password" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return whether Redis™ uses password authentication or not | ||
*/}} | ||
{{- define "function.redis.auth.enabled" -}} | ||
{{- if or (and .Values.redis.enabled .Values.redis.auth.enabled) (and (not .Values.redis.enabled) (or .Values.externalDatabase.password .Values.externalDatabase.existingSecret)) }} | ||
{{- true -}} | ||
{{- end -}} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ template "common.names.fullname" . }} | ||
labels: {{- include "common.labels.standard" . | nindent 4 }} | ||
{{- if .Values.commonLabels }} | ||
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
{{- if .Values.commonAnnotations }} | ||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
data: | ||
REDIS_HOST: {{ template "function.redisHost" . }} | ||
REDIS_PORT_NUMBER: {{ template "function.redisPort" . }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{{- if (include "function.redis.createSecret" .) }} | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: {{ template "common.names.fullname" . }}-redis | ||
labels: {{- include "common.labels.standard" . | nindent 4 }} | ||
{{- if .Values.commonLabels }} | ||
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
{{- if .Values.commonAnnotations }} | ||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
type: Opaque | ||
data: | ||
redis-password: {{ .Values.externalDatabase.password | b64enc | quote }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{{- if not .Values.function.existingSecret }} | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: {{ template "common.names.fullname" . }} | ||
namespace: {{ .Release.Namespace | quote }} | ||
labels: {{- include "common.labels.standard" . | nindent 4 }} | ||
{{- if .Values.commonLabels }} | ||
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
{{- if .Values.commonAnnotations }} | ||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
type: Opaque | ||
data: | ||
endpoint: {{ .Values.function.endpoint | b64enc | quote }} | ||
token: {{ .Values.function.token | b64enc | quote }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
apiVersion: serving.knative.dev/v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "common.names.fullname" . }} | ||
namespace: {{ .Release.Namespace | quote }} | ||
labels: {{- include "common.labels.standard" . | nindent 4 }} | ||
{{- if .Values.commonLabels }} | ||
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
{{- if .Values.commonAnnotations }} | ||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
template: | ||
metadata: | ||
labels: {{- include "common.labels.standard" . | nindent 8 }} | ||
{{- if .Values.podLabels }} | ||
{{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} | ||
{{- end }} | ||
{{- if or .Values.podAnnotations }} | ||
annotations: | ||
{{- if .Values.podAnnotations }} | ||
{{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }} | ||
{{- end }} | ||
{{- end }} | ||
spec: | ||
containers: | ||
- name: function | ||
image: {{ template "function.image" . }} | ||
env: | ||
{{- if (include "function.redis.auth.enabled" .) }} | ||
- name: REDIS_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ include "function.redis.secretName" . }} | ||
key: {{ include "function.redis.secretPasswordKey" . }} | ||
{{- end }} | ||
- name: YOURLS_ENDPOINT | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ include "function.secretName" . }} | ||
key: endpoint | ||
- name: YOURLS_TOKEN | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ include "function.secretName" . }} | ||
key: token | ||
envFrom: | ||
- configMapRef: | ||
name: {{ include "common.names.fullname" . }} |
Oops, something went wrong.