diff --git a/apis/core/fuzzer/fuzzer.go b/apis/core/fuzzer/fuzzer.go index 97e6b5b07..0d163bb92 100644 --- a/apis/core/fuzzer/fuzzer.go +++ b/apis/core/fuzzer/fuzzer.go @@ -30,6 +30,9 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} { func(s *v1alpha1.PodView, c fuzz.Continue) { c.FuzzNoCustom(s) // fuzz self without calling this function again }, + func(s *v1alpha1.Project, c fuzz.Continue) { + c.FuzzNoCustom(s) // fuzz self without calling this function again + }, func(s *v1alpha1.ResourceSummary, c fuzz.Continue) { c.FuzzNoCustom(s) // fuzz self without calling this function again }, diff --git a/apis/core/v1alpha1/openapi_generated.go b/apis/core/v1alpha1/openapi_generated.go index 53f9c2032..e539ac1dc 100644 --- a/apis/core/v1alpha1/openapi_generated.go +++ b/apis/core/v1alpha1/openapi_generated.go @@ -314,6 +314,10 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kmodules.xyz/resource-metadata/apis/core/v1alpha1.PodView": schema_resource_metadata_apis_core_v1alpha1_PodView(ref), "kmodules.xyz/resource-metadata/apis/core/v1alpha1.PodViewList": schema_resource_metadata_apis_core_v1alpha1_PodViewList(ref), "kmodules.xyz/resource-metadata/apis/core/v1alpha1.PodViewSpec": schema_resource_metadata_apis_core_v1alpha1_PodViewSpec(ref), + "kmodules.xyz/resource-metadata/apis/core/v1alpha1.Project": schema_resource_metadata_apis_core_v1alpha1_Project(ref), + "kmodules.xyz/resource-metadata/apis/core/v1alpha1.ProjectList": schema_resource_metadata_apis_core_v1alpha1_ProjectList(ref), + "kmodules.xyz/resource-metadata/apis/core/v1alpha1.ProjectSpec": schema_resource_metadata_apis_core_v1alpha1_ProjectSpec(ref), + "kmodules.xyz/resource-metadata/apis/core/v1alpha1.ProjectStatus": schema_resource_metadata_apis_core_v1alpha1_ProjectStatus(ref), "kmodules.xyz/resource-metadata/apis/core/v1alpha1.ResourceCalculator": schema_resource_metadata_apis_core_v1alpha1_ResourceCalculator(ref), "kmodules.xyz/resource-metadata/apis/core/v1alpha1.ResourceCalculatorResponse": schema_resource_metadata_apis_core_v1alpha1_ResourceCalculatorResponse(ref), "kmodules.xyz/resource-metadata/apis/core/v1alpha1.ResourceSummary": schema_resource_metadata_apis_core_v1alpha1_ResourceSummary(ref), @@ -15672,6 +15676,153 @@ func schema_resource_metadata_apis_core_v1alpha1_PodViewSpec(ref common.Referenc } } +func schema_resource_metadata_apis_core_v1alpha1_Project(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Project is the Schema for the projects API", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/resource-metadata/apis/core/v1alpha1.ProjectSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/resource-metadata/apis/core/v1alpha1.ProjectStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "kmodules.xyz/resource-metadata/apis/core/v1alpha1.ProjectSpec", "kmodules.xyz/resource-metadata/apis/core/v1alpha1.ProjectStatus"}, + } +} + +func schema_resource_metadata_apis_core_v1alpha1_ProjectList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ProjectList contains a list of Project", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/resource-metadata/apis/core/v1alpha1.Project"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "kmodules.xyz/resource-metadata/apis/core/v1alpha1.Project"}, + } +} + +func schema_resource_metadata_apis_core_v1alpha1_ProjectSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ProjectSpec defines the desired state of Project", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "namespaces": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "namespaceSelector": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, + } +} + +func schema_resource_metadata_apis_core_v1alpha1_ProjectStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ProjectStatus defines the observed state of Project", + Type: []string{"object"}, + }, + }, + } +} + func schema_resource_metadata_apis_core_v1alpha1_ResourceCalculator(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/apis/core/v1alpha1/project_types.go b/apis/core/v1alpha1/project_types.go new file mode 100644 index 000000000..6461dbcef --- /dev/null +++ b/apis/core/v1alpha1/project_types.go @@ -0,0 +1,77 @@ +/* +Copyright AppsCode Inc. and Contributors + +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. +*/ + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + ResourceKindProject = "Project" + ResourceProject = "project" + ResourceProjects = "projects" +) + +// ProjectSpec defines the desired state of Project +type ProjectSpec struct { + // +kubebuilder:default=User + Type ProjectType `json:"type,omitempty"` + Namespaces []string `json:"namespaces,omitempty"` + NamespaceSelector *metav1.LabelSelector `json:"namespaceSelector,omitempty"` +} + +// +kubebuilder:validation:Enum=Default;System;User +type ProjectType string + +const ( + ProjectDefault ProjectType = "Default" + ProjectSystem ProjectType = "System" + ProjectUser ProjectType = "User" +) + +// ProjectStatus defines the observed state of Project +type ProjectStatus struct{} + +// +genclient +// +genclient:nonNamespaced +// +genclient:onlyVerbs=get,list +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +//+kubebuilder:object:root=true +//+kubebuilder:resource:scope=Cluster + +// Project is the Schema for the projects API +type Project struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ProjectSpec `json:"spec,omitempty"` + Status ProjectStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true +//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ProjectList contains a list of Project +type ProjectList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Project `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Project{}, &ProjectList{}) +} diff --git a/apis/core/v1alpha1/zz_generated.deepcopy.go b/apis/core/v1alpha1/zz_generated.deepcopy.go index bed311805..333e60083 100644 --- a/apis/core/v1alpha1/zz_generated.deepcopy.go +++ b/apis/core/v1alpha1/zz_generated.deepcopy.go @@ -27,6 +27,7 @@ import ( v1 "k8s.io/api/core/v1" resource "k8s.io/apimachinery/pkg/api/resource" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" version "k8s.io/apimachinery/pkg/version" ) @@ -582,6 +583,109 @@ func (in *PodViewSpec) DeepCopy() *PodViewSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Project) DeepCopyInto(out *Project) { + *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 Project. +func (in *Project) DeepCopy() *Project { + if in == nil { + return nil + } + out := new(Project) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Project) 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 *ProjectList) DeepCopyInto(out *ProjectList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Project, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectList. +func (in *ProjectList) DeepCopy() *ProjectList { + if in == nil { + return nil + } + out := new(ProjectList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ProjectList) 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 *ProjectSpec) DeepCopyInto(out *ProjectSpec) { + *out = *in + if in.Namespaces != nil { + in, out := &in.Namespaces, &out.Namespaces + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.NamespaceSelector != nil { + in, out := &in.NamespaceSelector, &out.NamespaceSelector + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectSpec. +func (in *ProjectSpec) DeepCopy() *ProjectSpec { + if in == nil { + return nil + } + out := new(ProjectSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectStatus) DeepCopyInto(out *ProjectStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectStatus. +func (in *ProjectStatus) DeepCopy() *ProjectStatus { + if in == nil { + return nil + } + out := new(ProjectStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ResourceCalculator) DeepCopyInto(out *ResourceCalculator) { *out = *in diff --git a/client/clientset/versioned/typed/core/v1alpha1/core_client.go b/client/clientset/versioned/typed/core/v1alpha1/core_client.go index 315f11d99..0d8fe5675 100644 --- a/client/clientset/versioned/typed/core/v1alpha1/core_client.go +++ b/client/clientset/versioned/typed/core/v1alpha1/core_client.go @@ -31,6 +31,7 @@ type CoreV1alpha1Interface interface { GenericResourcesGetter GenericResourceServicesGetter PodViewsGetter + ProjectsGetter ResourceCalculatorsGetter ResourceSummariesGetter } @@ -52,6 +53,10 @@ func (c *CoreV1alpha1Client) PodViews(namespace string) PodViewInterface { return newPodViews(c, namespace) } +func (c *CoreV1alpha1Client) Projects() ProjectInterface { + return newProjects(c) +} + func (c *CoreV1alpha1Client) ResourceCalculators() ResourceCalculatorInterface { return newResourceCalculators(c) } diff --git a/client/clientset/versioned/typed/core/v1alpha1/fake/fake_core_client.go b/client/clientset/versioned/typed/core/v1alpha1/fake/fake_core_client.go index 2f2a70fc9..e40835870 100644 --- a/client/clientset/versioned/typed/core/v1alpha1/fake/fake_core_client.go +++ b/client/clientset/versioned/typed/core/v1alpha1/fake/fake_core_client.go @@ -40,6 +40,10 @@ func (c *FakeCoreV1alpha1) PodViews(namespace string) v1alpha1.PodViewInterface return &FakePodViews{c, namespace} } +func (c *FakeCoreV1alpha1) Projects() v1alpha1.ProjectInterface { + return &FakeProjects{c} +} + func (c *FakeCoreV1alpha1) ResourceCalculators() v1alpha1.ResourceCalculatorInterface { return &FakeResourceCalculators{c} } diff --git a/client/clientset/versioned/typed/core/v1alpha1/fake/fake_project.go b/client/clientset/versioned/typed/core/v1alpha1/fake/fake_project.go new file mode 100644 index 000000000..dfc32eb1a --- /dev/null +++ b/client/clientset/versioned/typed/core/v1alpha1/fake/fake_project.go @@ -0,0 +1,69 @@ +/* +Copyright AppsCode Inc. and Contributors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + testing "k8s.io/client-go/testing" + v1alpha1 "kmodules.xyz/resource-metadata/apis/core/v1alpha1" +) + +// FakeProjects implements ProjectInterface +type FakeProjects struct { + Fake *FakeCoreV1alpha1 +} + +var projectsResource = schema.GroupVersionResource{Group: "core.k8s.appscode.com", Version: "v1alpha1", Resource: "projects"} + +var projectsKind = schema.GroupVersionKind{Group: "core.k8s.appscode.com", Version: "v1alpha1", Kind: "Project"} + +// Get takes name of the project, and returns the corresponding project object, and an error if there is any. +func (c *FakeProjects) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Project, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(projectsResource, name), &v1alpha1.Project{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Project), err +} + +// List takes label and field selectors, and returns the list of Projects that match those selectors. +func (c *FakeProjects) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ProjectList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(projectsResource, projectsKind, opts), &v1alpha1.ProjectList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.ProjectList{ListMeta: obj.(*v1alpha1.ProjectList).ListMeta} + for _, item := range obj.(*v1alpha1.ProjectList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} diff --git a/client/clientset/versioned/typed/core/v1alpha1/generated_expansion.go b/client/clientset/versioned/typed/core/v1alpha1/generated_expansion.go index 47363aeb4..6c0f4130e 100644 --- a/client/clientset/versioned/typed/core/v1alpha1/generated_expansion.go +++ b/client/clientset/versioned/typed/core/v1alpha1/generated_expansion.go @@ -24,6 +24,8 @@ type GenericResourceServiceExpansion interface{} type PodViewExpansion interface{} +type ProjectExpansion interface{} + type ResourceCalculatorExpansion interface{} type ResourceSummaryExpansion interface{} diff --git a/client/clientset/versioned/typed/core/v1alpha1/project.go b/client/clientset/versioned/typed/core/v1alpha1/project.go new file mode 100644 index 000000000..555867e76 --- /dev/null +++ b/client/clientset/versioned/typed/core/v1alpha1/project.go @@ -0,0 +1,82 @@ +/* +Copyright AppsCode Inc. and Contributors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + rest "k8s.io/client-go/rest" + v1alpha1 "kmodules.xyz/resource-metadata/apis/core/v1alpha1" + scheme "kmodules.xyz/resource-metadata/client/clientset/versioned/scheme" +) + +// ProjectsGetter has a method to return a ProjectInterface. +// A group's client should implement this interface. +type ProjectsGetter interface { + Projects() ProjectInterface +} + +// ProjectInterface has methods to work with Project resources. +type ProjectInterface interface { + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Project, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ProjectList, error) + ProjectExpansion +} + +// projects implements ProjectInterface +type projects struct { + client rest.Interface +} + +// newProjects returns a Projects +func newProjects(c *CoreV1alpha1Client) *projects { + return &projects{ + client: c.RESTClient(), + } +} + +// Get takes name of the project, and returns the corresponding project object, and an error if there is any. +func (c *projects) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Project, err error) { + result = &v1alpha1.Project{} + err = c.client.Get(). + Resource("projects"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Projects that match those selectors. +func (c *projects) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ProjectList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.ProjectList{} + err = c.client.Get(). + Resource("projects"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} diff --git a/crds/core.k8s.appscode.com_projects.yaml b/crds/core.k8s.appscode.com_projects.yaml new file mode 100644 index 000000000..a1ac9a0d2 --- /dev/null +++ b/crds/core.k8s.appscode.com_projects.yaml @@ -0,0 +1,102 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + creationTimestamp: null + name: projects.core.k8s.appscode.com +spec: + group: core.k8s.appscode.com + names: + kind: Project + listKind: ProjectList + plural: projects + singular: project + scope: Cluster + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: Project is the Schema for the projects API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: ProjectSpec defines the desired state of Project + properties: + namespaceSelector: + description: A label selector is a label query over a set of resources. + The result of matchLabels and matchExpressions are ANDed. An empty + label selector matches all objects. A null label selector matches + no objects. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: A label selector requirement is a selector that + contains values, a key, and an operator that relates the key + and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: operator represents a key's relationship to + a set of values. Valid operators are In, NotIn, Exists + and DoesNotExist. + type: string + values: + description: values is an array of string values. If the + operator is In or NotIn, the values array must be non-empty. + If the operator is Exists or DoesNotExist, the values + array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single + {key,value} in the matchLabels map is equivalent to an element + of matchExpressions, whose key field is "key", the operator + is "In", and the values array contains only "value". The requirements + are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + items: + type: string + type: array + type: + default: User + enum: + - Default + - System + - User + type: string + type: object + status: + description: ProjectStatus defines the observed state of Project + type: object + type: object + served: true + storage: true diff --git a/go.mod b/go.mod index 3fc5d169f..e0229546b 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( k8s.io/klog/v2 v2.80.1 k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 kmodules.xyz/apiversion v0.2.0 - kmodules.xyz/client-go v0.25.34-0.20230920051128-f758ec0276ab + kmodules.xyz/client-go v0.25.34-0.20230920171733-80f7303d9ec0 kmodules.xyz/crd-schema-fuzz v0.25.0 kmodules.xyz/resource-metrics v0.25.2 kmodules.xyz/schema-checker v0.4.1 diff --git a/go.sum b/go.sum index bff738b57..c5eacf1f5 100644 --- a/go.sum +++ b/go.sum @@ -731,8 +731,8 @@ k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2 h1:GfD9OzL11kvZN5iArC6oTS7RTj7oJ k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= kmodules.xyz/apiversion v0.2.0 h1:vAQYqZFm4xu4pbB1cAdHbFEPES6EQkcR4wc06xdTOWk= kmodules.xyz/apiversion v0.2.0/go.mod h1:oPX8g8LvlPdPX3Yc5YvCzJHQnw3YF/X4/jdW0b1am80= -kmodules.xyz/client-go v0.25.34-0.20230920051128-f758ec0276ab h1:Al8RDDn7TNBozXvqApo2BAU2lUxDkYAPDRC1FBA2DQ8= -kmodules.xyz/client-go v0.25.34-0.20230920051128-f758ec0276ab/go.mod h1:r/Va2Y6t1G8X1sPRjrQC6FWB3oh/i6rjssmlfJnbCmg= +kmodules.xyz/client-go v0.25.34-0.20230920171733-80f7303d9ec0 h1:587Wc7z8wIvA3qmS0e8F5qjVuoVbCwLykUVIbcEGtpM= +kmodules.xyz/client-go v0.25.34-0.20230920171733-80f7303d9ec0/go.mod h1:r/Va2Y6t1G8X1sPRjrQC6FWB3oh/i6rjssmlfJnbCmg= kmodules.xyz/crd-schema-fuzz v0.25.0 h1:c5ZxNRqJak1bkGhECmyrKpzKGThFMB4088Kynyvngbc= kmodules.xyz/crd-schema-fuzz v0.25.0/go.mod h1:VigFz19GwCxMGhb3YjCtlSXmfXb0J/g9du1So6rvqsk= kmodules.xyz/offshoot-api v0.25.0 h1:Svq9da/+sg5afOjpgo9vx2J/Lu90Mo0aFxkdQmgKnGI= diff --git a/hub/resourcedescriptors/core.k8s.appscode.com/v1alpha1/projects.yaml b/hub/resourcedescriptors/core.k8s.appscode.com/v1alpha1/projects.yaml new file mode 100644 index 000000000..fb9f370ba --- /dev/null +++ b/hub/resourcedescriptors/core.k8s.appscode.com/v1alpha1/projects.yaml @@ -0,0 +1,90 @@ +apiVersion: meta.k8s.appscode.com/v1alpha1 +kind: ResourceDescriptor +metadata: + creationTimestamp: null + labels: + k8s.io/group: core.k8s.appscode.com + k8s.io/kind: Project + k8s.io/resource: projects + k8s.io/version: v1alpha1 + name: core.k8s.appscode.com-v1alpha1-projects +spec: + resource: + group: core.k8s.appscode.com + kind: Project + name: projects + scope: Cluster + version: v1alpha1 + validation: + openAPIV3Schema: + description: Project is the Schema for the projects API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + properties: + name: + description: 'Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names' + type: string + labels: + additionalProperties: + type: string + description: 'Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels' + type: object + annotations: + additionalProperties: + type: string + description: 'Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations' + type: object + type: object + spec: + description: ProjectSpec defines the desired state of Project + properties: + namespaceSelector: + description: A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + items: + type: string + type: array + type: + default: User + enum: + - Default + - System + - User + type: string + type: object + type: object diff --git a/hub/resourceeditors/core.k8s.appscode.com/v1alpha1/projects.yaml b/hub/resourceeditors/core.k8s.appscode.com/v1alpha1/projects.yaml new file mode 100644 index 000000000..67f31b30d --- /dev/null +++ b/hub/resourceeditors/core.k8s.appscode.com/v1alpha1/projects.yaml @@ -0,0 +1,17 @@ +apiVersion: ui.k8s.appscode.com/v1alpha1 +kind: ResourceEditor +metadata: + creationTimestamp: null + labels: + k8s.io/group: core.k8s.appscode.com + k8s.io/kind: Project + k8s.io/resource: projects + k8s.io/version: v1alpha1 + name: core.k8s.appscode.com-v1alpha1-projects +spec: + resource: + group: core.k8s.appscode.com + kind: Project + name: projects + scope: Cluster + version: v1alpha1 diff --git a/hub/resourcetabledefinitions/core.k8s.appscode.com/v1alpha1/projects.yaml b/hub/resourcetabledefinitions/core.k8s.appscode.com/v1alpha1/projects.yaml new file mode 100644 index 000000000..5676b6d5b --- /dev/null +++ b/hub/resourcetabledefinitions/core.k8s.appscode.com/v1alpha1/projects.yaml @@ -0,0 +1,18 @@ +apiVersion: meta.k8s.appscode.com/v1alpha1 +kind: ResourceTableDefinition +metadata: + creationTimestamp: null + labels: + k8s.io/group: core.k8s.appscode.com + k8s.io/kind: Project + k8s.io/resource: projects + k8s.io/version: v1alpha1 + name: core.k8s.appscode.com-v1alpha1-projects +spec: + defaultView: true + resource: + group: core.k8s.appscode.com + kind: Project + name: projects + scope: Cluster + version: v1alpha1 diff --git a/vendor/kmodules.xyz/client-go/Makefile b/vendor/kmodules.xyz/client-go/Makefile index a57078a0f..c05270cd9 100644 --- a/vendor/kmodules.xyz/client-go/Makefile +++ b/vendor/kmodules.xyz/client-go/Makefile @@ -18,10 +18,8 @@ GO_PKG := kmodules.xyz REPO := $(notdir $(shell pwd)) BIN := client-go -CRD_OPTIONS ?= "crd:maxDescLen=0,generateEmbeddedObjectMeta=true,allowDangerousTypes=true" # https://github.com/appscodelabs/gengo-builder CODE_GENERATOR_IMAGE ?= ghcr.io/appscode/gengo:release-1.25 -API_GROUPS ?= management:v1alpha1 # This version-strategy uses git tags to set the version string git_branch := $(shell git rev-parse --abbrev-ref HEAD) @@ -47,7 +45,7 @@ endif ### These variables should not need tweaking. ### -SRC_PKGS := admissionregistration api apis apiextensions apiregistration apps batch certificates client cluster conditions core discovery dynamic extensions meta networking openapi policy rbac storage tools +SRC_PKGS := admissionregistration api apiextensions apiregistration apps batch certificates client cluster conditions core discovery dynamic extensions meta networking openapi policy rbac storage tools SRC_DIRS := $(SRC_PKGS) *.go DOCKER_PLATFORMS := linux/amd64 linux/arm linux/arm64 @@ -118,20 +116,6 @@ clientset: --go-header-file "./hack/license/go.txt" \ --input-dirs "$(GO_PKG)/$(REPO)/api/v1" \ --output-file-base zz_generated.deepcopy - @docker run --rm \ - -u $$(id -u):$$(id -g) \ - -v /tmp:/.cache \ - -v $$(pwd):$(DOCKER_REPO_ROOT) \ - -w $(DOCKER_REPO_ROOT) \ - --env HTTP_PROXY=$(HTTP_PROXY) \ - --env HTTPS_PROXY=$(HTTPS_PROXY) \ - $(CODE_GENERATOR_IMAGE) \ - /go/src/k8s.io/code-generator/generate-groups.sh \ - deepcopy \ - $(GO_PKG)/$(REPO)/client \ - $(GO_PKG)/$(REPO)/apis \ - "$(API_GROUPS)" \ - --go-header-file "./hack/license/go.txt" # Generate openapi schema .PHONY: openapi @@ -187,28 +171,8 @@ gen-enum: $(BUILD_DIRS) go generate ./api/... \ " -# Generate CRD manifests -.PHONY: gen-crds -gen-crds: - @echo "Generating CRD manifests" - @docker run --rm \ - -u $$(id -u):$$(id -g) \ - -v /tmp:/.cache \ - -v $$(pwd):$(DOCKER_REPO_ROOT) \ - -w $(DOCKER_REPO_ROOT) \ - --env HTTP_PROXY=$(HTTP_PROXY) \ - --env HTTPS_PROXY=$(HTTPS_PROXY) \ - $(CODE_GENERATOR_IMAGE) \ - controller-gen \ - $(CRD_OPTIONS) \ - paths="./apis/..." \ - output:crd:artifacts:config=crds - -.PHONY: manifests -manifests: gen-crds - .PHONY: gen -gen: clientset manifests gen-enum # openapi gen-crd-protos +gen: clientset gen-enum # openapi gen-crd-protos fmt: $(BUILD_DIRS) @docker run \ diff --git a/vendor/modules.txt b/vendor/modules.txt index 34c4829d7..d9214656f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -681,7 +681,7 @@ k8s.io/utils/trace # kmodules.xyz/apiversion v0.2.0 ## explicit; go 1.14 kmodules.xyz/apiversion -# kmodules.xyz/client-go v0.25.34-0.20230920051128-f758ec0276ab +# kmodules.xyz/client-go v0.25.34-0.20230920171733-80f7303d9ec0 ## explicit; go 1.18 kmodules.xyz/client-go kmodules.xyz/client-go/api/v1