Skip to content

[50] Helm-chart initial commit #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/helm-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Helm publish

on:
push:
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
CHARTS_REPOSITORY: ${{ github.repository_owner }}/charts
CHART_NAME: etcd-operator


jobs:
build:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout repository
uses: actions/[email protected]

- name: Install Helm
uses: azure/[email protected]
with:
version: 'v3.14.3'

- name: Get latest tag
run: |
git fetch --tags
TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "Latest tag on current commit is $TAG"
echo "LATEST_TAG=${TAG}" >> $GITHUB_ENV
echo "LATEST_TAG_TRIMMED_V=${TAG#v}" >> $GITHUB_ENV

- name: Helm login registry
working-directory: charts
run: |
helm registry login \
--username ${{ github.actor }} \
--password ${{ secrets.GITHUB_TOKEN }} \
${{ env.REGISTRY }}/${{ env.CHARTS_REPOSITORY }}

- name: Helm package chart
working-directory: charts
run: |
helm package ${{ env.CHART_NAME }} \
--version ${LATEST_TAG_TRIMMED_V} \
--app-version ${LATEST_TAG} \
--dependency-update

- name: Helm push chart
working-directory: charts
run: |
helm push ${{ env.CHART_NAME }}-${LATEST_TAG_TRIMMED_V}.tgz \
oci://${{ env.REGISTRY }}/${{ env.CHARTS_REPOSITORY }}
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ repos:
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
exclude: "^charts/etcd-operator/(values.schema.json|README.md)$"
- id: check-added-large-files
- repo: local
hooks:
Expand All @@ -23,3 +24,18 @@ repos:
entry: sh -c "make lint-fix"
language: system
require_serial: true
- id: make-helm-lint
name: make-helm-lint
entry: sh -c "make helm-lint"
language: system
require_serial: true
- id: make-helm-schema-run
name: make-helm-schema-run
entry: sh -c "make helm-schema-run"
language: system
require_serial: true
- id: make-helm-docs-run
name: make-helm-docs-run
entry: sh -c "make helm-docs-run"
language: system
require_serial: true
47 changes: 46 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ lint: golangci-lint ## Run golangci-lint linter & yamllint
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
$(GOLANGCI_LINT) run --fix

.PHONY: helm-lint
helm-lint: helm ## Run helm lint over chart
$(HELM) lint charts/etcd-operator

.PHONY: helm-schema-run
helm-schema-run: helm-schema ## Run helm schema over chart
$(HELM) schema -input charts/etcd-operator/values.yaml -output charts/etcd-operator/values.schema.json

.PHONY: helm-docs-run
helm-docs-run: helm-docs ## Run helm schema over chart
$(HELM_DOCS)

##@ Build

.PHONY: build
Expand Down Expand Up @@ -155,20 +167,32 @@ LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)

HELM_PLUGINS ?= $(LOCALBIN)/helm-plugins
export HELM_PLUGINS
$(HELM_PLUGINS):
mkdir -p $(HELM_PLUGINS)

## Tool Binaries
KUBECTL ?= kubectl
KUSTOMIZE ?= $(LOCALBIN)/kustomize
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
ENVTEST ?= $(LOCALBIN)/setup-envtest
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint
HELM ?= $(LOCALBIN)/helm
HELM_DOCS ?= $(LOCALBIN)/helm-docs

## Tool Versions
KUSTOMIZE_VERSION ?= v5.3.0
CONTROLLER_TOOLS_VERSION ?= v0.14.0
ENVTEST_VERSION ?= latest
GOLANGCI_LINT_VERSION ?= v1.54.2
HELM_VERSION ?= v3.14.3
HELM_SCHEMA_VERSION ?= v1.2.2
HELM_DOCS_VERSION ?= v1.13.1

## Tool install scripts
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
HELM_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3"

.PHONY: kustomize
kustomize: $(LOCALBIN)
Expand All @@ -190,3 +214,24 @@ envtest: $(LOCALBIN)
golangci-lint: $(LOCALBIN)
@test -x $(GOLANGCI_LINT) && $(GOLANGCI_LINT) version | grep -q $(GOLANGCI_LINT_VERSION) || \
GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)

.PHONY: helm
helm: $(LOCALBIN)
@if test -x $(HELM) && ! $(HELM) version | grep -q $(HELM_VERSION); then \
rm -f $(HELM); \
fi
@test -x $(HELM) || { curl -Ss $(HELM_INSTALL_SCRIPT) | sed "s|/usr/local/bin|$(LOCALBIN)|" | PATH="$(LOCALBIN):$(PATH)" bash -s -- --no-sudo --version $(HELM_VERSION); }

.PHONY: helm-schema
helm-schema: helm $(HELM_PLUGINS)
@if ! $(HELM) plugin list | grep schema | grep -q $(subst v,,$(HELM_SCHEMA_VERSION)); then \
if $(HELM) plugin list | grep -q schema ; then \
$(HELM) plugin uninstall schema; \
fi; \
$(HELM) plugin install https://github.com/losisin/helm-values-schema-json --version=$(HELM_SCHEMA_VERSION); \
fi

.PHONY: helm-docs
helm-docs: $(LOCALBIN)
@test -x $(HELM_DOCS) && $(HELM_DOCS) version | grep -q $(HELM_DOCS_VERSION) || \
GOBIN=$(LOCALBIN) go install github.com/norwoodj/helm-docs/cmd/helm-docs@$(HELM_DOCS_VERSION)
23 changes: 23 additions & 0 deletions charts/etcd-operator/.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/
5 changes: 5 additions & 0 deletions charts/etcd-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v2
name: etcd-operator
type: application
version: 0.0.1
appVersion: "v0.0.1"
62 changes: 62 additions & 0 deletions charts/etcd-operator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# etcd-operator

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

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | |
| etcdOperator.args[0] | string | `"--health-probe-bind-address=:8081"` | |
| etcdOperator.args[1] | string | `"--metrics-bind-address=127.0.0.1:8080"` | |
| etcdOperator.args[2] | string | `"--leader-elect"` | |
| etcdOperator.envVars | object | `{}` | |
| etcdOperator.image.pullPolicy | string | `"IfNotPresent"` | |
| etcdOperator.image.repository | string | `"ghcr.io/aenix-io/etcd-operator"` | |
| etcdOperator.image.tag | string | `"latest"` | |
| etcdOperator.livenessProbe.httpGet.path | string | `"/healthz"` | |
| etcdOperator.livenessProbe.httpGet.port | int | `8081` | |
| etcdOperator.livenessProbe.initialDelaySeconds | int | `15` | |
| etcdOperator.livenessProbe.periodSeconds | int | `20` | |
| etcdOperator.readinessProbe.httpGet.path | string | `"/readyz"` | |
| etcdOperator.readinessProbe.httpGet.port | int | `8081` | |
| etcdOperator.readinessProbe.initialDelaySeconds | int | `5` | |
| etcdOperator.readinessProbe.periodSeconds | int | `10` | |
| etcdOperator.resources.limits.cpu | string | `"500m"` | |
| etcdOperator.resources.limits.memory | string | `"128Mi"` | |
| etcdOperator.resources.requests.cpu | string | `"10m"` | |
| etcdOperator.resources.requests.memory | string | `"64Mi"` | |
| etcdOperator.securityContext.allowPrivilegeEscalation | bool | `false` | |
| etcdOperator.securityContext.capabilities.drop[0] | string | `"ALL"` | |
| etcdOperator.service.port | int | `9443` | |
| etcdOperator.service.type | string | `"ClusterIP"` | |
| fullnameOverride | string | `""` | |
| imagePullSecrets | list | `[]` | |
| kubeRbacProxy.args[0] | string | `"--secure-listen-address=0.0.0.0:8443"` | |
| kubeRbacProxy.args[1] | string | `"--upstream=http://127.0.0.1:8080/"` | |
| kubeRbacProxy.args[2] | string | `"--logtostderr=true"` | |
| kubeRbacProxy.args[3] | string | `"--v=0"` | |
| kubeRbacProxy.image.pullPolicy | string | `"IfNotPresent"` | |
| kubeRbacProxy.image.repository | string | `"gcr.io/kubebuilder/kube-rbac-proxy"` | |
| kubeRbacProxy.image.tag | string | `"v0.15.0"` | |
| kubeRbacProxy.livenessProbe | object | `{}` | |
| kubeRbacProxy.readinessProbe | object | `{}` | |
| kubeRbacProxy.resources.limits.cpu | string | `"500m"` | |
| kubeRbacProxy.resources.limits.memory | string | `"128Mi"` | |
| kubeRbacProxy.resources.requests.cpu | string | `"5m"` | |
| kubeRbacProxy.resources.requests.memory | string | `"64Mi"` | |
| kubeRbacProxy.securityContext.allowPrivilegeEscalation | bool | `false` | |
| kubeRbacProxy.securityContext.capabilities.drop[0] | string | `"ALL"` | |
| kubeRbacProxy.service.port | int | `8443` | |
| kubeRbacProxy.service.type | string | `"ClusterIP"` | |
| nameOverride | string | `""` | |
| nodeSelector | object | `{}` | |
| podAnnotations | object | `{}` | |
| podLabels | object | `{}` | |
| podSecurityContext | object | `{}` | |
| replicaCount | int | `1` | |
| securityContext.runAsNonRoot | bool | `true` | |
| serviceAccount.annotations | object | `{}` | |
| serviceAccount.create | bool | `true` | |
| tolerations | list | `[]` | |

Loading