feat: add go-task, set up prettier, format yaml (#50)

This commit is contained in:
ᗪєνιη ᗷυнʟ authored and GitHub committed 2021-08-03 09:13:56 -04:00
1 parent 99370f6d8d
commit 525be88214
40 files changed
+229 -94

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Discuss on Discord
- name: Discuss on Discord
url: https://discord.com/invite/sTMX7Vh
about: Join our Discord community
+23
View File
@@ -0,0 +1,23 @@
---
default: true
# MD013/line-length - Line length
MD013:
# Number of characters
line_length: 240
# Number of characters for headings
heading_line_length: 80
# Number of characters for code blocks
code_block_line_length: 80
# Include code blocks
code_blocks: true
# Include tables
tables: true
# Include headings
headings: true
# Include headings
headers: true
# Strict length checking
strict: false
# Stern length checking
stern: false
+2
View File
@@ -0,0 +1,2 @@
*.sops.yaml
gotk-components.yaml
+5
View File
@@ -0,0 +1,5 @@
---
trailingComma: "es5"
tabWidth: 2
semi: false
singleQuote: false
@@ -1,10 +1,10 @@
ignore: |
.github/
crds.yaml
*.sops.yaml
gotk-components.yaml
extends: default
rules:
truthy:
allowed-values: ['true', 'false', 'on', 'yes']
allowed-values: ["true", "false", "on"]
comments:
min-spaces-from-content: 1
line-length: disable
@@ -14,6 +14,4 @@ rules:
brackets:
min-spaces-inside: 0
max-spaces-inside: 0
indentation:
spaces: 2
indent-sequences: consistent
indentation: enable
+1 -2
View File
@@ -1,11 +1,10 @@
---
name: Schedule - Update Flux
on: # yamllint disable-line rule:truthy
workflow_dispatch:
schedule:
- cron: '0 12 * * *'
- cron: "0 12 * * *"
jobs:
flux-upgrade:
+2 -3
View File
@@ -1,5 +1,4 @@
---
name: Invalid Template
on:
@@ -16,9 +15,9 @@ jobs:
- uses: dessant/support-requests@v2
with:
github-token: ${{ github.token }}
support-label: 'template-incomplete'
support-label: "template-incomplete"
issue-comment: >
:wave: @{issue-author}, please follow the template provided.
close-issue: true
lock-issue: true
issue-lock-reason: 'resolved'
issue-lock-reason: "resolved"
+19 -6
View File
@@ -1,19 +1,32 @@
---
name: Lint
on: # yamllint disable-line rule:truthy
workflow_dispatch:
pull_request:
jobs:
yaml:
yamllint:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: yamllint
uses: reviewdog/action-yamllint@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
yamllint_flags: '-c .github/yamllint.config.yaml ./cluster/'
yamllint_flags: "-c .github/lint/.yamllint.yaml ./cluster"
shellcheck:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: shellcheck
uses: reviewdog/action-shellcheck@v1
with:
path: "./hack"
level: "error"
markdownlint:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: markdownlint
uses: reviewdog/action-markdownlint@v0.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
+1 -3
View File
@@ -1,12 +1,10 @@
---
name: Schedule - Renovate Helm Releases
on: # yamllint disable-line rule:truthy
workflow_dispatch:
schedule:
- cron: '0 */12 * * *'
- cron: "0 */12 * * *"
jobs:
renovate-helm-releases:
+3 -4
View File
@@ -1,6 +1,5 @@
---
name: 'Support requests'
name: "Support requests"
on:
issues:
@@ -16,7 +15,7 @@ jobs:
- uses: dessant/support-requests@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
support-label: 'support'
support-label: "support"
issue-comment: >
:wave: @{issue-author}, we use the issue tracker exclusively
for bug reports and feature requests. However, this issue appears
@@ -25,4 +24,4 @@ jobs:
- [Discord](https://discord.gg/sTMX7Vh)
close-issue: true
lock-issue: false
issue-lock-reason: 'off-topic'
issue-lock-reason: "off-topic"
+8 -7
View File
@@ -1,28 +1,29 @@
---
fail_fast: false
repos:
- repo: https://github.com/adrienverge/yamllint
- repo: https://github.com/adrienverge/yamllint
rev: v1.26.2
hooks:
- args:
- -c
- .github/yamllint.config.yaml
- --config-file
- .github/lint/.yamllint.yaml
id: yamllint
- repo: https://github.com/pre-commit/pre-commit-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: mixed-line-ending
- repo: https://github.com/Lucas-C/pre-commit-hooks
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.10
hooks:
- id: remove-crlf
- id: remove-tabs
- repo: https://github.com/sirosen/fix-smartquotes
- repo: https://github.com/sirosen/fix-smartquotes
rev: 0.2.0
hooks:
- id: fix-smartquotes
- repo: https://github.com/k8s-at-home/sops-pre-commit
- repo: https://github.com/k8s-at-home/sops-pre-commit
rev: v2.0.3
hooks:
- id: forbid-secrets
+9
View File
@@ -0,0 +1,9 @@
---
version: "3"
tasks:
sync:
desc: Sync flux-system with the Git Repository
cmds:
- flux reconcile source git flux-system
silent: true
+33
View File
@@ -0,0 +1,33 @@
---
version: "3"
tasks:
all:
- task: markdown
- task: yaml
markdown:
desc: Format Markdown
cmds:
- >-
prettier
--ignore-path '.github/lint/.prettierignore'
--config '.github/lint/.prettierrc.yaml'
--list-different
--ignore-unknown
--parser=markdown
--write '*.md' '**/*.md'
ignore_error: true
yaml:
desc: Format YAML
cmds:
- >-
prettier
--ignore-path '.github/lint/.prettierignore'
--config
'.github/lint/.prettierrc.yaml'
--list-different
--ignore-unknown
--parser=yaml
--write '*.y*ml'
'**/*.y*ml'
ignore_error: true
+26
View File
@@ -0,0 +1,26 @@
---
version: "3"
tasks:
all:
- task: markdown
- task: yaml
- task: format
markdown:
desc: Lint Markdown
cmds:
- markdownlint -c '.github/lint/.markdownlint.yaml' *.md **/*.md
ignore_errors: true
yaml:
desc: Lint YAML
cmds:
- yamllint -c '.github/lint/.yamllint.yaml' .
ignore_errors: true
format:
desc: Lint general formatting
cmds:
- prettier --ignore-path '.github/lint/.prettierignore' --config '.github/lint/.prettierrc.yaml' --check .
ignore_errors: true
+12
View File
@@ -0,0 +1,12 @@
---
version: "3"
tasks:
init:
desc: Initialize pre-commit hooks
cmds:
- pre-commit install-hooks
run:
desc: Run pre-commit
cmds:
- pre-commit run --all-files
+8 -6
View File
@@ -50,6 +50,8 @@ Already provisioned Bare metal or VMs with any modern operating system like Ubun
| [pre-commit](https://github.com/pre-commit/pre-commit) | Runs checks during `git commit` | `2.12.0` | ❌ |
| [kustomize](https://kustomize.io/) | Template-free way to customize application configuration | `4.1.0` | ❌ |
| [helm](https://helm.sh/) | Manage Kubernetes applications | `3.5.4` | ❌ |
| [go-task](https://github.com/go-task/task) | A task runner / simpler Make alternative written in Go | `3.7.0` | ❌ |
| [prettier](https://github.com/prettier/prettier) | Prettier is an opinionated code formatter. | `2.3.2` | ❌ |
### :warning:  pre-commit
@@ -252,23 +254,23 @@ export BOOTSTRAP_INGRESS_NGINX_LB="169.254.1.10"
```sh
envsubst < ./tmpl/.sops.yaml > ./.sops.yaml
envsubst < ./tmpl/cluster-secrets.yaml > ./cluster/base/cluster-secrets.yaml
envsubst < ./tmpl/cluster-secrets.sops.yaml > ./cluster/base/cluster-secrets.sops.yaml
envsubst < ./tmpl/cluster-settings.yaml > ./cluster/base/cluster-settings.yaml
envsubst < ./tmpl/gotk-sync.yaml > ./cluster/base/flux-system/gotk-sync.yaml
envsubst < ./tmpl/secret.enc.yaml > ./cluster/core/cert-manager/secret.enc.yaml
envsubst < ./tmpl/secret.sops.yaml > ./cluster/core/cert-manager/secret.sops.yaml
```
6. **Verify** all the above files have the correct information present
7. Encrypt `cluster/cluster-secrets.yaml` and `cert-manager/secret.enc.yaml` with SOPS
7. Encrypt `cluster/cluster-secrets.sops.yaml` and `cert-manager/secret.sops.yaml` with SOPS
```sh
export GPG_TTY=$(tty)
sops --encrypt --in-place ./cluster/base/cluster-secrets.yaml
sops --encrypt --in-place ./cluster/core/cert-manager/secret.enc.yaml
sops --encrypt --in-place ./cluster/base/cluster-secrets.sops.yaml
sops --encrypt --in-place ./cluster/core/cert-manager/secret.sops.yaml
```
:round_pushpin: Variables defined in `cluster-secrets.yaml` and `cluster-settings.yaml` will be usable anywhere in your YAML manifests under `./cluster`
:round_pushpin: Variables defined in `cluster-secrets.sops.yaml` and `cluster-settings.sops.yaml` will be usable anywhere in your YAML manifests under `./cluster`
8. **Verify** all the above files are **encrypted** with SOPS
+16
View File
@@ -0,0 +1,16 @@
---
version: "3"
vars:
PROJECT_DIR:
sh: "git rev-parse --show-toplevel"
CLUSTER_DIR: "{{.PROJECT_DIR}}/cluster"
env:
KUBECONFIG: "{{.PROJECT_DIR}}/kubeconfig"
includes:
flux: .taskfiles/flux.yml
format: .taskfiles/format.yml
lint: .taskfiles/lint.yml
pre-commit: .taskfiles/pre-commit.yml
@@ -1,5 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- config-pvc.yaml
- helm-release.yaml
- config-pvc.yaml
- helm-release.yaml
+1 -1
View File
@@ -1,4 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- homer
- homer
+3 -3
View File
@@ -1,6 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- default
- networking
- system-upgrade
- default
- networking
- system-upgrade
@@ -1,4 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- helm-release.yaml
- helm-release.yaml
+2 -2
View File
@@ -1,5 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ingress-nginx
- wildcard-certificate
- ingress-nginx
- wildcard-certificate
@@ -1,4 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- certificate.yaml
- certificate.yaml
@@ -2,4 +2,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- system-upgrade-controller
- system-upgrade-controller
@@ -2,5 +2,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- server-plan.yaml
- agent-plan.yaml
- server-plan.yaml
- agent-plan.yaml
@@ -1,8 +1,8 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- bitnami-charts.yaml
- ingress-nginx-charts.yaml
- jetstack-charts.yaml
- k8s-at-home-charts.yaml
- metallb-charts.yaml
- bitnami-charts.yaml
- ingress-nginx-charts.yaml
- jetstack-charts.yaml
- k8s-at-home-charts.yaml
- metallb-charts.yaml
@@ -1,4 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- helm
- helm
+3 -3
View File
@@ -1,6 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- gotk-components.yaml
- gotk-sync.yaml
- charts
- gotk-components.yaml
- gotk-sync.yaml
- charts
+4 -4
View File
@@ -1,7 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- helm-release.yaml
- letsencrypt-production.yaml
- letsencrypt-staging.yaml
- secret.enc.yaml
- helm-release.yaml
- letsencrypt-production.yaml
- letsencrypt-staging.yaml
- secret.enc.yaml
+4 -4
View File
@@ -1,7 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- namespaces
- metallb-system
- cert-manager
- system-upgrade
- namespaces
- metallb-system
- cert-manager
- system-upgrade
@@ -1,4 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- helm-release.yaml
- helm-release.yaml
+3 -3
View File
@@ -1,6 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- cert-manager.yaml
- metallb-system.yaml
- networking.yaml
- cert-manager.yaml
- metallb-system.yaml
- networking.yaml
@@ -2,4 +2,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: system-upgrade
resources:
- https://github.com/rancher/system-upgrade-controller/releases/download/v0.6.2/system-upgrade-controller.yaml
- https://github.com/rancher/system-upgrade-controller/releases/download/v0.6.2/system-upgrade-controller.yaml
+2 -2
View File
@@ -1,5 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
# renovate: registryUrl=https://charts.jetstack.io chart=cert-manager
- https://github.com/jetstack/cert-manager/releases/download/v1.4.2/cert-manager.crds.yaml
# renovate: registryUrl=https://charts.jetstack.io chart=cert-manager
- https://github.com/jetstack/cert-manager/releases/download/v1.4.2/cert-manager.crds.yaml
+1 -1
View File
@@ -1,4 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- cert-manager
- cert-manager
+1 -1
View File
@@ -1,6 +1,6 @@
---
creation_rules:
- encrypted_regex: '^(data|stringData)$'
- encrypted_regex: "^(data|stringData)$"
pgp: >-
${FLUX_KEY_FP},
${PERSONAL_KEY_FP}
+9
View File
@@ -0,0 +1,9 @@
# yamllint disable
apiVersion: v1
kind: Secret
metadata:
name: cluster-secrets
namespace: flux-system
stringData:
SECRET_DOMAIN: ${BOOTSTRAP_DOMAIN}
SECRET_CLOUDFLARE_EMAIL: ${BOOTSTRAP_CLOUDFLARE_EMAIL}
-9
View File
@@ -1,9 +0,0 @@
# yamllint disable
apiVersion: v1
kind: Secret
metadata:
name: cluster-secrets
namespace: flux-system
stringData:
SECRET_DOMAIN: ${BOOTSTRAP_DOMAIN}
SECRET_CLOUDFLARE_EMAIL: ${BOOTSTRAP_CLOUDFLARE_EMAIL}
-8
View File
@@ -1,8 +0,0 @@
# yamllint disable
apiVersion: v1
kind: Secret
metadata:
name: cloudflare-token-secret
namespace: cert-manager
stringData:
cloudflare-token: ${BOOTSTRAP_CLOUDFLARE_TOKEN}
+8
View File
@@ -0,0 +1,8 @@
# yamllint disable
apiVersion: v1
kind: Secret
metadata:
name: cloudflare-token-secret
namespace: cert-manager
stringData:
cloudflare-token: ${BOOTSTRAP_CLOUDFLARE_TOKEN}