Skip to content

Commit 03d3f3e

Browse files
Merge pull request #25 from NVIDIA/add_clientsets
Add clientsets for NIM operator APIs
2 parents 969e5be + d0cbe14 commit 03d3f3e

Some content is hidden

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

53 files changed

+2302
-32
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,10 @@ updates:
4242
directory: "/deployments/devel"
4343
schedule:
4444
interval: "daily"
45+
46+
- package-ecosystem: "gomod"
47+
target-branch: main
48+
directory: "tools/"
49+
schedule:
50+
interval: "weekly"
51+
day: "sunday"

Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ IMG ?= nvcr.io/nvidia/cloud-native/nim-operator:v0.1.0
1717
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
1818
ENVTEST_K8S_VERSION = 1.30.0
1919

20+
GO_CMD ?= go
21+
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
22+
2023
# Import versions
2124
include $(CURDIR)/versions.mk
2225

@@ -33,6 +36,8 @@ endif
3336
# tools. (i.e. podman)
3437
CONTAINER_TOOL ?= docker
3538

39+
CLIENT_GEN = $(shell pwd)/bin/client-gen
40+
3641
# DEFAULT_CHANNEL defines the default channel used in the bundle.
3742
# Add a new line here if you would like to change its default config. (E.g DEFAULT_CHANNEL = "stable")
3843
# To re-generate a bundle for any other default channel without changing the default setup, you can:
@@ -82,6 +87,19 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust
8287
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
8388
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
8489

90+
.PHONY: generate-clientset
91+
generate-clientset: install-tools
92+
$(CLIENT_GEN) --go-header-file=$(CURDIR)/hack/boilerplate.go.txt \
93+
--clientset-name "versioned" \
94+
--output-dir $(CURDIR)/api \
95+
--output-pkg $(MODULE)/api \
96+
--input-base $(CURDIR)/api \
97+
--input "apps/v1alpha1"
98+
99+
validate-generated-assets: manifests generate generate-clientset
100+
@echo "- Verifying that the generated code and manifests are in-sync..."
101+
@git diff --exit-code -- api config
102+
85103
.PHONY: fmt
86104
fmt: ## Run go fmt against code.
87105
go fmt ./...
@@ -171,6 +189,11 @@ deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in
171189
undeploy: kustomize ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
172190
$(KUSTOMIZE) build config/default | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
173191

192+
install-tools:
193+
@echo Installing tools from tools.go
194+
export GOBIN=$(PROJECT_DIR)/bin && \
195+
grep '^\s*_' tools/tools.go | awk '{print $$2}' | xargs -tI % $(GO_CMD) install -mod=readonly -modfile=tools/go.mod %
196+
174197
##@ Dependencies
175198

176199
## Location to install dependencies to

PROJECT

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ resources:
1515
domain: nvidia.com
1616
group: apps
1717
kind: NIMService
18-
path: github.com/NVIDIA/k8s-nim-operator/api/v1alpha1
18+
path: github.com/NVIDIA/k8s-nim-operator/api/apps/v1alpha1
1919
version: v1alpha1
2020
- api:
2121
crdVersion: v1
@@ -24,7 +24,7 @@ resources:
2424
domain: nvidia.com
2525
group: apps
2626
kind: NIMCache
27-
path: github.com/NVIDIA/k8s-nim-operator/api/v1alpha1
27+
path: github.com/NVIDIA/k8s-nim-operator/api/apps/v1alpha1
2828
version: v1alpha1
2929
- api:
3030
crdVersion: v1
@@ -33,6 +33,6 @@ resources:
3333
domain: nvidia.com
3434
group: apps
3535
kind: NIMPipeline
36-
path: github.com/NVIDIA/k8s-nim-operator/api/v1alpha1
36+
path: github.com/NVIDIA/k8s-nim-operator/api/apps/v1alpha1
3737
version: v1alpha1
3838
version: "3"
File renamed without changes.

api/v1alpha1/groupversion_info.go renamed to api/apps/v1alpha1/groupversion_info.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ import (
2525
)
2626

2727
var (
28-
// GroupVersion is group version used to register these objects
29-
GroupVersion = schema.GroupVersion{Group: "apps.nvidia.com", Version: "v1alpha1"}
28+
// SchemeGroupVersion is group version used to register these objects
29+
SchemeGroupVersion = schema.GroupVersion{Group: "apps.nvidia.com", Version: "v1alpha1"}
3030

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

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

api/v1alpha1/nimcache_types.go renamed to api/apps/v1alpha1/nimcache_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ func (s *NIMSource) EnvFromSecrets() []v1.EnvFromSource {
211211
return []corev1.EnvFromSource{}
212212
}
213213

214+
// +genclient
214215
// +kubebuilder:object:root=true
215216
// +kubebuilder:subresource:status
216217
// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.state`,priority=0

api/v1alpha1/nimpipeline_types.go renamed to api/apps/v1alpha1/nimpipeline_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ type NIMPipelineStatus struct {
4747
State string `json:"state,omitempty"`
4848
}
4949

50+
// +genclient
5051
// +kubebuilder:object:root=true
5152
// +kubebuilder:subresource:status
5253

api/v1alpha1/nimservice_types.go renamed to api/apps/v1alpha1/nimservice_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ type NIMServiceStatus struct {
9090
State string `json:"state,omitempty"`
9191
}
9292

93+
// +genclient
9394
// +kubebuilder:object:root=true
9495
// +kubebuilder:subresource:status
9596
// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.state`,priority=0

api/versioned/clientset.go

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

api/versioned/fake/clientset_generated.go

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

api/versioned/fake/doc.go

Lines changed: 19 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)