Skip to content

Commit

Permalink
Clean up namespace in Helm and config of values
Browse files Browse the repository at this point in the history
  • Loading branch information
iyannsch committed Dec 3, 2024
1 parent 9951a58 commit dc264f1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ It is a Kubernetes operator that cleans unused workspaces periodically.

## Configuration
The following values can be configured via environment variables:
- `K8S_NAMESPACE`: The namespace in which theia-ide pods are running. Default is `theia-prod`.
- `WORKSPACE_TTL`: The time to live of a workspace. Default is 2 weeks (1209600 000 000 000).
- `CHECK_INTERVAL`: The interval at which the operator checks for unused workspaces. Default is 1 hour (1800 000 000 000).
- `WORKSPACE_TTL`: The time to live of a workspace. Default is 2 weeks (1209600s).
- `CHECK_INTERVAL`: The interval at which the operator checks for unused workspaces. Default is 1 hour (1800s).

## Deployment
`helm upgrade --install theia-workspace-garbage-collector ./helm -f ./helm/values.yaml`
4 changes: 2 additions & 2 deletions helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ spec:
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: K8S_NAMESPACE
value: {{ .Values.env.K8S_NAMESPACE | quote }}
value: {{ .Release.Namespace | quote }}
- name: WORKSPACE_TTL
value: {{ .Values.env.WORKSPACE_TTL | quote}}
value: {{ .Values.env.WORKSPACE_TTL | quote }}
- name: CHECK_INTERVAL
value: {{ .Values.env.CHECK_INTERVAL | quote }}
5 changes: 2 additions & 3 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ serviceAccount:
name: garbage-collector-sa

env:
K8S_NAMESPACE: "theia-prod"
WORKSPACE_TTL: "1209600000000000"
CHECK_INTERVAL: "1800000000000"
WORKSPACE_TTL: "1209600s"
CHECK_INTERVAL: "1800s"
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ func main() {
defer stop()

fmt.Println("Starting garbage collector...")

// Print configuration
fmt.Printf("- Namespace: %s\n", namespace)
fmt.Printf("- Check interval: %s\n", checkInterval)
fmt.Printf("- Workspace TTL: %s\n", getEnv("WORKSPACE_TTL", strconv.FormatInt(int64(14*24*time.Hour), 10)))

// Run garbage collection loop
for {
select {
Expand Down

0 comments on commit dc264f1

Please sign in to comment.