OpenShift deployment
This commit is contained in:
18
OpenShift/agent-deploy.sh
Executable file
18
OpenShift/agent-deploy.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$1" = "p" ]
|
||||
then
|
||||
YAML=instana-agent-os-private.yaml
|
||||
else
|
||||
YAML=instana-agent-os.yaml
|
||||
fi
|
||||
|
||||
oc login -u system:admin
|
||||
oc create -f $YAML
|
||||
oc project instana-agent
|
||||
oc adm policy add-scc-to-user privileged -z instana-admin
|
||||
oc label node localhost agent=instana
|
||||
oc adm policy add-role-to-user admin developer -n instana-agent
|
||||
|
||||
oc login -u developer
|
||||
|
49
OpenShift/deploy.sh
Executable file
49
OpenShift/deploy.sh
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Put your EUM key here
|
||||
EUM_KEY=""
|
||||
|
||||
# set -x
|
||||
|
||||
# This only works for default local install of minishift
|
||||
# Need to tweak some settings in OpenShift
|
||||
oc login -u developer
|
||||
oc new-project robot-shop
|
||||
oc login -u system:admin
|
||||
oc adm policy add-scc-to-user anyuid system:serviceaccount:robot-shop:default
|
||||
oc login -u developer
|
||||
oc project robot-shop
|
||||
|
||||
echo "OpenShift set up complete, ready to deploy Robot Shop now."
|
||||
/bin/echo -n "Enter to continue: "
|
||||
read CONTINUE
|
||||
|
||||
# set the environment from the .env file
|
||||
for VAR in $(egrep '^[A-Z]+=' ../.env)
|
||||
do
|
||||
export $VAR
|
||||
done
|
||||
|
||||
|
||||
# import all the images from docker hub into OpenShift
|
||||
for LINE in $(awk '/^ {2}[a-z]+:$/ {printf "%s", $0} /image: / {print $2}' ../docker-compose.yaml)
|
||||
do
|
||||
NAME=$(echo "$LINE" | cut -d: -f1)
|
||||
IMAGE=$(echo "$LINE" | cut -d: -f2-)
|
||||
FULL_IMAGE=$(eval "echo $IMAGE")
|
||||
|
||||
echo "NAME $NAME"
|
||||
echo "importing $FULL_IMAGE"
|
||||
|
||||
oc import-image $FULL_IMAGE --from $FULL_IMAGE --confirm
|
||||
# a bit of a hack but appears to work
|
||||
BASE=$(basename $FULL_IMAGE)
|
||||
oc new-app -i $BASE --name $NAME
|
||||
done
|
||||
|
||||
# Set EUM environment if required
|
||||
if [ -n "$EUM_KEY" ]
|
||||
then
|
||||
oc set env dc/web INSTANA_EUM_KEY=$EUM_KEY
|
||||
fi
|
||||
|
114
OpenShift/instana-agent-os.yaml
Normal file
114
OpenShift/instana-agent-os.yaml
Normal file
@@ -0,0 +1,114 @@
|
||||
apiVersion: v1
|
||||
kind: List
|
||||
items:
|
||||
- kind: Namespace
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: instana-agent
|
||||
labels:
|
||||
name: instana-agent
|
||||
|
||||
- apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: instana-admin
|
||||
namespace: instana-agent
|
||||
|
||||
- apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: instana-agent-secret
|
||||
namespace: instana-agent
|
||||
data:
|
||||
key: <your base64 encoded key here>
|
||||
|
||||
- apiVersion: extensions/v1beta1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
labels:
|
||||
app: instana-agent
|
||||
name: instana-agent
|
||||
namespace: instana-agent
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: instana-agent
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: instana-agent
|
||||
spec:
|
||||
nodeSelector:
|
||||
agent: instana
|
||||
hostIPC: true
|
||||
hostNetwork: true
|
||||
hostPID: true
|
||||
containers:
|
||||
- name: instana-agent
|
||||
image: instana/agent
|
||||
imagePullPolicy: Always
|
||||
env:
|
||||
- name: INSTANA_ZONE
|
||||
value: Stans-Robot-Shop
|
||||
- name: INSTANA_AGENT_ENDPOINT
|
||||
value: saas-us-west-2.instana.io
|
||||
- name: INSTANA_AGENT_ENDPOINT_PORT
|
||||
value: '443'
|
||||
- name: INSTANA_AGENT_HTTP_LISTEN
|
||||
value: '*'
|
||||
- name: INSTANA_AGENT_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: instana-agent-secret
|
||||
key: key
|
||||
securityContext:
|
||||
privileged: true
|
||||
volumeMounts:
|
||||
- name: dev
|
||||
mountPath: /dev
|
||||
- name: run
|
||||
mountPath: /var/run/docker.sock
|
||||
- name: sys
|
||||
mountPath: /sys
|
||||
- name: log
|
||||
mountPath: /var/log
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- echo
|
||||
- noop
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 5
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- echo
|
||||
- noop
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 5
|
||||
resources:
|
||||
requests:
|
||||
memory: "256Mi"
|
||||
cpu: "0.2"
|
||||
limits:
|
||||
memory: "512Mi"
|
||||
cpu: "0.5"
|
||||
volumes:
|
||||
- name: dev
|
||||
hostPath:
|
||||
path: /dev
|
||||
- name: run
|
||||
hostPath:
|
||||
path: /var/run/docker.sock
|
||||
- name: sys
|
||||
hostPath:
|
||||
path: /sys
|
||||
- name: log
|
||||
hostPath:
|
||||
path: /var/log
|
||||
serviceAccount: instana-admin
|
||||
|
Reference in New Issue
Block a user