Skip to content

Commit

Permalink
0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
julianxhokaxhiu committed Jan 10, 2023
0 parents commit 54a8213
Show file tree
Hide file tree
Showing 91 changed files with 9,495 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env bash

# Go environment
# ===================

CACHE_PATH=".cache/gopath"
mkdir -p $CACHE_PATH
export GOPATH=$(realpath $CACHE_PATH)

# Local variables
# ===============
CURRENT_PATH=$(pwd)
REPO_NAME=$(basename $CURRENT_PATH)
REPO_HOST_PATH=$(realpath $CURRENT_PATH/..)
REPO_NODE_PATH="/srv/git"
REPO_URI="http://git-http-backend/git/${REPO_NAME}"
REPO_BRANCH=$(git branch --show-current)
K8S_VERSION="kindest/node:v1.24.7@sha256:577c630ce8e509131eab1aea12c022190978dd2f745aac5eb1fe65c0807eb315"

# Export as environment variables if not already defined
# ======================================================
export KKA_REPO_NAME=${KKA_REPO_NAME:-${REPO_NAME}}
export KKA_REPO_HOST_PATH=${KKA_REPO_HOST_PATH:-${REPO_HOST_PATH}}
export KKA_REPO_NODE_PATH=${KKA_REPO_NODE_PATH:-${REPO_NODE_PATH}}
export KKA_REPO_URI=${KKA_REPO_URI:-${REPO_URI}}
export KKA_REPO_BRANCH=${KKA_REPO_BRANCH:-${REPO_BRANCH}}
export KKA_K8S_VERSION=${KKA_K8S_VERSION:-${K8S_VERSION}}

# Required by MetalLB - https://kind.sigs.k8s.io/docs/user/loadbalancer/
# ======================================================================
if [ $(docker network ls -f "name=kind" -q) ]; then
export KKA_METALLB_CIDR=$(docker network inspect -f '{{ (index .IPAM.Config 0).Subnet }}' kind)
fi

# Enable this flag if you want to just deploy the K8s cluster
# with MetalLB in place, to allow Loadbalancer services to work
# =============================================================
export KKA_DEPLOY_MINIMAL="${KKA_DEPLOY_MINIMAL:-false}"

# Control which addons we might want to exclude from default deployment,
# if KKA_DEPLOY_MINIMAL == false
# ======================================================================
# Istio
export KKA_AOA_EXCLUDE_ISTIO="${KKA_AOA_EXCLUDE_ISTIO:-false}"
# Knative depends on Istio by default, if we exclude it we exclude Knative as well
if [ "${KKA_AOA_EXCLUDE_ISTIO}" == "true" ]; then
export KKA_AOA_EXCLUDE_KNATIVE="true"
else
export KKA_AOA_EXCLUDE_KNATIVE="${KKA_AOA_EXCLUDE_KNATIVE:-false}"
fi
# Prometheus + Grafana stack
export KKA_AOA_EXCLUDE_PROMETHEUSSTACK="${KKA_AOA_EXCLUDE_PROMETHEUSSTACK:-false}"
# Dex
export KKA_AOA_EXCLUDE_DEX="${KKA_AOA_EXCLUDE_DEX:-false}"
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
55 changes: 55 additions & 0 deletions .github/ISSUE_TEMPLATE/issue_template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: "Issue"
description: Create a new issue for an enhancement, a bug or a chore.
title: "[ISSUE] - <title>"
labels: ["issue"]
body:
- type: dropdown
id: issue-type
attributes:
label: "Issue Type"
description: What kind of an issue are you reporting?
multiple: true
options:
- Enhancement
- Bug
- Chore
validations:
required: true
- type: textarea
id: description
attributes:
label: "Description"
description: Please enter an short description of your issue
placeholder: Short description of the bug/enhancement incident...
validations:
required: true
- type: textarea
id: reprod
attributes:
label: "Detailed steps"
description: Please enter an explicit description of your issue
value: |
1. Go to '...'
2. Run this command '....'
3. See error
render: bash
validations:
required: true
- type: textarea
id: screenshot
attributes:
label: "Screenshots"
description: If applicable, add screenshots to help explain your problem.
value: |
Add any relevant screenshots here
render: bash
validations:
required: false
- type: textarea
id: logs
attributes:
label: "Logs"
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: bash
validations:
required: false
16 changes: 16 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## What does this PR do?

Please include a summary of the change, and please also include relevant motivation and context. List any dependencies that are required for this change.

## Related issues

Please include a link to the issues related to this Pull Request.

## Checklist before merging

- [ ] My code follows the style guidelines of this project.
- [ ] I have performed a self-review of my own code.
- [ ] I have checked the [contributing document](../CONTRIBUTING.MD).
- [ ] I have checked the existing [Pull Requests](https://github.com/nearform/k8s-kurated-addons/pulls) to see whether someone else has raised a similar idea or question.
- [ ] I have added tests that prove my fix is effective or that my feature works.
- [ ] I have upgraded the [changelog](../CHANGELOG.md) according to the nature of the feature that I am adding to this Pull Request.
27 changes: 27 additions & 0 deletions .github/renovate-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = {
platform: 'github',
extends: ['config:base', ':disableDependencyDashboard', ":semanticCommitTypeAll(deps)"],
packageRules: [
{
matchUpdateTypes: ["minor", "patch"],
automerge: true
},
// Istio has to be considered as a whole
{
matchPaths: ["addons/istio/**"],
groupName: "Istio Helm Chart"
}
],
username: "nearform-renovate-app",
gitAuthor: '"Nearform" <nearform@nearform.com>',
automergeType: "branch",
platformAutomerge: true,
repositories: ['nearform/k8s-kurated-addons'],
enabledManagers: ['helmv3', 'github-actions'],
prConcurrentLimit: 0,
branchConcurrentLimit: 0,
branchNameStrict: true,
baseBranches: ['main'],
dependencyDashboard: false,
rebaseWhen : "auto"
};
3 changes: 3 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
}
22 changes: 22 additions & 0 deletions .github/workflows/assets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Upload assets

on:
release:
types:
- published

jobs:
upload-assets:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Upload files to a GitHub release
run: |
source .envrc
cat manifests/app-of-apps.yaml | envsubst > app-of-apps.yaml
./scripts/upload-assets.sh ${{ github.repository }} app-of-apps.yaml ${{ github.ref }}
env:
GITHUB_TOKEN: ${{ github.token }}
KKA_REPO_URI: https://github.com/${{ github.repository }}.git
KKA_REPO_BRANCH: ${{ github.ref_name }}
48 changes: 48 additions & 0 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Run Integration Tests

on:
pull_request:
branches:
- main

jobs:
create-cluster:
strategy:
matrix:
KKA_K8S_VERSION:
[
"kindest/node:v1.23.13@sha256:577c630ce8e509131eab1aea12c022190978dd2f745aac5eb1fe65c0807eb315",
"kindest/node:v1.24.7@sha256:577c630ce8e509131eab1aea12c022190978dd2f745aac5eb1fe65c0807eb315",
"kindest/node:v1.25.3@sha256:f1de3b0670462f43280114eccceab8bf1b9576d2afe0582f8f74529da6fd0365",
]
runs-on: macos-12
steps:
- uses: actions/checkout@v3

- name: Integration test
run: |
# Install GNU tools and make use them from now on
brew install bash make coreutils
PATH="$(brew --prefix)/opt/make/libexec/gnubin:$PATH"
# Install asdf and expose to PATH
brew install asdf
. $(brew --prefix)/opt/asdf/libexec/asdf.sh
# Install Docker
brew install docker
# Add asdf plugins and install tools in .tool-versions
make asdf_install
# Print Colima version
colima version
# Run Colima ( 3 vCPU, 12GB RAM, 12GB Disk )
colima start --cpu 3 --memory 12 --disk 12
# Create a local branch to allow the next steps to work
git checkout -b ci
# Deploy cluster
make ci
# Run tests
make integration-test
env:
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
KKA_AOA_EXCLUDE_DEX: true
KKA_AOA_EXCLUDE_PROMETHEUSSTACK: true
KKA_K8S_VERSION: ${{ matrix.KKA_K8S_VERSION }}
40 changes: 40 additions & 0 deletions .github/workflows/preview.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Run Unit Tests

on:
pull_request:
branches:
- main

jobs:
create-cluster:
strategy:
matrix:
KKA_K8S_VERSION:
[
"kindest/node:v1.23.13@sha256:577c630ce8e509131eab1aea12c022190978dd2f745aac5eb1fe65c0807eb315",
"kindest/node:v1.24.7@sha256:577c630ce8e509131eab1aea12c022190978dd2f745aac5eb1fe65c0807eb315",
"kindest/node:v1.25.3@sha256:f1de3b0670462f43280114eccceab8bf1b9576d2afe0582f8f74529da6fd0365",
]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Unit test
run: |
# Install envsubst
sudo apt-get update && sudo apt-get install -y gettext
# Install asdf and expose to PATH
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.10.2
. $HOME/.asdf/asdf.sh
# Add asdf plugins and install tools in .tool-versions
make asdf_install
# Create a local branch to allow the next step to work
git checkout -b ci
# Deploy cluster
make ci
# Run tests
make unit-test
env:
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
KKA_DEPLOY_MINIMAL: true
KKA_K8S_VERSION: ${{ matrix.KKA_K8S_VERSION }}
32 changes: 32 additions & 0 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: release-please

on:
push:
branches:
- main

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: nearform/github-app-token@v1
id: get_installation_token
with:
app_id: ${{ secrets.RENOVATE_APP_ID }}
installation_id: ${{ secrets.RENOVATE_APP_INSTALLATION_ID }}
private_key: ${{ secrets.RENOVATE_APP_PRIVATE_KEY }}

- uses: google-github-actions/release-please-action@v3
with:
release-type: simple
package-name: k8s-kurated-addons
bump-minor-pre-major: true
token: ${{ steps.get_installation_token.outputs.token }}
extra-files: |
app-of-apps/Chart.yaml
addons/argocd/Chart.yaml
addons/cert-manager/Chart.yaml
addons/dex/Chart.yaml
addons/istio/base/Chart.yaml
addons/istio/istiod/Chart.yaml
addons/kube-prometheus-stack/Chart.yaml
29 changes: 29 additions & 0 deletions .github/workflows/renovate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Renovate

on:
workflow_dispatch:
schedule:
- cron: '0 21 * * 0,2,4' # Every Sunday, Tuesday and Thursday at 9PM UTC

jobs:
renovate:
permissions: write-all
runs-on: ubuntu-latest
steps:
- uses: nearform/github-app-token@v1
id: get_installation_token
with:
app_id: ${{ secrets.RENOVATE_APP_ID }}
installation_id: ${{ secrets.RENOVATE_APP_INSTALLATION_ID }}
private_key: ${{ secrets.RENOVATE_APP_PRIVATE_KEY }}

- name: Checkout
uses: actions/checkout@v3.2.0

- name: Self-hosted Renovate
uses: renovatebot/github-action@v34.58.1
with:
configurationFile: .github/renovate-config.js
token: "x-access-token:${{ steps.get_installation_token.outputs.token }}"
env:
LOG_LEVEL: 'debug'
25 changes: 25 additions & 0 deletions .github/workflows/static-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Run static checks

on:
pull_request:
branches:
- main

jobs:
format:
name: Lint & format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Static check
run: |
# Install envsubst
sudo apt-get update && sudo apt-get install -y gettext
# Install asdf and expose to PATH
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.10.2
. $HOME/.asdf/asdf.sh
# Add asdf plugins and install tools in .tool-versions
make asdf_install
# Run checks
make validate
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
argocd/charts
*Chart.lock
*charts/

.idea
local.env
kind.local.yaml

.cache
22 changes: 22 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-added-large-files
- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.5.0
hooks:
- id: go-fmt
- repo: https://github.com/gruntwork-io/pre-commit
rev: v0.1.17 # Get the latest from: https://github.com/gruntwork-io/pre-commit/releases
hooks:
- id: helmlint
- repo: local
hooks:
- id: tiltfile-validate
name: Validate Tiltfile
entry: ./scripts/tilt-validate.sh
language: script
files: ^Tiltfile$
2 changes: 2 additions & 0 deletions .tiltignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/charts
**/tmpcharts
Loading

0 comments on commit 54a8213

Please sign in to comment.