Skip to content

Commit

Permalink
KEP-2170: Generate clientset, openapi spec for the V2 APIs (#2273)
Browse files Browse the repository at this point in the history
Generate clientset, informers, listers and open api spec
for v2alpha1 APIs.

Signed-off-by: Varsha Prasad Narsing <[email protected]>
  • Loading branch information
varshaprasad96 authored Oct 10, 2024
1 parent cbd4ae7 commit de6c28b
Show file tree
Hide file tree
Showing 74 changed files with 3,217 additions and 50 deletions.
2 changes: 1 addition & 1 deletion hack/boilerplate/boilerplate.go.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 The Kubeflow Authors
// Copyright 2024 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
13 changes: 10 additions & 3 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ chmod +x ${CODEGEN_PKG}/generate-internal-groups.sh
# k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir
# instead of the $GOPATH directly. For normal projects this can be dropped.
cd ${SCRIPT_ROOT}
echo "Generating client,lister,informer for kubeflow.org/v1"
echo "Generating client,lister,informer for kubeflow.org/v1 and kubeflow.org/v2alpha1"
${CODEGEN_PKG}/generate-groups.sh "client,lister,informer" \
github.com/kubeflow/training-operator/pkg/client github.com/kubeflow/training-operator/pkg/apis \
kubeflow.org:v1 \
kubeflow.org:v1,v2alpha1 \
--output-base "${TEMP_DIR}" \
--go-header-file hack/boilerplate/boilerplate.go.txt

Expand All @@ -101,11 +101,18 @@ go build -o openapi-gen ${OPENAPI_PKG}/cmd/openapi-gen

echo "Generating OpenAPI specification for kubeflow.org/v1"
./openapi-gen --input-dirs github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1 \
--report-filename=hack/violation_exception.list \
--report-filename=hack/violation_exception_v1.list \
--output-package github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1 \
--go-header-file hack/boilerplate/boilerplate.go.txt "$@" \
--output-base "${TEMP_DIR}"

echo "Generating OpenAPI specification for kubeflow.org/v2alpha1"
./openapi-gen --input-dirs github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1 \
--report-filename=hack/violation_exception_v2alpha1.list \
--output-package github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1 \
--go-header-file hack/boilerplate/boilerplate.go.txt "$@" \
--output-base "${TEMP_DIR}"

cd - >/dev/null

# Copy everything back.
Expand Down
File renamed without changes.
21 changes: 21 additions & 0 deletions hack/violation_exception_v2alpha1.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,ContainerOverride,Args
API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,ContainerOverride,Command
API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,ContainerOverride,Env
API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,ContainerOverride,EnvFrom
API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,ContainerOverride,VolumeMounts
API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,DatasetConfig,Env
API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,InputModel,Env
API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,OutputModel,Env
API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,PodSpecOverride,Containers
API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,PodSpecOverride,InitContainers
API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,PodSpecOverride,TargetReplicatedJobs
API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,PodSpecOverride,Tolerations
API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,PodSpecOverride,Volumes
API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,TorchElasticPolicy,Metrics
API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,TrainJobSpec,PodSpecOverrides
API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,TrainJobStatus,Conditions
API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,TrainJobStatus,ReplicatedJobsStatus
API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,Trainer,Args
API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,Trainer,Command
API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,Trainer,Env
API rule violation: names_match,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,MPIMLPolicySource,SSHAuthMountPath
1 change: 1 addition & 0 deletions pkg/apis/kubeflow.org/v1/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

// +k8s:defaulter-gen=TypeMeta
// +k8s:openapi-gen=true
// +k8s:deepcopy-gen=package

// Package v1 is the v1 version of the API.
// +groupName=kubeflow.org
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/kubeflow.org/v1/openapi_generated.go

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

2 changes: 1 addition & 1 deletion pkg/apis/kubeflow.org/v1/zz_generated.deepcopy.go

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

2 changes: 1 addition & 1 deletion pkg/apis/kubeflow.org/v1/zz_generated.defaults.go

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

22 changes: 22 additions & 0 deletions pkg/apis/kubeflow.org/v2alpha1/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2024 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// +k8s:defaulter-gen=TypeMeta
// +k8s:openapi-gen=true
// +k8s:deepcopy-gen=package

// Package v2alpha1 is the v2alpha1 version of the API.
// +groupName=kubeflow.org

package v2alpha1
Loading

0 comments on commit de6c28b

Please sign in to comment.