Skip to content

Commit bf1b43a

Browse files
authored
feat(operator): auto generated custom k8s client (#6984)
* wip * k8s generated client * fix: don't overwrite controller-gen deep-copy * generate client before running go vet to pick up compilation errors * go generate not needed * require go mod tidy to download k8s code gen * copyright
1 parent e9e5105 commit bf1b43a

Some content is hidden

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

59 files changed

+2981
-8
lines changed

operator/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ kind-image-load-all: kind-image-load kind-image-load-cli
149149

150150
.PHONY: go-generate
151151
go-generate:
152+
go mod tidy
152153
go generate ./...
153154

154155
##@ Deployment
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
Copyright (c) 2024 Seldon Technologies Ltd.
3+
4+
Use of this software is governed BY
5+
(1) the license included in the LICENSE file or
6+
(2) if the license included in the LICENSE file is the Business Source License 1.1,
7+
the Change License after the Change Date as each is defined in accordance with the LICENSE file.
8+
*/
9+
10+
// +k8s:deepcopy-gen=package
11+
// +groupName=mlops.seldon.io/v1alpha1
12+
13+
package v1alpha1

operator/apis/mlops/v1alpha1/experiment_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ type ExperimentStatus struct {
5959
//+kubebuilder:printcolumn:name="Mirror ready",type=string,JSONPath=`.status.conditions[?(@.type=='MirrorReady')].status`,description="Mirror ready status",priority=1
6060
//+kubebuilder:printcolumn:name="Message",type=string,JSONPath=`.status.conditions[?(@.type=='Ready')].message`,description="Status message"
6161
//+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
62+
//+genclient
63+
//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
6264

6365
// Experiment is the Schema for the experiments API
6466
type Experiment struct {
@@ -70,6 +72,7 @@ type Experiment struct {
7072
}
7173

7274
//+kubebuilder:object:root=true
75+
//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
7376

7477
// ExperimentList contains a list of Experiment
7578
type ExperimentList struct {

operator/apis/mlops/v1alpha1/groupversion_info.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,16 @@ import (
1818
)
1919

2020
var (
21-
// GroupVersion is group version used to register these objects
22-
GroupVersion = schema.GroupVersion{Group: "mlops.seldon.io", Version: "v1alpha1"}
21+
// SchemeGroupVersion is group version used to register these objects
22+
SchemeGroupVersion = schema.GroupVersion{Group: "mlops.seldon.io", Version: "v1alpha1"}
2323

2424
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
25-
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
25+
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
2626

2727
// AddToScheme adds the types in this group-version to the given scheme.
2828
AddToScheme = SchemeBuilder.AddToScheme
2929
)
30+
31+
func Resource(resource string) schema.GroupResource {
32+
return SchemeGroupVersion.WithResource(resource).GroupResource()
33+
}

operator/apis/mlops/v1alpha1/model_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ type ModelStatus struct {
155155
//+kubebuilder:printcolumn:name="Available Replicas",type=integer,JSONPath=`.status.availableReplicas`,description="Number of replicas available to receive inference requests"
156156
//+kubebuilder:printcolumn:name="ModelGw Ready",type=string,JSONPath=`.status.modelgwReady`,description="Model Gateway ready status"
157157
//+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
158+
//+genclient
159+
//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
158160

159161
// Model is the Schema for the models API
160162
type Model struct {
@@ -166,6 +168,7 @@ type Model struct {
166168
}
167169

168170
//+kubebuilder:object:root=true
171+
//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
169172

170173
// ModelList contains a list of Model
171174
type ModelList struct {

operator/apis/mlops/v1alpha1/pipeline_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ import (
2727
//+kubebuilder:printcolumn:name="Dataflow ready",type=string,JSONPath=`.status.conditions[?(@.type=='PipelineReady')].status`,description="Dataflow ready status",priority=1
2828
//+kubebuilder:printcolumn:name="Message",type=string,JSONPath=`.status.conditions[?(@.type=='Ready')].message`,description="Status message"
2929
//+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
30+
//+genclient
31+
//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
3032

3133
// Pipeline is the Schema for the pipelines API
3234
type Pipeline struct {
@@ -38,6 +40,7 @@ type Pipeline struct {
3840
}
3941

4042
//+kubebuilder:object:root=true
43+
//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
4144

4245
// PipelineList contains a list of Pipeline
4346
type PipelineList struct {

operator/apis/mlops/v1alpha1/seldonconfig_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ type SeldonConfigStatus struct {
131131

132132
//+kubebuilder:object:root=true
133133
//+kubebuilder:subresource:status
134+
//+genclient
135+
//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
134136

135137
// SeldonConfig is the Schema for the seldonconfigs API
136138
type SeldonConfig struct {
@@ -142,6 +144,7 @@ type SeldonConfig struct {
142144
}
143145

144146
//+kubebuilder:object:root=true
147+
//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
145148

146149
// SeldonConfigList contains a list of SeldonConfig
147150
type SeldonConfigList struct {

operator/apis/mlops/v1alpha1/seldonruntime_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ type SeldonRuntimeStatus struct {
4444

4545
//+kubebuilder:object:root=true
4646
//+kubebuilder:subresource:status
47+
//+genclient
48+
//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
4749

4850
// SeldonRuntime is the Schema for the seldonruntimes API
4951
type SeldonRuntime struct {
@@ -55,6 +57,7 @@ type SeldonRuntime struct {
5557
}
5658

5759
//+kubebuilder:object:root=true
60+
//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
5861

5962
// SeldonRuntimeList contains a list of SeldonRuntime
6063
type SeldonRuntimeList struct {

operator/apis/mlops/v1alpha1/server_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ type ServerStatus struct {
8282
//+kubebuilder:printcolumn:name="Replicas",type=integer,JSONPath=`.status.replicas`,description="Number of replicas"
8383
//+kubebuilder:printcolumn:name="Loaded Models",type=integer,JSONPath=`.status.loadedModels`,description="Number of loaded models"
8484
//+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
85+
//+genclient
86+
//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
8587

8688
// Server is the Schema for the servers API
8789
type Server struct {
@@ -93,6 +95,7 @@ type Server struct {
9395
}
9496

9597
//+kubebuilder:object:root=true
98+
//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
9699

97100
// ServerList contains a list of Server
98101
type ServerList struct {

operator/apis/mlops/v1alpha1/serverconfig_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ type ServerConfigStatus struct {
4646
//+kubebuilder:object:root=true
4747
//+kubebuilder:subresource:status
4848
//+kubebuilder:resource:shortName=mlc
49+
//+genclient
50+
//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
4951

5052
// ServerConfig is the Schema for the serverconfigs API
5153
type ServerConfig struct {
@@ -57,6 +59,7 @@ type ServerConfig struct {
5759
}
5860

5961
//+kubebuilder:object:root=true
62+
//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
6063

6164
// ServerConfigList contains a list of ServerConfig
6265
type ServerConfigList struct {

0 commit comments

Comments
 (0)