k8s: fix imagePullPolicy #148
This file contains hidden or 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
name: Test with Kubernetes | |
on: [push, pull_request] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# transporter: [NATS, Redis, MQTT, AMQP, AMQP10, Kafka] | |
transporter: [NATS, Redis, MQTT, AMQP, Kafka] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js with ${{ matrix.transporter }} transporter | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22.x | |
- name: Install dependencies | |
run: npm i | |
- name: Create answers file | |
run: node update-answers.js | |
working-directory: ./test/ci | |
env: | |
TRANSPORTER: ${{ matrix.transporter }} | |
- name: Generate project with '${{ matrix.transporter }}' transporter | |
run: npm test | |
- name: Run tests in the generated project | |
run: npm test | |
working-directory: ./ci-test | |
- name: Start a local Docker Registry | |
run: docker run -d --restart=always -p 5000:5000 --name registry registry:2 | |
- name: Set Registry IP for KinD | |
run: | | |
REGISTRY_IP=$(docker inspect -f '{{.NetworkSettings.IPAddress}}' registry) | |
echo $REGISTRY_IP | |
sed -i "s/registry:5000/$REGISTRY_IP:5000/g" test/ci/kind-config.yaml | |
cat test/ci/kind-config.yaml | |
- name: Build Docker image | |
run: docker build -t ci-test . | |
working-directory: ./ci-test | |
- uses: engineerd/[email protected] | |
with: | |
version: "v0.29.0" | |
config: ./test/ci/kind-config.yaml | |
- run: kubectl cluster-info | |
- run: kubectl get nodes | |
- run: kubectl get pods --all-namespaces | |
- name: Load built image | |
run: kind load docker-image ci-test | |
- name: Install NGINX Ingress | |
run: | | |
kubectl apply -f https://kind.sigs.k8s.io/examples/ingress/deploy-ingress-nginx.yaml | |
kubectl wait --namespace ingress-nginx \ | |
--for=condition=ready pod \ | |
--selector=app.kubernetes.io/component=controller \ | |
--timeout=90s | |
# kubectl patch deployments -n ingress-nginx ingress-nginx-controller -p '{"spec":{"template":{"spec":{"containers":[{"name":"nginx-ingress-controller","ports":[{"containerPort":80,"hostPort":80},{"containerPort":443,"hostPort":443}]}],"nodeSelector":{"ingress-ready":"true"},"tolerations":[{"key":"node-role.kubernetes.io/master","operator":"Equal","effect":"NoSchedule"}]}}}}' | |
- name: Kubectl apply | |
working-directory: ./ci-test | |
run: | | |
kubectl apply -f k8s.yaml | |
kubectl rollout status deployment greeter --timeout=180s | |
- name: Check pods | |
run: | | |
kubectl get all | |
kubectl describe pod greeter | |
- run: curl --silent --show-error --fail http://ci-test.127.0.0.1.nip.io/api/greeter/hello | |
- run: curl --silent --show-error --fail http://ci-test.127.0.0.1.nip.io/api/products | |
- name: Check Pod | |
run: kubectl describe pod greeter | |
if: failure() | |
- name: Check logs | |
run: kubectl logs deployment/greeter | |
if: failure() |