Skip to content

Commit

Permalink
create configmap and mount for the first workbench in NS
Browse files Browse the repository at this point in the history
Signed-off-by: Harshad Reddy Nalla <hnalla@redhat.com>
  • Loading branch information
harshad16 committed Apr 3, 2024
1 parent 5182222 commit 3a24e61
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions components/odh-notebook-controller/controllers/notebook_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,24 @@ func CheckAndMountCACertBundle(ctx context.Context, cli client.Client, notebook
workbenchConfigMap := &corev1.ConfigMap{}
err := cli.Get(ctx, client.ObjectKey{Namespace: notebook.Namespace, Name: workbenchConfigMapName}, workbenchConfigMap)
if err != nil {
log.Info("workbench-trusted-ca-bundle ConfigMap is not present, skipping mounting of certificates.")
return nil
log.Info("workbench-trusted-ca-bundle ConfigMap is not present,start creating..")
// create the ConfigMap if it does not exist
workbenchConfigMap = &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: workbenchConfigMapName,
Namespace: notebook.Namespace,
Labels: map[string]string{"opendatahub.io/managed-by": "workbenches"},
},
Data: map[string]string{
"ca-bundle.crt": odhConfigMap.Data["ca-bundle.crt"],
},
}
err = cli.Create(ctx, workbenchConfigMap)
if err != nil {
log.Info("Failed to create workbench-trusted-ca-bundle ConfigMap")
return nil
}
log.Info("Created workbench-trusted-ca-bundle ConfigMap")
}

cm := workbenchConfigMap
Expand Down

0 comments on commit 3a24e61

Please sign in to comment.