Skip to content

Commit

Permalink
update: add validation on application and monitoring namespace in DSCI
Browse files Browse the repository at this point in the history
Signed-off-by: Wen Zhou <wenzhou@redhat.com>
  • Loading branch information
zdtsw committed Sep 26, 2024
1 parent 4a53076 commit 848b725
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion apis/dscinitialization/v1/dscinitialization_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ type DSCInitializationSpec struct {
// +kubebuilder:default:=opendatahub
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="ApplicationsNamespace is immutable"
// +operator-sdk:csv:customresourcedefinitions:type=spec,order=1
// +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?)?$"
// +kubebuilder:validation:MaxLength=63
ApplicationsNamespace string `json:"applicationsNamespace"`
// Enable monitoring on specified namespace
// +operator-sdk:csv:customresourcedefinitions:type=spec,order=2
Expand Down Expand Up @@ -68,8 +70,10 @@ type Monitoring struct {
// or if it is installed, the operator will try to remove it.
// +kubebuilder:validation:Enum=Managed;Removed
ManagementState operatorv1.ManagementState `json:"managementState,omitempty"`
// +kubebuilder:default=opendatahub
// Namespace for monitoring if it is enabled
// +kubebuilder:default=opendatahub
// +kubebuilder:validation:Pattern="^([a-z0-9]([-a-z0-9]*[a-z0-9])?)?$"
// +kubebuilder:validation:MaxLength=63
Namespace string `json:"namespace,omitempty"`
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ spec:
default: opendatahub
description: Namespace for applications to be installed, non-configurable,
default to "opendatahub"
maxLength: 63
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?)?$
type: string
x-kubernetes-validations:
- message: ApplicationsNamespace is immutable
Expand Down Expand Up @@ -95,6 +97,8 @@ spec:
namespace:
default: opendatahub
description: Namespace for monitoring if it is enabled
maxLength: 63
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?)?$
type: string
type: object
serviceMesh:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ spec:
default: opendatahub
description: Namespace for applications to be installed, non-configurable,
default to "opendatahub"
maxLength: 63
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?)?$
type: string
x-kubernetes-validations:
- message: ApplicationsNamespace is immutable
Expand Down Expand Up @@ -95,6 +97,8 @@ spec:
namespace:
default: opendatahub
description: Namespace for monitoring if it is enabled
maxLength: 63
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?)?$
type: string
type: object
serviceMesh:
Expand Down
4 changes: 2 additions & 2 deletions docs/api-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ _Appears in:_

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `applicationsNamespace` _string_ | Namespace for applications to be installed, non-configurable, default to "opendatahub" | opendatahub | |
| `applicationsNamespace` _string_ | Namespace for applications to be installed, non-configurable, default to "opendatahub" | opendatahub | MaxLength: 63 <br />Pattern: `^([a-z0-9]([-a-z0-9]*[a-z0-9])?)?$` <br /> |
| `monitoring` _[Monitoring](#monitoring)_ | Enable monitoring on specified namespace | | |
| `serviceMesh` _[ServiceMeshSpec](#servicemeshspec)_ | Configures Service Mesh as networking layer for Data Science Clusters components.<br />The Service Mesh is a mandatory prerequisite for single model serving (KServe) and<br />you should review this configuration if you are planning to use KServe.<br />For other components, it enhances user experience; e.g. it provides unified<br />authentication giving a Single Sign On experience. | | |
| `trustedCABundle` _[TrustedCABundleSpec](#trustedcabundlespec)_ | When set to `Managed`, adds odh-trusted-ca-bundle Configmap to all namespaces that includes<br />cluster-wide Trusted CA Bundle in .data["ca-bundle.crt"].<br />Additionally, this fields allows admins to add custom CA bundles to the configmap using the .CustomCABundle field. | | |
Expand Down Expand Up @@ -686,7 +686,7 @@ _Appears in:_
| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `managementState` _[ManagementState](#managementstate)_ | Set to one of the following values:<br />- "Managed" : the operator is actively managing the component and trying to keep it active.<br /> It will only upgrade the component if it is safe to do so.<br />- "Removed" : the operator is actively managing the component and will not install it,<br /> or if it is installed, the operator will try to remove it. | | Enum: [Managed Removed] <br /> |
| `namespace` _string_ | Namespace for monitoring if it is enabled | opendatahub | |
| `namespace` _string_ | Namespace for monitoring if it is enabled | opendatahub | MaxLength: 63 <br />Pattern: `^([a-z0-9]([-a-z0-9]*[a-z0-9])?)?$` <br /> |


#### TrustedCABundleSpec
Expand Down

0 comments on commit 848b725

Please sign in to comment.