@@ -93,6 +93,44 @@ func createNotebook(test Test, namespace *corev1.Namespace, notebookUserToken, j
93
93
test .Expect (err ).NotTo (gomega .HaveOccurred ())
94
94
}
95
95
96
+ func createNotebookWithPvc (test Test , namespace * corev1.Namespace , notebookUserToken , jupyterNotebookConfigMapName , jupyterNotebookConfigMapFileName string , numGpus int ) {
97
+ // Create PVC for Notebook
98
+ notebookPVC := CreatePersistentVolumeClaim (test , namespace .Name , "10Gi" , corev1 .ReadWriteOnce )
99
+ s3BucketName , _ := GetStorageBucketName ()
100
+ s3AccessKeyId , _ := GetStorageBucketAccessKeyId ()
101
+ s3SecretAccessKey , _ := GetStorageBucketSecretKey ()
102
+
103
+ // Read the Notebook CR from resources and perform replacements for custom values using go template
104
+ notebookProps := NotebookProps {
105
+ IngressDomain : GetOpenShiftIngressDomain (test ),
106
+ OpenShiftApiUrl : GetOpenShiftApiUrl (test ),
107
+ KubernetesUserBearerToken : notebookUserToken ,
108
+ Namespace : namespace .Name ,
109
+ OpenDataHubNamespace : GetOpenDataHubNamespace (test ),
110
+ RayImage : GetRayImage (),
111
+ NotebookImage : GetNotebookImage (test ),
112
+ NotebookConfigMapName : jupyterNotebookConfigMapName ,
113
+ NotebookConfigMapFileName : jupyterNotebookConfigMapFileName ,
114
+ NotebookPVC : notebookPVC .Name ,
115
+ NumGpus : numGpus ,
116
+ S3BucketName : s3BucketName ,
117
+ S3AccessKeyId : s3AccessKeyId ,
118
+ S3SecretAccessKey : s3SecretAccessKey ,
119
+ S3DefaultRegion : GetS3DefaultRegion (),
120
+ }
121
+ notebookTemplate , err := files .ReadFile ("resources/custom-nb-small.yaml" )
122
+ test .Expect (err ).NotTo (gomega .HaveOccurred ())
123
+
124
+ parsedNotebookTemplate := ParseTemplate (test , notebookTemplate , notebookProps )
125
+
126
+ // Create Notebook CR
127
+ notebookCR := & unstructured.Unstructured {}
128
+ err = yaml .NewYAMLOrJSONDecoder (bytes .NewBuffer (parsedNotebookTemplate ), 8192 ).Decode (notebookCR )
129
+ test .Expect (err ).NotTo (gomega .HaveOccurred ())
130
+ _ , err = test .Client ().Dynamic ().Resource (notebookResource ).Namespace (namespace .Name ).Create (test .Ctx (), notebookCR , metav1.CreateOptions {})
131
+ test .Expect (err ).NotTo (gomega .HaveOccurred ())
132
+ }
133
+
96
134
func deleteNotebook (test Test , namespace * corev1.Namespace ) {
97
135
err := test .Client ().Dynamic ().Resource (notebookResource ).Namespace (namespace .Name ).Delete (test .Ctx (), "jupyter-nb-kube-3aadmin" , metav1.DeleteOptions {})
98
136
test .Expect (err ).NotTo (gomega .HaveOccurred ())
0 commit comments