feat: add go-task, set up prettier, format yaml (#50)
This commit is contained in:
1 parent
99370f6d8d
commit
525be88214
21 files changed
+185
-50
No files matched your search
@@ -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
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
*.sops.yaml
|
||||||
|
gotk-components.yaml
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
trailingComma: "es5"
|
||||||
|
tabWidth: 2
|
||||||
|
semi: false
|
||||||
|
singleQuote: false
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
ignore: |
|
ignore: |
|
||||||
.github/
|
*.sops.yaml
|
||||||
crds.yaml
|
gotk-components.yaml
|
||||||
extends: default
|
extends: default
|
||||||
rules:
|
rules:
|
||||||
truthy:
|
truthy:
|
||||||
allowed-values: ['true', 'false', 'on', 'yes']
|
allowed-values: ["true", "false", "on"]
|
||||||
comments:
|
comments:
|
||||||
min-spaces-from-content: 1
|
min-spaces-from-content: 1
|
||||||
line-length: disable
|
line-length: disable
|
||||||
@@ -14,6 +14,4 @@ rules:
|
|||||||
brackets:
|
brackets:
|
||||||
min-spaces-inside: 0
|
min-spaces-inside: 0
|
||||||
max-spaces-inside: 0
|
max-spaces-inside: 0
|
||||||
indentation:
|
indentation: enable
|
||||||
spaces: 2
|
|
||||||
indent-sequences: consistent
|
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
name: Schedule - Update Flux
|
name: Schedule - Update Flux
|
||||||
|
|
||||||
on: # yamllint disable-line rule:truthy
|
on: # yamllint disable-line rule:truthy
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 12 * * *'
|
- cron: "0 12 * * *"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
flux-upgrade:
|
flux-upgrade:
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
name: Invalid Template
|
name: Invalid Template
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@@ -16,9 +15,9 @@ jobs:
|
|||||||
- uses: dessant/support-requests@v2
|
- uses: dessant/support-requests@v2
|
||||||
with:
|
with:
|
||||||
github-token: ${{ github.token }}
|
github-token: ${{ github.token }}
|
||||||
support-label: 'template-incomplete'
|
support-label: "template-incomplete"
|
||||||
issue-comment: >
|
issue-comment: >
|
||||||
:wave: @{issue-author}, please follow the template provided.
|
:wave: @{issue-author}, please follow the template provided.
|
||||||
close-issue: true
|
close-issue: true
|
||||||
lock-issue: true
|
lock-issue: true
|
||||||
issue-lock-reason: 'resolved'
|
issue-lock-reason: "resolved"
|
||||||
@@ -1,19 +1,32 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
name: Lint
|
name: Lint
|
||||||
|
|
||||||
on: # yamllint disable-line rule:truthy
|
on: # yamllint disable-line rule:truthy
|
||||||
workflow_dispatch:
|
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
yaml:
|
yamllint:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: yamllint
|
- name: yamllint
|
||||||
uses: reviewdog/action-yamllint@v1
|
uses: reviewdog/action-yamllint@v1
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.github_token }}
|
yamllint_flags: "-c .github/lint/.yamllint.yaml ./cluster"
|
||||||
reporter: github-pr-review
|
shellcheck:
|
||||||
yamllint_flags: '-c .github/yamllint.config.yaml ./cluster/'
|
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,12 +1,10 @@
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
name: Schedule - Renovate Helm Releases
|
name: Schedule - Renovate Helm Releases
|
||||||
|
|
||||||
on: # yamllint disable-line rule:truthy
|
on: # yamllint disable-line rule:truthy
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 */12 * * *'
|
- cron: "0 */12 * * *"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
renovate-helm-releases:
|
renovate-helm-releases:
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
name: "Support requests"
|
||||||
name: 'Support requests'
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
issues:
|
issues:
|
||||||
@@ -16,7 +15,7 @@ jobs:
|
|||||||
- uses: dessant/support-requests@v2
|
- uses: dessant/support-requests@v2
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
support-label: 'support'
|
support-label: "support"
|
||||||
issue-comment: >
|
issue-comment: >
|
||||||
:wave: @{issue-author}, we use the issue tracker exclusively
|
:wave: @{issue-author}, we use the issue tracker exclusively
|
||||||
for bug reports and feature requests. However, this issue appears
|
for bug reports and feature requests. However, this issue appears
|
||||||
@@ -25,4 +24,4 @@ jobs:
|
|||||||
- [Discord](https://discord.gg/sTMX7Vh)
|
- [Discord](https://discord.gg/sTMX7Vh)
|
||||||
close-issue: true
|
close-issue: true
|
||||||
lock-issue: false
|
lock-issue: false
|
||||||
issue-lock-reason: 'off-topic'
|
issue-lock-reason: "off-topic"
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
|
---
|
||||||
fail_fast: false
|
fail_fast: false
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/adrienverge/yamllint
|
- repo: https://github.com/adrienverge/yamllint
|
||||||
rev: v1.26.2
|
rev: v1.26.2
|
||||||
hooks:
|
hooks:
|
||||||
- args:
|
- args:
|
||||||
- -c
|
- --config-file
|
||||||
- .github/yamllint.config.yaml
|
- .github/lint/.yamllint.yaml
|
||||||
id: yamllint
|
id: yamllint
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v4.0.1
|
rev: v4.0.1
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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` | ❌ |
|
| [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` | ❌ |
|
| [kustomize](https://kustomize.io/) | Template-free way to customize application configuration | `4.1.0` | ❌ |
|
||||||
| [helm](https://helm.sh/) | Manage Kubernetes applications | `3.5.4` | ❌ |
|
| [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
|
### :warning: pre-commit
|
||||||
|
|
||||||
@@ -252,23 +254,23 @@ export BOOTSTRAP_INGRESS_NGINX_LB="169.254.1.10"
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
envsubst < ./tmpl/.sops.yaml > ./.sops.yaml
|
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/cluster-settings.yaml > ./cluster/base/cluster-settings.yaml
|
||||||
envsubst < ./tmpl/gotk-sync.yaml > ./cluster/base/flux-system/gotk-sync.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
|
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
|
```sh
|
||||||
export GPG_TTY=$(tty)
|
export GPG_TTY=$(tty)
|
||||||
sops --encrypt --in-place ./cluster/base/cluster-secrets.yaml
|
sops --encrypt --in-place ./cluster/base/cluster-secrets.sops.yaml
|
||||||
sops --encrypt --in-place ./cluster/core/cert-manager/secret.enc.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
|
8. **Verify** all the above files are **encrypted** with SOPS
|
||||||
|
|
||||||
|
|||||||
@@ -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
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
creation_rules:
|
creation_rules:
|
||||||
- encrypted_regex: '^(data|stringData)$'
|
- encrypted_regex: "^(data|stringData)$"
|
||||||
pgp: >-
|
pgp: >-
|
||||||
${FLUX_KEY_FP},
|
${FLUX_KEY_FP},
|
||||||
${PERSONAL_KEY_FP}
|
${PERSONAL_KEY_FP}
|
||||||
@@ -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}
|
||||||
@@ -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}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
# yamllint disable
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Secret
|
|
||||||
metadata:
|
|
||||||
name: cloudflare-token-secret
|
|
||||||
namespace: cert-manager
|
|
||||||
stringData:
|
|
||||||
cloudflare-token: ${BOOTSTRAP_CLOUDFLARE_TOKEN}
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# yamllint disable
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: cloudflare-token-secret
|
||||||
|
namespace: cert-manager
|
||||||
|
stringData:
|
||||||
|
cloudflare-token: ${BOOTSTRAP_CLOUDFLARE_TOKEN}
|
||||||
Reference in new issue
Block a user