Created
October 30, 2016 00:47
-
-
Save munnerz/de7c14f589beb7bd4549d86ba48b06d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: extensions/v1beta1 | |
kind: Deployment | |
metadata: | |
name: abc-xyz | |
labels: | |
app: abc-xyz | |
version: v1 | |
spec: | |
replicas: 2 | |
strategy: | |
type: RollingUpdate | |
rollingUpdate: | |
maxSurge: 1 | |
maxUnavailable: 0 | |
template: | |
metadata: | |
labels: | |
app: abc-xyz | |
version: v1 | |
spec: | |
terminationGracePeriodSeconds: 5 | |
volumes: | |
- name: nginx | |
configMap: | |
name: abc-xyz-nginx | |
- name: www-golang | |
configMap: | |
name: abc-xyz-golang | |
containers: | |
- name: nginx | |
image: nginx:1.10-alpine | |
resources: | |
limits: | |
cpu: 500m | |
memory: 256Mi | |
ports: | |
- name: http | |
containerPort: 80 | |
livenessProbe: | |
httpGet: | |
path: /_healthz | |
port: 80 | |
initialDelaySeconds: 3 | |
timeoutSeconds: 2 | |
failureThreshold: 2 | |
volumeMounts: | |
- name: nginx | |
mountPath: /etc/nginx | |
readOnly: true | |
- name: www-golang | |
mountPath: /www/golang | |
readOnly: true | |
--- | |
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: abc-xyz-nginx | |
data: | |
# Adding new entries here will make them appear as files in the deployment. | |
nginx.conf: | | |
worker_processes 5; | |
events { | |
} | |
http { | |
# This is the main site redirector. | |
server { | |
server_name abc.xyz; | |
listen 80; | |
if ($arg_go-get = "1") { | |
# This is a go-get operation. | |
# Send any file in any repo to static content. | |
rewrite ^/([^/]*)(/.*)?$ /_golang-go-get/$1.html; | |
} | |
location /_golang-go-get { | |
# Serve static content. | |
alias /www/golang; | |
} | |
location /_healthz { | |
add_header Content-Type text/plain; | |
return 200 'ok'; | |
} | |
} | |
} | |
--- | |
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: abc-xyz-golang | |
data: | |
# Adding new entries here will make them appear as files in the deployment. | |
example.html: | | |
<html><head> | |
<meta name="go-import" content="abc.xyz/example git https://github.com/abc-xyz/example"> | |
<meta name="go-source" content="abc.xyz/example https://github.com/abc-xyz/example https://github.com/abc-xyz/example/tree/master{/dir} https://github.com/abc-xyz/example/blob/master{/dir}/{file}#L{line}"> | |
</head></html> | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: abc-xyz | |
spec: | |
selector: | |
app: abc-xyz | |
version: v1 | |
type: ClusterIP | |
ports: | |
- name: http | |
port: 80 | |
--- | |
apiVersion: extensions/v1beta1 | |
kind: Ingress | |
metadata: | |
name: abc-xyz | |
labels: | |
app: abc-xyz | |
annotations: | |
kubernetes.io/ingress.class: nginx | |
kubernetes.io/tls-acme: "true" | |
spec: | |
tls: | |
- hosts: | |
- abc.xyz | |
secretName: abc-xyz | |
rules: | |
- host: abc.xyz | |
http: | |
paths: | |
- backend: | |
serviceName: abc-xyz | |
servicePort: 80 | |
path: / |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment