Skip to content

Commit 2589358

Browse files
committed
build: cleanup github-action and fix ci
nginx was (no longer?) assigned to the control-plane where kind port-mappings are configured, which was breaking the pipeline.
1 parent c5aa96c commit 2589358

File tree

11 files changed

+115
-197
lines changed

11 files changed

+115
-197
lines changed
Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,83 @@
1+
---
12
name: Checks deployment of kubenurse
3+
description: series of health check to validate kubenurse deployment
24

35
inputs:
46
namespace:
57
description: Namespace where the kubenurse is deployed
68
required: true
7-
type: string
89
svc-domain:
910
description: Ingress domain on which the kubenurse is running
1011
required: true
11-
type: string
1212

1313
runs:
1414
using: "composite"
1515
steps:
16-
- shell: bash
17-
run: |
18-
echo "Check number of kubenurses"
19-
test $(kubectl -n ${{ inputs.namespace }} get pods -l app.kubernetes.io/name=kubenurse \
20-
| wc -l) -eq 4 # Test for 3 Pods + header
21-
- shell: bash
22-
run: |
23-
echo "Check for unexpected log lines"
24-
test $(kubectl -n ${{ inputs.namespace }} logs -l app.kubernetes.io/name=kubenurse \
25-
| grep -v "kubenurse just started" \
26-
| wc -l) -eq 0 \
27-
- shell: bash
28-
run: |
29-
echo "Check if the kubenurse had any restarts"
30-
kubectl -n ${{ inputs.namespace }} get pods -l app.kubernetes.io/name=kubenurse \
31-
-o jsonpath='{range .items[*]}{.status.containerStatuses[0].restartCount}{"\n"}{end}' \
32-
| (! grep -v 0) # Validate for 0 restarts
33-
- shell: bash
34-
run: |
35-
echo "Check that metrics contain kubenurse specific data"
36-
curl -k -s --resolve \
37-
${{ inputs.svc-domain }}:443:127.0.0.1 \
38-
https://${{ inputs.svc-domain }}:443/metrics \
39-
| grep "kubenurse_httpclient_request_" > /dev/null
40-
- shell: bash
41-
run: |
42-
echo "Check that metrics contain neighbours"
43-
curl -k -s --resolve \
44-
${{ inputs.svc-domain }}:443:127.0.0.1 \
45-
https://${{ inputs.svc-domain }}:443/metrics \
46-
| grep "kubenurse_httpclient_request_" | grep 'type="path_' > /dev/null
47-
- shell: bash
48-
run: |
49-
echo "Check that metrics contain no errors"
50-
curl -k -s --resolve \
51-
${{ inputs.svc-domain }}:443:127.0.0.1 \
52-
https://${{ inputs.svc-domain }}:443/metrics \
53-
| (! grep "kubenurse_errors_total")
54-
- shell: bash
55-
run: |
56-
echo "Check the neighbourhood state"
57-
curl -k -s --resolve \
58-
${{ inputs.svc-domain }}:443:127.0.0.1 \
59-
https://${{ inputs.svc-domain }}:443/alive \
60-
| grep '"neighbourhood_state": "ok"' > /dev/null
61-
- shell: bash
62-
run: |
63-
echo "Check that discovery is ok and status page includes neighbours"
64-
curl -k -s --resolve \
65-
${{ inputs.svc-domain }}:443:127.0.0.1 \
66-
https://${{ inputs.svc-domain }}:443/alive \
67-
| grep '"neighbourhood": \[' > /dev/null # If no others are discovered, this is null
68-
- shell: bash
69-
run: |
70-
echo "Show kubenurse status"
71-
curl -k -s --resolve \
72-
${{ inputs.svc-domain }}:443:127.0.0.1 \
73-
https://${{ inputs.svc-domain }}:443/alive
74-
if: ${{ always() }}
75-
- shell: bash
76-
run: |
77-
echo "Describe resources on failure"
78-
kubectl -n ${{ inputs.namespace }} get pods -o wide
79-
kubectl -n ${{ inputs.namespace }} logs -l app.kubernetes.io/name=kubenurse
80-
kubectl -n ${{ inputs.namespace }} describe pods -l app.kubernetes.io/name=kubenurse
81-
kubectl -n ${{ inputs.namespace }} describe daemonsets -l app.kubernetes.io/name=kubenurse
82-
kubectl -n ${{ inputs.namespace }} get events
83-
if: ${{ failure() }}
16+
- shell: bash
17+
run: |
18+
echo "Check number of kubenurses"
19+
test $(kubectl -n ${{ inputs.namespace }} get pods -l app.kubernetes.io/name=kubenurse \
20+
| wc -l) -eq 4 # Test for 3 Pods + header
21+
- shell: bash
22+
run: |
23+
echo "Check for unexpected log lines"
24+
test $(kubectl -n ${{ inputs.namespace }} logs -l app.kubernetes.io/name=kubenurse \
25+
| grep -v "kubenurse just started" \
26+
| wc -l) -eq 0 \
27+
- shell: bash
28+
run: |
29+
echo "Check if the kubenurse had any restarts"
30+
kubectl -n ${{ inputs.namespace }} get pods -l app.kubernetes.io/name=kubenurse \
31+
-o jsonpath='{range .items[*]}{.status.containerStatuses[0].restartCount}{"\n"}{end}' \
32+
| (! grep -v 0) # Validate for 0 restarts
33+
- shell: bash
34+
run: |
35+
echo "Check that metrics contain kubenurse specific data"
36+
curl -k -s --resolve \
37+
${{ inputs.svc-domain }}:443:127.0.0.1 \
38+
https://${{ inputs.svc-domain }}:443/metrics \
39+
| grep "kubenurse_httpclient_request_" > /dev/null
40+
- shell: bash
41+
run: |
42+
echo "Check that metrics contain neighbours"
43+
curl -k -s --resolve \
44+
${{ inputs.svc-domain }}:443:127.0.0.1 \
45+
https://${{ inputs.svc-domain }}:443/metrics \
46+
| grep "kubenurse_httpclient_request_" | grep 'type="path_' > /dev/null
47+
- shell: bash
48+
run: |
49+
echo "Check that metrics contain no errors"
50+
curl -k -s --resolve \
51+
${{ inputs.svc-domain }}:443:127.0.0.1 \
52+
https://${{ inputs.svc-domain }}:443/metrics \
53+
| (! grep "kubenurse_errors_total")
54+
- shell: bash
55+
run: |
56+
echo "Check the neighbourhood state"
57+
curl -k -s --resolve \
58+
${{ inputs.svc-domain }}:443:127.0.0.1 \
59+
https://${{ inputs.svc-domain }}:443/alive \
60+
| grep '"neighbourhood_state": "ok"' > /dev/null
61+
- shell: bash
62+
run: |
63+
echo "Check that discovery is ok and status page includes neighbours"
64+
curl -k -s --resolve \
65+
${{ inputs.svc-domain }}:443:127.0.0.1 \
66+
https://${{ inputs.svc-domain }}:443/alive \
67+
| grep '"neighbourhood": \[' > /dev/null # If no others are discovered, this is null
68+
- shell: bash
69+
run: |
70+
echo "Show kubenurse status"
71+
curl -k -s --resolve \
72+
${{ inputs.svc-domain }}:443:127.0.0.1 \
73+
https://${{ inputs.svc-domain }}:443/alive
74+
if: ${{ always() }}
75+
- shell: bash
76+
run: |
77+
echo "Describe resources on failure"
78+
kubectl get pods -o wide --all-namespaces
79+
kubectl -n ${{ inputs.namespace }} logs -l app.kubernetes.io/name=kubenurse
80+
kubectl -n ${{ inputs.namespace }} describe pods -l app.kubernetes.io/name=kubenurse
81+
kubectl -n ${{ inputs.namespace }} describe daemonsets -l app.kubernetes.io/name=kubenurse
82+
kubectl -n ${{ inputs.namespace }} get events
83+
if: ${{ failure() }}

.github/workflows/ci-helm-deploy-nginx.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@ jobs:
2828
uses: engineerd/setup-kind@v0.6.2
2929
with:
3030
config: "ci/kind-config.yaml"
31-
version: "v0.24.0"
32-
- name: Show cluster info and switch to kube-system
31+
version: "v0.30.0"
32+
- name: Show cluster info and switch to kube-nurse
3333
run: |
3434
kubectl cluster-info
3535
kubectl get nodes
3636
echo "current-context:" $(kubectl config current-context)
37-
kubectl config set-context --current --namespace kube-system
37+
kubectl create ns kube-nurse
38+
kubectl config set-context --current --namespace kube-nurse
3839
- name: Deploy ingress-nginx
3940
timeout-minutes: 2
4041
run: |
41-
kubectl apply -f \
42-
https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/kind/deploy.yaml
42+
kubectl apply -k ci/nginx/
4343
kubectl wait --namespace ingress-nginx \
4444
--for=condition=ready pod --selector=app.kubernetes.io/component=controller --timeout=90s
4545
- name: Import image into kind
@@ -59,13 +59,13 @@ jobs:
5959
timeout-minutes: 2
6060
run: |
6161
sleep 15 # wait for the scheduler to create pods
62-
kubectl -n kube-system wait pods -l app.kubernetes.io/name=kubenurse --for=condition=Ready
63-
kubectl -n kube-system get pods -l app.kubernetes.io/name=kubenurse
62+
kubectl wait pods -l app.kubernetes.io/name=kubenurse --for=condition=Ready
63+
kubectl get pods -l app.kubernetes.io/name=kubenurse
6464
kubectl rollout restart daemonset kubenurse
6565
kubectl rollout status daemonset kubenurse --timeout=1m
6666
sleep 60 # Wait to generate some checks etc.
6767
- name: Check deployment
6868
uses: ./.github/actions/check-deployment
6969
with:
70-
namespace: kube-system
70+
namespace: kube-nurse
7171
svc-domain: ingress-nginx-controller.ingress-nginx.svc.cluster.local

.github/workflows/ci-helm-deploy-traefik.yml

Lines changed: 0 additions & 75 deletions
This file was deleted.

.github/workflows/ci-kustomize-deploy.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@ jobs:
2828
uses: engineerd/setup-kind@v0.6.2
2929
with:
3030
config: "ci/kind-config.yaml"
31-
version: "v0.24.0"
32-
- name: Show cluster info and switch to kube-system
31+
version: "v0.30.0"
32+
- name: Show cluster info and switch to kube-nurse
3333
run: |
3434
kubectl cluster-info
3535
kubectl get nodes
3636
echo "current-context:" $(kubectl config current-context)
37-
kubectl config set-context --current --namespace kube-system
37+
kubectl create ns kube-nurse
38+
kubectl config set-context --current --namespace kube-nurse
3839
- name: Deploy ingress-nginx
3940
timeout-minutes: 2
4041
run: |
41-
kubectl apply -f \
42-
https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/kind/deploy.yaml
42+
kubectl apply -k ci/nginx/
4343
kubectl wait --namespace ingress-nginx \
4444
--for=condition=ready pod --selector=app.kubernetes.io/component=controller --timeout=90s
4545
- name: Import image into kind
@@ -63,5 +63,5 @@ jobs:
6363
- name: Check deployment
6464
uses: ./.github/actions/check-deployment
6565
with:
66-
namespace: kube-system
66+
namespace: kube-nurse
6767
svc-domain: ingress-nginx-controller.ingress-nginx.svc.cluster.local

ci/deployment/kustomization.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
bases:
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
24
- ../../examples/
3-
patchesStrategicMerge:
4-
- conf.yaml
5+
patches:
6+
- path: conf.yaml
57
images:
68
- name: postfinance/kubenurse
79
newTag: latest-ci
10+
namespace: kube-nurse

ci/kind-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ nodes:
77
kind: InitConfiguration
88
nodeRegistration:
99
kubeletExtraArgs:
10-
node-labels: "ingress-ready=true"
10+
node-labels: "kind-port-mapping=true"
1111
extraPortMappings: # required for ingress-nginx
1212
- containerPort: 80
1313
hostPort: 80

ci/nginx/kustomization.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/kind/deploy.yaml
5+
patches:
6+
- path: node-selector.yaml
7+
namespace: ingress-nginx

ci/nginx/node-selector.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: ingress-nginx-controller
6+
namespace: ingress-nginx
7+
spec:
8+
template:
9+
spec:
10+
containers:
11+
- name: controller
12+
nodeSelector:
13+
kubernetes.io/os: linux
14+
kind-port-mapping: "true"

ci/traefik-config.yaml

Lines changed: 0 additions & 30 deletions
This file was deleted.

examples/daemonset.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ spec:
2727
- name: KUBENURSE_INGRESS_URL
2828
value: https://kubenurse.example.com
2929
- name: KUBENURSE_SERVICE_URL
30-
value: http://kubenurse.kube-system.svc.cluster.local:8080
30+
value: http://kubenurse.kube-nurse.svc.cluster.local:8080
3131
- name: KUBENURSE_NAMESPACE
32-
value: kube-system
32+
value: kube-nurse
3333
- name: KUBENURSE_NEIGHBOUR_FILTER
3434
value: "app.kubernetes.io/name=kubenurse"
35-
image: "postfinance/kubenurse:v1.5.1"
35+
image: "postfinance/kubenurse:v1.15.0"
3636
ports:
3737
- containerPort: 8080
3838
protocol: TCP

0 commit comments

Comments
 (0)