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 Kubernetes manifests #324

Merged
merged 1 commit into from
May 1, 2024
Merged
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
90 changes: 90 additions & 0 deletions examples/deployment-custom-ca.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: pomerium-verify
namespace: pomerium
labels:
app.kubernetes.io/name: pomerium-verify
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: pomerium-verify
template:
metadata:
labels:
app.kubernetes.io/name: pomerium-verify
spec:
containers:
- name: pomerium-verify
image: pomerium/verify:latest
env:
- name: PORT
value: "8000"
- name: EXTRA_CA_CERTS
value: /var/run/pomerium-verify/ca.crt
ports:
- name: http
protocol: TCP
containerPort: 8000
volumeMounts:
- name: pomerium-verify-ca-cert
mountPath: /var/run/pomerium-verify/
readOnly: true
resources:
requests:
cpu: 100m
memory: 64Mi
limits:
cpu: 200m
memory: 128Mi
securityContext:
capabilities:
drop:
- ALL
runAsNonRoot: true
runAsUser: 65532
runAsGroup: 65532
readinessProbe:
httpGet:
path: /healthz
port: 8000
initialDelaySeconds: 2
periodSeconds: 10
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 3
volumes:
- name: pomerium-verify-ca-cert
secret:
secretName: pomerium-verify-ca-cert
items:
- key: ca.crt
path: ca.crt
defaultMode: 0444
---
apiVersion: v1
kind: Service
metadata:
name: pomerium-verify
namespace: pomerium
spec:
selector:
app.kubernetes.io/name: pomerium-verify
ports:
- name: http
protocol: TCP
port: 80
targetPort: 8000
type: ClusterIP
---
apiVersion: v1
kind: Secret
metadata:
name: pomerium-verify-ca-cert
namespace: pomerium
type: Opaque
data:
ca.crt: |
(your pem-encoded CA certificate)
66 changes: 66 additions & 0 deletions examples/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: pomerium-verify
namespace: pomerium
labels:
app.kubernetes.io/name: pomerium-verify
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: pomerium-verify
template:
metadata:
labels:
app.kubernetes.io/name: pomerium-verify
spec:
containers:
- name: pomerium-verify
image: pomerium/verify:latest
env:
- name: PORT
value: "8000"
ports:
- name: http
protocol: TCP
containerPort: 8000
resources:
requests:
cpu: 100m
memory: 64Mi
limits:
cpu: 200m
memory: 128Mi
securityContext:
capabilities:
drop:
- ALL
runAsNonRoot: true
runAsUser: 65532
runAsGroup: 65532
readinessProbe:
httpGet:
path: /healthz
port: 8000
initialDelaySeconds: 2
periodSeconds: 10
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 3
---
apiVersion: v1
kind: Service
metadata:
name: pomerium-verify
namespace: pomerium
spec:
selector:
app.kubernetes.io/name: pomerium-verify
ports:
- name: http
protocol: TCP
port: 80
targetPort: 8000
type: ClusterIP
21 changes: 21 additions & 0 deletions examples/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: verify
namespace: pomerium
annotations:
ingress.pomerium.io/pass_identity_headers: "true"
ingress.pomerium.io/allow_any_authenticated_user: "true"
spec:
ingressClassName: pomerium
rules:
- host: verify.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: pomerium-verify
port:
name: http
4 changes: 4 additions & 0 deletions http.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ func (srv *Server) initRouter() {
srv.router = chi.NewRouter()
srv.router.Use(sdk.AddIdentityToRequest(verifier))

srv.router.Get("/healthz", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
})

// mount api
srv.router.Route("/api", func(r chi.Router) {
r.Use(middleware.NoCache)
Expand Down
Loading