Skip to content

Commit e34d9c5

Browse files
authored
Add Kubeflow Notebook CR (#2331)
* Add Kubeflow Notebook CR * squash! additional manual edits as needed
1 parent c9865b1 commit e34d9c5

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

ocp_resources/notebook.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/scripts/resource/README.md
2+
3+
from __future__ import annotations
4+
5+
from typing import Any
6+
from ocp_resources.resource import NamespacedResource
7+
8+
9+
class Notebook(NamespacedResource):
10+
"""Notebook is the CR for Kubeflow Notebooks 1.x (and OpenShift AI Workbenches)."""
11+
12+
api_group: str = NamespacedResource.ApiGroup.KUBEFLOW_ORG
13+
14+
def __init__(
15+
self,
16+
template: dict[str, Any] | None = None,
17+
**kwargs: Any,
18+
) -> None:
19+
"""
20+
Args:
21+
template (dict[str, Any]): Pod template for the notebook pod.
22+
"""
23+
super().__init__(**kwargs)
24+
25+
self.template = template
26+
27+
def to_dict(self) -> None:
28+
super().to_dict()
29+
30+
if not self.kind_dict and not self.yaml_file:
31+
self.res["spec"] = {}
32+
_spec = self.res["spec"]
33+
34+
if self.template is not None:
35+
_spec["template"] = self.template
36+
37+
# End of generated code

ocp_resources/resource.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ class ApiGroup:
345345
K8S_MARIADB_COM: str = "k8s.mariadb.com"
346346
K8S_OVN_ORG: str = "k8s.ovn.org"
347347
K8S_V1_CNI_CNCF_IO: str = "k8s.v1.cni.cncf.io"
348+
KUBEFLOW_ORG: str = "kubeflow.org"
348349
KUBERNETES_IO: str = "kubernetes.io"
349350
KUBEVIRT_IO: str = "kubevirt.io"
350351
KUBEVIRT_KUBEVIRT_IO: str = "kubevirt.kubevirt.io"

0 commit comments

Comments
 (0)