Skip to content
Permalink
Browse files

adding ocp4 scripts

  • Loading branch information...
burrsutter committed Jul 20, 2019
1 parent ad1fbc4 commit 290dcd75cdd3a4f47e3f97ff1d04badd95793661
@@ -0,0 +1,13 @@
#!/bin/bash

echo 'correct usage is source 0_setenv.sh'

export PROJECT_HOME=/Users/burrsutter/tryopenshift;
export PATH=$PROJECT_HOME/bin:$PATH
# export KUBECONFIG=$PROJECT_HOME/.kube/config
export KUBECONFIG=$PROJECT_HOME/july15v1/auth/kubeconfig
export KUBE_EDITOR="code -w"

export ISTIO_HOME=$PROJECT_HOME/scripts-istio/istio-1.1.1
export PATH=$ISTIO_HOME/bin:$PATH

@@ -4,11 +4,11 @@ kubens tutorial

# kubectl label set istio-injection=enabled

kubectl apply -f <(istioctl kube-inject -f ../istio-tutorial/customer/kubernetes/Deployment.remote.yml) -n tutorial
kubectl apply -f <(istioctl kube-inject -f ../istio-tutorial/customer/kubernetes/Deployment.yml) -n tutorial
kubectl create -f ../istio-tutorial/customer/kubernetes/Service.yml -n tutorial
kubectl patch service/customer -p '{"spec":{"type":"NodePort"}}' -n tutorial
kubectl apply -f <(istioctl kube-inject -f ../istio-tutorial/preference/kubernetes/Deployment.remote.yml) -n tutorial
kubectl apply -f <(istioctl kube-inject -f ../istio-tutorial/preference/kubernetes/Deployment.yml) -n tutorial
kubectl create -f ../istio-tutorial/preference/kubernetes/Service.yml -n tutorial
kubectl apply -f <(istioctl kube-inject -f ../istio-tutorial/recommendation/kubernetes/Deployment.remote.yml) -n tutorial
kubectl apply -f <(istioctl kube-inject -f ../istio-tutorial/recommendation/kubernetes/Deployment.yml) -n tutorial
kubectl create -f ../istio-tutorial/recommendation/kubernetes/Service.yml -n tutorial

@@ -6,10 +6,10 @@ kubens tutorial
oc adm policy add-scc-to-user privileged -z default -n tutorial
# kubectl label set istio-injection=enabled

kubectl apply -f <(istioctl kube-inject -f ../istio-tutorial/customer/kubernetes/Deployment.remote.yml) -n tutorial
kubectl apply -f <(istioctl kube-inject -f ../istio-tutorial/customer/kubernetes/Deployment.yml) -n tutorial
kubectl create -f ../istio-tutorial/customer/kubernetes/Service.yml -n tutorial
kubectl apply -f <(istioctl kube-inject -f ../istio-tutorial/preference/kubernetes/Deployment.remote.yml) -n tutorial
kubectl apply -f <(istioctl kube-inject -f ../istio-tutorial/preference/kubernetes/Deployment.yml) -n tutorial
kubectl create -f ../istio-tutorial/preference/kubernetes/Service.yml -n tutorial
kubectl apply -f <(istioctl kube-inject -f ../istio-tutorial/recommendation/kubernetes/Deployment.remote.yml) -n tutorial
kubectl apply -f <(istioctl kube-inject -f ../istio-tutorial/recommendation/kubernetes/Deployment.yml) -n tutorial
kubectl create -f ../istio-tutorial/recommendation/kubernetes/Service.yml -n tutorial

@@ -0,0 +1,17 @@
#!/bin/bash
kubectl create namespace tutorial
kubens tutorial

# on minishift
oc adm policy add-scc-to-user privileged -z default -n tutorial
# kubectl label set istio-injection=enabled

kubectl apply -f <(istioctl kube-inject -f ../istio-tutorial/customer/kubernetes/Deployment.yml) -n tutorial
kubectl create -f ../istio-tutorial/customer/kubernetes/Service.yml -n tutorial
kubectl apply -f <(istioctl kube-inject -f ../istio-tutorial/preference/kubernetes/Deployment.yml) -n tutorial
kubectl create -f ../istio-tutorial/preference/kubernetes/Service.yml -n tutorial
kubectl apply -f <(istioctl kube-inject -f ../istio-tutorial/recommendation/kubernetes/Deployment.yml) -n tutorial
kubectl create -f ../istio-tutorial/recommendation/kubernetes/Service.yml -n tutorial

kubectl apply -f ../istio-tutorial/customer/kubernetes/Gateway.yml -n tutorial

@@ -0,0 +1,9 @@
#!/bin/bash

export GRAALVM_HOME=~/tools/graalvm-ce-1.0.0-rc16/Contents/Home/

cd ../istio-tutorial/recommendation/java/quarkus

mvn package -Pnative -Dnative-image.docker-build=true -DskipTests
docker build -f src/main/docker/Dockerfile.native -t dev.local/burrsutter/recommendation:v2 .

@@ -0,0 +1,9 @@
#!/bin/bash

docker login docker.io

docker tag $1 docker.io/burrsutter/recommendation:v2

docker push docker.io/burrsutter/recommendation:v2

kubectl apply -f <(istioctl kube-inject -f Deployment-v2.yml) -n tutorial
@@ -0,0 +1,7 @@
#!/bin/bash
cd ../istio-tutorial/recommendation/java/quarkus

mvn clean package -DskipTests

docker build -t dev.local/burrsutter/recommendation:v2 .

@@ -0,0 +1,11 @@
#!/bin/bash

docker login docker.io

docker tag $1 docker.io/burrsutter/recommendation:v2

docker push docker.io/burrsutter/recommendation:v2

kubectl apply -f <(istioctl kube-inject -f Deployment-v2.yml) -n tutorial

# kubectl apply -f <(istioctl kube-inject -f ../../kubernetes/Deployment-v2.yml) -n tutorial
@@ -0,0 +1,61 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: recommendation
version: v2
name: recommendation-v2
spec:
replicas: 1
selector:
matchLabels:
app: recommendation
version: v2
template:
metadata:
labels:
app: recommendation
version: v2
annotations:
sidecar.istio.io/inject: "true"
spec:
containers:
- env:
- name: JAVA_OPTIONS
value: -Xms15m -Xmx15m -Xmn15m
image: docker.io/burrsutter/recommendation:v2
imagePullPolicy: Always
name: recommendation
ports:
- containerPort: 8080
name: http
protocol: TCP
- containerPort: 8778
name: jolokia
protocol: TCP
- containerPort: 9779
name: prometheus
protocol: TCP
resources:
requests:
memory: "50Mi"
cpu: "250m" # 1/4 core
limits:
memory: "120Mi"
cpu: "500m"
livenessProbe:
httpGet:
port: 8080
path: /
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 10
readinessProbe:
httpGet:
port: 8080
path: /health
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 10
securityContext:
privileged: false
@@ -0,0 +1,11 @@
#!/bin/bash

URL=$(kubectl -n istio-system get routes -l app=istio-ingressgateway -o jsonpath='{.items[:1].spec.host}')
echo $URL

while true
do curl $URL/customer
sleep .3
done


0 comments on commit 290dcd7

Please sign in to comment.
You can’t perform that action at this time.