Merge pull request #462 from vincent-pli/extend-cluster-status
Extend cluster.status.APIEnablements.Resources to struct with Kind
This commit is contained in:
commit
c053b6c8b3
|
@ -149,9 +149,22 @@ spec:
|
||||||
is for.
|
is for.
|
||||||
type: string
|
type: string
|
||||||
resources:
|
resources:
|
||||||
description: Resources contains the name of the resources.
|
description: Resources is a list of APIResource.
|
||||||
items:
|
items:
|
||||||
|
description: APIResource specifies the name and kind names
|
||||||
|
for the resource.
|
||||||
|
properties:
|
||||||
|
kind:
|
||||||
|
description: Kind is the kind for the resource (e.g. 'Deployment'
|
||||||
|
is the kind for resource 'deployments')
|
||||||
type: string
|
type: string
|
||||||
|
name:
|
||||||
|
description: Name is the plural name of the resource.
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- kind
|
||||||
|
- name
|
||||||
|
type: object
|
||||||
type: array
|
type: array
|
||||||
required:
|
required:
|
||||||
- groupVersion
|
- groupVersion
|
||||||
|
|
|
@ -138,9 +138,19 @@ type ClusterStatus struct {
|
||||||
type APIEnablement struct {
|
type APIEnablement struct {
|
||||||
// GroupVersion is the group and version this APIEnablement is for.
|
// GroupVersion is the group and version this APIEnablement is for.
|
||||||
GroupVersion string `json:"groupVersion"`
|
GroupVersion string `json:"groupVersion"`
|
||||||
// Resources contains the name of the resources.
|
// Resources is a list of APIResource.
|
||||||
// +optional
|
// +optional
|
||||||
Resources []string `json:"resources,omitempty"`
|
Resources []APIResource `json:"resources,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// APIResource specifies the name and kind names for the resource.
|
||||||
|
type APIResource struct {
|
||||||
|
// Name is the plural name of the resource.
|
||||||
|
// +required
|
||||||
|
Name string `json:"name"`
|
||||||
|
// Kind is the kind for the resource (e.g. 'Deployment' is the kind for resource 'deployments')
|
||||||
|
// +required
|
||||||
|
Kind string `json:"kind"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NodeSummary represents the summary of nodes status in a specific cluster.
|
// NodeSummary represents the summary of nodes status in a specific cluster.
|
||||||
|
|
|
@ -15,7 +15,7 @@ func (in *APIEnablement) DeepCopyInto(out *APIEnablement) {
|
||||||
*out = *in
|
*out = *in
|
||||||
if in.Resources != nil {
|
if in.Resources != nil {
|
||||||
in, out := &in.Resources, &out.Resources
|
in, out := &in.Resources, &out.Resources
|
||||||
*out = make([]string, len(*in))
|
*out = make([]APIResource, len(*in))
|
||||||
copy(*out, *in)
|
copy(*out, *in)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -31,6 +31,22 @@ func (in *APIEnablement) DeepCopy() *APIEnablement {
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *APIResource) DeepCopyInto(out *APIResource) {
|
||||||
|
*out = *in
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIResource.
|
||||||
|
func (in *APIResource) DeepCopy() *APIResource {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(APIResource)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *Cluster) DeepCopyInto(out *Cluster) {
|
func (in *Cluster) DeepCopyInto(out *Cluster) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
|
|
@ -369,11 +369,16 @@ func getAPIEnablements(clusterClient *util.ClusterClient) ([]v1alpha1.APIEnablem
|
||||||
var apiEnablements []v1alpha1.APIEnablement
|
var apiEnablements []v1alpha1.APIEnablement
|
||||||
|
|
||||||
for _, list := range apiResourceList {
|
for _, list := range apiResourceList {
|
||||||
var apiResource []string
|
var apiResources []v1alpha1.APIResource
|
||||||
for _, resource := range list.APIResources {
|
for _, resource := range list.APIResources {
|
||||||
apiResource = append(apiResource, resource.Name)
|
apiResource := v1alpha1.APIResource{
|
||||||
|
Name: resource.Name,
|
||||||
|
Kind: resource.Kind,
|
||||||
}
|
}
|
||||||
apiEnablements = append(apiEnablements, v1alpha1.APIEnablement{GroupVersion: list.GroupVersion, Resources: apiResource})
|
|
||||||
|
apiResources = append(apiResources, apiResource)
|
||||||
|
}
|
||||||
|
apiEnablements = append(apiEnablements, v1alpha1.APIEnablement{GroupVersion: list.GroupVersion, Resources: apiResources})
|
||||||
}
|
}
|
||||||
|
|
||||||
return apiEnablements, nil
|
return apiEnablements, nil
|
||||||
|
|
Loading…
Reference in New Issue