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

Commit 5784641

Browse files
committed
build,test: add setup-cluster.sh script and a Makefile
1 parent ed551bc commit 5784641

File tree

4 files changed

+107
-1
lines changed

4 files changed

+107
-1
lines changed

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.PHONY: build test
2+
3+
build:
4+
operator-sdk build --verbose docker.io/oscf/js-function-operator:v0.0.1
5+
6+
push:
7+
docker push docker.io/oscf/js-function-operator:v0.0.1
8+
9+
kube:
10+
minikube start --memory=8192 --cpus=6 --disk-size=30g --vm-driver=kvm2 --kubernetes-version=v1.16.0 --extra-config=apiserver.enable-admission-plugins="LimitRanger,NamespaceExists,NamespaceLifecycle,ResourceQuota,ServiceAccount,DefaultStorageClass,MutatingAdmissionWebhook"
11+
12+
test:
13+
./test/run_e2e.sh

pkg/controller/jsfunction/jsfunction_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ func (r *ReconcileJSFunction) Reconcile(request reconcile.Request) (reconcile.Re
178178
// No service for this function exists. Create a new one
179179
service, err := r.serviceForFunction(function, jsFunctionBuild.Spec.Image)
180180
if err != nil {
181+
reqLogger.Error(err, "Error creating a new knative Service", "Service.Namespace", service.Namespace, "Service.Name", service.Name)
181182
return reconcile.Result{}, err
182183
}
183184

test/run_e2e.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
NS=jsfunction-test
2+
NS=jsfunction-operator-test
33

44
kubectl create namespace $NS
55
kubectl create -f deploy/crds/faas_v1alpha1_jsfunction_crd.yaml

test/setup-cluster.sh

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#!/bin/sh
2+
3+
# This script will set up a minikube cluster with knative serving and eventing
4+
# as well as tekton pipelines.
5+
6+
minikube status
7+
8+
minikube start --memory=8192 --cpus=6 \
9+
--kubernetes-version=v1.12.0 \
10+
--vm-driver=kvm2 \
11+
--disk-size=30g \
12+
--extra-config=apiserver.enable-admission-plugins="LimitRanger,NamespaceExists,NamespaceLifecycle,ResourceQuota,ServiceAccount,DefaultStorageClass,MutatingAdmissionWebhook"
13+
14+
helm init
15+
16+
# Install Istio
17+
export ISTIO_VERSION=1.1.7
18+
echo "Installing ${ISTIO_VERSION}"
19+
curl -L https://git.io/getLatestIstio | sh -
20+
cd istio-${ISTIO_VERSION}
21+
22+
for i in install/kubernetes/helm/istio-init/files/crd*yaml; do kubectl apply -f $i; done
23+
24+
echo "Waiting for CRDs to be comitted"
25+
sleep 7
26+
27+
cat <<EOF | kubectl apply -f -
28+
apiVersion: v1
29+
kind: Namespace
30+
metadata:
31+
name: istio-system
32+
labels:
33+
istio-injection: disabled
34+
EOF
35+
36+
# A lighter template, with just pilot/gateway.
37+
# Based on install/kubernetes/helm/istio/values-istio-minimal.yaml
38+
helm template --namespace=istio-system \
39+
--set prometheus.enabled=false \
40+
--set mixer.enabled=false \
41+
--set mixer.policy.enabled=false \
42+
--set mixer.telemetry.enabled=false \
43+
`# Pilot doesn't need a sidecar.` \
44+
--set pilot.sidecar=false \
45+
--set pilot.resources.requests.memory=128Mi \
46+
`# Disable galley (and things requiring galley).` \
47+
--set galley.enabled=false \
48+
--set global.useMCP=false \
49+
`# Disable security / policy.` \
50+
--set security.enabled=false \
51+
--set global.disablePolicyChecks=true \
52+
`# Disable sidecar injection.` \
53+
--set sidecarInjectorWebhook.enabled=false \
54+
--set global.proxy.autoInject=disabled \
55+
--set global.omitSidecarInjectorConfigMap=true \
56+
`# Set gateway pods to 1 to sidestep eventual consistency / readiness problems.` \
57+
--set gateways.istio-ingressgateway.autoscaleMin=1 \
58+
--set gateways.istio-ingressgateway.autoscaleMax=1 \
59+
`# Set pilot trace sampling to 100%` \
60+
--set pilot.traceSampling=100 \
61+
install/kubernetes/helm/istio \
62+
> ./istio-lean.yaml
63+
64+
kubectl apply -f istio-lean.yaml
65+
66+
kubectl get pods --namespace istio-system
67+
68+
# Install Knative
69+
kubectl apply --selector knative.dev/crd-install=true \
70+
--filename https://github.com/knative/serving/releases/download/v0.9.0/serving.yaml \
71+
--filename https://github.com/knative/eventing/releases/download/v0.9.0/release.yaml \
72+
--filename https://github.com/knative/serving/releases/download/v0.9.0/monitoring.yaml
73+
74+
kubectl apply --filename https://github.com/knative/serving/releases/download/v0.9.0/serving.yaml \
75+
--filename https://github.com/knative/eventing/releases/download/v0.9.0/release.yaml \
76+
--filename https://github.com/knative/serving/releases/download/v0.9.0/monitoring.yaml
77+
78+
79+
# Install Tekton
80+
kubectl apply --filename https://storage.googleapis.com/tekton-releases/latest/release.yaml
81+
82+
# Install FaaS
83+
cd ..
84+
kubectl apply -f deploy/crds/faas_v1alpha1_jsfunction_crd.yaml
85+
kubectl apply -f deploy/crds/faas_v1alpha1_jsfunctionbuild_crd.yaml
86+
kubectl apply -f deploy/role.yaml
87+
kubectl apply -f deploy/role_binding.yaml
88+
kubectl apply -f deploy/service_account.yaml
89+
kubectl apply -f deploy/build/js-function-build.yaml
90+
kubectl apply -f deploy/operator.yaml
91+
92+
kubectl get namespaces

0 commit comments

Comments
 (0)