From 8956bd46dbe1d12be4c44928f1f0611623b28e30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=97=AA=D1=94=CE=BD=CE=B9=CE=B7=20=E1=97=B7=CF=85=D0=BD?= =?UTF-8?q?=CA=9F?= Date: Mon, 9 Aug 2021 15:53:07 -0400 Subject: [PATCH] feat: deploy metrics-server (#56) * chore: update readme to not deploy metrics-server * feat: add metrics-server kustomization * feat: enable metrics server * Update kustomization.yaml * Update kustomization.yaml * Update and rename lint.yaml to lint-markdown.yaml * Create lint-shell.yaml * Create lint.yaml --- .github/workflows/lint-markdown.yaml | 28 +++++++++++++ .github/workflows/lint-shell.yaml | 27 +++++++++++++ .github/workflows/lint.yaml | 39 +++++++++---------- README.md | 2 +- cluster/apps/kube-system/kustomization.yaml | 5 +++ .../metrics-server/kustomization.yaml | 28 +++++++++++++ cluster/apps/kustomization.yaml | 1 + 7 files changed, 108 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/lint-markdown.yaml create mode 100644 .github/workflows/lint-shell.yaml create mode 100644 cluster/apps/kube-system/kustomization.yaml create mode 100644 cluster/apps/kube-system/metrics-server/kustomization.yaml diff --git a/.github/workflows/lint-markdown.yaml b/.github/workflows/lint-markdown.yaml new file mode 100644 index 00000000..fdfe6118 --- /dev/null +++ b/.github/workflows/lint-markdown.yaml @@ -0,0 +1,28 @@ +--- +name: Lint Markdown files on Pull Requests + +on: # yamllint disable-line rule:truthy + pull_request: + paths: + - "**.md" + +jobs: + markdownlint: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Get changes + uses: dorny/paths-filter@v2 + id: filter + with: + list-files: shell + filters: | + markdown: + - added|modified: "**.md" + - name: Lint files + if: ${{ steps.filter.outputs.markdown == 'true' }} + uses: reviewdog/action-shellcheck@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + markdownlint_flags: "-c '.github/lint/.markdownlint.yaml' ${{ steps.filter.outputs.markdown_files }}" diff --git a/.github/workflows/lint-shell.yaml b/.github/workflows/lint-shell.yaml new file mode 100644 index 00000000..e4a66287 --- /dev/null +++ b/.github/workflows/lint-shell.yaml @@ -0,0 +1,27 @@ +--- +name: Lint Shell scripts on Pull Requests + +on: # yamllint disable-line rule:truthy + pull_request: + paths: + - "**.sh" + +jobs: + shellcheck: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Get changes + uses: dorny/paths-filter@v2 + id: filter + with: + list-files: shell + filters: | + shell: + - added|modified: "**.sh" + - name: Lint files + if: ${{ steps.filter.outputs.shell == 'true' }} + uses: reviewdog/action-shellcheck@v1 + with: + shellcheck_flags: "${{ steps.filter.outputs.shell_files }}" diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index a655171b..86411d38 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -1,32 +1,29 @@ --- -name: Lint +name: Lint YAML files on Pull Requests on: # yamllint disable-line rule:truthy pull_request: + paths: + - "**.yaml" + - "**.yml" jobs: yamllint: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 - - name: yamllint + - name: Checkout + uses: actions/checkout@v2 + - name: Get changes + uses: dorny/paths-filter@v2 + id: filter + with: + list-files: shell + filters: | + yaml: + - added|modified: "**.yaml" + - added|modified: "**.yml" + - name: Lint files + if: ${{ steps.filter.outputs.yaml == 'true' }} uses: reviewdog/action-yamllint@v1 with: - 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 }} + yamllint_flags: "-c .github/lint/.yamllint.yaml ${{ steps.filter.outputs.yaml_files }}" diff --git a/README.md b/README.md index 8a3d451e..e8ed14f1 100644 --- a/README.md +++ b/README.md @@ -164,7 +164,7 @@ k3sup install \ --host=169.254.1.1 \ --user=k8s-at-home \ --k3s-version=v1.20.5+k3s1 \ - --k3s-extra-args="--disable servicelb --disable traefik" + --k3s-extra-args="--disable servicelb --disable traefik --disable metrics-server" ``` 3. Join worker nodes (optional) diff --git a/cluster/apps/kube-system/kustomization.yaml b/cluster/apps/kube-system/kustomization.yaml new file mode 100644 index 00000000..c0d108f5 --- /dev/null +++ b/cluster/apps/kube-system/kustomization.yaml @@ -0,0 +1,5 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - metrics-server diff --git a/cluster/apps/kube-system/metrics-server/kustomization.yaml b/cluster/apps/kube-system/metrics-server/kustomization.yaml new file mode 100644 index 00000000..dd4c19eb --- /dev/null +++ b/cluster/apps/kube-system/metrics-server/kustomization.yaml @@ -0,0 +1,28 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - github.com/kubernetes-sigs/metrics-server/manifests/base?ref=v0.5.0 +images: + - name: gcr.io/k8s-staging-metrics-server/metrics-server + newName: k8s.gcr.io/metrics-server/metrics-server + newTag: v0.5.0 +patchesStrategicMerge: + - |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: metrics-server + namespace: kube-system + spec: + template: + spec: + containers: + - name: metrics-server + args: + - --cert-dir=/tmp + - --secure-port=443 + - --kubelet-use-node-status-port + - --metric-resolution=15s + - --kubelet-insecure-tls + - --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname diff --git a/cluster/apps/kustomization.yaml b/cluster/apps/kustomization.yaml index df6e956b..aa6355c2 100644 --- a/cluster/apps/kustomization.yaml +++ b/cluster/apps/kustomization.yaml @@ -2,5 +2,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - default + - kube-system - networking - system-upgrade