-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(common): initial implementation (#854)
- Loading branch information
Showing
15 changed files
with
158 additions
and
11 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
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
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
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
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
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 |
---|---|---|
|
@@ -19,7 +19,7 @@ jobs: | |
matrix: | ||
chart: ${{ fromJson(needs.getChangedCharts.outputs.charts) }} | ||
env: | ||
CT_TARGET_BRANCH: ${{ github.event.repository.default_branch }} | ||
CT_TARGET_BRANCH: ${{ github.event.pull_request.base.ref || github.event.repository.default_branch }} | ||
CHART: ${{ matrix.chart }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
@@ -46,7 +46,13 @@ jobs: | |
- uses: helm/[email protected] | ||
|
||
- name: Lint chart | ||
run: ct lint --check-version-increment=false | ||
run: | | ||
if ! [[ -f "charts/$CHART/values.yaml" ]]; then | ||
echo "No values.yaml found for $CHART, skipping 'ct lint'" >/dev/stderr | ||
helm lint "charts/$CHART" | ||
else | ||
ct lint --check-version-increment=false | ||
fi | ||
env: | ||
CT_CHART_REPOS: ${{ steps.helm-repos.outputs.repos }} | ||
CT_CHARTS: charts/${{ matrix.chart }} | ||
|
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
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
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
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,6 @@ | ||
dependencies: | ||
- name: common | ||
repository: https://charts.bitnami.com/bitnami | ||
version: 2.19.0 | ||
digest: sha256:a18a4c3aa2d73ddc357aba5bb326df478db26141604438075d3bfc9e7ee0eaca | ||
generated: "2024-03-26T10:22:51.926182467+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,16 @@ | ||
apiVersion: v2 | ||
name: common | ||
description: A library chart for common resources | ||
type: library | ||
version: 1.0.0 | ||
maintainers: | ||
- name: cwrau | ||
email: [email protected] | ||
- name: marvinWolff | ||
email: [email protected] | ||
- name: tasches | ||
email: [email protected] | ||
dependencies: | ||
- name: common | ||
version: 2.19.0 | ||
repository: https://charts.bitnami.com/bitnami |
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,11 @@ | ||
[modeline]: # ( vim: set ft=markdown: ) | ||
{{ template "chart.header" . }} | ||
{{ template "chart.deprecationWarning" . }} | ||
|
||
{{ template "chart.badgesSection" . }} | ||
|
||
{{ template "chart.description" . }} | ||
|
||
{{ template "chart.homepageLine" . }} | ||
|
||
{{ template "chart.maintainersSection" . }} |
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,35 @@ | ||
{{/* | ||
Creates a labels block for a HelmRelease resource. | ||
{{ include "common.helm.labels" (dict) -}} | ||
*/}} | ||
{{- define "common.helm.labels" -}} | ||
{{- include "common.labels.standard" (dict "Release" (dict "Name" "{{ .Release.Name }}" "Service" "{{ .Release.Service }}") "Chart" (dict "Name" "{{ .Chart.Name }}" "Version" "{{ .Chart.Version }}") "Values" (dict)) -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Returns the chart version for a given chart in a given repository. | ||
{{ include "common.helm.chartVersion" (dict "context" $ "repo" "bitnami" "chart" "redis") -}} | ||
*/}} | ||
{{- define "common.helm.chartVersion" -}} | ||
{{- $_ := set . "Values" .context.Values -}} | ||
{{- dig .repo "charts" .chart nil .Values.global.helmRepositories | required (printf "The repo '%s' is either missing or doesn't contain the chart '%s'" .repo .chart) -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Returns a HelmRelease.spec.chart.spec for a given chart in a given repository. | ||
{{ include "common.helm.chartSpec" (dict "context" $ "repo" "bitnami" "chart" "redis" "prependReleaseName" true) -}} | ||
*/}} | ||
{{- define "common.helm.chartSpec" -}} | ||
{{- $_ := set . "Release" .context.Release -}} | ||
{{- dict | ||
"chart" .chart | ||
"version" (include "common.helm.chartVersion" (dict "repo" .repo "chart" .chart "context" .context)) | ||
"sourceRef" (dict | ||
"kind" "HelmRepository" | ||
"name" (eq .prependReleaseName true | ternary (printf "%s-%s" .Release.Name .repo) .repo) | ||
"namespace" .Release.Namespace | ||
) | ||
| toYaml | ||
-}} | ||
{{- 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,22 @@ | ||
{{/* | ||
Return a resource request/limit object based on a given preset or provided resources. | ||
{{ include "common.resources" (dict "resources" (dict) "resourcesPreset" "small") -}} | ||
*/}} | ||
{{- define "common.resources" -}} | ||
{{- $resources := dict -}} | ||
{{- if .resources -}} | ||
{{- $resources = .resources | merge $resources -}} | ||
{{- end -}} | ||
{{- if and .resourcesPreset (ne .resourcesPreset "none") -}} | ||
{{- $resources = include "common.resources.preset" (dict "type" .resourcesPreset) | fromYaml | merge $resources -}} | ||
{{- end -}} | ||
{{- toYaml $resources -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return a (dict resources resourcesPreset) for passing through to capable charts, e.g. bitnami | ||
{{ include "common.resourcesWithPreset" (dict "resources" (dict) "resourcesPreset" "small") -}} | ||
*/}} | ||
{{- define "common.resourcesWithPreset" -}} | ||
{{- pick . "resources" "resourcesPreset" | toYaml -}} | ||
{{- 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,30 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft-07/schema", | ||
"type": "object", | ||
"title": "common defs", | ||
"additionalProperties": false, | ||
"$defs": { | ||
"resourcesPreset": { | ||
"type": "string", | ||
"enum": [ | ||
"nano", | ||
"micro", | ||
"small", | ||
"medium", | ||
"large", | ||
"xlarge", | ||
"2xlarge" | ||
] | ||
} | ||
}, | ||
"properties": { | ||
"global": { | ||
"type": "object", | ||
"description": "global values for all charts" | ||
}, | ||
"common": { | ||
"type": "object", | ||
"description": "Values for sub-chart" | ||
} | ||
} | ||
} |