Skip to content

Commit

Permalink
WIP: dnslookup
Browse files Browse the repository at this point in the history
  • Loading branch information
squakez committed Jan 17, 2024
1 parent d774737 commit ef0eac0
Show file tree
Hide file tree
Showing 2 changed files with 160 additions and 158 deletions.
314 changes: 158 additions & 156 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,104 +12,106 @@ on:

jobs:

test-default:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v1

- name: Create kind cluster
uses: ./

- name: Test
run: |
kubectl cluster-info
kubectl get storageclass standard
test-with-custom-resource-limits:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v1

- name: Create kind cluster with custom resource limits
uses: ./
with:
cpu: "3"
disk: "5"
memory: "11"
- name: Test
run: |
kubectl get node $(kubectl get node -o custom-columns=":metadata.name") -o custom-columns="CPU:.status.capacity.cpu" | grep "3" 1> /dev/null && echo "CPU OK"
kubectl get node $(kubectl get node -o custom-columns=":metadata.name") -o custom-columns="DISK:.status.capacity.ephemeral-storage" | grep -E "5\d{6}Ki" 1> /dev/null && echo "Disk OK"
kubectl get node $(kubectl get node -o custom-columns=":metadata.name") -o custom-columns="MEMORY:.status.capacity.memory" | grep -E "11\d{6}Ki" 1> /dev/null && echo "Memory OK"
test-with-custom-name:
strategy:
matrix:
version:
- v0.17.0
- v0.16.0
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v1

- name: Create kind cluster with custom name
uses: ./
with:
version: "${{ matrix.version }}"
cluster_name: "custom-name"

- name: Test
run: |
kubectl cluster-info
kubectl get storageclass standard
# test-default:
# strategy:
# matrix:
# os: [ubuntu-latest, macos-latest, macos-11]
# runs-on: ${{ matrix.os }}
# steps:
# - name: Checkout
# uses: actions/checkout@v1

# - name: Create kind cluster
# uses: ./

# - name: Test
# run: |
# kubectl cluster-info
# kubectl get storageclass standard

# test-with-custom-resource-limits:
# runs-on: macos-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v1

# - name: Create kind cluster with custom resource limits
# uses: ./
# with:
# cpu: "3"
# disk: "5"
# memory: "11"
# - name: Test
# run: |
# kubectl get node $(kubectl get node -o custom-columns=":metadata.name") -o custom-columns="CPU:.status.capacity.cpu" | grep "3" 1> /dev/null && echo "CPU OK"
# kubectl get node $(kubectl get node -o custom-columns=":metadata.name") -o custom-columns="DISK:.status.capacity.ephemeral-storage" | grep -E "5\d{6}Ki" 1> /dev/null && echo "Disk OK"
# kubectl get node $(kubectl get node -o custom-columns=":metadata.name") -o custom-columns="MEMORY:.status.capacity.memory" | grep -E "11\d{6}Ki" 1> /dev/null && echo "Memory OK"

# test-with-custom-name:
# strategy:
# matrix:
# version:
# - v0.17.0
# - v0.16.0
# os: [ubuntu-latest, macos-latest]
# runs-on: ${{ matrix.os }}
# steps:
# - name: Checkout
# uses: actions/checkout@v1

# - name: Create kind cluster with custom name
# uses: ./
# with:
# version: "${{ matrix.version }}"
# cluster_name: "custom-name"

# - name: Test
# run: |
# kubectl cluster-info
# kubectl get storageclass standard

# test-without-registry:
# strategy:
# matrix:
# version:
# - v0.17.0
# - v0.16.0
# os: [ubuntu-latest, macos-latest]
# runs-on: ${{ matrix.os }}
# steps:
# - name: Checkout
# uses: actions/checkout@v1

# - name: Create kind cluster with custom name
# uses: ./
# with:
# version: "${{ matrix.version }}"
# cluster_name: "custom-name"
# registry: false

# - name: Test
# run: |
# kubectl cluster-info
# kubectl get storageclass standard

# registry_id=$(docker ps --filter "name=kind-registry" --format "{{.ID}}")
# if [[ -n "$registry_id" ]]; then
# echo "Registry present"
# exit 1
# fi

test-without-registry:
test-with-registry:
strategy:
matrix:
version:
- v0.17.0
- v0.16.0
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, macos-11]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v1

- name: Create kind cluster with custom name
uses: ./
with:
version: "${{ matrix.version }}"
cluster_name: "custom-name"
registry: false

- name: Test
- name: lookup
run: |
kubectl cluster-info
kubectl get storageclass standard
registry_id=$(docker ps --filter "name=kind-registry" --format "{{.ID}}")
if [[ -n "$registry_id" ]]; then
echo "Registry present"
exit 1
fi
nslookup localhost
test-with-registry:
strategy:
matrix:
version:
- v0.17.0
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v1

Expand Down Expand Up @@ -148,70 +150,70 @@ jobs:
exit 1
fi
test-with-registry-with-delete-rights:
strategy:
matrix:
version:
- v0.17.0
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v1

- name: Create kind cluster with registry
uses: ./
with:
version: "${{ matrix.version }}"
registry_delete: true

- name: Test
run: |
kubectl cluster-info
kubectl get storageclass standard
# Checking env variable
if [[ "$KIND_REGISTRY" != "kind-registry:5000" ]]; then
echo "Wrong KIND_REGISTRY env variable: $KIND_REGISTRY"
exit 1
fi
# Test registry usage inside cluster
docker pull busybox
docker tag busybox kind-registry:5000/localbusybox
# Test delete API
OUTPUT=$(docker push kind-registry:5000/localbusybox | grep -o 'digest.*size')
TRIM=${OUTPUT//digest: /}
DIGEST=${TRIM// size/}
exit $(curl -X DELETE kind-registry:5000/v2/localbusybox/manifests/$DIGEST)
test-knative:
strategy:
matrix:
knative_version:
- v1.9.0
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v1

- name: Create kind cluster
uses: ./
with:
knative_serving: "${{ matrix.knative_version }}"
knative_kourier: "${{ matrix.knative_version }}"
knative_eventing: "${{ matrix.knative_version }}"

- name: Test
run: |
kubectl cluster-info
kubectl get storageclass standard
cat << EOF | kubectl apply -f -
apiVersion: messaging.knative.dev/v1
kind: InMemoryChannel
metadata:
name: messages
EOF
# test-with-registry-with-delete-rights:
# strategy:
# matrix:
# version:
# - v0.17.0
# os: [ubuntu-latest, macos-latest]
# runs-on: ${{ matrix.os }}
# steps:
# - name: Checkout
# uses: actions/checkout@v1

# - name: Create kind cluster with registry
# uses: ./
# with:
# version: "${{ matrix.version }}"
# registry_delete: true

# - name: Test
# run: |
# kubectl cluster-info
# kubectl get storageclass standard

# # Checking env variable
# if [[ "$KIND_REGISTRY" != "kind-registry:5000" ]]; then
# echo "Wrong KIND_REGISTRY env variable: $KIND_REGISTRY"
# exit 1
# fi

# # Test registry usage inside cluster
# docker pull busybox
# docker tag busybox kind-registry:5000/localbusybox

# # Test delete API
# OUTPUT=$(docker push kind-registry:5000/localbusybox | grep -o 'digest.*size')
# TRIM=${OUTPUT//digest: /}
# DIGEST=${TRIM// size/}
# exit $(curl -X DELETE kind-registry:5000/v2/localbusybox/manifests/$DIGEST)

# test-knative:
# strategy:
# matrix:
# knative_version:
# - v1.9.0
# os: [ubuntu-latest, macos-latest]
# runs-on: ${{ matrix.os }}
# steps:
# - name: Checkout
# uses: actions/checkout@v1

# - name: Create kind cluster
# uses: ./
# with:
# knative_serving: "${{ matrix.knative_version }}"
# knative_kourier: "${{ matrix.knative_version }}"
# knative_eventing: "${{ matrix.knative_version }}"

# - name: Test
# run: |
# kubectl cluster-info
# kubectl get storageclass standard

# cat << EOF | kubectl apply -f -
# apiVersion: messaging.knative.dev/v1
# kind: InMemoryChannel
# metadata:
# name: messages
# EOF
4 changes: 2 additions & 2 deletions registry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ main() {
local document=false

parse_command_line "$@"

if [[ "$document" = "false" ]]
then
install_docker
Expand Down Expand Up @@ -201,7 +201,7 @@ connect_registry() {

create_kind_config() {
sudo mkdir -p /etc/kind-registry
cat <<EOF | sudo dd status=none of=/etc/kind-registry/config.yaml
cat <<EOF | sudo dd of=/etc/kind-registry/config.yaml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
containerdConfigPatches:
Expand Down

0 comments on commit ef0eac0

Please sign in to comment.