Skip to content
This repository was archived by the owner on Aug 6, 2021. It is now read-only.

Commit

Permalink
Test on minikube (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
pbochynski authored Oct 15, 2020
1 parent 712cc8c commit d455737
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 12 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/e2e-minikube.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Tests on minikube

on:
push:
pull_request:
types: [opened, synchronize, reopened]
schedule:
- cron: '0 * * * *' # every hour

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v2
- name: Prepare docker registry, minikube and helm 3
run: |
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
docker run -d \
-p 5000:5000 \
--restart=always \
--name registry.localhost \
-v $PWD/registry:/var/lib/registry \
registry:2
echo "starting cluster"
minikube start --memory=6800m --kubernetes-version=1.18.9 --insecure-registry="registry.localhost:5000"
minikube ssh "sudo sh -c \"grep host.minikube.internal /etc/hosts | sed s/host.minikube.internal/registry.localhost/ >>/etc/hosts\""
echo "Installing helm"
curl -s https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
while [[ $(kubectl get nodes -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" ]]; do echo "Waiting for cluster nodes to be ready"; sleep 2; done
- name: Install Istio
run: |
./install-istio.sh
- name: Minikube tunnel
run: |
./minikube-tunnel.sh
- name: Install Kyma
env:
SKIP_MODULES: apiserver-proxy,helm-broker,console,cluster-users,apiserver-proxy,logging,tracing
run: |
./download-kyma-charts.sh
IP=$(minikube ssh "grep host.minikube.internal /etc/hosts | cut -f1")
export REGISTRY_IP=${IP//[$'\t\r\n ']}
./install-kyma.sh
sudo cp kyma.crt /usr/local/share/ca-certificates
sudo update-ca-certificates
- name: Install Commerce Mock
run: |
./commerce-mock.sh
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
- name: Run End To End Test
run: |
./app-connector-example.sh
9 changes: 1 addition & 8 deletions app-connector-example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ apiVersion: serverless.kyma-project.io/v1alpha1
kind: Function
metadata:
labels:
serverless.kyma-project.io/build-resources-preset: slow
serverless.kyma-project.io/build-resources-preset: local-dev
serverless.kyma-project.io/function-resources-preset: S
serverless.kyma-project.io/replicas-preset: S
name: lastorder
Expand All @@ -26,13 +26,6 @@ spec:
{\"axios\": \"^0.19.2\"}\n}"
maxReplicas: 1
minReplicas: 1
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 50m
memory: 64Mi
source: "let lastOrder = {};\n\nconst axios = require('axios');\n\nasync function
getOrder(code) {\n let url = process.env.GATEWAY_URL+\"/site/orders/\"+code;\n
\ console.log(\"URL: %s\", url);\n let response = await axios.get(url,{headers:{\"X-B3-Sampled\":1}})\n
Expand Down
2 changes: 1 addition & 1 deletion commerce-mock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@ spec:
port: 10000
EOF
MOCK_PROVIDER=""
while [[ -z $MOCK_PROVIDER ]]; do echo "waiting for commerce mock to be ready"; MOCK_PROVIDER=$(curl -sk https://commerce.local.kyma.dev/local/apis |jq -r '.[0].provider'); sleep 5; done
while [[ -z $MOCK_PROVIDER ]]; do echo "waiting for commerce mock to be ready"; MOCK_PROVIDER=$(curl -sk https://commerce.local.kyma.dev/local/apis |jq -r '.[0].provider'); curl -ik "https://commerce.local.kyma.dev/local/apis" ; sleep 5; done
10 changes: 7 additions & 3 deletions install-kyma.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SECONDS=0
export DOMAIN=local.kyma.dev
export OVERRIDES=global.isLocalEnv=false,global.ingress.domainName=$DOMAIN,global.environment.gardener=false,global.domainName=$DOMAIN,global.tlsCrt=ZHVtbXkK
export ORY=global.ory.hydra.persistence.enabled=false,global.ory.hydra.persistence.postgresql.enabled=false,hydra.hydra.autoMigrate=false
export ORY=global.ory.hydra.persistence.enabled=false,global.ory.hydra.persistence.postgresql.enabled=false,hydra.hydra.autoMigrate=false,hydra.deployment.resources.requests.cpu=10m,oathkeeper.deployment.resources.requests.cpu=10m
# export REGISTRY_VALUES="dockerRegistry.username=$REGISTRY_USER,dockerRegistry.password=$REGISTRY_PASS,dockerRegistry.enableInternal=false,dockerRegistry.serverAddress=ghcr.io,dockerRegistry.registryAddress=ghcr.io/$REGISTRY_USER"
export REGISTRY_VALUES="dockerRegistry.enableInternal=false,dockerRegistry.serverAddress=registry.localhost:5000,dockerRegistry.registryAddress=registry.localhost:5000"

Expand Down Expand Up @@ -75,9 +75,13 @@ EOF
# Wait for nodes to be ready before scheduling any workload
while [[ $(kubectl get nodes -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" ]]; do echo "Waiting for cluster nodes to be ready, elapsed time: $(( $SECONDS/60 )) min $(( $SECONDS % 60 )) sec"; sleep 2; done

export REGISTRY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' /registry.localhost)
if [[ -z $REGISTRY_IP ]]; then
export REGISTRY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' /registry.localhost)
fi
echo "Patching CoreDns with REGISTRY_IP=$REGISTRY_IP"
sed "s/REGISTRY_IP/$REGISTRY_IP/" coredns-patch.tpl >coredns-patch.yaml
kubectl -n kube-system patch cm coredns --patch "$(cat coredns-patch.yaml)"

kubectl apply -f resources/cluster-essentials/files -n kyma-system
helm_install pod-preset resources/cluster-essentials/charts/pod-preset kyma-system
helm_install testing resources/testing kyma-system
Expand All @@ -89,7 +93,7 @@ helm_install ory resources/ory kyma-system --set $OVERRIDES --set $ORY &
helm_install api-gateway resources/api-gateway kyma-system --set $OVERRIDES &

helm_install rafter resources/rafter kyma-system --set $OVERRIDES &
helm_install service-catalog resources/service-catalog kyma-system --set $OVERRIDES &
helm_install service-catalog resources/service-catalog kyma-system --set $OVERRIDES --set catalog.webhook.resources.requests.cpu=10m,catalog.controllerManager.resources.requests.cpu=10m &
helm_install service-catalog-addons resources/service-catalog-addons kyma-system --set $OVERRIDES &
helm_install helm-broker resources/helm-broker kyma-system --set $OVERRIDES &

Expand Down
4 changes: 4 additions & 0 deletions minikube-tunnel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
minikube tunnel -c >/dev/null 2>&1 &
LB_IP=""
while [[ -z $LB_IP ]]; do LB_IP=$(kubectl get svc istio-ingressgateway -n istio-system -ojsonpath='{.status.loadBalancer.ingress[0].ip}'); echo "Waiting for LoadBalancer IP: $LB_IP"; sleep 5; done
sudo sh -c "echo \"$LB_IP commerce.local.kyma.dev dex.local.kyma.dev lastorder.local.kyma.dev\">>/etc/hosts"

0 comments on commit d455737

Please sign in to comment.