Skip to content

Commit

Permalink
KEP-2170: Generate CRDs for v2 CRDs
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Iwai <[email protected]>
  • Loading branch information
tenzen-y committed Aug 28, 2024
1 parent ea5272f commit efa6c8d
Show file tree
Hide file tree
Showing 32 changed files with 21,672 additions and 26 deletions.
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ help: ## Display this help.

manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=training-operator webhook paths="./pkg/apis/kubeflow.org/v1/..." \
output:crd:artifacts:config=manifests/base/crds \
output:rbac:artifacts:config=manifests/base/rbac \
output:webhook:artifacts:config=manifests/base/webhook
output:crd:artifacts:config=manifests/base/v1/crds \
output:rbac:artifacts:config=manifests/base/v1/rbac \
output:webhook:artifacts:config=manifests/v1/base/webhook
$(CONTROLLER_GEN) "crd:generateEmbeddedObjectMeta=true" paths="./pkg/apis/kubeflow.org/v2alpha1/..." \
output:crd:artifacts:config=manifests/base/v2alpha1/crds

generate: controller-gen ## Generate apidoc, sdk and code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate/boilerplate.go.txt" paths="./pkg/apis/..."
Expand Down Expand Up @@ -95,10 +97,10 @@ docker-push: ## Push docker image with the manager.
##@ Deployment

install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build manifests/base/crds | kubectl apply -f -
$(KUSTOMIZE) build manifests/base/v1/crds | kubectl apply -f -

uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build manifests/base/crds | kubectl delete -f -
$(KUSTOMIZE) build manifests/base/v1/crds | kubectl delete -f -

deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd manifests/overlays/standalone && $(KUSTOMIZE) edit set image kubeflow/training-operator=${IMG}
Expand Down
10 changes: 0 additions & 10 deletions manifests/base/kustomization.yaml

This file was deleted.

File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions manifests/base/v1/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- crds
- rbac/cluster-role-binding.yaml
- rbac/role.yaml
- rbac/service-account.yaml
- webhook
- service.yaml
- deployment.yaml
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9,275 changes: 9,275 additions & 0 deletions manifests/base/v2alpha1/crds/kubeflow.org_clustertrainingruntimes.yaml

Large diffs are not rendered by default.

9,275 changes: 9,275 additions & 0 deletions manifests/base/v2alpha1/crds/kubeflow.org_trainingruntimes.yaml

Large diffs are not rendered by default.

3,084 changes: 3,084 additions & 0 deletions manifests/base/v2alpha1/crds/kubeflow.org_trainjobs.yaml

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions manifests/base/v2alpha1/crds/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- kubeflow.org_clustertrainingruntimes.yaml
- kubeflow.org_trainingruntimes.yaml
- kubeflow.org_trainjobs.yaml
2 changes: 1 addition & 1 deletion manifests/overlays/kubeflow/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: kubeflow
resources:
- ../../base
- ../../base/v1
- kubeflow-training-roles.yaml
images:
- name: kubeflow/training-operator
Expand Down
2 changes: 1 addition & 1 deletion manifests/overlays/standalone/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: kubeflow
resources:
- ../../base
- ../../base/v1
- namespace.yaml
images:
- name: kubeflow/training-operator
Expand Down
3 changes: 3 additions & 0 deletions pkg/apis/kubeflow.org/v2alpha1/trainingruntime_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import (
)

// +kubebuilder:object:root=true
// +kubebuilder:storageversion
// +kubebuilder:resource:scope=Cluster

// ClusterTrainingRuntime represents a training runtime which can be referenced as part of
// `trainingRuntimeRef` API in TrainJob. This resource is a cluster-scoped and can be referenced
Expand Down Expand Up @@ -51,6 +53,7 @@ type ClusterTrainingRuntimeList struct {
}

// +kubebuilder:object:root=true
// +kubebuilder:storageversion

// TrainingRuntime represents a training runtime which can be referenced as part of
// `trainingRuntimeRef` API in TrainJob. This resource is a namespaced-scoped and can be referenced
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/kubeflow.org/v2alpha1/trainjob_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
// +kubebuilder:printcolumn:name="State",type=string,JSONPath=`.status.conditions[-1:].type`
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`

Expand Down
2 changes: 1 addition & 1 deletion pkg/controller.v1/mpi/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ var _ = BeforeSuite(func() {

By("bootstrapping test environment")
testEnv = &envtest.Environment{
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "manifests", "base", "crds")},
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "manifests", "base", "v1", "crds")},
ErrorIfCRDPathMissing: true,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ var _ = BeforeSuite(func() {

By("bootstrapping test environment")
testEnv = &envtest.Environment{
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "manifests", "base", "crds")},
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "manifests", "base", "v1", "crds")},
ErrorIfCRDPathMissing: true,
WebhookInstallOptions: envtest.WebhookInstallOptions{
Paths: []string{filepath.Join("..", "..", "..", "manifests", "base", "webhook", "manifests.yaml")},
Paths: []string{filepath.Join("..", "..", "..", "manifests", "base", "v1", "webhook", "manifests.yaml")},
},
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/controller.v1/pytorch/pytorchjob_controller_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ var _ = BeforeSuite(func() {

By("bootstrapping test environment")
testEnv = &envtest.Environment{
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "manifests", "base", "crds")},
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "manifests", "base", "v1", "crds")},
ErrorIfCRDPathMissing: true,
WebhookInstallOptions: envtest.WebhookInstallOptions{
Paths: []string{filepath.Join("..", "..", "..", "manifests", "base", "webhook", "manifests.yaml")},
Paths: []string{filepath.Join("..", "..", "..", "manifests", "base", "v1", "webhook", "manifests.yaml")},
},
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/controller.v1/tensorflow/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ var _ = BeforeSuite(func() {

By("bootstrapping test environment")
testEnv = &envtest.Environment{
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "manifests", "base", "crds")},
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "manifests", "base", "v1", "crds")},
ErrorIfCRDPathMissing: true,
WebhookInstallOptions: envtest.WebhookInstallOptions{
Paths: []string{filepath.Join("..", "..", "..", "manifests", "base", "webhook", "manifests.yaml")},
Paths: []string{filepath.Join("..", "..", "..", "manifests", "base", "v1", "webhook", "manifests.yaml")},
},
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/controller.v1/xgboost/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ var _ = BeforeSuite(func() {

By("bootstrapping test environment")
testEnv = &envtest.Environment{
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "manifests", "base", "crds")},
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "manifests", "base", "v1", "crds")},
ErrorIfCRDPathMissing: true,
WebhookInstallOptions: envtest.WebhookInstallOptions{
Paths: []string{filepath.Join("..", "..", "..", "manifests", "base", "webhook", "manifests.yaml")},
Paths: []string{filepath.Join("..", "..", "..", "manifests", "base", "v1", "webhook", "manifests.yaml")},
},
}

Expand Down

0 comments on commit efa6c8d

Please sign in to comment.