Skip to content

Commit f92af4f

Browse files
committed
Initial NEMO PoC
1 parent b611e37 commit f92af4f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1568
-640
lines changed

PROJECT

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ resources:
2323
- api:
2424
crdVersion: v1
2525
namespaced: true
26-
controller: false
2726
domain: opendatahub.io
2827
group: trustyai
2928
kind: TrustyAIService
@@ -51,4 +50,13 @@ resources:
5150
kind: GuardrailsOrchestrator
5251
path: github.com/trustyai-explainability/trustyai-service-operator/api/gorch/v1alpha1
5352
version: v1alpha1
53+
- api:
54+
crdVersion: v1
55+
namespaced: true
56+
controller: true
57+
domain: opendatahub.io
58+
group: trustyai
59+
kind: NemoGuardrails
60+
path: github.com/trustyai-explainability/trustyai-service-operator/api/v1alpha1
61+
version: v1alpha1
5462
version: "3"

api/common/condition.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package common
2+
3+
import (
4+
corev1 "k8s.io/api/core/v1"
5+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
6+
)
7+
8+
type Condition struct {
9+
Type string `json:"type" description:"type of condition ie. Available|Progressing|Degraded."`
10+
11+
Status corev1.ConditionStatus `json:"status" description:"status of the condition, one of True, False, Unknown"`
12+
13+
// +optional
14+
Reason string `json:"reason,omitempty" description:"one-word CamelCase reason for the condition's last transition"`
15+
16+
// +optional
17+
Message string `json:"message,omitempty" description:"human-readable message indicating details about last transition"`
18+
19+
// +optional
20+
LastTransitionTime metav1.Time `json:"lastTransitionTime" description:"last time the condition transit from one status to another"`
21+
}
22+
23+
// DeepCopyInto copies all properties of this object into another object of the same type.
24+
func (in *Condition) DeepCopyInto(out *Condition) {
25+
*out = *in
26+
in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime)
27+
}

api/gorch/v1alpha1/guardrailsorchestrator_types.go

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ limitations under the License.
1717
package v1alpha1
1818

1919
import (
20-
corev1 "k8s.io/api/core/v1"
21-
20+
"github.com/trustyai-explainability/trustyai-service-operator/api/common"
2221
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2322
)
2423

@@ -32,7 +31,7 @@ type GuardrailsOrchestratorSpec struct {
3231

3332
// Number of replicas
3433
Replicas int32 `json:"replicas"`
35-
// Name of configmap containing generator,detector,and chunker arguments
34+
// Name of configmap containing generator, detector, and chunker arguments
3635
OrchestratorConfig *string `json:"orchestratorConfig"`
3736
// Boolean flag to enable/disable built-in detectors
3837
// +optional
@@ -73,29 +72,12 @@ type OtelExporter struct {
7372
OTLPExport string `json:"otlpExport,omitempty"`
7473
}
7574

76-
type ConditionType string
77-
78-
type Condition struct {
79-
Type ConditionType `json:"type" description:"type of condition ie. Available|Progressing|Degraded."`
80-
81-
Status corev1.ConditionStatus `json:"status" description:"status of the condition, one of True, False, Unknown"`
82-
83-
// +optional
84-
Reason string `json:"reason,omitempty" description:"one-word CamelCase reason for the condition's last transition"`
85-
86-
// +optional
87-
Message string `json:"message,omitempty" description:"human-readable message indicating details about last transition"`
88-
89-
// +optional
90-
LastTransitionTime metav1.Time `json:"lastTransitionTime" description:"last time the condition transit from one status to another"`
91-
}
92-
9375
type GuardrailsOrchestratorStatus struct {
9476
Phase string `json:"phase,omitempty"`
9577

9678
// Conditions describes the state of the GuardrailsOrchestrator resource.
9779
// +optional
98-
Conditions []Condition `json:"conditions,omitempty"`
80+
Conditions []common.Condition `json:"conditions,omitempty"`
9981
}
10082

10183
// +kubebuilder:object:root=true

api/gorch/v1alpha1/zz_generated.deepcopy.go

Lines changed: 2 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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 contains API Schema definitions for the trustyai v1alpha1 API group
18+
// +kubebuilder:object:generate=true
19+
// +groupName=trustyai.opendatahub.io
20+
package v1alpha1
21+
22+
import (
23+
"k8s.io/apimachinery/pkg/runtime/schema"
24+
"sigs.k8s.io/controller-runtime/pkg/scheme"
25+
)
26+
27+
var (
28+
// GroupVersion is group version used to register these objects
29+
GroupVersion = schema.GroupVersion{Group: "trustyai.opendatahub.io", Version: "v1alpha1"}
30+
31+
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
32+
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
33+
34+
// AddToScheme adds the types in this group-version to the given scheme.
35+
AddToScheme = SchemeBuilder.AddToScheme
36+
)
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22+
)
23+
24+
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
25+
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
26+
27+
// NemoGuardrailsSpec defines the desired state of NemoGuardrails
28+
type NemoGuardrailsSpec struct {
29+
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
30+
// Important: Run "make" to regenerate code after modifying this file
31+
32+
// NemoConfig should be the name of the configmap containing the NeMO server configuration
33+
NemoConfig string `json:"nemoConfig,omitempty"`
34+
}
35+
36+
// NemoGuardrailStatus defines the observed state of NemoGuardrails
37+
type NemoGuardrailStatus struct {
38+
Phase string `json:"phase,omitempty"`
39+
40+
// Conditions describes the state of the NemoGuardrails resource.
41+
// +optional
42+
Conditions []common.Condition `json:"conditions,omitempty"`
43+
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
44+
// Important: Run "make" to regenerate code after modifying this file
45+
}
46+
47+
//+kubebuilder:object:root=true
48+
//+kubebuilder:subresource:status
49+
50+
// NemoGuardrails is the Schema for the nemoguardrails API
51+
type NemoGuardrails struct {
52+
metav1.TypeMeta `json:",inline"`
53+
metav1.ObjectMeta `json:"metadata,omitempty"`
54+
55+
Spec NemoGuardrailsSpec `json:"spec,omitempty"`
56+
Status NemoGuardrailStatus `json:"status,omitempty"`
57+
}
58+
59+
//+kubebuilder:object:root=true
60+
61+
// NemoGuardrailsList contains a list of NemoGuardrails
62+
type NemoGuardrailsList struct {
63+
metav1.TypeMeta `json:",inline"`
64+
metav1.ListMeta `json:"metadata,omitempty"`
65+
Items []NemoGuardrails `json:"items"`
66+
}
67+
68+
func init() {
69+
SchemeBuilder.Register(&NemoGuardrails{}, &NemoGuardrailsList{})
70+
}

api/nemo/v1alpha1/zz_generated.deepcopy.go

Lines changed: 122 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)