Skip to content

deps(deps): update kubernetes packages ( v0.31.2 → v0.31.3 ) #12

deps(deps): update kubernetes packages ( v0.31.2 → v0.31.3 )

deps(deps): update kubernetes packages ( v0.31.2 → v0.31.3 ) #12

Workflow file for this run

---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Test E2E
on:
# Manual Trigger
workflow_dispatch: {}
# Run on any PR that changes this pipeline or that should ultimately trigger a release when merged
pull_request:
paths:
- ".github/workflows/test.yaml"
- "go.mod"
- "go.sum"
- "**/**.go"
env:
KUBECONFIG_DIR: ./configs/
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Build `kubectl-switch`
run: go build -o kubectl-switch
- name: Install `minikube`
run: |
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube && rm minikube-linux-amd64
- name: Set Up Kubernetes Clusters
run: |
KUBECONFIG=./configs/cluster1.yaml minikube start -p test-cluster-1 &
KUBECONFIG=./configs/cluster2.yaml minikube start -p test-cluster-2 &
wait
- name: Switch context to test-cluster-1
run: ./kubectl-switch context test-cluster-1
- name: Validate the cluster has switched to test-cluster-1 by listing nodes
run: |
kubectl get nodes | grep "test-cluster-1" || { echo "Error: test-cluster-1 not found in node list!" >&2; exit 1; }
- name: Check that no pods are found in the default namespace
run: |
kubectl get pods --namespace=default 2>&1 | grep "No resources found" || { echo "Error: Pods found in default namespace!" >&2; exit 1; }
- name: Switch to the kube-system namespace
run: ./kubectl-switch namespace kube-system
- name: Validate that kube-system namespace is selected and kube-apiserver is running
run: |
kubectl get pods --namespace=kube-system | grep "kube-apiserver" || { echo "Error: kube-apiserver not found in kube-system!" >&2; exit 1; }
- name: Switch back to the default namespace
run: ./kubectl-switch namespace default
- name: Check that no pods are found again in the default namespace
run: |
kubectl get pods --namespace=default 2>&1 | grep "No resources found" || { echo "Error: Pods found in default namespace!" >&2; exit 1; }
- name: Switch context to test-cluster-2
run: ./kubectl-switch context test-cluster-2
- name: Validate the cluster has switched to test-cluster-2 by listing nodes
run: |
kubectl get nodes | grep "test-cluster-2" || { echo "Error: test-cluster-2 not found in node list!" >&2; exit 1; }