|
| 1 | +/* |
| 2 | +Copyright 2023. |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +package v1alpha1 |
| 18 | + |
| 19 | +import ( |
| 20 | + "github.com/trustyai-explainability/trustyai-service-operator/api/common" |
| 21 | + corev1 "k8s.io/api/core/v1" |
| 22 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 23 | +) |
| 24 | + |
| 25 | +// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! |
| 26 | +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. |
| 27 | + |
| 28 | +// NemoGuardrailsSpec defines the desired state of NemoGuardrails |
| 29 | +type NemoGuardrailsSpec struct { |
| 30 | + // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster |
| 31 | + // Important: Run "make" to regenerate code after modifying this file |
| 32 | + |
| 33 | + // NemoConfig should be the name of the configmap containing the NeMO server configuration |
| 34 | + NemoConfig string `json:"nemoConfig,omitempty"` |
| 35 | + CABundleConfig *common.CABundleConfig `json:"caBundleConfig,omitempty"` |
| 36 | + // Define Env information for the main container |
| 37 | + // +optional |
| 38 | + Env []corev1.EnvVar `json:"env,omitempty"` |
| 39 | +} |
| 40 | + |
| 41 | +type CAStatus struct { |
| 42 | + ODHTrustedCAFound bool `json:"odhTrustedCAFound"` |
| 43 | + ODHTrustedCAError string `json:"odhTrustedCAError,omitempty"` |
| 44 | + OpenshiftServingCAFound bool `json:"openshiftServingCAFound"` |
| 45 | + OpenshiftServingCAError string `json:"openshiftServingCAError,omitempty"` |
| 46 | + UserCAFound bool `json:"userCAFound,omitempty"` |
| 47 | + UserCAError string `json:"userCAError,omitempty"` |
| 48 | +} |
| 49 | + |
| 50 | +// NemoGuardrailStatus defines the observed state of NemoGuardrails |
| 51 | +type NemoGuardrailStatus struct { |
| 52 | + Phase string `json:"phase,omitempty"` |
| 53 | + |
| 54 | + // Conditions describes the state of the NemoGuardrails resource. |
| 55 | + // +optional |
| 56 | + Conditions []common.Condition `json:"conditions,omitempty"` |
| 57 | + // CA describes the status of the CA configmaps |
| 58 | + // +optional |
| 59 | + CA *CAStatus `json:"ca,omitempty"` |
| 60 | + // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster |
| 61 | + // Important: Run "make" to regenerate code after modifying this file |
| 62 | +} |
| 63 | + |
| 64 | +//+kubebuilder:object:root=true |
| 65 | +//+kubebuilder:subresource:status |
| 66 | + |
| 67 | +// NemoGuardrails is the Schema for the nemoguardrails API |
| 68 | +type NemoGuardrails struct { |
| 69 | + metav1.TypeMeta `json:",inline"` |
| 70 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 71 | + |
| 72 | + Spec NemoGuardrailsSpec `json:"spec,omitempty"` |
| 73 | + Status NemoGuardrailStatus `json:"status,omitempty"` |
| 74 | +} |
| 75 | + |
| 76 | +//+kubebuilder:object:root=true |
| 77 | + |
| 78 | +// NemoGuardrailsList contains a list of NemoGuardrails |
| 79 | +type NemoGuardrailsList struct { |
| 80 | + metav1.TypeMeta `json:",inline"` |
| 81 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 82 | + Items []NemoGuardrails `json:"items"` |
| 83 | +} |
| 84 | + |
| 85 | +func init() { |
| 86 | + SchemeBuilder.Register(&NemoGuardrails{}, &NemoGuardrailsList{}) |
| 87 | +} |
0 commit comments