1
0
Fork 0

Code reorganization

This commit is contained in:
Joao Gilberto Magalhaes 2022-08-26 14:19:56 -05:00
parent 799e277fe0
commit 2a74f5d445
17 changed files with 54 additions and 20 deletions

View file

@ -0,0 +1,37 @@
version: "3"
services:
easyhaproxy:
image: byjg/easy-haproxy:4.1.0
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- certs_letsencrypt:/certs/letsencrypt
- certs_haproxy:/certs/haproxy
environment:
EASYHAPROXY_DISCOVER: docker
EASYHAPROXY_LABEL_PREFIX: easyhaproxy
EASYHAPROXY_LETSENCRYPT_EMAIL: changeme@example.org
EASYHAPROXY_SSL_MODE: "default"
HAPROXY_CUSTOMERRORS: "true"
HAPROXY_USERNAME: admin
HAPROXY_PASSWORD: password
HAPROXY_STATS_PORT: 1936
ports:
- "80:80/tcp"
- "443:443/tcp"
- "1936:1936/tcp"
networks:
- easyhaproxy
volumes:
certs_letsencrypt:
external: true
certs_haproxy:
external: true
networks:
easyhaproxy:
external: true

29
deploy/docker/install.sh Executable file
View file

@ -0,0 +1,29 @@
#!/bin/bash
ASSETS_DIR="$(dirname "${BASH_SOURCE[0]}")"/../../build/assets/certs/haproxy
docker network create easyhaproxy
docker volume create certs_letsencrypt
docker volume create certs_haproxy
docker run -d --rm --name easyhaproxy_install -v certs_haproxy:/certs alpine tail -f /dev/null
docker cp $ASSETS_DIR/.place_holder_cert.pem easyhaproxy_install:/certs/.place_holder_cert.pem
docker stop easyhaproxy_install
echo
echo
echo make sure to add to all of your containers:
echo
echo docker-compose
echo ==============
echo "networks:"
echo " default:"
echo " name: easyhaproxy"
echo " external: true"
echo
echo
echo docker run
echo ==============
echo docker run ... --network easyhaproxy ... your_image:tag
echo

View file

@ -0,0 +1,135 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: easyhaproxy
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: easyhaproxy-ingress
namespace: easyhaproxy
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: easyhaproxy-ingress
rules:
- apiGroups:
- ""
resources:
# - configmaps
# - endpoints
# - nodes
- pods
- services
- namespaces
# - events
- serviceaccounts
verbs:
- get
- list
- watch
- apiGroups:
- "extensions"
- "networking.k8s.io"
resources:
- ingresses
# - ingresses/status
# - ingressclasses
verbs:
- get
- list
- watch
# - apiGroups:
# - "extensions"
# - "networking.k8s.io"
# resources:
# - ingresses/status
# verbs:
# - update
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
- list
# - watch
# - create
# - patch
# - update
# - apiGroups:
# - "discovery.k8s.io"
# resources:
# - endpointslices
# verbs:
# - get
# - list
# - watch
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: easyhaproxy-ingress
namespace: easyhaproxy
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: easyhaproxy-ingress
subjects:
- kind: ServiceAccount
name: easyhaproxy-ingress
namespace: easyhaproxy
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: easyhaproxy-ingress
namespace: easyhaproxy
spec:
selector:
matchLabels:
app: easyhaproxy-ingress
template:
metadata:
labels:
app: easyhaproxy-ingress
spec:
serviceAccountName: easyhaproxy-ingress
containers:
- image: byjg/easy-haproxy:test
imagePullPolicy: Always
name: easyhaproxy-ingress
ports:
- name: http
containerPort: 80
hostPort: 80
- name: https
containerPort: 443
hostPort: 443
- name: stats
containerPort: 1936
hostPort: 1936
resources:
requests:
cpu: "100m"
memory: "128Mi"
env:
- name: EASYHAPROXY_DISCOVER
value: kubernetes
- name: HAPROXY_USERNAME
value: admin
- name: HAPROXY_PASSWORD
value: password
- name: EASYHAPROXY_REFRESH_CONF
value: "10"
- name: HAPROXY_CUSTOMERRORS
value: "true"
- name: EASYHAPROXY_SSL_MODE
value: loose