Deal with auto-generated files

Signed-off-by: RainbowMango <renhongcai@huawei.com>
This commit is contained in:
RainbowMango 2021-03-15 15:01:47 +08:00 committed by Hongcai Ren
parent 686b66ecdc
commit a649f6dabe
5 changed files with 123 additions and 78 deletions

View File

@ -83,11 +83,104 @@ spec:
required:
- resource
type: object
status:
description: Status represents the most recently observed status of the
ResourceBinding.
properties:
aggregatedStatus:
description: AggregatedStatus represents status list of the resource
running in each member cluster.
items:
description: AggregatedStatusItem represents status of the resource
running in a member cluster.
properties:
clusterName:
description: ClusterName represents the member cluster name
which the resource deployed on.
type: string
required:
- clusterName
type: object
x-kubernetes-preserve-unknown-fields: true
type: array
conditions:
description: Conditions contain the different condition statuses.
items:
description: "Condition contains details for one aspect of the current
state of this API Resource. --- This struct is intended for direct
use as an array at the field path .status.conditions. For example,
type FooStatus struct{ // Represents the observations of a
foo's current state. // Known .status.conditions.type are:
\"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type
\ // +patchStrategy=merge // +listType=map // +listMapKey=type
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
\n // other fields }"
properties:
lastTransitionTime:
description: lastTransitionTime is the last time the condition
transitioned from one status to another. This should be when
the underlying condition changed. If that is not known, then
using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: message is a human readable message indicating
details about the transition. This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: observedGeneration represents the .metadata.generation
that the condition was set based upon. For instance, if .metadata.generation
is currently 12, but the .status.conditions[x].observedGeneration
is 9, the condition is out of date with respect to the current
state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: reason contains a programmatic identifier indicating
the reason for the condition's last transition. Producers
of specific condition types may define expected values and
meanings for this field, and whether the values are considered
a guaranteed API. The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: status of the condition, one of True, False, Unknown.
enum:
- "True"
- "False"
- Unknown
type: string
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
--- Many .condition.type values are consistent across resources
like Available, but because arbitrary conditions can be useful
(see .node.status.conditions), the ability to deconflict is
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
type: object
required:
- spec
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""

View File

@ -98,49 +98,10 @@ spec:
description: ClusterName represents the member cluster name
which the resource deployed on.
type: string
resourceStatus:
description: ResourceStatus represents the status of the resource.
properties:
deploymentStatus:
description: Deployment represents the deployment status
in the member cluster, only available when the resource
kind is Deployment.
properties:
availableReplicas:
description: Total number of available pods (ready for
at least minReadySeconds) targeted by this deployment.
format: int32
type: integer
readyReplicas:
description: Total number of ready pods targeted by
this deployment.
format: int32
type: integer
replicas:
description: Total number of non-terminated pods targeted
by this deployment (their labels match the selector).
format: int32
type: integer
unavailableReplicas:
description: Total number of unavailable pods targeted
by this deployment. This is the total number of pods
that are still required for the deployment to have
100% available capacity. They may either be pods that
are running but not yet available or pods that still
have not been created.
format: int32
type: integer
updatedReplicas:
description: Total number of non-terminated pods targeted
by this deployment that have the desired template
spec.
format: int32
type: integer
type: object
type: object
required:
- clusterName
type: object
x-kubernetes-preserve-unknown-fields: true
type: array
conditions:
description: Conditions contain the different condition statuses.

View File

@ -12,7 +12,7 @@ import (
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AggregatedStatusItem) DeepCopyInto(out *AggregatedStatusItem) {
*out = *in
in.ResourceStatus.DeepCopyInto(&out.ResourceStatus)
in.Status.DeepCopyInto(&out.Status)
return
}
@ -32,6 +32,7 @@ func (in *ClusterResourceBinding) DeepCopyInto(out *ClusterResourceBinding) {
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
return
}
@ -86,22 +87,6 @@ func (in *ClusterResourceBindingList) DeepCopyObject() runtime.Object {
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DeploymentStatus) DeepCopyInto(out *DeploymentStatus) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentStatus.
func (in *DeploymentStatus) DeepCopy() *DeploymentStatus {
if in == nil {
return nil
}
out := new(DeploymentStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Manifest) DeepCopyInto(out *Manifest) {
*out = *in
@ -282,27 +267,6 @@ func (in *ResourceIdentifier) DeepCopy() *ResourceIdentifier {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ResourceStatus) DeepCopyInto(out *ResourceStatus) {
*out = *in
if in.Deployment != nil {
in, out := &in.Deployment, &out.Deployment
*out = new(DeploymentStatus)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceStatus.
func (in *ResourceStatus) DeepCopy() *ResourceStatus {
if in == nil {
return nil
}
out := new(ResourceStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TargetCluster) DeepCopyInto(out *TargetCluster) {
*out = *in

View File

@ -24,6 +24,7 @@ type ClusterResourceBindingsGetter interface {
type ClusterResourceBindingInterface interface {
Create(ctx context.Context, clusterResourceBinding *v1alpha1.ClusterResourceBinding, opts v1.CreateOptions) (*v1alpha1.ClusterResourceBinding, error)
Update(ctx context.Context, clusterResourceBinding *v1alpha1.ClusterResourceBinding, opts v1.UpdateOptions) (*v1alpha1.ClusterResourceBinding, error)
UpdateStatus(ctx context.Context, clusterResourceBinding *v1alpha1.ClusterResourceBinding, opts v1.UpdateOptions) (*v1alpha1.ClusterResourceBinding, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ClusterResourceBinding, error)
@ -112,6 +113,21 @@ func (c *clusterResourceBindings) Update(ctx context.Context, clusterResourceBin
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *clusterResourceBindings) UpdateStatus(ctx context.Context, clusterResourceBinding *v1alpha1.ClusterResourceBinding, opts v1.UpdateOptions) (result *v1alpha1.ClusterResourceBinding, err error) {
result = &v1alpha1.ClusterResourceBinding{}
err = c.client.Put().
Resource("clusterresourcebindings").
Name(clusterResourceBinding.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(clusterResourceBinding).
Do(ctx).
Into(result)
return
}
// Delete takes name of the clusterResourceBinding and deletes it. Returns an error if one occurs.
func (c *clusterResourceBindings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().

View File

@ -80,6 +80,17 @@ func (c *FakeClusterResourceBindings) Update(ctx context.Context, clusterResourc
return obj.(*v1alpha1.ClusterResourceBinding), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeClusterResourceBindings) UpdateStatus(ctx context.Context, clusterResourceBinding *v1alpha1.ClusterResourceBinding, opts v1.UpdateOptions) (*v1alpha1.ClusterResourceBinding, error) {
obj, err := c.Fake.
Invokes(testing.NewRootUpdateSubresourceAction(clusterresourcebindingsResource, "status", clusterResourceBinding), &v1alpha1.ClusterResourceBinding{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ClusterResourceBinding), err
}
// Delete takes name of the clusterResourceBinding and deletes it. Returns an error if one occurs.
func (c *FakeClusterResourceBindings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.