-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: CI improvements and RBAC fixes
- Loading branch information
Showing
9 changed files
with
171 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,60 @@ jobs: | |
with: | ||
version: latest | ||
args: release --snapshot --rm-dist --skip-publish | ||
- name: Setup kind | ||
uses: engineerd/[email protected] | ||
with: | ||
config: "ci/kind-config.yaml" | ||
- name: Show cluster info and switch to kube-system | ||
run: | | ||
kubectl cluster-info | ||
echo "current-context:" $(kubectl config current-context) | ||
kubectl config set-context --current --namespace kube-system | ||
- name: Deploy ingress-nginx | ||
timeout-minutes: 2 | ||
run: | | ||
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/kind/deploy.yaml | ||
kubectl wait --namespace ingress-nginx --for=condition=ready pod --selector=app.kubernetes.io/component=controller --timeout=90s | ||
- name: Import image into kind | ||
run: kind load docker-image postfinance/kubenurse:latest | ||
- name: Deploy example setup | ||
run: | | ||
kubectl apply -k ci/deployment/ | ||
- name: Wait for pods | ||
timeout-minutes: 1 | ||
run: | | ||
sleep 15 # wait for the scheduler to create pods | ||
kubectl wait pods -l app=kubenurse --for=condition=Ready | ||
kubectl get pods -l app=kubenurse | ||
- name: Check state of pods | ||
timeout-minutes: 2 | ||
run: | | ||
sleep 60 # Wait to generate some checks etc. | ||
test $(kubectl get pods -l app=kubenurse | wc -l) -eq 4 # Test for 3 Pods + header | ||
echo "Number of kubenurses is ok" | ||
test $(kubectl logs -l app=kubenurse | grep -v "I'm ready to help you" | wc -l) -eq 0 # Test that there are no unexpected log lines present | ||
echo "Logs are ok" | ||
kubectl get pods -l app=kubenurse -o jsonpath='{range .items[*]}{.status.containerStatuses[0].restartCount}{"\n"}{end}' | (! grep -v 0) # Validate for 0 restarts | ||
echo "Restart count is ok" | ||
curl -k -s --resolve ingress-nginx-controller.ingress-nginx.svc.cluster.local:443:127.0.0.1 https://ingress-nginx-controller.ingress-nginx.svc.cluster.local:443/metrics | grep "kubenurse_request_" > /dev/null | ||
echo "Metrics contain kubenurse specific data" | ||
curl -k -s --resolve ingress-nginx-controller.ingress-nginx.svc.cluster.local:443:127.0.0.1 https://ingress-nginx-controller.ingress-nginx.svc.cluster.local:443/metrics | grep "kubenurse_request_" | grep 'type="path_' > /dev/null | ||
echo "Metrics contains neighbours" | ||
curl -k -s --resolve ingress-nginx-controller.ingress-nginx.svc.cluster.local:443:127.0.0.1 https://ingress-nginx-controller.ingress-nginx.svc.cluster.local:443/metrics | (! grep "kubenurse_errors_total") | ||
echo "Metrics contains no errors" | ||
curl -k -s --resolve ingress-nginx-controller.ingress-nginx.svc.cluster.local:443:127.0.0.1 https://ingress-nginx-controller.ingress-nginx.svc.cluster.local:443/alive | grep '"neighbourhood_state": "ok"' > /dev/null | ||
echo "Neighbourhood state ok" | ||
curl -k -s --resolve ingress-nginx-controller.ingress-nginx.svc.cluster.local:443:127.0.0.1 https://ingress-nginx-controller.ingress-nginx.svc.cluster.local:443/alive | grep '"neighbourhood": \[' > /dev/null # If no others are discovered, this is null | ||
echo "Discovery ok: Status page includes neighbours" | ||
- name: Show kubenurse status | ||
run: | | ||
curl -k -s --resolve ingress-nginx-controller.ingress-nginx.svc.cluster.local:443:127.0.0.1 https://ingress-nginx-controller.ingress-nginx.svc.cluster.local:443/alive | ||
if: ${{ always() }} | ||
- name: Describe resources on failure | ||
run: | | ||
kubectl get pods -o wide | ||
kubectl logs -l app=kubenurse | ||
kubectl describe pods -l app=kubenurse | ||
kubectl describe daemonsets -l app=kubenurse | ||
kubectl get events | ||
if: ${{ failure() }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
apiVersion: apps/v1 | ||
kind: DaemonSet | ||
metadata: | ||
name: kubenurse | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: kubenurse | ||
env: | ||
- name: KUBENURSE_INSECURE | ||
value: "true" | ||
- name: KUBENURSE_INGRESS_URL | ||
value: https://ingress-nginx-controller.ingress-nginx.svc.cluster.local | ||
--- | ||
apiVersion: extensions/v1beta1 | ||
kind: Ingress | ||
metadata: | ||
name: kubenurse | ||
spec: | ||
rules: | ||
- host: ingress-nginx-controller.ingress-nginx.svc.cluster.local | ||
http: | ||
paths: | ||
- backend: | ||
serviceName: kubenurse | ||
servicePort: 8080 | ||
tls: | ||
- hosts: | ||
- ingress-nginx-controller.ingress-nginx.svc.cluster.local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
bases: | ||
- ../../examples/ | ||
patchesStrategicMerge: | ||
- conf.yaml | ||
images: | ||
- name: postfinance/kubenurse | ||
newTag: latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
kind: Cluster | ||
apiVersion: kind.x-k8s.io/v1alpha4 | ||
nodes: | ||
- role: control-plane | ||
kubeadmConfigPatches: | ||
- | | ||
kind: InitConfiguration | ||
nodeRegistration: | ||
kubeletExtraArgs: | ||
node-labels: "ingress-ready=true" | ||
extraPortMappings: # required for ingress-nginx | ||
- containerPort: 80 | ||
hostPort: 80 | ||
protocol: TCP | ||
- containerPort: 443 | ||
hostPort: 443 | ||
protocol: TCP | ||
- role: worker | ||
- role: worker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
resources: | ||
- daemonset.yaml | ||
- ingress.yaml | ||
- rbac.yaml | ||
- serviceaccount.yaml | ||
- service.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,5 @@ | |
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: nurse | ||
name: kubenurse | ||
namespace: kube-system |