Skip to content
This repository has been archived by the owner on Oct 3, 2020. It is now read-only.

Refactor code to support running on secure environments #233

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
8 changes: 7 additions & 1 deletion deploy/auth.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: kube-ops-view
namespace: default

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not namespace: {{ .Values.Namespace }}?

---
apiVersion: v1
kind: ServiceAccount
metadata:
name: kube-ops-view-redis
namespace: default
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
Expand Down
11 changes: 5 additions & 6 deletions deploy/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
application: kube-ops-view
version: v0.11
name: kube-ops-view
namespace: default
spec:
replicas: 1
selector:
Expand All @@ -16,13 +17,12 @@ spec:
application: kube-ops-view
version: v0.11
spec:
serviceAccount: kube-ops-view
serviceAccountName: kube-ops-view
containers:
- name: service
# see https://github.com/hjacobs/kube-ops-view/releases
image: hjacobs/kube-ops-view:0.11
args:
# remove this option to use built-in memory store
- --redis-url=redis://kube-ops-view-redis:6379
ports:
- containerPort: 8080
Expand All @@ -35,12 +35,11 @@ spec:
timeoutSeconds: 1
resources:
limits:
cpu: 300m
memory: 200Mi
requests:
cpu: 200m
memory: 100Mi
requests:
cpu: 50m
memory: 50Mi
securityContext:
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 1000
1 change: 1 addition & 0 deletions deploy/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: kube-ops-view
namespace: default
spec:
rules:
- host: "kube-ops-view.example.org"
Expand Down
31 changes: 28 additions & 3 deletions deploy/redis-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
application: kube-ops-view-redis
version: v0.0.1
name: kube-ops-view-redis
namespace: default
spec:
replicas: 1
selector:
Expand All @@ -16,9 +17,25 @@ spec:
application: kube-ops-view-redis
version: v0.0.1
spec:
# Test
serviceAccountName: kube-ops-view-redis
# Since there are read-only filesystems, important data is copied to an
# emptyDir via an initContainer to avoid read-only errors
initContainers:
- name: copy-files-to-vol
image: bitnami/redis:5.0.5
command: ["sh", "-c", "[ \"$(ls -A /mnt/data)\" ] || (cp -R /opt/bitnami/redis/* /mnt/data/ && exit 0)"]
volumeMounts:
- name: bitnami-fs
mountPath: /mnt/data
containers:
- name: redis
image: redis:5-alpine
# bitnami/redis is chosen over library/redis so support out-of-the-box
# rootless containers
image: bitnami/redis:5.0.5
env:
- name: ALLOW_EMPTY_PASSWORD
value: "yes"
ports:
- containerPort: 6379
protocol: TCP
Expand All @@ -32,8 +49,16 @@ spec:
requests:
cpu: 50m
memory: 50Mi
volumeMounts:
- mountPath: /bitnami/redis/data
name: redis-bitnami-data
- mountPath: /opt/bitnami/redis
name: bitnami-fs
securityContext:
readOnlyRootFilesystem: true
runAsNonRoot: true
# we need to use the "redis" uid
runAsUser: 100
volumes:
- name: redis-bitnami-data
emptyDir: {}
- name: bitnami-fs
emptyDir: {}
1 change: 1 addition & 0 deletions deploy/redis-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ metadata:
labels:
application: kube-ops-view-redis
name: kube-ops-view-redis
namespace: default
spec:
selector:
application: kube-ops-view-redis
Expand Down
1 change: 1 addition & 0 deletions deploy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ metadata:
labels:
application: kube-ops-view
name: kube-ops-view
namespace: default
spec:
selector:
application: kube-ops-view
Expand Down