add examples crd generate file
Signed-off-by: changzhen <changzhen5@huawei.com>
This commit is contained in:
parent
5a025ea3f1
commit
fe010eae28
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,4 @@
|
|||
// Package v1alpha1 is the v1alpha1 version of the API.
|
||||
// +k8s:deepcopy-gen=package,register
|
||||
// +groupName=workload.example.io
|
||||
package v1alpha1
|
|
@ -5,6 +5,10 @@ import (
|
|||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +kubebuilder:subresource:status
|
||||
|
||||
// Workload is a simple Deployment.
|
||||
type Workload struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
// +build !ignore_autogenerated
|
||||
|
||||
// Code generated by deepcopy-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Workload) DeepCopyInto(out *Workload) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
out.Status = in.Status
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Workload.
|
||||
func (in *Workload) DeepCopy() *Workload {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Workload)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Workload) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *WorkloadSpec) DeepCopyInto(out *WorkloadSpec) {
|
||||
*out = *in
|
||||
if in.Replicas != nil {
|
||||
in, out := &in.Replicas, &out.Replicas
|
||||
*out = new(int32)
|
||||
**out = **in
|
||||
}
|
||||
in.Template.DeepCopyInto(&out.Template)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadSpec.
|
||||
func (in *WorkloadSpec) DeepCopy() *WorkloadSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(WorkloadSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *WorkloadStatus) DeepCopyInto(out *WorkloadStatus) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadStatus.
|
||||
func (in *WorkloadStatus) DeepCopy() *WorkloadStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(WorkloadStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
// Code generated by register-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// GroupName specifies the group name used to register the objects.
|
||||
const GroupName = "workload.example.io"
|
||||
|
||||
// GroupVersion specifies the group and the version used to register the objects.
|
||||
var GroupVersion = v1.GroupVersion{Group: GroupName, Version: "v1alpha1"}
|
||||
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
// Deprecated: use GroupVersion instead.
|
||||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
|
||||
|
||||
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||
func Resource(resource string) schema.GroupResource {
|
||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||
}
|
||||
|
||||
var (
|
||||
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
|
||||
SchemeBuilder runtime.SchemeBuilder
|
||||
localSchemeBuilder = &SchemeBuilder
|
||||
// Depreciated: use Install instead
|
||||
AddToScheme = localSchemeBuilder.AddToScheme
|
||||
Install = localSchemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
func init() {
|
||||
// We only register manually written functions here. The registration of the
|
||||
// generated functions takes place in the generated files. The separation
|
||||
// makes the code compile even when the generated files are missing.
|
||||
localSchemeBuilder.Register(addKnownTypes)
|
||||
}
|
||||
|
||||
// Adds the list of known types to Scheme.
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&Workload{},
|
||||
)
|
||||
// AddToGroupVersion allows the serialization of client types like ListOptions.
|
||||
v1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||
return nil
|
||||
}
|
|
@ -38,6 +38,11 @@ deepcopy-gen \
|
|||
--input-dirs=github.com/karmada-io/karmada/pkg/apis/config/v1alpha1 \
|
||||
--output-package=github.com/karmada-io/karmada/pkg/apis/config/v1alpha1 \
|
||||
--output-file-base=zz_generated.deepcopy
|
||||
deepcopy-gen \
|
||||
--go-header-file hack/boilerplate/boilerplate.go.txt \
|
||||
--input-dirs=github.com/karmada-io/karmada/examples/customresourceexplorer/apis/workload/v1alpha1 \
|
||||
--output-package=github.com/karmada-io/karmada/examples/customresourceexplorer/apis/workload/v1alpha1 \
|
||||
--output-file-base=zz_generated.deepcopy
|
||||
|
||||
echo "Generating with register-gen"
|
||||
GO111MODULE=on go install k8s.io/code-generator/cmd/register-gen
|
||||
|
@ -66,6 +71,11 @@ register-gen \
|
|||
--input-dirs=github.com/karmada-io/karmada/pkg/apis/config/v1alpha1 \
|
||||
--output-package=github.com/karmada-io/karmada/pkg/apis/config/v1alpha1 \
|
||||
--output-file-base=zz_generated.register
|
||||
register-gen \
|
||||
--go-header-file hack/boilerplate/boilerplate.go.txt \
|
||||
--input-dirs=github.com/karmada-io/karmada/examples/customresourceexplorer/apis/workload/v1alpha1 \
|
||||
--output-package=github.com/karmada-io/karmada/examples/customresourceexplorer/apis/workload/v1alpha1 \
|
||||
--output-file-base=zz_generated.register
|
||||
|
||||
echo "Generating with client-gen"
|
||||
GO111MODULE=on go install k8s.io/code-generator/cmd/client-gen
|
||||
|
@ -91,3 +101,4 @@ informer-gen \
|
|||
--versioned-clientset-package=github.com/karmada-io/karmada/pkg/generated/clientset/versioned \
|
||||
--listers-package=github.com/karmada-io/karmada/pkg/generated/listers \
|
||||
--output-package=github.com/karmada-io/karmada/pkg/generated/informers
|
||||
|
||||
|
|
|
@ -14,3 +14,4 @@ util::install_tools ${CONTROLLER_GEN_PKG} ${CONTROLLER_GEN_VER} >/dev/null 2>&1
|
|||
|
||||
# Unify the crds used by helm chart and the installation scripts
|
||||
controller-gen crd paths=./pkg/apis/... output:crd:dir=./charts/_crds/bases
|
||||
controller-gen crd paths=./examples/customresourceexplorer/apis/... output:crd:dir=./examples/customresourceexplorer/apis/
|
||||
|
|
Loading…
Reference in New Issue