Skip to content

Instantly share code, notes, and snippets.

@DelusionalOptimist
Created September 17, 2021 14:54
Show Gist options
  • Save DelusionalOptimist/2c3ee0220a6f8bbaa7881d2230b34fff to your computer and use it in GitHub Desktop.
Save DelusionalOptimist/2c3ee0220a6f8bbaa7881d2230b34fff to your computer and use it in GitHub Desktop.
Meshery dev env in containers
#!/bin/env bash
main() {
local DEPLOY="true"
parse_command_line "$@"
if [[ $DEPLOY = "true" ]]
then
eval $(minikube -p minikube docker-env)
cd $HOME/dev/meshery
docker build -t meshery:edge-latest --file=./dev-dockerfile .
kubectl create ns meshery
kubectl apply -f $HOME/test-manifests/service-account.yaml -n meshery --wait
kubectl apply -f $HOME/test-manifests/meshery-deployment.yaml -n meshery --wait
kubectl apply -f $HOME/test-manifests/meshery-service.yaml -n meshery --wait
else
kubectl delete -f $HOME/test-manifests/service-account.yaml -n meshery --wait
kubectl delete -f $HOME/test-manifests/meshery-deployment.yaml -n meshery --wait
kubectl delete -f $HOME/test-manifests/meshery-service.yaml -n meshery --wait
kubectl delete -f $HOME/dev/meshery/install/deployment_yamls/k8s/getnighthawk-deployment.yaml -n meshery --wait
fi
}
parse_command_line() {
while :
do
case "${1:-}" in
-d|--delete)
DEPLOY="false"
;;
*)
break
;;
esac
shift
done
}
main "$@"
FROM ubuntu
RUN adduser --disabled-login appuser
RUN apt-get update; apt-get install -y ca-certificates curl; update-ca-certificates && rm -rf /var/lib/apt/lists/*
WORKDIR /app/cmd
ADD ./meshery /app/cmd/
COPY ./install/deployment_yamls/k8s/getnighthawk-deployment.yaml /home/appuser/.meshery/manifests/
COPY ./oam /app/oam
COPY ./ui/out /app/ui/out
COPY ./provider-ui/out /app/provider-ui/out
COPY ./nighthawk_output_transform /app/cmd/nighthawk_output_transform
RUN mkdir -p /home/appuser/.meshery/config; chown -R appuser /home/appuser/
USER appuser
CMD ./meshery
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert -f ../docker-compose.yaml
kompose.version: 1.17.0 ()
creationTimestamp: null
labels:
io.kompose.service: getnighthawk
name: getnighthawk
spec:
selector:
matchLabels:
io.kompose.service: getnighthawk
replicas: 1
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
io.kompose.service: getnighthawk
spec:
containers:
- image: layer5/getnighthawk:latest
imagePullPolicy: Always
name: getnighthawk
command: ["nighthawk_service"]
ports:
- containerPort: 8443
resources: {}
restartPolicy: Always
status: {}
---
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.cmd: kompose convert -f ../docker-compose.yaml
kompose.version: 1.17.0 ()
creationTimestamp: null
labels:
io.kompose.service: getnighthawk
name: getnighthawk
spec:
ports:
- name: "8443"
port: 8443
targetPort: 8443
selector:
io.kompose.service: getnighthawk
status:
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert -f ../docker-compose.yaml
kompose.version: 1.17.0 ()
creationTimestamp: null
labels:
io.kompose.service: meshery
name: meshery
spec:
selector:
matchLabels:
io.kompose.service: meshery
replicas: 1
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
io.kompose.service: meshery
spec:
serviceAccountName: meshery-server
containers:
- env:
- name: EVENT
value: mesheryLocal
- name: PROVIDER_BASE_URLS
value: https://meshery.layer5.io
- name: ADAPTER_URLS
value: meshery-istio:10000 meshery-linkerd:10001 meshery-consul:10002 meshery-octarine:10003 meshery-nsm:10004 meshery-kuma:10007 meshery-cpx:10008 meshery-osm:10009 meshery-nginx-sm:10010
image: meshery:edge-latest
imagePullPolicy: IfNotPresent
name: meshery
ports:
- containerPort: 8080
resources: {}
restartPolicy: Always
status: {}
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.cmd: kompose convert -f ../docker-compose.yaml
kompose.version: 1.17.0 ()
creationTimestamp: null
labels:
io.kompose.service: meshery
name: meshery
spec:
ports:
- name: "http"
port: 9081
targetPort: 8080
selector:
io.kompose.service: meshery
type: LoadBalancer
apiVersion: v1
kind: ServiceAccount
metadata:
name: meshery-server
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: meshery-server
labels:
app: meshery
rules:
- apiGroups:
- '*'
resources:
- '*'
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- approve
- nonResourceURLs: ["/metrics", "/health", "/ping"]
verbs:
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: meshery-server
labels:
app: meshery
roleRef:
kind: ClusterRole
name: meshery-server
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: meshery-server
namespace: meshery
---%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment