Skip to content

Commit

Permalink
feat(helm): init helm chart
Browse files Browse the repository at this point in the history
Signed-off-by: Anthony TREUILLIER <anthony.treuillier.ext@orange.com>
  • Loading branch information
antrema committed Oct 31, 2024
1 parent 8b76acd commit bd46d6c
Show file tree
Hide file tree
Showing 35 changed files with 2,296 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .github/ci/ct.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
remote: origin
target-branch: main
validate-maintainers: false
check-version-increment: false
chart-dirs:
- charts
helm-extra-args: "--timeout=5m"
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
62 changes: 62 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build GitHub Pages
on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

permissions:
id-token: write
contents: write
pages: write

jobs:
build_mkdocs:
runs-on: ubuntu-latest
steps:
- name: Checkout
# This action checks-out your repository under $GITHUB_WORKSPACE, so your workflow can access it.
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Install Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: '3.12'
- run: pip install \
'mkdocs-material>=9.5.0,<9.6.0'
- run: mkdocs build --config-file mkdocs.yml
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
destination_dir: docs
publish_dir: site
# - run: mkdocs gh-deploy --config-file mkdocs.yml --force

deploy_mkdocs:
needs: build_mkdocs
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
# This action checks-out your repository under $GITHUB_WORKSPACE, so your workflow can access it.
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: gh-pages
- name: Setup Pages
# A GitHub Action to enable Pages and extract various metadata about a site.
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
- name: Upload artifact
# A composite Action for packaging and uploading artifact that can be deployed to GitHub Pages.
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
with:
path: '.'
- name: Deploy to GitHub Pages
# This action is used to deploy Actions artifacts to GitHub Pages.
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
97 changes: 97 additions & 0 deletions .github/workflows/helm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Helm Chart

on:
push:
branches:
- main
- release-*
paths:
- charts/powerdns-operator/Chart.yaml

workflow_dispatch: {}

permissions:
contents: read

jobs:
lint-and-test:
name: Lint and Test
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Set up Helm
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0

- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: 3.x

- name: Set up Helm Chart Testing
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
with:
version: 3.11.0
yamllint_version: 1.35.1
yamale_version: 5.2.1

- name: Set up Artifact Hub
run: |
curl --fail --location https://github.com/artifacthub/hub/releases/download/v1.19.0/ah_1.19.0_linux_amd64.tar.gz --output /tmp/ah.tar.gz
echo "0e430493521ce387ca04d79b26646a86f92886dbcceb44985bb71082a9530ca5 /tmp/ah.tar.gz" | shasum --check
sudo tar --extract --file /tmp/ah.tar.gz --directory /usr/local/bin ah
- name: Lint chart
run: |
ct lint --config .github/ci/ct.yaml
ah lint --path charts/powerdns-operator
- name: Install chart unittest
run: |
helm env
helm plugin install https://github.com/helm-unittest/helm-unittest
- name: Run unitests
run: make helm-test

release:
name: Release
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Set up Helm
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0

- name: Run chart-releaser
uses: helm/chart-releaser-action@a917fd15b20e8b64b94d9158ad54cd6345335584 # v1.6.0
if: |
github.ref == 'refs/heads/main' ||
startsWith(github.ref, 'refs/heads/release-')
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
CR_RELEASE_NAME_TEMPLATE: helm-chart-{{ .Version }}
CR_SKIP_EXISTING: true
with:
charts_dir: charts
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
bin/*
Dockerfile.cross

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Go workspace file
go.work

# Kubernetes Generated files - skip generated files, except for vendored files
!vendor/**/zz_generated.*

# editor and IDE paraphernalia
.idea
.vscode
*.swp
*.swo
*~
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2024 Benjamin Pinchon

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
59 changes: 59 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Helm
HELM_UNITTEST_VERSION = 3.16.1-0.6.2
HELM_DOCS_VERSION = v1.14.2
HELM_DIR ?= charts/powerdns-operator
DOC_DIR ?= docs

OUTPUT_DIR ?= bin

# Setting SHELL to bash allows bash commands to be executed by recipes.
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
SHELL = /usr/bin/env bash -o pipefail
.SHELLFLAGS = -ec

# ====================================================================================
# Colors

BLUE := $(shell printf "\033[34m")
YELLOW := $(shell printf "\033[33m")
RED := $(shell printf "\033[31m")
GREEN := $(shell printf "\033[32m")
CNone := $(shell printf "\033[0m")

# ====================================================================================
# Logger

TIME_LONG = `date +%Y-%m-%d' '%H:%M:%S`
TIME_SHORT = `date +%H:%M:%S`
TIME = $(TIME_SHORT)

INFO = echo ${TIME} ${BLUE}[ .. ]${CNone}
WARN = echo ${TIME} ${YELLOW}[WARN]${CNone}
ERR = echo ${TIME} ${RED}[FAIL]${CNone}
OK = echo ${TIME} ${GREEN}[ OK ]${CNone}
FAIL = (echo ${TIME} ${RED}[FAIL]${CNone} && false)

# ====================================================================================

##@ Helm
helm-docs:
@cd $(HELM_DIR); \
docker run --rm -v $(shell pwd)/$(HELM_DIR):/helm-docs -u $(shell id -u) jnorwood/helm-docs:$(HELM_DOCS_VERSION)
cp $(HELM_DIR)/README.md $(DOC_DIR)/README.md

HELM_VERSION ?= $(shell helm show chart $(HELM_DIR) | grep '^version:' | sed 's/version: //g')

helm-build:
@$(INFO) helm package
@helm package $(HELM_DIR) --dependency-update --destination $(OUTPUT_DIR)/chart
@mv $(OUTPUT_DIR)/chart/powerdns-operator-$(HELM_VERSION).tgz $(OUTPUT_DIR)/chart/powerdns-operator.tgz
@$(OK) helm package

helm-test:
@cd $(HELM_DIR); \
docker run --rm -v $(shell pwd)/$(HELM_DIR):/apps -u $(shell id -u) helmunittest/helm-unittest:$(HELM_UNITTEST_VERSION) .

helm-test-update:
@cd $(HELM_DIR); \
docker run --rm -v $(shell pwd)/$(HELM_DIR):/apps -u $(shell id -u) helmunittest/helm-unittest:$(HELM_UNITTEST_VERSION) -u .

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# PowerDNS-Operator-helm-chart

This project provide a Helm chart to deploy PowerDNS-Operator
27 changes: 27 additions & 0 deletions charts/powerdns-operator/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 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/

tests/
README.md.gotmpl
.helmignore
36 changes: 36 additions & 0 deletions charts/powerdns-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: v2
name: powerdns-operator
description: Manage PowerDNS resources with Kubernetes
type: application
version: 0.1.0
appVersion: 0.1.0
kubeVersion: '>= 1.21.0-0'
keywords:
- powerdns-operator
- powerdns
- dns
home: https://orange-opensource.github.io/PowerDNS-Operator-helm-chart
icon: https://github.com/Orange-OpenSource/PowerDNS-Operator/blob/main/docs/assets/favicon.png?raw=true
maintainers:
- name: antrema
- name: mydoomfr
sources:
- https://github.com/Orange-OpenSource/PowerDNS-Operator-helm-chart
annotations:
artifacthub.io/crds: |
- kind: Zone
version: v1alpha1
name: zone.dns.cav.enablers.ob
displayName: Zone
description: |
A Zone is a collection of records that are managed together. Zones can
be used to represent a domain, a subdomain, or a set of records that are
managed together.
- kind: RRset
version: v1alpha1
name: rrset.dns.cav.enablers.ob
displayName: RRset
description: |
An RRset is a collection of records that share the same name and type.
RRsets can be used to represent a collection of records that are managed
together.
Loading

0 comments on commit bd46d6c

Please sign in to comment.