From 46aaf41835527d72041bb3acf14ececa1813f6a1 Mon Sep 17 00:00:00 2001 From: Dhiraj Bokde Date: Thu, 12 Sep 2024 12:56:03 -0700 Subject: [PATCH] fix: cleanup optional properties, fixes RHOAIENG-12838 --- api/v1alpha1/modelregistry_types.go | 17 ++++++++++------- ...registry.opendatahub.io_modelregistries.yaml | 17 ++++++----------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/api/v1alpha1/modelregistry_types.go b/api/v1alpha1/modelregistry_types.go index 724d625..627e8d3 100644 --- a/api/v1alpha1/modelregistry_types.go +++ b/api/v1alpha1/modelregistry_types.go @@ -186,7 +186,7 @@ type TLSServerSettings struct { // ISTIO_MUTUAL: Secure connections from the downstream using mutual TLS by presenting server certificates for authentication. Compared to Mutual mode, this mode uses certificates, representing gateway workload identity, generated automatically by Istio for mTLS authentication. When this mode is used, all other TLS fields should be empty. // // OPTIONAL_MUTUAL: Similar to MUTUAL mode, except that the client certificate is optional. Unlike SIMPLE mode, A client certificate will still be explicitly requested during handshake, but the client is not required to send a certificate. If a client certificate is presented, it will be validated. ca_certificates should be specified for validating client certificates. - Mode string `json:"mode"` + Mode string `json:"mode,omitempty"` // The name of the secret that holds the TLS certs including the CA certificates. // If not provided, it is set automatically using model registry operator env variable DEFAULT_CERT. @@ -249,16 +249,19 @@ type GatewayConfig struct { } type IstioConfig struct { - //+kubebuilder:required // Authorino authentication provider name - AuthProvider string `json:"authProvider"` + // + // If missing, it is set using the operator environment property DEFAULT_AUTH_PROVIDER + // Model registry will have an error status if the operator property is also missing + AuthProvider string `json:"authProvider,omitempty"` - // Authorino AuthConfig selector labels + // Authorino AuthConfig selector labels. + // + // If missing, it is set using the operator environment property DEFAULT_AUTH_CONFIG_LABELS //+optional AuthConfigLabels map[string]string `json:"authConfigLabels,omitempty"` - //+kubebuilder:required //+kubebuilder:default=ISTIO_MUTUAL //+kubebuilder:Enum=DISABLE;SIMPLE;MUTUAL;ISTIO_MUTUAL @@ -336,10 +339,10 @@ type ModelRegistryStatus struct { // Hosts where model registry services are available // NOTE: Gateway service names are different for gRPC and REST service routes - Hosts []string `json:"hosts"` + Hosts []string `json:"hosts,omitempty"` // Formatted Host names separated by comma - HostsStr string `json:"hostsStr"` + HostsStr string `json:"hostsStr,omitempty"` Conditions []metav1.Condition `json:"conditions,omitempty"` } diff --git a/config/crd/bases/modelregistry.opendatahub.io_modelregistries.yaml b/config/crd/bases/modelregistry.opendatahub.io_modelregistries.yaml index b1db282..ff9f677 100644 --- a/config/crd/bases/modelregistry.opendatahub.io_modelregistries.yaml +++ b/config/crd/bases/modelregistry.opendatahub.io_modelregistries.yaml @@ -148,10 +148,14 @@ spec: authConfigLabels: additionalProperties: type: string - description: Authorino AuthConfig selector labels + description: "Authorino AuthConfig selector labels. \n If missing, + it is set using the operator environment property DEFAULT_AUTH_CONFIG_LABELS" type: object authProvider: - description: Authorino authentication provider name + description: "Authorino authentication provider name \n If missing, + it is set using the operator environment property DEFAULT_AUTH_PROVIDER + Model registry will have an error status if the operator property + is also missing" type: string gateway: description: Optional Istio Gateway for registry services. Gateway @@ -239,8 +243,6 @@ spec: - ISTIO_MUTUAL - OPTIONAL_MUTUAL type: string - required: - - mode type: object type: object istioIngress: @@ -320,8 +322,6 @@ spec: - ISTIO_MUTUAL - OPTIONAL_MUTUAL type: string - required: - - mode type: object type: object required: @@ -341,8 +341,6 @@ spec: for mTLS authentication. When this mode is used, all other fields in `ClientTLSSettings` should be empty." type: string - required: - - authProvider type: object mysql: description: MySQL configuration options @@ -721,9 +719,6 @@ spec: hostsStr: description: Formatted Host names separated by comma type: string - required: - - hosts - - hostsStr type: object type: object served: true