From 97411bb2743c531c3560b848ba3a826d70a4d4d6 Mon Sep 17 00:00:00 2001
From: Tim Kreuzer <t.kreuzer@fz-juelich.de>
Date: Fri, 7 Feb 2025 11:54:12 +0100
Subject: [PATCH] create JupyterHub Outpost 1.0.7

---
 charts/jupyterhub-outpost/Chart.yaml          |  2 +-
 charts/jupyterhub-outpost/README.md           | 17 +++++++++++++++++
 charts/jupyterhub-outpost/templates/rbac.yaml |  4 ++--
 3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/charts/jupyterhub-outpost/Chart.yaml b/charts/jupyterhub-outpost/Chart.yaml
index 487c92c..9bf530b 100644
--- a/charts/jupyterhub-outpost/Chart.yaml
+++ b/charts/jupyterhub-outpost/Chart.yaml
@@ -17,7 +17,7 @@ type: application
 # This is the chart version. This version number should be incremented each time you make changes
 # to the chart and its templates, including the app version.
 # Versions are expected to follow Semantic Versioning (https://semver.org/)
-version: 1.0.6
+version: 1.0.7
 
 # This is the version number of the application being deployed. This version number should be
 # incremented each time you make changes to the application. Versions are not expected to
diff --git a/charts/jupyterhub-outpost/README.md b/charts/jupyterhub-outpost/README.md
index e5ead55..4139ebd 100644
--- a/charts/jupyterhub-outpost/README.md
+++ b/charts/jupyterhub-outpost/README.md
@@ -116,6 +116,23 @@ extraEnvVarsSecrets:
 ```
  
 ### CHANGELOG
+#### 1.0.7
+- Add permission to delete events. Allows for cleaner spawning events when using KubeSpawner.
+  Example Configuration:
+  ```
+  def delete_previous_events(spawner):
+      config.load_incluster_config()
+      v1 = client.CoreV1Api()
+      events = v1.list_namespaced_event(namespace=spawner.namespace, field_selector=f"involvedObject.name={spawner.pod_name}")
+      for event in events.items:
+          name = event.metadata.name
+          if name:
+              v1.delete_namespaced_event(name=name, namespace=spawner.namespace)
+
+  async def pre_spawn_hook(spawner):
+      delete_previous_events(spawner)
+  ```
+
 #### 1.0.6
 - using `jupyterjsc/jupyterhub-outpost:1.0.5` as default image, fixes async calls
 
diff --git a/charts/jupyterhub-outpost/templates/rbac.yaml b/charts/jupyterhub-outpost/templates/rbac.yaml
index ec3e241..bc87517 100644
--- a/charts/jupyterhub-outpost/templates/rbac.yaml
+++ b/charts/jupyterhub-outpost/templates/rbac.yaml
@@ -37,7 +37,7 @@ rules:
     verbs: ["get", "watch", "list", "create", "delete"]
   - apiGroups: [""]       # "" indicates the core API group
     resources: ["events"]
-    verbs: ["get", "watch", "list"]
+    verbs: ["get", "watch", "list", "delete"]
 ---
 kind: RoleBinding
 apiVersion: rbac.authorization.k8s.io/v1
@@ -52,4 +52,4 @@ subjects:
 roleRef:
   kind: Role
   name: {{ include "jupyterhub-outpost.fullname" . }}
-  apiGroup: rbac.authorization.k8s.io
\ No newline at end of file
+  apiGroup: rbac.authorization.k8s.io
-- 
GitLab