Coverage for ocp_resources/dsc_initialization.py: 0%

27 statements  

« prev     ^ index     » next       coverage.py v7.6.10, created at 2025-01-30 10:48 +0200

1# Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/scripts/resource/README.md 

2 

3from typing import Any, Dict, Optional 

4from ocp_resources.resource import Resource, MissingRequiredArgumentError 

5 

6 

7class DSCInitialization(Resource): 

8 """ 

9 DSCInitialization is the Schema for the dscinitializations API. 

10 """ 

11 

12 api_group: str = Resource.ApiGroup.DSCINITIALIZATION_OPENDATAHUB_IO 

13 

14 def __init__( 

15 self, 

16 applications_namespace: Optional[str] = "", 

17 dev_flags: Optional[Dict[str, Any]] = None, 

18 monitoring: Optional[Dict[str, Any]] = None, 

19 service_mesh: Optional[Dict[str, Any]] = None, 

20 trusted_ca_bundle: Optional[Dict[str, Any]] = None, 

21 **kwargs: Any, 

22 ) -> None: 

23 """ 

24 Args: 

25 applications_namespace (str): Namespace for applications to be installed, non-configurable, default 

26 to "redhat-ods-applications" 

27 

28 dev_flags (Dict[str, Any]): Internal development useful field to test customizations. This is not 

29 recommended to be used in production environment. 

30 

31 monitoring (Dict[str, Any]): Enable monitoring on specified namespace 

32 

33 service_mesh (Dict[str, Any]): Configures Service Mesh as networking layer for Data Science Clusters 

34 components. The Service Mesh is a mandatory prerequisite for 

35 single model serving (KServe) and you should review this 

36 configuration if you are planning to use KServe. For other 

37 components, it enhances user experience; e.g. it provides unified 

38 authentication giving a Single Sign On experience. 

39 

40 trusted_ca_bundle (Dict[str, Any]): When set to `Managed`, adds odh-trusted-ca-bundle Configmap to all 

41 namespaces that includes cluster-wide Trusted CA Bundle in 

42 .data["ca-bundle.crt"]. Additionally, this fields allows admins to 

43 add custom CA bundles to the configmap using the .CustomCABundle 

44 field. 

45 

46 """ 

47 super().__init__(**kwargs) 

48 

49 self.applications_namespace = applications_namespace 

50 self.dev_flags = dev_flags 

51 self.monitoring = monitoring 

52 self.service_mesh = service_mesh 

53 self.trusted_ca_bundle = trusted_ca_bundle 

54 

55 def to_dict(self) -> None: 

56 super().to_dict() 

57 

58 if not self.kind_dict and not self.yaml_file: 

59 if not self.applications_namespace: 

60 raise MissingRequiredArgumentError(argument="self.applications_namespace") 

61 

62 self.res["spec"] = {} 

63 _spec = self.res["spec"] 

64 

65 _spec["applicationsNamespace"] = self.applications_namespace 

66 

67 if self.dev_flags: 

68 _spec["devFlags"] = self.dev_flags 

69 

70 if self.monitoring: 

71 _spec["monitoring"] = self.monitoring 

72 

73 if self.service_mesh: 

74 _spec["serviceMesh"] = self.service_mesh 

75 

76 if self.trusted_ca_bundle: 

77 _spec["trustedCABundle"] = self.trusted_ca_bundle 

78 

79 # End of generated code