Skip to content

Commit

Permalink
Merge pull request #72 from bcochofel/first_release
Browse files Browse the repository at this point in the history
feat: first release
  • Loading branch information
bcochofel authored Jan 23, 2021
2 parents 253ee61 + f43d022 commit 0e7d18e
Show file tree
Hide file tree
Showing 30 changed files with 543 additions and 909 deletions.
56 changes: 56 additions & 0 deletions .chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{{ if .Versions -}}
<a name="unreleased"></a>
## [Unreleased]

{{ if .Unreleased.CommitGroups -}}
{{ range .Unreleased.CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}

{{ range .Versions }}
<a name="{{ .Tag.Name }}"></a>
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
{{ range .CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}

{{- if .RevertCommits -}}
### Reverts
{{ range .RevertCommits -}}
- {{ .Revert.Header }}
{{ end }}
{{ end -}}

{{- if .MergeCommits -}}
### Pull Requests
{{ range .MergeCommits -}}
- {{ .Header }}
{{ end }}
{{ end -}}

{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}
{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}

{{- if .Versions }}
[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD
{{ range .Versions -}}
{{ if .Tag.Previous -}}
[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
{{ end -}}
{{ end -}}
{{ end -}}
28 changes: 28 additions & 0 deletions .chglog/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
style: github
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: https://github.com/bcochofel/k8s-gitops-istio-demo
options:
commits:
# filters:
# Type:
# - feat
# - fix
# - perf
# - refactor
commit_groups:
# title_maps:
# feat: Features
# fix: Bug Fixes
# perf: Performance Improvements
# refactor: Code Refactoring
header:
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
pattern_maps:
- Type
- Scope
- Subject
notes:
keywords:
- BREAKING CHANGE
31 changes: 31 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Release
on:
push:
branches:
- '*' # all branches
- '!main' # exclude main branch
- '!master' # exclude main branch

jobs:
changelog:
name: Changelog
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: Use GitVersion
uses: gittools/actions/gitversion/[email protected]
id: gitversion
- name: Changelog
id: changelog
uses: nuuday/[email protected]
with:
next_version: "${{ steps.gitversion.outputs.majorMinorPatch }}"
- name: Commit Changelog
uses: stefanzweifel/git-auto-commit-action@v4
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release
on:
push:
branches:
- main
- master

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: Use GitVersion
uses: gittools/actions/gitversion/[email protected]
id: gitversion
- name: Create Release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.gitversion.outputs.majorMinorPatch }}
release_name: Release ${{ steps.gitversion.outputs.majorMinorPatch }}
body: |
[CHANGELOG](./CHANGELOG.md)
draft: false
prerelease: false
7 changes: 5 additions & 2 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ jobs:
with:
kubectl: 1.18.9
kustomize: 3.8.4
helm: 2.16.7
helmv3: 3.2.1
kubeseal: 0.12.5
kubeaudit: 0.11.5
command: |
echo "Validating kustomize istio-demo scenario..."
#kustomize build scenarios/istio-demo | kubeval --strict --ignore-missing-schemas
kustomize build scenarios/istio-demo | kubeval --strict --ignore-missing-schemas
echo "Validating kustomize istio-default scenario..."
#kustomize build scenarios/istio-production | kubeval --strict --ignore-missing-schemas
kustomize build scenarios/istio-production | kubeval --strict --ignore-missing-schemas
7 changes: 6 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@ repos:
- id: detect-private-key
- id: check-merge-conflict
- id: no-commit-to-branch
# - id: check-yaml
- id: check-yaml
- repo: https://github.com/commitizen-tools/commitizen
rev: master
hooks:
- id: commitizen
stages: [commit-msg]
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<a name="unreleased"></a>
## [Unreleased]


<a name="0.1.0"></a>
## [0.1.0] - 2021-01-23
### Feat
- first release

### Fix
- istio-demo scenario


<a name="flux-sync"></a>
## flux-sync - 2021-01-23
### Pull Requests
- Merge pull request [#71](https://github.com/bcochofel/k8s-gitops-istio-demo/issues/71) from bcochofel/kiali-cr
- Merge pull request [#2](https://github.com/bcochofel/k8s-gitops-istio-demo/issues/2) from bcochofel/kustomize-base
- Merge pull request [#1](https://github.com/bcochofel/k8s-gitops-istio-demo/issues/1) from bcochofel/bootstrap-repo


[Unreleased]: https://github.com/bcochofel/k8s-gitops-istio-demo/compare/0.1.0...HEAD
[0.1.0]: https://github.com/bcochofel/k8s-gitops-istio-demo/compare/flux-sync...0.1.0
8 changes: 0 additions & 8 deletions Makefile

This file was deleted.

27 changes: 20 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# k8s-gitops-istio-demo

[![Validate Scenarios](https://github.com/bcochofel/k8s-gitops-istio-demo/workflows/Validate%20Scenarios/badge.svg)](https://github.com/bcochofel/k8s-gitops-istio-demo/blob/master/.github/workflows/validate.yml)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![GitHub license](https://img.shields.io/github/license/bcochofel/k8s-gitops-istio-demo.svg)](https://github.com/bcochofel/k8s-gitops-istio-demo/blob/master/LICENSE)
[![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/bcochofel/k8s-gitops-istio-demo)](https://github.com/bcochofel/k8s-gitops-istio-demo/tags)
[![GitHub issues](https://img.shields.io/github/issues/bcochofel/k8s-gitops-istio-demo.svg)](https://github.com/bcochofel/k8s-gitops-istio-demo/issues/)
[![GitHub forks](https://img.shields.io/github/forks/bcochofel/k8s-gitops-istio-demo.svg?style=social&label=Fork&maxAge=2592000)](https://github.com/bcochofel/k8s-gitops-istio-demo/network/)
[![GitHub stars](https://img.shields.io/github/stars/bcochofel/k8s-gitops-istio-demo.svg?style=social&label=Star&maxAge=2592000)](https://github.com/bcochofel/k8s-gitops-istio-demo/stargazers/)
[![pre-commit badge][pre-commit-badge]][pre-commit] [![Conventional commits badge][conventional-commits-badge]][conventional-commits] [![Keep a Changelog v1.1.0 badge][keep-a-changelog-badge]][keep-a-changelog] [![MIT License Badge][license-badge]][license]

Kubernetes manifests that can be used with GitOps.
Most of the manifests use Helm Operator, so you need to have that installed on your cluster.

# pre-commit hooks

Read the [pre-commit hooks](docs/pre-commit-hooks.md) document for more info.

# git-chglog

Read the [git-chglog](docs/git-chlog.md) document for more info.

## Requirements

The scenarios under `kustomize/` use [Kustomize](https://github.com/kubernetes-sigs/kustomize).
Expand Down Expand Up @@ -49,3 +51,14 @@ Prometheus is deployed using the new Prometheus Operator [chart](https://github.
The Prometheus instances use labels (tier=cluster and tier=istio) to separate the scrape and rules for each scope.

You can use [this repo](https://github.com/bcochofel/terraform-modules) to deploy both Istio and Flux using Terraform (`examples` folder)

[pre-commit]: https://github.com/pre-commit/pre-commit
[pre-commit-badge]: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white
[conventional-commits-badge]: https://img.shields.io/badge/Conventional%20Commits-1.0.0-green.svg
[conventional-commits]: https://conventionalcommits.org
[keep-a-changelog-badge]: https://img.shields.io/badge/changelog-Keep%20a%20Changelog%20v1.1.0-%23E05735
[keep-a-changelog]: https://keepachangelog.com/en/1.0.0/
[license]: ./LICENSE
[license-badge]: https://img.shields.io/badge/license-MIT-green.svg
[changelog]: ./CHANGELOG.md
[changelog-badge]: https://img.shields.io/badge/changelog-Keep%20a%20Changelog%20v1.1.0-%23E05735
14 changes: 14 additions & 0 deletions docs/git-chlog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# git-chglog

The Changelog file is maintained using [git-chglog](https://github.com/git-chglog/git-chglog)

```bash
❯ git-chglog --init
? What is the URL of your repository? {{ github_url }}
? What is your favorite style? github
? Choose the format of your favorite commit message <type>(<scope>): <subject>
? What is your favorite template style? keep-a-changelog
? Do you include Merge Commit in CHANGELOG? Yes
? Do you include Revert Commit in CHANGELOG? Yes
? In which directory do you output configuration files and templates? .chglog
```
Binary file added docs/images/lab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/tested.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions docs/pre-commit-hooks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# pre-commit hooks

GIT hooks are implemented using [`pre-commit`](https://pre-commit.com/).

To install `pre-commit` follow [this](https://pre-commit.com/#install) guide.

After installing `pre-commit` and cloning this repo you can enable the hooks locally by running:

```bash
pre-commit install
pre-commit install --hook-type commit-msg
```

You can also run specific hooks on all files:

```bash
pre-commit run detect-private-key --all-files
```

or run all hooks on all files:

```bash
pre-commit run --all-files
```

for more options check `pre-commit` [documentation](https://pre-commit.com/#advanced)

**NOTE:** to run the hooks you should have installed the following tools:
* [`terraform`](https://www.terraform.io/downloads.html)
* [`terragrunt`](https://terragrunt.gruntwork.io/docs/getting-started/install/)
* [`tflint`](https://github.com/terraform-linters/tflint) and
* [`terraform-docs`](https://github.com/terraform-docs/terraform-docs) installed locally.
7 changes: 7 additions & 0 deletions docs/references.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# References

- [Kubespray](https://github.com/kubernetes-sigs/kubespray)
- [kubectl Cheat Sheet](https://kubernetes.io/docs/reference/kubectl/cheatsheet/)
- [Set up Kubernetes cluster on laptop/PC using Vagrant Virtual Box and Kubespray](https://medium.com/@kanrangsan/home-lab-set-up-kubernetes-cluster-on-laptop-pc-using-vagrant-virtual-box-and-kubespray-a445c0429226)
- [Deployment with Kubernetes](https://blog.lelonek.me/deployment-with-kubernetes-e74cd6a8974)
- [pre-commit](https://pre-commit.com/#install)
13 changes: 13 additions & 0 deletions docs/requirements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Requirements

To run this repository you need:

- [Vagrant](https://www.vagrantup.com/downloads.html)
- At least 16GB of RAM (you can change the Vagrantfile)

You can also use [pre-commit](https://pre-commit.com/#install). After installing
`pre-commit` just execute:

```ShellSession
pre-commit install
```
10 changes: 5 additions & 5 deletions scenarios/istio-demo/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ bases:
patchesStrategicMerge:
- metallb-patch.yaml
- istio-operator-patch.yaml
resources:
- https://raw.githubusercontent.com/istio/istio/release-1.8/samples/addons/kiali.yaml
- https://raw.githubusercontent.com/istio/istio/release-1.8/samples/addons/grafana.yaml
- https://raw.githubusercontent.com/istio/istio/release-1.8/samples/addons/prometheus.yaml
- https://raw.githubusercontent.com/istio/istio/release-1.8/samples/addons/jaeger.yaml
#resources:
#- https://raw.githubusercontent.com/istio/istio/release-1.8/samples/addons/kiali.yaml
#- https://raw.githubusercontent.com/istio/istio/release-1.8/samples/addons/grafana.yaml
#- https://raw.githubusercontent.com/istio/istio/release-1.8/samples/addons/prometheus.yaml
#- https://raw.githubusercontent.com/istio/istio/release-1.8/samples/addons/jaeger.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,5 @@
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: flux
namespace: fluxcd
labels:
app: flux
release: flux
tier: cluster
spec:
endpoints:
- port: http
honorLabels: true
namespaceSelector:
matchNames:
- fluxcd
selector:
matchLabels:
app: flux
release: flux
---
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
labels:
Expand Down
21 changes: 21 additions & 0 deletions scenarios/istio-production/flux-prometheus-servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: flux
namespace: fluxcd
labels:
app: flux
release: flux
tier: cluster
spec:
endpoints:
- port: http
honorLabels: true
namespaceSelector:
matchNames:
- fluxcd
selector:
matchLabels:
app: flux
release: flux
Loading

0 comments on commit 0e7d18e

Please sign in to comment.