Skip to content

Commit

Permalink
ADD ide service account disable service links disable service account…
Browse files Browse the repository at this point in the history
… token automount
  • Loading branch information
wabscale committed Feb 20, 2022
1 parent 4a7b57b commit f98480b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
11 changes: 10 additions & 1 deletion api/anubis/k8s/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,16 @@ def create_pipeline_job_obj(submission: Submission) -> client.V1Job:
"network-policy": "submission-pipeline",
}
),
spec=client.V1PodSpec(restart_policy="Never", containers=[container]),
spec=client.V1PodSpec(
restart_policy="Never",
containers=[container],
# Minimal service account with no extra permissions
service_account_name='theia-ide',
# Disable service information from being injected into the environment
enable_service_links=False,
# Don't mount service account tokens
automount_service_account_token=False,
),
)

# Create the specification of deployment
Expand Down
6 changes: 6 additions & 0 deletions api/anubis/k8s/theia.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,12 @@ def create_theia_k8s_pod_pvc(
containers=pod_containers,
# Add the shared Volume(s)
volumes=pod_volumes,
# Minimal service account with no extra permissions
service_account_name='theia-ide',
# Disable service information from being injected into the environment
enable_service_links=False,
# Don't mount service account tokens
automount_service_account_token=False,
# Add any extra things in the spec (depending on the
# options set for the session)
**spec_extra,
Expand Down
4 changes: 2 additions & 2 deletions k8s/chart/templates/network-policy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ spec:
- 10.0.0.0/8
- 192.168.0.0/16
- 172.16.0.0/12
- 169.254.169.254 # Hosting Provider Metadata IP
- 169.254.169.254/32 # Hosting Provider Metadata IP

---

Expand Down Expand Up @@ -93,7 +93,7 @@ spec:
- 10.0.0.0/8
- 192.168.0.0/16
- 172.16.0.0/12
- 169.254.169.254 # Hosting Provider Metadata IP
- 169.254.169.254/32 # Hosting Provider Metadata IP
- to:
- podSelector:
matchLabels:
Expand Down
14 changes: 14 additions & 0 deletions k8s/chart/templates/theia.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,20 @@ spec:
targetPort: 5000
---

apiVersion: v1
kind: ServiceAccount
metadata:
name: theia-ide
labels:
{{- include "chart.labels" . | nindent 4 }}
component: theia
{{- if .Values.imagePullSecret }}
imagePullSecrets:
- name: {{ .Values.imagePullSecret }}
{{- end }}

---

apiVersion: v1
kind: ServiceAccount
metadata:
Expand Down

0 comments on commit f98480b

Please sign in to comment.