Skip to content

Commit

Permalink
feat: public helm repository via github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
eshepelyuk committed Sep 9, 2020
1 parent dc419b2 commit 63f5459
Show file tree
Hide file tree
Showing 9 changed files with 121 additions and 63 deletions.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ indent_size=2
[*.py]
indent_size = 4

[README.adoc]
max_line_length = 100
74 changes: 53 additions & 21 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,70 @@
name: Release Helm chart and Docker image
name: Release CMAK operator

on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch

jobs:
build_docker_job:
name: Helm chart and Docker image
name: Docker image
runs-on: ubuntu-18.04
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: nodejs 12
uses: actions/setup-node@v1
with:
node-version: '12.x'
- run: npm install [email protected] @release-it/[email protected]
- name: releaseIt
run: |
git config user.email "eshepelyuk@github"
git config user.name "Ievgenii Shepeliuk"
npx release-it --ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: cmak version
id: cmakVersion
run: |
cat /tmp/cmak.version
echo "::set-env name=CMAK_VERSION::$(cat /tmp/cmak.version)"
- uses: azure/setup-helm@v1
- run: helm package . --version $CMAK_VERSION
- name: upload artifact
uses: actions/upload-artifact@v2
with:
name: "helm"
path: "cmak-operator-${{ env.CMAK_VERSION }}.tgz"
- name: docker login
uses: docker/login-action@v1
with:
username: eshepelyuk
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: detect version
run: echo "::set-env name=CMAK_VERSION::${GITHUB_REF:10}"
- uses: azure/setup-helm@v1
- name: package helm chart
run: helm package .
- name: publish docker image
uses: hiberbee/github-action-skaffold@latest
with:
command: build
tag: ${{ env.CMAK_VERSION }}
- name: attach helm chart to release
uses: ncipollo/release-action@v1
with:
artifacts: "cmak-operator-${{ env.CMAK_VERSION }}.tgz"
allowUpdates: true
omitBody: true
omitBodyDuringUpdate: true
omitName: true
omitNameDuringUpdate: true
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}

publish_chart_job:
needs: build_docker_job
name: Helm chart
runs-on: ubuntu-18.04
steps:
- name: checkout gh-pages
uses: actions/checkout@v2
with:
ref: gh-pages
- name: download artifact
uses: actions/download-artifact@v2
id: download
with:
name: helm
- uses: azure/setup-helm@v1
- run: helm repo index .
- name: publish
uses: actions-js/push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ CHANGELOG.md
*.tgz
node_modules
package-lock.json
package.json
.idea
1 change: 1 addition & 0 deletions .helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ venv
*.json
skaffold.yaml

node_modules
26 changes: 9 additions & 17 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
{
"ci": true,
"git": {
"commitMessage": "chore: release ${version}",
"tagAnnotation": "chore: release ${version}",
"requireCleanWorkingDir": true,
"requireCommits": true,
"requireBranch": "master",
"commit": true,
"push": true,
"tag": true
"commit": false,
"tagAnnotation": "chore: release ${version}"
},

"npm": {
"publish": false
},

"npm": false,
"github": {
"release": true
"release": true,
"assets": ["cmak-operator*.tgz"]
},

"plugins": {
"@release-it/conventional-changelog": {
"preset": "conventionalcommits"
},
"@release-it/bumper": {
"out": "Chart.yaml"
}
},
"hooks": {
"after:release": "echo ${version} > /tmp/cmak.version"
}
}
2 changes: 1 addition & 1 deletion Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ apiVersion: v2
name: cmak-operator
description: CMAK operator for K8S.
type: application
version: 0.2.1
version: 0.0.0
appVersion: 3.0.0.5

4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ FROM python:3.8-alpine3.11

COPY *.py *.txt /opt/

RUN pip install -r /opt/requirements.txt
RUN pip install click~=7.0 kazoo~=2.8

WORKDIR /opt
WORKDIR /opt
71 changes: 51 additions & 20 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
= CMAK operator
:cmak-v: 0.2.1
:toc: macro
:icons: font

Expand All @@ -11,60 +10,93 @@ ifdef::env-github[]
:warning-caption: :warning:
endif::[]

image:https://img.shields.io/github/v/tag/eshepelyuk/cmak-operator?sort=semver&style=for-the-badge[GitHub tag (latest SemVer)] image:https://img.shields.io/github/license/eshepelyuk/cmak-operator?logo=github&style=for-the-badge[GitHub, link="https://opensource.org/licenses/MIT", window="_blank"]
image:https://img.shields.io/github/v/tag/eshepelyuk/cmak-operator?sort=semver&style=for-the-badge&label=current[Release,
link="https://github.com/eshepelyuk/cmak-operator/releases/latest"]
image:https://img.shields.io/docker/pulls/eshepelyuk/cmak-operator-cli?style=for-the-badge[Docker Hub,
link="https://hub.docker.com/repository/docker/eshepelyuk/cmak-operator-cli"]
image:https://img.shields.io/github/license/eshepelyuk/cmak-operator?logo=github&style=for-the-badge[MIT licence,
link="https://opensource.org/licenses/MIT", window="_blank"]
toc::[]
CMAK operator is a Helm chart and set of tools that allows to install
CMAK operator is a set of tools package as Helm chart, that allows to install
and configure https://github.com/yahoo/CMAK[CMAK (ex Kafka Manager)] into Kubernetes cluster.
https://github.com/yahoo/CMAK[CMAK (ex. Kafka Manager)] is well-known
and mature tool for monitoring and managing https://kafka.apache.org/[Apache Kafka] clusters.
It's extremely easy to configure multiple clusters in CMAK,
as well as connection settings and enable optional authorization
using https://helm.sh/docs/chart_template_guide/values_files/[Helm values files]
== Prerequisites
CMAK operator creates https://kubernetes.io/docs/concepts/workloads/controllers/job/[Kubernetes Jobs] for configuring CMAK.
CMAK operator creates
https://kubernetes.io/docs/concepts/workloads/controllers/job/[Kubernetes Jobs]
for configuring CMAK.
Kubernetes Jobs are not automatically garbage collected.
To enable cleanup it is required to enable `TTLAfterFinished` https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/[feature gate].
To enable cleanup it is required to enable `TTLAfterFinished`
https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/[feature gate].
== Installation
== Installation with Helm
CMAK operator could be installed only using Helm 3.
Helm chart is published to public Helm repository, hosted by GitHub.
It's recommended to install CMAK operator into a dedicated namespace.
[source]
[subs="attributes"]
.Add Helm repository
----
$ helm install --create-namespace --namespace cmak-ns cmak \
https://github.com/eshepelyuk/cmak-operator/releases/download/{cmak-v}/cmak-operator-{cmak-v}.tgz
$ helm repo add cmak https://eshepelyuk.github.io/cmak-operator
$ helm repo update
----
[source]
.Install latest version
----
$ helm install --create-namespace -n cmak-ns mycmak cmak/cmak-operator
----
[source]
.Seach for available versions
----
$ helm search repo cmak-operator --versions
NAME CHART VERSION APP VERSION DESCRIPTION
cmak/cmak-operator 0.2.1 3.0.0.5 CMAK operator for K8S.
cmak/cmak-operator 0.2.0 3.0.0.5 CMAK operator for K8S.
----
[source]
.Install specific version
----
$ helm install --create-namespace -n cmak-ns --version 0.2.1 mycmak cmak/cmak-operator
----
=== Check installation
[IMPORTANT]
.Exposing CMAK UI
====
Currently, CMAK operator doesn't create any `Ingress` or similar resources to expose UI via HTTP.
A users of CMAK operator should take care of this by themselves.
Currently, CMAK operator doesn't create neither `Ingress`
nor any other K8S resources to expose UI via HTTP.
Users of CMAK operator should take care of this by themselves.
====
The simpliest test is to port forward CMAK UI HTTP port and access it from browser via localhost.
The simpliest test is to port forward CMAK UI HTTP port and access it from browser .
[source]
----
$ kubectl port-forward -n cmak-ns service/cmak 9000:9000
----
Then, navigate to http://localhost:9000.

Then, open http://localhost:9000 in your browser.
== Configuration
Check `values.yaml` for all available options.
It's extremely easy to configure multiple clusters in CMAK,
starting from cluster setup, connection settings and ending with authorization
using https://helm.sh/docs/chart_template_guide/values_files/[Helm values files].
Check https://helm.sh/docs/chart_template_guide/values_files/[Helm values files]
for all available options and their description.
. Minimal values.yaml configuration for adding a several Kafka clusters to CMAK.
[source,yaml]
Expand Down Expand Up @@ -107,8 +139,7 @@ Configuration should be passed to helm via command line during installation or u
[source]
[subs="attributes"]
----
$ helm install --create-namespace --namespace cmak-ns -f cmak-values.yaml cmak \
https://github.com/eshepelyuk/cmak-operator/releases/download/{cmak-v}/cmak-operator-{cmak-v}.tgz
$ helm install --create-namespace -n cmak-ns -f cmak-values.yaml mycmak cmak/cmak-operator
----
== Troubleshooting
Expand Down
2 changes: 0 additions & 2 deletions requirements.txt

This file was deleted.

0 comments on commit 63f5459

Please sign in to comment.