Skip to content

Commit

Permalink
Merge pull request #18 from foomo/gateway-crds
Browse files Browse the repository at this point in the history
feat(gateway-crds): add chart
  • Loading branch information
franklinkim authored Sep 23, 2024
2 parents de9bda3 + 0e8cf68 commit f125a6c
Show file tree
Hide file tree
Showing 9 changed files with 241 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ lint:
## https://github.com/norwoodj/helm-docs
docs:
@for dir in ./charts/* ; do \
docker run --rm --volume "$$(pwd)/$${dir}:/helm-docs/$${dir}" jnorwood/helm-docs:v1.12.0 --template-files "$${dir}/README.md.gotmpl" ;\
docker run --rm --volume "$$(pwd)/$${dir}:/helm-docs/$${dir}" jnorwood/helm-docs:v1.14.2 --template-files "$${dir}/README.md.gotmpl" ;\
done

.PHONY: schema
Expand Down
23 changes: 23 additions & 0 deletions charts/gateway-crds/.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/
18 changes: 18 additions & 0 deletions charts/gateway-crds/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v2
type: application
name: gateway-crds
description: Foomo Gateway Custom Resource Definition Chart
icon: https://avatars.githubusercontent.com/u/889755?s=200&v=4
home: https://www.foomo.org
keywords:
- foomo
- gateway
sources:
- https://github.com/foomo/helm-charts
annotations:
"artifacthub.io/links": |
- name: Chart Source
url: https://github.com/foomo/helm-charts
version: 0.1.0
appVersion: 0.1.0
21 changes: 21 additions & 0 deletions charts/gateway-crds/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# gateway-crds

![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.0](https://img.shields.io/badge/AppVersion-0.1.0-informational?style=flat-square)

Foomo Gateway Custom Resource Definition Chart

**Homepage:** <https://www.foomo.org>

## Source Code

* <https://github.com/foomo/helm-charts>

## Values

### Overrides

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| fullnameOverride | string | `""` | Overrides the chart's computed fullname |
| nameOverride | string | `""` | Overrides the chart's name |
| namespaceOverride | string | `""` | The name of the Namespace to deploy If not set, `.Release.Namespace` is used |
16 changes: 16 additions & 0 deletions charts/gateway-crds/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{ template "chart.header" . }}
{{ template "chart.deprecationWarning" . }}

{{ template "chart.badgesSection" . }}

{{ template "chart.description" . }}

{{ template "chart.homepageLine" . }}

{{ template "chart.maintainersSection" . }}

{{ template "chart.sourcesSection" . }}

{{ template "chart.requirementsSection" . }}

{{ template "chart.valuesSection" . }}
58 changes: 58 additions & 0 deletions charts/gateway-crds/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "gateway.crds.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 "gateway.crds.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 "gateway.crds.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "gateway.crds.labels" -}}
helm.sh/chart: {{ include "gateway.crds.chart" . }}
{{ include "gateway.crds.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

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

{{/*
Create the name of the namespace
*/}}
{{- define "gateway.crds.namespace" -}}
{{- default .Release.Namespace .Values.namespaceOverride }}
{{- end }}
79 changes: 79 additions & 0 deletions charts/gateway-crds/templates/gateways.foomo.org.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
# name must match the spec fields below, and be in the form: <plural>.<group>
name: gateways.foomo.org
labels:
{{- include "gateway.crds.labels" . | nindent 4 }}
spec:
# group name to use for REST API: /apis/<group>/<version>
group: foomo.org
# list of versions supported by this CustomResourceDefinition
versions:
- name: v1
# Each version can be enabled/disabled by Served flag.
served: true
# One and only one version must be marked as the storage version.
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
service:
type: string
minLength: 1
description: k8s service to connect to
sitemap:
type: string
addToRobots:
type: string
expose:
type: array
items:
type: object
properties:
stripBasePath:
type: boolean
description: service is exposed at /foo request is /foo/bar, stripBasePath == true => requests will go to /bar and /foo will be set as x-base-path header
description:
type: string
description: a description of the exposition, to be show in gateway api
cmsApp:
type: string
description: named application in cms
paths:
type: array
minItems: 0
description: 'paths in urls to register for, lookup is automatically long to short'
items:
type: string
cmsMimetypes:
type: array
minItems: 0
description: contentserver mimetypes
items:
type: string
internalAccessGroups:
type: array
minItems: 0
description: access is only granted to these internal groups
items:
type: string
required:
- service

# either Namespaced or Cluster
scope: Namespaced
names:
# plural name to be used in the URL: /apis/<group>/<version>/<plural>
plural: gateways
# singular name to be used as an alias on the CLI and for display
singular: gateway
# kind is normally the CamelCased singular type. Your resource manifests use this.
kind: Gateway
# shortNames allow shorter string to match your resource on the CLI
shortNames:
- gw
15 changes: 15 additions & 0 deletions charts/gateway-crds/values.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "http://json-schema.org/schema#",
"type": "object",
"properties": {
"fullnameOverride": {
"type": "string"
},
"nameOverride": {
"type": "string"
},
"namespaceOverride": {
"type": "string"
}
}
}
10 changes: 10 additions & 0 deletions charts/gateway-crds/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -- Overrides the chart's name
# @section -- Overrides
nameOverride: ""
# -- Overrides the chart's computed fullname
# @section -- Overrides
fullnameOverride: ""
# -- The name of the Namespace to deploy
# If not set, `.Release.Namespace` is used
# @section -- Overrides
namespaceOverride: ''

0 comments on commit f125a6c

Please sign in to comment.