Skip to content

Commit

Permalink
Make metrics traefik docker configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
manics committed Oct 25, 2020
1 parent f686fcf commit 234d3e2
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test_k3s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ jobs:
kubectl version
kubectl get storageclass
kubectl get deploy,daemonset,pods --all-namespaces
# These options should be enabled
kubectl get --namespace kube-system deploy metrics-server
kubectl get --namespace kube-system deploy traefik
shell: bash

- name: Helm
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/test_k3s_options.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: Test

# yamllint disable-line rule:truthy
on:
- pull_request
- push

jobs:

test_install_k3s:
runs-on: ubuntu-latest
name: Test K3s options
steps:
- uses: actions/checkout@v2
- id: k3s
uses: ./
with:
metrics-enabled: false
traefik-enabled: false
docker-enabled: true
# This action should export KUBECONFIG

- name: Kubectl
run: |
kubectl version
kubectl get deploy,daemonset,pods --all-namespaces
kubectl get --namespace kube-system deploy metrics-server || ret=$?
if [ $ret -eq 0 ]; then
echo "ERROR: metrics-server should be disabled"
exit 1
fi
kubectl get --namespace kube-system deploy traefik || ret=$?
if [ $ret -eq 0 ]; then
echo "ERROR: traefik should be disabled"
exit 1
fi
docker info
docker ps
shell: bash
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Install K3s with Calico for network policies, and Helm 3.
Versions 1.16 and later are supported.
- `helm-version`: Helm version, see https://github.com/helm/helm/releases.
Versions 3.1 and later are supported.
- `metrics-enabled`: Enable or disable K3S metrics-server
- `traefik-enabled`: Enable or disable K3S Traefik ingress
- `docker-enabled`: Use Docker for K3s


## Outputs
Expand Down
30 changes: 27 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ inputs:
description: Helm 3 version (https://github.com/helm/helm/releases)
required: true
default: v3.3.4
metrics-enabled:
description: Enable or disable K3S metrics-server
required: true
default: "true"
traefik-enabled:
description: Enable or disable K3S Traefik ingress
required: true
default: "true"
docker-enabled:
description: Use Docker for K3s
required: true
default: "false"

outputs:
kubeconfig:
description: Path to kubeconfig file
Expand All @@ -46,14 +59,25 @@ runs:
run: |
if [[ ${{ inputs.k3s-version }} == v1.16.* ]]; then
k3s_disable_command=--no-deploy
else
k3s_disable_command=--disable
fi
if [[ ${{ inputs.metrics-enabled }} != true ]]; then
k3s_disable_metrics="${k3s_disable_command} metrics-server"
fi
if [[ ${{ inputs.traefik-enabled }} != true ]]; then
k3s_disable_traefik="${k3s_disable_command} traefik"
fi
if [[ ${{ inputs.docker-enabled }} == true ]]; then
k3s_docker=--docker
fi
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=${{ inputs.k3s-version }} sh -s - \
--write-kubeconfig-mode=644 \
"${k3s_disable_command:---disable}" metrics-server \
"${k3s_disable_command:---disable}" traefik \
${k3s_disable_metrics} \
${k3s_disable_traefik} \
--disable-network-policy \
--flannel-backend=none \
--docker
${k3s_docker}
shell: bash

# Install calico as a CNI to enforce our NetworkPolicies. Note that canal
Expand Down

0 comments on commit 234d3e2

Please sign in to comment.