Skip to content

Commit 44ba445

Browse files
committed
Hooking Code-generator tool into make generate.
And including output.
1 parent 58eb93d commit 44ba445

Some content is hidden

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

43 files changed

+2757
-8
lines changed

Makefile

+15-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,21 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust
4949

5050
.PHONY: generate
5151
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
52-
$(CONTROLLER_GEN) object:headerFile="config/boilerplate.go.txt" paths="./..."
52+
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
53+
./hack/update-codegen.sh
54+
55+
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
56+
# Use same code-generator version as k8s.io/api
57+
CODEGEN_VERSION := $(shell go list -m -f '{{.Version}}' k8s.io/api)
58+
CODEGEN = $(shell pwd)/bin/code-generator
59+
CODEGEN_ROOT = $(shell go env GOMODCACHE)/k8s.io/code-generator@$(CODEGEN_VERSION)
60+
.PHONY: code-generator
61+
code-generator:
62+
@GOBIN=$(PROJECT_DIR)/bin GO111MODULE=on go install k8s.io/code-generator/cmd/client-gen@$(CODEGEN_VERSION)
63+
cp -f $(CODEGEN_ROOT)/generate-groups.sh $(PROJECT_DIR)/bin/
64+
cp -f $(CODEGEN_ROOT)/generate-internal-groups.sh $(PROJECT_DIR)/bin/
65+
cp -f $(CODEGEN_ROOT)/kube_codegen.sh $(PROJECT_DIR)/bin/
66+
5367

5468
.PHONY: fmt
5569
fmt: ## Run go fmt against code.

api/v1alpha1/groupversion_info.go

+9
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,18 @@ var (
2828
// GroupVersion is group version used to register these objects
2929
GroupVersion = schema.GroupVersion{Group: "gateway.inference.k8s.io", Version: "v1alpha1"}
3030

31+
// SchemeGroupVersion is alias to GroupVersion for client-go libraries.
32+
// It is required by pkg/client/informers/externalversions/...
33+
SchemeGroupVersion = GroupVersion
34+
3135
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
3236
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
3337

3438
// AddToScheme adds the types in this group-version to the given scheme.
3539
AddToScheme = SchemeBuilder.AddToScheme
3640
)
41+
42+
// Resource is required by pkg/client/listers/...
43+
func Resource(resource string) schema.GroupResource {
44+
return GroupVersion.WithResource(resource).GroupResource()
45+
}

api/v1alpha1/llmserverpool_types.go

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ type LLMServerPoolStatus struct {
4545

4646
// +kubebuilder:object:root=true
4747
// +kubebuilder:subresource:status
48+
// +genclient
4849

4950
// LLMServerPool is the Schema for the llmserverpools API
5051
type LLMServerPool struct {

api/v1alpha1/llmservice_types.go

+1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ type LLMServiceStatus struct {
111111

112112
// +kubebuilder:object:root=true
113113
// +kubebuilder:subresource:status
114+
// +genclient
114115

115116
// LLMService is the Schema for the llmservices API
116117
type LLMService struct {

client-go/applyconfiguration/api/v1alpha1/llmserverpool.go

+224
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client-go/applyconfiguration/api/v1alpha1/llmserverpoolspec.go

+44
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client-go/applyconfiguration/api/v1alpha1/llmserverpoolstatus.go

+56
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)