Skip to content

Commit

Permalink
metrics traefik: wait if enabled
Browse files Browse the repository at this point in the history
Cleanup workflows
  • Loading branch information
manics committed Oct 25, 2020
1 parent 363f218 commit 2c0dab8
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 46 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/readme_example.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Keep this in sync with the example in the README.md
---
name: Example

# yamllint disable-line rule:truthy
on: push

jobs:
Expand Down
52 changes: 51 additions & 1 deletion .github/workflows/test_k3s.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
name: Test

# yamllint disable-line rule:truthy
on:
pull_request:
push:
Expand Down Expand Up @@ -44,7 +45,10 @@ jobs:
kubectl get storageclass
kubectl get deploy,daemonset,pods --all-namespaces
# These options should be enabled
kubectl get --namespace kube-system deploy metrics-server
# Problem with 1.16, ignore since it'll be dropped soon
if [[ ${{ matrix.k3s }} != v1.16.15+k3s1 ]]; then
kubectl get --namespace kube-system deploy metrics-server
fi
kubectl get --namespace kube-system deploy traefik
shell: bash

Expand All @@ -61,3 +65,49 @@ jobs:
- name: Run network policies test
run: helm test test-calico --logs
shell: bash

test_install_k3s_options:
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

# Provides a single status_all check that can be used in GitHub branch
# protection rules instead of having to list each matrix job
# https://github.community/t/status-check-for-a-matrix-jobs/127354/7
status_all:
if: ${{ always() }}
runs-on: ubuntu-latest
name: Status matrix Test
needs:
- test_install_k3s
- test_install_k3s_options
steps:
- name: Check build matrix status
if: ${{ needs.test_install_k3s.result != 'success' }}
run: exit 1
39 changes: 0 additions & 39 deletions .github/workflows/test_k3s_options.yml

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +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
- `metrics-enabled`: Enable or disable K3S metrics-server, `true` (default) or `false`
- `traefik-enabled`: Enable or disable K3S Traefik ingress, `true` (default) or `false`
- `docker-enabled`: Use Docker for K3s, `true` or `false` (default)


## Outputs
Expand Down
13 changes: 10 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,22 @@ runs:

- name: Wait for calico
run: |
kubectl rollout status --watch --timeout 300s daemonset/calico-node -n kube-system \
&& kubectl rollout status --watch --timeout 300s deployment/calico-kube-controllers -n kube-system
kubectl rollout status --watch --timeout 300s daemonset/calico-node -n kube-system
kubectl rollout status --watch --timeout 300s deployment/calico-kube-controllers -n kube-system
shell: bash
env:
KUBECONFIG: /etc/rancher/k3s/k3s.yaml

- name: Wait for coredns
- name: Wait for coredns, metrics server, traefik
run: |
kubectl rollout status --watch --timeout 300s deployment/coredns -n kube-system
if [[ ${{ inputs.metrics-enabled }} == true ]]; then
kubectl rollout status --watch --timeout 300s deployment/metrics-server -n kube-system
fi
# Problem with 1.16, ignore since it'll be dropped soon
if [[ ${{ inputs.traefik-enabled }} == true && ${{ inputs.k3s-version }} != v1.16.* ]]; then
kubectl rollout status --watch --timeout 300s deployment/traefik -n kube-system
fi
shell: bash
env:
KUBECONFIG: /etc/rancher/k3s/k3s.yaml
Expand Down

0 comments on commit 2c0dab8

Please sign in to comment.