Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ kind-image-load-all: kind-image-load kind-image-load-cli

.PHONY: go-generate
go-generate:
go mod tidy
go generate ./...

##@ Deployment
Expand Down
13 changes: 13 additions & 0 deletions operator/apis/mlops/v1alpha1/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
Copyright (c) 2024 Seldon Technologies Ltd.

Use of this software is governed BY
(1) the license included in the LICENSE file or
(2) if the license included in the LICENSE file is the Business Source License 1.1,
the Change License after the Change Date as each is defined in accordance with the LICENSE file.
*/

// +k8s:deepcopy-gen=package
// +groupName=mlops.seldon.io/v1alpha1

package v1alpha1
3 changes: 3 additions & 0 deletions operator/apis/mlops/v1alpha1/experiment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ type ExperimentStatus struct {
//+kubebuilder:printcolumn:name="Mirror ready",type=string,JSONPath=`.status.conditions[?(@.type=='MirrorReady')].status`,description="Mirror ready status",priority=1
//+kubebuilder:printcolumn:name="Message",type=string,JSONPath=`.status.conditions[?(@.type=='Ready')].message`,description="Status message"
//+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
//+genclient
//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// Experiment is the Schema for the experiments API
type Experiment struct {
Expand All @@ -70,6 +72,7 @@ type Experiment struct {
}

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

// ExperimentList contains a list of Experiment
type ExperimentList struct {
Expand Down
10 changes: 7 additions & 3 deletions operator/apis/mlops/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ import (
)

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

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

// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)

func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
3 changes: 3 additions & 0 deletions operator/apis/mlops/v1alpha1/model_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ type ModelStatus struct {
//+kubebuilder:printcolumn:name="Available Replicas",type=integer,JSONPath=`.status.availableReplicas`,description="Number of replicas available to receive inference requests"
//+kubebuilder:printcolumn:name="ModelGw Ready",type=string,JSONPath=`.status.modelgwReady`,description="Model Gateway ready status"
//+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
//+genclient
//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// Model is the Schema for the models API
type Model struct {
Expand All @@ -166,6 +168,7 @@ type Model struct {
}

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

// ModelList contains a list of Model
type ModelList struct {
Expand Down
3 changes: 3 additions & 0 deletions operator/apis/mlops/v1alpha1/pipeline_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import (
//+kubebuilder:printcolumn:name="Dataflow ready",type=string,JSONPath=`.status.conditions[?(@.type=='PipelineReady')].status`,description="Dataflow ready status",priority=1
//+kubebuilder:printcolumn:name="Message",type=string,JSONPath=`.status.conditions[?(@.type=='Ready')].message`,description="Status message"
//+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
//+genclient
//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// Pipeline is the Schema for the pipelines API
type Pipeline struct {
Expand All @@ -38,6 +40,7 @@ type Pipeline struct {
}

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

// PipelineList contains a list of Pipeline
type PipelineList struct {
Expand Down
3 changes: 3 additions & 0 deletions operator/apis/mlops/v1alpha1/seldonconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ type SeldonConfigStatus struct {

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

// SeldonConfig is the Schema for the seldonconfigs API
type SeldonConfig struct {
Expand All @@ -142,6 +144,7 @@ type SeldonConfig struct {
}

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

// SeldonConfigList contains a list of SeldonConfig
type SeldonConfigList struct {
Expand Down
3 changes: 3 additions & 0 deletions operator/apis/mlops/v1alpha1/seldonruntime_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ type SeldonRuntimeStatus struct {

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

// SeldonRuntime is the Schema for the seldonruntimes API
type SeldonRuntime struct {
Expand All @@ -55,6 +57,7 @@ type SeldonRuntime struct {
}

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

// SeldonRuntimeList contains a list of SeldonRuntime
type SeldonRuntimeList struct {
Expand Down
3 changes: 3 additions & 0 deletions operator/apis/mlops/v1alpha1/server_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ type ServerStatus struct {
//+kubebuilder:printcolumn:name="Replicas",type=integer,JSONPath=`.status.replicas`,description="Number of replicas"
//+kubebuilder:printcolumn:name="Loaded Models",type=integer,JSONPath=`.status.loadedModels`,description="Number of loaded models"
//+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
//+genclient
//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// Server is the Schema for the servers API
type Server struct {
Expand All @@ -93,6 +95,7 @@ type Server struct {
}

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

// ServerList contains a list of Server
type ServerList struct {
Expand Down
3 changes: 3 additions & 0 deletions operator/apis/mlops/v1alpha1/serverconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ type ServerConfigStatus struct {
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:shortName=mlc
//+genclient
//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// ServerConfig is the Schema for the serverconfigs API
type ServerConfig struct {
Expand All @@ -57,6 +59,7 @@ type ServerConfig struct {
}

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

// ServerConfigList contains a list of ServerConfig
type ServerConfigList struct {
Expand Down
21 changes: 21 additions & 0 deletions operator/gen-k8s-client.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

# Generates custom k8s client in ./pkg/generated/clientset/versioned for our CRs including watchers

set -o errexit
set -o nounset
set -o pipefail

ROOT_DIR="$(pwd)"
MODULE="github.com/seldonio/seldon-core/operator/v2"

CODEGEN_PKG="${CODEGEN_PKG:-$(cd "${ROOT_DIR}" && go list -f '{{.Dir}}' -m k8s.io/code-generator)}"

source "${CODEGEN_PKG}/kube_codegen.sh"

kube::codegen::gen_client \
--with-watch \
--output-dir "${ROOT_DIR}/pkg/generated" \
--output-pkg "${MODULE}/pkg/generated" \
--boilerplate "${ROOT_DIR}/hack/boilerplate.go.txt" \
"${ROOT_DIR}/apis"
11 changes: 7 additions & 4 deletions operator/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ require (
github.com/seldonio/seldon-core/components/tls/v2 v2.9.1
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.6
github.com/stretchr/testify v1.10.0
github.com/tidwall/gjson v1.18.0
go.uber.org/mock v0.4.0
golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c
google.golang.org/grpc v1.73.0
google.golang.org/protobuf v1.36.6
Expand All @@ -40,17 +40,17 @@ require (
github.com/fxamacker/cbor/v2 v2.8.0 // indirect
github.com/google/btree v1.1.3 // indirect
github.com/google/gnostic-models v0.7.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.uber.org/mock v0.4.0 // indirect
go.yaml.in/yaml/v2 v2.4.2 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/mod v0.25.0 // indirect
golang.org/x/sync v0.15.0 // indirect
golang.org/x/tools v0.33.0 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
k8s.io/code-generator v0.33.2 // indirect
k8s.io/gengo/v2 v2.0.0-20250207200755-1244d31929d7 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
)

Expand Down Expand Up @@ -107,7 +107,10 @@ require (
sigs.k8s.io/yaml v1.5.0 // indirect
)

tool go.uber.org/mock/mockgen
tool (
go.uber.org/mock/mockgen
k8s.io/code-generator/cmd/client-gen
)

replace github.com/seldonio/seldon-core/components/tls/v2 => ../components/tls

Expand Down
4 changes: 4 additions & 0 deletions operator/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,11 @@ k8s.io/apimachinery v0.33.2 h1:IHFVhqg59mb8PJWTLi8m1mAoepkUNYmptHsV+Z1m5jY=
k8s.io/apimachinery v0.33.2/go.mod h1:BHW0YOu7n22fFv/JkYOEfkUYNRN0fj0BlvMFWA7b+SM=
k8s.io/client-go v0.33.2 h1:z8CIcc0P581x/J1ZYf4CNzRKxRvQAwoAolYPbtQes+E=
k8s.io/client-go v0.33.2/go.mod h1:9mCgT4wROvL948w6f6ArJNb7yQd7QsvqavDeZHvNmHo=
k8s.io/code-generator v0.33.2 h1:PCJ0Y6viTCxxJHMOyGqYwWEteM4q6y1Hqo2rNpl6jF4=
k8s.io/code-generator v0.33.2/go.mod h1:hBjCA9kPMpjLWwxcr75ReaQfFXY8u+9bEJJ7kRw3J8c=
k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/gengo/v2 v2.0.0-20250207200755-1244d31929d7 h1:2OX19X59HxDprNCVrWi6jb7LW1PoqTlYqEq5H2oetog=
k8s.io/gengo/v2 v2.0.0-20250207200755-1244d31929d7/go.mod h1:EJykeLsmFC60UQbYJezXkEsG2FLrt0GPNkU5iK5GWxU=
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
Expand Down
2 changes: 1 addition & 1 deletion operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Use of this software is governed by
(2) if the license included in the LICENSE file is the Business Source License 1.1,
the Change License after the Change Date as each is defined in accordance with the LICENSE file.
*/

//go:generate ./gen-k8s-client.sh
package main

import (
Expand Down
112 changes: 112 additions & 0 deletions operator/pkg/generated/clientset/versioned/clientset.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading