Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add example deployment setup. #52

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.git
/example
/scripts
/glide.lock
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ RUN go build -o /kubehook ./cmd/kubehook
FROM alpine:3.7
MAINTAINER Nic Cope <[email protected]>
RUN apk --no-cache add ca-certificates
COPY --from=golang /kubehook /
COPY --from=golang /kubehook /
ENTRYPOINT [ "/kubehook" ]
CMD [ "--help" ]
37 changes: 37 additions & 0 deletions example/backend/kubecfg.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---

apiVersion: v1
kind: Config
preferences: {}
current-context: ""

clusters:
- name: development
cluster: {}
- name: staging
cluster: {}
- name: production
cluster: {}

users:
- name: developer
user: {}
- name: admin
user: {}

contexts:
- name: dev-system
context:
cluster: development
namespace: system
user: developer
- name: staging-system
context:
cluster: staging
namespace: system
user: admin
- name: production-system
context:
cluster: production
namespace: system
user: admin
27 changes: 27 additions & 0 deletions example/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---

version: '2.4'

services:
frontend:
image: nginx:alpine
volumes:
- type: bind
source: ./frontend
target: /etc/nginx/conf.d
read_only: true
ports:
- "127.0.0.1:8080:80"

backend:
image: localhost/kubehook
build: ..
command:
- '--kubecfg-template'
- '/etc/kubehook/kubecfg.conf'
- 'example-secret'
volumes:
- type: bind
source: ./backend
target: /etc/kubehook
read_only: true
35 changes: 35 additions & 0 deletions example/frontend/example.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
server {
listen 80;
server_name localhost;

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

location / {
auth_basic "Example";
auth_basic_user_file /etc/nginx/conf.d/htpasswd.txt;
sendfile off;

proxy_pass http://backend:10003;
proxy_redirect default;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-User $remote_user;
proxy_set_header X-Forwarded-Groups "local;example";
proxy_max_temp_file_size 0;

client_max_body_size 10m;
client_body_buffer_size 128k;

proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
}
4 changes: 4 additions & 0 deletions example/frontend/htpasswd.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Password01
user01:$2y$10$UnLAqXHOX7j28CZQH5HI8uOXPMw6unOjbSIZdBcGM/fySunBY8ls2
# Password02
user02:$2y$10$Zx7sCpBg0owPuB5mzw6yeeOHaaWbD3Va42AXU7j97o6fAZC5VJ2zW