From d4021f9cbd8bc9d3960a97ee8b373797d1645980 Mon Sep 17 00:00:00 2001 From: hongming Date: Wed, 30 Apr 2025 14:01:21 +0800 Subject: [PATCH] Update staging kubesphere.io/api (#6495) Signed-off-by: hongming --- pkg/scheme/scheme.go | 19 +- .../kubesphere.io/api/application/group.go | 1 - .../api/application/v2/application_types.go | 71 ---- .../v2/applicationrelease_types.go | 87 ----- .../v2/applicationversion_types.go | 82 ----- .../api/application/v2/category_types.go | 38 --- .../kubesphere.io/api/application/v2/doc.go | 5 + .../api/application/v2/register.go | 28 +- .../api/application/v2/repo_types.go | 70 ---- .../kubesphere.io/api/application/v2/types.go | 322 ++++++++++++++++++ .../application/v2/zz_generated.deepcopy.go | 2 +- .../src/kubesphere.io/api/cluster/group.go | 1 - .../kubesphere.io/api/cluster/v1alpha1/doc.go | 2 - .../api/cluster/v1alpha1/label_types.go | 48 --- .../api/cluster/v1alpha1/register.go | 50 ++- .../v1alpha1/{cluster_types.go => types.go} | 34 +- .../cluster/v1alpha1/zz_generated.deepcopy.go | 2 +- .../kubesphere.io/api/core/v1alpha1/doc.go | 5 + .../api/core/v1alpha1/installplan_types.go | 83 ----- .../api/core/v1alpha1/register.go | 8 +- .../api/core/v1alpha1/repository_types.go | 60 ---- .../api/core/v1alpha1/serviceaccount_types.go | 37 -- .../v1alpha1/{extension_types.go => types.go} | 159 +++++++++ .../extensions/v1alpha1/apiservice_types.go | 38 --- .../api/extensions/v1alpha1/doc.go | 5 + .../v1alpha1/extensionentry_types.go | 36 -- .../api/extensions/v1alpha1/jsbundle_types.go | 82 ----- .../api/extensions/v1alpha1/register.go | 29 +- .../extensions/v1alpha1/reverseproxy_types.go | 63 ---- .../api/extensions/v1alpha1/types.go | 204 +++++++++++ .../kubesphere.io/api/gateway/v1alpha2/doc.go | 5 + .../api/gateway/v1alpha2/register.go | 27 +- .../{ingressclassscope_types.go => types.go} | 0 staging/src/kubesphere.io/api/go.mod | 22 +- staging/src/kubesphere.io/api/go.sum | 112 +----- staging/src/kubesphere.io/api/iam/group.go | 2 - .../src/kubesphere.io/api/iam/v1alpha2/doc.go | 5 + .../api/iam/v1alpha2/register.go | 22 +- .../kubesphere.io/api/iam/v1alpha2/types.go | 3 - .../api/iam/v1beta1/constants.go | 1 - .../src/kubesphere.io/api/iam/v1beta1/doc.go | 2 - .../kubesphere.io/api/iam/v1beta1/im_types.go | 256 -------------- .../kubesphere.io/api/iam/v1beta1/register.go | 18 +- .../kubesphere.io/api/iam/v1beta1/types.go | 253 ++++++++++++++ staging/src/kubesphere.io/api/quota/group.go | 2 - .../kubesphere.io/api/quota/v1alpha2/doc.go | 4 +- .../api/quota/v1alpha2/register.go | 33 +- .../kubesphere.io/api/quota/v1alpha2/types.go | 4 - .../api/quota/v1alpha2/types_test.go | 62 ---- .../quota/v1alpha2/zz_generated.deepcopy.go | 2 +- .../src/kubesphere.io/api/storage/group.go | 2 - .../kubesphere.io/api/storage/v1alpha1/doc.go | 4 +- .../api/storage/v1alpha1/register.go | 35 +- .../{capability_types.go => types.go} | 8 - .../storage/v1alpha1/zz_generated.deepcopy.go | 2 +- staging/src/kubesphere.io/api/tenant/group.go | 2 - .../kubesphere.io/api/tenant/v1alpha1/doc.go | 5 + .../api/tenant/v1alpha1/register.go | 26 +- .../v1alpha1/{workspace_types.go => types.go} | 0 .../tenant/v1alpha1/zz_generated.deepcopy.go | 2 +- .../kubesphere.io/api/tenant/v1alpha2/doc.go | 5 + .../api/tenant/v1alpha2/register.go | 26 +- .../{workspacetemplate_types.go => types.go} | 0 .../kubesphere.io/api/tenant/v1beta1/doc.go | 5 + .../api/tenant/v1beta1/register.go | 28 +- .../{workspacetemplate_types.go => types.go} | 42 ++- .../api/tenant/v1beta1/workspace_types.go | 48 --- .../tenant/v1beta1/zz_generated.deepcopy.go | 2 +- staging/src/kubesphere.io/client-go/go.mod | 5 +- staging/src/kubesphere.io/client-go/go.sum | 33 +- .../client-go/kubesphere/scheme/register.go | 2 + 71 files changed, 1253 insertions(+), 1535 deletions(-) delete mode 100644 staging/src/kubesphere.io/api/application/group.go delete mode 100644 staging/src/kubesphere.io/api/application/v2/application_types.go delete mode 100644 staging/src/kubesphere.io/api/application/v2/applicationrelease_types.go delete mode 100644 staging/src/kubesphere.io/api/application/v2/applicationversion_types.go delete mode 100644 staging/src/kubesphere.io/api/application/v2/category_types.go create mode 100644 staging/src/kubesphere.io/api/application/v2/doc.go delete mode 100644 staging/src/kubesphere.io/api/application/v2/repo_types.go create mode 100644 staging/src/kubesphere.io/api/application/v2/types.go delete mode 100644 staging/src/kubesphere.io/api/cluster/group.go delete mode 100644 staging/src/kubesphere.io/api/cluster/v1alpha1/label_types.go rename staging/src/kubesphere.io/api/cluster/v1alpha1/{cluster_types.go => types.go} (88%) create mode 100644 staging/src/kubesphere.io/api/core/v1alpha1/doc.go delete mode 100644 staging/src/kubesphere.io/api/core/v1alpha1/installplan_types.go delete mode 100644 staging/src/kubesphere.io/api/core/v1alpha1/repository_types.go delete mode 100644 staging/src/kubesphere.io/api/core/v1alpha1/serviceaccount_types.go rename staging/src/kubesphere.io/api/core/v1alpha1/{extension_types.go => types.go} (52%) delete mode 100644 staging/src/kubesphere.io/api/extensions/v1alpha1/apiservice_types.go create mode 100644 staging/src/kubesphere.io/api/extensions/v1alpha1/doc.go delete mode 100644 staging/src/kubesphere.io/api/extensions/v1alpha1/extensionentry_types.go delete mode 100644 staging/src/kubesphere.io/api/extensions/v1alpha1/jsbundle_types.go delete mode 100644 staging/src/kubesphere.io/api/extensions/v1alpha1/reverseproxy_types.go create mode 100644 staging/src/kubesphere.io/api/extensions/v1alpha1/types.go create mode 100644 staging/src/kubesphere.io/api/gateway/v1alpha2/doc.go rename staging/src/kubesphere.io/api/gateway/v1alpha2/{ingressclassscope_types.go => types.go} (100%) delete mode 100644 staging/src/kubesphere.io/api/iam/group.go create mode 100644 staging/src/kubesphere.io/api/iam/v1alpha2/doc.go delete mode 100644 staging/src/kubesphere.io/api/iam/v1beta1/im_types.go delete mode 100644 staging/src/kubesphere.io/api/quota/group.go delete mode 100644 staging/src/kubesphere.io/api/quota/v1alpha2/types_test.go delete mode 100644 staging/src/kubesphere.io/api/storage/group.go rename staging/src/kubesphere.io/api/storage/v1alpha1/{capability_types.go => types.go} (95%) delete mode 100644 staging/src/kubesphere.io/api/tenant/group.go create mode 100644 staging/src/kubesphere.io/api/tenant/v1alpha1/doc.go rename staging/src/kubesphere.io/api/tenant/v1alpha1/{workspace_types.go => types.go} (100%) create mode 100644 staging/src/kubesphere.io/api/tenant/v1alpha2/doc.go rename staging/src/kubesphere.io/api/tenant/v1alpha2/{workspacetemplate_types.go => types.go} (100%) create mode 100644 staging/src/kubesphere.io/api/tenant/v1beta1/doc.go rename staging/src/kubesphere.io/api/tenant/v1beta1/{workspacetemplate_types.go => types.go} (57%) delete mode 100644 staging/src/kubesphere.io/api/tenant/v1beta1/workspace_types.go diff --git a/pkg/scheme/scheme.go b/pkg/scheme/scheme.go index 7e99a7b64..8cc35d232 100644 --- a/pkg/scheme/scheme.go +++ b/pkg/scheme/scheme.go @@ -6,24 +6,9 @@ package scheme import ( - apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/serializer" - clientgoscheme "k8s.io/client-go/kubernetes/scheme" - kubespherescheme "kubesphere.io/client-go/kubesphere/scheme" ) // Scheme contains all types of custom Scheme and kubernetes client-go Scheme. -var Scheme = runtime.NewScheme() -var Codecs = serializer.NewCodecFactory(Scheme) - -func init() { - // register common meta types into schemas. - metav1.AddToGroupVersion(Scheme, metav1.SchemeGroupVersion) - - _ = clientgoscheme.AddToScheme(Scheme) - _ = apiextensionsv1.AddToScheme(Scheme) - _ = kubespherescheme.AddToScheme(Scheme) -} +var Scheme = kubespherescheme.Scheme +var Codecs = kubespherescheme.Codecs diff --git a/staging/src/kubesphere.io/api/application/group.go b/staging/src/kubesphere.io/api/application/group.go deleted file mode 100644 index b584a8a4b..000000000 --- a/staging/src/kubesphere.io/api/application/group.go +++ /dev/null @@ -1 +0,0 @@ -package application diff --git a/staging/src/kubesphere.io/api/application/v2/application_types.go b/staging/src/kubesphere.io/api/application/v2/application_types.go deleted file mode 100644 index 730974fa4..000000000 --- a/staging/src/kubesphere.io/api/application/v2/application_types.go +++ /dev/null @@ -1,71 +0,0 @@ -package v2 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - "kubesphere.io/api/constants" -) - -// ApplicationSpec defines the desired state of Application -type ApplicationSpec struct { - AppHome string `json:"appHome,omitempty"` - AppType string `json:"appType,omitempty"` - Icon string `json:"icon,omitempty"` - Abstraction string `json:"abstraction,omitempty"` - Attachments []string `json:"attachments,omitempty"` - Resources []GroupVersionResource `json:"resources,omitempty"` -} - -type GroupVersionResource struct { - Group string `json:"Group,omitempty"` - Version string `json:"Version,omitempty"` - Resource string `json:"Resource,omitempty"` - Name string `json:"Name,omitempty"` - Desc string `json:"Desc,omitempty"` - ParentNode string `json:"ParentNode,omitempty"` -} - -// ApplicationStatus defines the observed state of Application -type ApplicationStatus struct { - // the state of the helm application: draft, submitted, passed, rejected, suspended, active - State string `json:"state,omitempty"` - UpdateTime *metav1.Time `json:"updateTime"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:scope=Cluster,shortName=app -// +kubebuilder:subresource:status -// +kubebuilder:printcolumn:name="repo",type="string",JSONPath=".metadata.labels.application\\.kubesphere\\.io/repo-name" -// +kubebuilder:printcolumn:name="workspace",type="string",JSONPath=".metadata.labels.kubesphere\\.io/workspace" -// +kubebuilder:printcolumn:name="appType",type="string",JSONPath=".spec.appType" -// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state" -// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" - -// Application is the Schema for the applications API -type Application struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec ApplicationSpec `json:"spec,omitempty"` - Status ApplicationStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// ApplicationList contains a list of Application -type ApplicationList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []Application `json:"items"` -} - -func getValue(m map[string]string, key string) string { - if m == nil { - return "" - } - return m[key] -} - -func (in *Application) GetWorkspace() string { - return getValue(in.Labels, constants.WorkspaceLabelKey) -} diff --git a/staging/src/kubesphere.io/api/application/v2/applicationrelease_types.go b/staging/src/kubesphere.io/api/application/v2/applicationrelease_types.go deleted file mode 100644 index b7c3a589e..000000000 --- a/staging/src/kubesphere.io/api/application/v2/applicationrelease_types.go +++ /dev/null @@ -1,87 +0,0 @@ -package v2 - -import ( - "crypto/md5" - "encoding/json" - "fmt" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - "kubesphere.io/api/constants" -) - -// ApplicationReleaseSpec defines the desired state of ApplicationRelease -type ApplicationReleaseSpec struct { - AppID string `json:"appID"` - AppVersionID string `json:"appVersionID"` - Values []byte `json:"values,omitempty"` - AppType string `json:"appType,omitempty"` - Icon string `json:"icon,omitempty"` -} - -// ApplicationReleaseStatus defines the observed state of ApplicationRelease -type ApplicationReleaseStatus struct { - State string `json:"state"` - Message string `json:"message,omitempty"` - SpecHash string `json:"specHash,omitempty"` - InstallJobName string `json:"installJobName,omitempty"` - UninstallJobName string `json:"uninstallJobName,omitempty"` - LastUpdate metav1.Time `json:"lastUpdate,omitempty"` - RealTimeResources []json.RawMessage `json:"realTimeResources,omitempty"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:scope=Cluster,shortName=apprls -// +kubebuilder:subresource:status -// +kubebuilder:printcolumn:name="workspace",type="string",JSONPath=".metadata.labels.kubesphere\\.io/workspace" -// +kubebuilder:printcolumn:name="app",type="string",JSONPath=".metadata.labels.application\\.kubesphere\\.io/app-id" -// +kubebuilder:printcolumn:name="appversion",type="string",JSONPath=".metadata.labels.application\\.kubesphere\\.io/appversion-id" -// +kubebuilder:printcolumn:name="appType",type="string",JSONPath=".spec.appType" -// +kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".metadata.labels.kubesphere\\.io/cluster" -// +kubebuilder:printcolumn:name="Namespace",type="string",JSONPath=".metadata.labels.kubesphere\\.io/namespace" -// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state" -// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" - -// ApplicationRelease is the Schema for the applicationreleases API -type ApplicationRelease struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec ApplicationReleaseSpec `json:"spec,omitempty"` - Status ApplicationReleaseStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// ApplicationReleaseList contains a list of ApplicationRelease -type ApplicationReleaseList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []ApplicationRelease `json:"items"` -} - -func (in *ApplicationRelease) GetCreator() string { - return getValue(in.Annotations, constants.CreatorAnnotationKey) -} - -func (in *ApplicationRelease) GetRlsCluster() string { - name := getValue(in.Labels, constants.ClusterNameLabelKey) - if name != "" { - return name - } - //todo remove hardcode - return "host" -} - -func (in *ApplicationRelease) GetRlsNamespace() string { - ns := getValue(in.Labels, constants.NamespaceLabelKey) - if ns == "" { - return "default" - } - return ns -} - -func (in *ApplicationRelease) HashSpec() string { - specJSON, _ := json.Marshal(in.Spec) - return fmt.Sprintf("%x", md5.Sum(specJSON)) -} diff --git a/staging/src/kubesphere.io/api/application/v2/applicationversion_types.go b/staging/src/kubesphere.io/api/application/v2/applicationversion_types.go deleted file mode 100644 index 479f08213..000000000 --- a/staging/src/kubesphere.io/api/application/v2/applicationversion_types.go +++ /dev/null @@ -1,82 +0,0 @@ -package v2 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - "kubesphere.io/api/constants" -) - -// ApplicationVersionSpec defines the desired state of ApplicationVersion -type ApplicationVersionSpec struct { - VersionName string `json:"versionName"` - AppHome string `json:"appHome,omitempty"` - Icon string `json:"icon,omitempty"` - Created *metav1.Time `json:"created,omitempty"` - Digest string `json:"digest,omitempty"` - AppType string `json:"appType,omitempty"` - Maintainer []Maintainer `json:"maintainer,omitempty"` - PullUrl string `json:"pullUrl,omitempty"` -} - -// ApplicationVersionStatus defines the observed state of ApplicationVersion -type ApplicationVersionStatus struct { - State string `json:"state,omitempty"` - Message string `json:"message,omitempty"` - UserName string `json:"userName,omitempty"` - Updated *metav1.Time `json:"updated,omitempty"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:scope=Cluster,shortName=appver -// +kubebuilder:subresource:status -// +kubebuilder:printcolumn:name="repo",type="string",JSONPath=".metadata.labels.application\\.kubesphere\\.io/repo-name" -// +kubebuilder:printcolumn:name="workspace",type="string",JSONPath=".metadata.labels.kubesphere\\.io/workspace" -// +kubebuilder:printcolumn:name="app",type="string",JSONPath=".metadata.labels.application\\.kubesphere\\.io/app-id" -// +kubebuilder:printcolumn:name="appType",type="string",JSONPath=".spec.appType" -// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state" -// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" - -// ApplicationVersion is the Schema for the applicationversions API -type ApplicationVersion struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec ApplicationVersionSpec `json:"spec,omitempty"` - Status ApplicationVersionStatus `json:"status,omitempty"` -} - -// Maintainer describes a Chart maintainer. -type Maintainer struct { - Name string `json:"name,omitempty"` - Email string `json:"email,omitempty"` - URL string `json:"url,omitempty"` -} - -// Metadata for a Application detail. -type Metadata struct { - Version string `json:"version"` - Home string `json:"home,omitempty"` - Icon string `json:"icon,omitempty"` - Sources []string `json:"sources,omitempty"` -} - -// +kubebuilder:object:root=true - -// ApplicationVersionList contains a list of ApplicationVersion -type ApplicationVersionList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []ApplicationVersion `json:"items"` -} - -func (in *ApplicationVersion) GetCreator() string { - return getValue(in.Annotations, constants.CreatorAnnotationKey) -} - -func (in *ApplicationVersion) GetWorkspace() string { - return getValue(in.Labels, constants.WorkspaceLabelKey) -} - -func (in *ApplicationVersion) GetAppID() string { - return getValue(in.Labels, AppIDLabelKey) -} diff --git a/staging/src/kubesphere.io/api/application/v2/category_types.go b/staging/src/kubesphere.io/api/application/v2/category_types.go deleted file mode 100644 index cc60c5d90..000000000 --- a/staging/src/kubesphere.io/api/application/v2/category_types.go +++ /dev/null @@ -1,38 +0,0 @@ -package v2 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// CategorySpec defines the desired state of HelmRepo -type CategorySpec struct { - Icon string `json:"icon,omitempty"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:scope=Cluster,shortName=appctg -// +kubebuilder:subresource:status -// +kubebuilder:printcolumn:name="total",type=string,JSONPath=`.status.total` -// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" - -// Category is the Schema for the categories API -type Category struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec CategorySpec `json:"spec,omitempty"` - Status CategoryStatus `json:"status,omitempty"` -} - -type CategoryStatus struct { - Total int `json:"total"` -} - -// +kubebuilder:object:root=true - -// CategoryList contains a list of Category -type CategoryList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []Category `json:"items"` -} diff --git a/staging/src/kubesphere.io/api/application/v2/doc.go b/staging/src/kubesphere.io/api/application/v2/doc.go new file mode 100644 index 000000000..df2a7533a --- /dev/null +++ b/staging/src/kubesphere.io/api/application/v2/doc.go @@ -0,0 +1,5 @@ +// +k8s:openapi-gen=true +// +kubebuilder:object:generate=true +// +groupName=application.kubesphere.io + +package v2 diff --git a/staging/src/kubesphere.io/api/application/v2/register.go b/staging/src/kubesphere.io/api/application/v2/register.go index 85245e643..7ca1ff0e2 100644 --- a/staging/src/kubesphere.io/api/application/v2/register.go +++ b/staging/src/kubesphere.io/api/application/v2/register.go @@ -1,24 +1,27 @@ -// Package v2 contains API Schema definitions for the application v1alpha1 API group -// +kubebuilder:object:generate=true -// +groupName=application.kubesphere.io package v2 import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" ) +const GroupName = "application.kubesphere.io" + var ( // SchemeGroupVersion is group version used to register these objects - SchemeGroupVersion = schema.GroupVersion{Group: "application.kubesphere.io", Version: "v2"} - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} - // AddToScheme adds the types in this group-version to the given scheme. - AddToScheme = SchemeBuilder.AddToScheme + SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v2"} + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme ) -func init() { - SchemeBuilder.Register( +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, &Category{}, &CategoryList{}, &Application{}, @@ -30,4 +33,7 @@ func init() { &Repo{}, &RepoList{}, ) + // Add the watch version that applies + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil } diff --git a/staging/src/kubesphere.io/api/application/v2/repo_types.go b/staging/src/kubesphere.io/api/application/v2/repo_types.go deleted file mode 100644 index dfa5a09b7..000000000 --- a/staging/src/kubesphere.io/api/application/v2/repo_types.go +++ /dev/null @@ -1,70 +0,0 @@ -package v2 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - "kubesphere.io/api/constants" -) - -type RepoCredential struct { - // chart repository username - Username string `json:"username,omitempty"` - // chart repository password - Password string `json:"password,omitempty"` - // identify HTTPS client using this SSL certificate file - CertFile string `json:"certFile,omitempty"` - // identify HTTPS client using this SSL key file - KeyFile string `json:"keyFile,omitempty"` - // verify certificates of HTTPS-enabled servers using this CA bundle - CAFile string `json:"caFile,omitempty"` - // skip tls certificate checks for the repository, default is ture - InsecureSkipTLSVerify *bool `json:"insecureSkipTLSVerify,omitempty"` -} - -// RepoSpec defines the desired state of Repo -type RepoSpec struct { - Url string `json:"url"` - Credential RepoCredential `json:"credential,omitempty"` - Description string `json:"description,omitempty"` - SyncPeriod *int `json:"syncPeriod"` -} - -// RepoStatus defines the observed state of Repo -type RepoStatus struct { - LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"` - State string `json:"state,omitempty"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:scope=Cluster,path=repos,shortName=repo -// +kubebuilder:subresource:status -// +kubebuilder:printcolumn:name="Workspace",type="string",JSONPath=".metadata.labels.kubesphere\\.io/workspace" -// +kubebuilder:printcolumn:name="url",type=string,JSONPath=`.spec.url` -// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state" -// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" - -// Repo is the Schema for the repoes API -type Repo struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec RepoSpec `json:"spec,omitempty"` - Status RepoStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// RepoList contains a list of Repo -type RepoList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []Repo `json:"items"` -} - -func (in *Repo) GetWorkspace() string { - return getValue(in.Labels, constants.WorkspaceLabelKey) -} - -func (in *Repo) GetCreator() string { - return getValue(in.Annotations, constants.CreatorAnnotationKey) -} diff --git a/staging/src/kubesphere.io/api/application/v2/types.go b/staging/src/kubesphere.io/api/application/v2/types.go new file mode 100644 index 000000000..c6be29e02 --- /dev/null +++ b/staging/src/kubesphere.io/api/application/v2/types.go @@ -0,0 +1,322 @@ +package v2 + +import ( + "crypto/md5" + "encoding/json" + "fmt" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "kubesphere.io/api/constants" +) + +// ApplicationSpec defines the desired state of Application +type ApplicationSpec struct { + AppHome string `json:"appHome,omitempty"` + AppType string `json:"appType,omitempty"` + Icon string `json:"icon,omitempty"` + Abstraction string `json:"abstraction,omitempty"` + Attachments []string `json:"attachments,omitempty"` + Resources []GroupVersionResource `json:"resources,omitempty"` +} + +type GroupVersionResource struct { + Group string `json:"Group,omitempty"` + Version string `json:"Version,omitempty"` + Resource string `json:"Resource,omitempty"` + Name string `json:"Name,omitempty"` + Desc string `json:"Desc,omitempty"` + ParentNode string `json:"ParentNode,omitempty"` +} + +// ApplicationStatus defines the observed state of Application +type ApplicationStatus struct { + // the state of the helm application: draft, submitted, passed, rejected, suspended, active + State string `json:"state,omitempty"` + UpdateTime *metav1.Time `json:"updateTime"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Cluster,shortName=app +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="repo",type="string",JSONPath=".metadata.labels.application\\.kubesphere\\.io/repo-name" +// +kubebuilder:printcolumn:name="workspace",type="string",JSONPath=".metadata.labels.kubesphere\\.io/workspace" +// +kubebuilder:printcolumn:name="appType",type="string",JSONPath=".spec.appType" +// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state" +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" + +// Application is the Schema for the applications API +type Application struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ApplicationSpec `json:"spec,omitempty"` + Status ApplicationStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// ApplicationList contains a list of Application +type ApplicationList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Application `json:"items"` +} + +func getValue(m map[string]string, key string) string { + if m == nil { + return "" + } + return m[key] +} + +func (in *Application) GetWorkspace() string { + return getValue(in.Labels, constants.WorkspaceLabelKey) +} + +// ApplicationReleaseSpec defines the desired state of ApplicationRelease +type ApplicationReleaseSpec struct { + AppID string `json:"appID"` + AppVersionID string `json:"appVersionID"` + Values []byte `json:"values,omitempty"` + AppType string `json:"appType,omitempty"` + Icon string `json:"icon,omitempty"` +} + +// ApplicationReleaseStatus defines the observed state of ApplicationRelease +type ApplicationReleaseStatus struct { + State string `json:"state"` + Message string `json:"message,omitempty"` + SpecHash string `json:"specHash,omitempty"` + InstallJobName string `json:"installJobName,omitempty"` + UninstallJobName string `json:"uninstallJobName,omitempty"` + LastUpdate metav1.Time `json:"lastUpdate,omitempty"` + RealTimeResources []json.RawMessage `json:"realTimeResources,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Cluster,shortName=apprls +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="workspace",type="string",JSONPath=".metadata.labels.kubesphere\\.io/workspace" +// +kubebuilder:printcolumn:name="app",type="string",JSONPath=".metadata.labels.application\\.kubesphere\\.io/app-id" +// +kubebuilder:printcolumn:name="appversion",type="string",JSONPath=".metadata.labels.application\\.kubesphere\\.io/appversion-id" +// +kubebuilder:printcolumn:name="appType",type="string",JSONPath=".spec.appType" +// +kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".metadata.labels.kubesphere\\.io/cluster" +// +kubebuilder:printcolumn:name="Namespace",type="string",JSONPath=".metadata.labels.kubesphere\\.io/namespace" +// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state" +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" + +// ApplicationRelease is the Schema for the applicationreleases API +type ApplicationRelease struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ApplicationReleaseSpec `json:"spec,omitempty"` + Status ApplicationReleaseStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// ApplicationReleaseList contains a list of ApplicationRelease +type ApplicationReleaseList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ApplicationRelease `json:"items"` +} + +func (in *ApplicationRelease) GetCreator() string { + return getValue(in.Annotations, constants.CreatorAnnotationKey) +} + +func (in *ApplicationRelease) GetRlsCluster() string { + name := getValue(in.Labels, constants.ClusterNameLabelKey) + if name != "" { + return name + } + //todo remove hardcode + return "host" +} + +func (in *ApplicationRelease) GetRlsNamespace() string { + ns := getValue(in.Labels, constants.NamespaceLabelKey) + if ns == "" { + return "default" + } + return ns +} + +func (in *ApplicationRelease) HashSpec() string { + specJSON, _ := json.Marshal(in.Spec) + return fmt.Sprintf("%x", md5.Sum(specJSON)) +} + +// ApplicationVersionSpec defines the desired state of ApplicationVersion +type ApplicationVersionSpec struct { + VersionName string `json:"versionName"` + AppHome string `json:"appHome,omitempty"` + Icon string `json:"icon,omitempty"` + Created *metav1.Time `json:"created,omitempty"` + Digest string `json:"digest,omitempty"` + AppType string `json:"appType,omitempty"` + Maintainer []Maintainer `json:"maintainer,omitempty"` + PullUrl string `json:"pullUrl,omitempty"` +} + +// ApplicationVersionStatus defines the observed state of ApplicationVersion +type ApplicationVersionStatus struct { + State string `json:"state,omitempty"` + Message string `json:"message,omitempty"` + UserName string `json:"userName,omitempty"` + Updated *metav1.Time `json:"updated,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Cluster,shortName=appver +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="repo",type="string",JSONPath=".metadata.labels.application\\.kubesphere\\.io/repo-name" +// +kubebuilder:printcolumn:name="workspace",type="string",JSONPath=".metadata.labels.kubesphere\\.io/workspace" +// +kubebuilder:printcolumn:name="app",type="string",JSONPath=".metadata.labels.application\\.kubesphere\\.io/app-id" +// +kubebuilder:printcolumn:name="appType",type="string",JSONPath=".spec.appType" +// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state" +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" + +// ApplicationVersion is the Schema for the applicationversions API +type ApplicationVersion struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ApplicationVersionSpec `json:"spec,omitempty"` + Status ApplicationVersionStatus `json:"status,omitempty"` +} + +// Maintainer describes a Chart maintainer. +type Maintainer struct { + Name string `json:"name,omitempty"` + Email string `json:"email,omitempty"` + URL string `json:"url,omitempty"` +} + +// Metadata for a Application detail. +type Metadata struct { + Version string `json:"version"` + Home string `json:"home,omitempty"` + Icon string `json:"icon,omitempty"` + Sources []string `json:"sources,omitempty"` +} + +// +kubebuilder:object:root=true + +// ApplicationVersionList contains a list of ApplicationVersion +type ApplicationVersionList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ApplicationVersion `json:"items"` +} + +func (in *ApplicationVersion) GetCreator() string { + return getValue(in.Annotations, constants.CreatorAnnotationKey) +} + +func (in *ApplicationVersion) GetWorkspace() string { + return getValue(in.Labels, constants.WorkspaceLabelKey) +} + +func (in *ApplicationVersion) GetAppID() string { + return getValue(in.Labels, AppIDLabelKey) +} + +// CategorySpec defines the desired state of HelmRepo +type CategorySpec struct { + Icon string `json:"icon,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Cluster,shortName=appctg +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="total",type=string,JSONPath=`.status.total` +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" + +// Category is the Schema for the categories API +type Category struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec CategorySpec `json:"spec,omitempty"` + Status CategoryStatus `json:"status,omitempty"` +} + +type CategoryStatus struct { + Total int `json:"total"` +} + +// +kubebuilder:object:root=true + +// CategoryList contains a list of Category +type CategoryList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Category `json:"items"` +} + +type RepoCredential struct { + // chart repository username + Username string `json:"username,omitempty"` + // chart repository password + Password string `json:"password,omitempty"` + // identify HTTPS client using this SSL certificate file + CertFile string `json:"certFile,omitempty"` + // identify HTTPS client using this SSL key file + KeyFile string `json:"keyFile,omitempty"` + // verify certificates of HTTPS-enabled servers using this CA bundle + CAFile string `json:"caFile,omitempty"` + // skip tls certificate checks for the repository, default is ture + InsecureSkipTLSVerify *bool `json:"insecureSkipTLSVerify,omitempty"` +} + +// RepoSpec defines the desired state of Repo +type RepoSpec struct { + Url string `json:"url"` + Credential RepoCredential `json:"credential,omitempty"` + Description string `json:"description,omitempty"` + SyncPeriod *int `json:"syncPeriod"` +} + +// RepoStatus defines the observed state of Repo +type RepoStatus struct { + LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"` + State string `json:"state,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Cluster,path=repos,shortName=repo +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="Workspace",type="string",JSONPath=".metadata.labels.kubesphere\\.io/workspace" +// +kubebuilder:printcolumn:name="url",type=string,JSONPath=`.spec.url` +// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state" +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" + +// Repo is the Schema for the repoes API +type Repo struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec RepoSpec `json:"spec,omitempty"` + Status RepoStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// RepoList contains a list of Repo +type RepoList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Repo `json:"items"` +} + +func (in *Repo) GetWorkspace() string { + return getValue(in.Labels, constants.WorkspaceLabelKey) +} + +func (in *Repo) GetCreator() string { + return getValue(in.Annotations, constants.CreatorAnnotationKey) +} diff --git a/staging/src/kubesphere.io/api/application/v2/zz_generated.deepcopy.go b/staging/src/kubesphere.io/api/application/v2/zz_generated.deepcopy.go index b26842421..0b0964b5a 100644 --- a/staging/src/kubesphere.io/api/application/v2/zz_generated.deepcopy.go +++ b/staging/src/kubesphere.io/api/application/v2/zz_generated.deepcopy.go @@ -6,7 +6,7 @@ package v2 import ( "encoding/json" - runtime "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. diff --git a/staging/src/kubesphere.io/api/cluster/group.go b/staging/src/kubesphere.io/api/cluster/group.go deleted file mode 100644 index 916b1b53b..000000000 --- a/staging/src/kubesphere.io/api/cluster/group.go +++ /dev/null @@ -1 +0,0 @@ -package cluster diff --git a/staging/src/kubesphere.io/api/cluster/v1alpha1/doc.go b/staging/src/kubesphere.io/api/cluster/v1alpha1/doc.go index d29defccc..5c13ebe8b 100644 --- a/staging/src/kubesphere.io/api/cluster/v1alpha1/doc.go +++ b/staging/src/kubesphere.io/api/cluster/v1alpha1/doc.go @@ -1,8 +1,6 @@ // Package v1alpha1 contains API Schema definitions for the tower v1alpha1 API group // +k8s:openapi-gen=true // +kubebuilder:object:generate=true -// +k8s:conversion-gen=kubesphere.io/api/cluster -// +k8s:defaulter-gen=TypeMeta // +groupName=cluster.kubesphere.io package v1alpha1 diff --git a/staging/src/kubesphere.io/api/cluster/v1alpha1/label_types.go b/staging/src/kubesphere.io/api/cluster/v1alpha1/label_types.go deleted file mode 100644 index 21e891bb4..000000000 --- a/staging/src/kubesphere.io/api/cluster/v1alpha1/label_types.go +++ /dev/null @@ -1,48 +0,0 @@ -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -func init() { - SchemeBuilder.Register(&Label{}, &LabelList{}) -} - -const ( - ClusterLabelIDsAnnotation = "cluster.kubesphere.io/label-ids" - LabelFinalizer = "finalizers.kubesphere.io/cluster-label" - ClusterLabelFormat = "label.cluster.kubesphere.io/%s" - - ResourcesPluralLabel = "labels" -) - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +genclient:nonNamespaced -// +kubebuilder:resource:scope=Cluster -// +kubebuilder:printcolumn:name="Key",type=string,JSONPath=".spec.key" -// +kubebuilder:printcolumn:name="Value",type=string,JSONPath=".spec.value" - -type Label struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec LabelSpec `json:"spec"` -} - -type LabelSpec struct { - Key string `json:"key"` - Value string `json:"value"` - // +optional - BackgroundColor string `json:"backgroundColor,omitempty"` - // +optional - Clusters []string `json:"clusters,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -type LabelList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []Label `json:"items"` -} diff --git a/staging/src/kubesphere.io/api/cluster/v1alpha1/register.go b/staging/src/kubesphere.io/api/cluster/v1alpha1/register.go index e3978b444..0f14c6949 100644 --- a/staging/src/kubesphere.io/api/cluster/v1alpha1/register.go +++ b/staging/src/kubesphere.io/api/cluster/v1alpha1/register.go @@ -1,41 +1,33 @@ -/* - -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 contains API Schema definitions for the tower v1alpha1 API group -// +k8s:openapi-gen=true -// +kubebuilder:object:generate=true -// +k8s:defaulter-gen=TypeMeta -// +groupName=cluster.kubesphere.io package v1alpha1 import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" ) +const GroupName = "cluster.kubesphere.io" + var ( - // SchemeGroupVersion is group version used to register these objects - SchemeGroupVersion = schema.GroupVersion{Group: "cluster.kubesphere.io", Version: "v1alpha1"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} - - // AddToScheme adds the types in this group-version to the given scheme. - AddToScheme = SchemeBuilder.AddToScheme + // SchemeGroupVersion is group version used to register these objects + SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme ) +// Resource takes an unqualified resource and returns a Group qualified GroupResource func Resource(resource string) schema.GroupResource { return SchemeGroupVersion.WithResource(resource).GroupResource() } + +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &Cluster{}, + &ClusterList{}, + &Label{}, + &LabelList{}, + ) + // Add the watch version that applies + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/staging/src/kubesphere.io/api/cluster/v1alpha1/cluster_types.go b/staging/src/kubesphere.io/api/cluster/v1alpha1/types.go similarity index 88% rename from staging/src/kubesphere.io/api/cluster/v1alpha1/cluster_types.go rename to staging/src/kubesphere.io/api/cluster/v1alpha1/types.go index a564be0c2..d32952ef7 100644 --- a/staging/src/kubesphere.io/api/cluster/v1alpha1/cluster_types.go +++ b/staging/src/kubesphere.io/api/cluster/v1alpha1/types.go @@ -10,6 +10,7 @@ const ( ResourceKindCluster = "Cluster" ResourcesSingularCluster = "cluster" ResourcesPluralCluster = "clusters" + ResourcesPluralLabel = "labels" HostCluster = "cluster-role.kubesphere.io/host" // ClusterRegion is the description of which region the cluster been placed @@ -25,6 +26,10 @@ const ( ClusterRoleHost ClusterRole = "host" ClusterRoleMember ClusterRole = "member" + + ClusterLabelIDsAnnotation = "cluster.kubesphere.io/label-ids" + LabelFinalizer = "finalizers.kubesphere.io/cluster-label" + ClusterLabelFormat = "label.cluster.kubesphere.io/%s" ) type ClusterRole string @@ -197,6 +202,31 @@ type ClusterList struct { Items []Cluster `json:"items"` } -func init() { - SchemeBuilder.Register(&Cluster{}, &ClusterList{}) +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Cluster +// +kubebuilder:printcolumn:name="Key",type=string,JSONPath=".spec.key" +// +kubebuilder:printcolumn:name="Value",type=string,JSONPath=".spec.value" + +type Label struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec LabelSpec `json:"spec"` +} + +type LabelSpec struct { + Key string `json:"key"` + Value string `json:"value"` + // +optional + BackgroundColor string `json:"backgroundColor,omitempty"` + // +optional + Clusters []string `json:"clusters,omitempty"` +} + +// +kubebuilder:object:root=true + +type LabelList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Label `json:"items"` } diff --git a/staging/src/kubesphere.io/api/cluster/v1alpha1/zz_generated.deepcopy.go b/staging/src/kubesphere.io/api/cluster/v1alpha1/zz_generated.deepcopy.go index cce731a2d..090eaa8e3 100644 --- a/staging/src/kubesphere.io/api/cluster/v1alpha1/zz_generated.deepcopy.go +++ b/staging/src/kubesphere.io/api/cluster/v1alpha1/zz_generated.deepcopy.go @@ -5,7 +5,7 @@ package v1alpha1 import ( - runtime "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. diff --git a/staging/src/kubesphere.io/api/core/v1alpha1/doc.go b/staging/src/kubesphere.io/api/core/v1alpha1/doc.go new file mode 100644 index 000000000..cb580ad4e --- /dev/null +++ b/staging/src/kubesphere.io/api/core/v1alpha1/doc.go @@ -0,0 +1,5 @@ +// +k8s:openapi-gen=true +// +kubebuilder:object:generate=true +// +groupName=kubesphere.io + +package v1alpha1 diff --git a/staging/src/kubesphere.io/api/core/v1alpha1/installplan_types.go b/staging/src/kubesphere.io/api/core/v1alpha1/installplan_types.go deleted file mode 100644 index 652a5f59b..000000000 --- a/staging/src/kubesphere.io/api/core/v1alpha1/installplan_types.go +++ /dev/null @@ -1,83 +0,0 @@ -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -const ( - ResourceKindInstallPlan = "InstallPlan" - - Automatic UpgradeStrategy = "Automatic" - Manual UpgradeStrategy = "Manual" -) - -type Placement struct { - // +listType=set - // +optional - Clusters []string `json:"clusters,omitempty"` - ClusterSelector *metav1.LabelSelector `json:"clusterSelector,omitempty"` -} - -type ClusterScheduling struct { - Placement *Placement `json:"placement,omitempty"` - Overrides map[string]string `json:"overrides,omitempty"` -} - -type InstallPlanState struct { - LastTransitionTime metav1.Time `json:"lastTransitionTime"` - State string `json:"state"` -} - -type InstallationStatus struct { - State string `json:"state,omitempty"` - ConfigHash string `json:"configHash,omitempty"` - TargetNamespace string `json:"targetNamespace,omitempty"` - ReleaseName string `json:"releaseName,omitempty"` - Version string `json:"version,omitempty"` - JobName string `json:"jobName,omitempty"` - Conditions []metav1.Condition `json:"conditions,omitempty"` - StateHistory []InstallPlanState `json:"stateHistory,omitempty"` -} - -type ExtensionRef struct { - Name string `json:"name"` - Version string `json:"version"` -} - -type UpgradeStrategy string - -type InstallPlanSpec struct { - Extension ExtensionRef `json:"extension"` - Enabled bool `json:"enabled"` - // +kubebuilder:default:=Manual - UpgradeStrategy UpgradeStrategy `json:"upgradeStrategy,omitempty"` - Config string `json:"config,omitempty"` - ClusterScheduling *ClusterScheduling `json:"clusterScheduling,omitempty"` -} - -type InstallPlanStatus struct { - InstallationStatus `json:",inline"` - Enabled bool `json:"enabled,omitempty"` - // ClusterSchedulingStatuses describes the subchart installation status of the extension - ClusterSchedulingStatuses map[string]InstallationStatus `json:"clusterSchedulingStatuses,omitempty"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:categories="extensions",scope="Cluster" -// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state" - -// InstallPlan defines how to install an extension in the cluster. -type InstallPlan struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - Spec InstallPlanSpec `json:"spec,omitempty"` - Status InstallPlanStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -type InstallPlanList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []InstallPlan `json:"items"` -} diff --git a/staging/src/kubesphere.io/api/core/v1alpha1/register.go b/staging/src/kubesphere.io/api/core/v1alpha1/register.go index 5faf5fb00..b03a0ed92 100644 --- a/staging/src/kubesphere.io/api/core/v1alpha1/register.go +++ b/staging/src/kubesphere.io/api/core/v1alpha1/register.go @@ -1,6 +1,3 @@ -// +kubebuilder:object:generate=true -// +groupName=kubesphere.io - package v1alpha1 import ( @@ -14,9 +11,8 @@ const GroupName = "kubesphere.io" var ( // SchemeGroupVersion is group version used to register these objects SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} - - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - AddToScheme = SchemeBuilder.AddToScheme + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme ) // Resource takes an unqualified resource and returns a Group qualified GroupResource diff --git a/staging/src/kubesphere.io/api/core/v1alpha1/repository_types.go b/staging/src/kubesphere.io/api/core/v1alpha1/repository_types.go deleted file mode 100644 index 56d954717..000000000 --- a/staging/src/kubesphere.io/api/core/v1alpha1/repository_types.go +++ /dev/null @@ -1,60 +0,0 @@ -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -type UpdateStrategy struct { - RegistryPoll `json:"registryPoll,omitempty"` - Timeout metav1.Duration `json:"timeout"` -} - -type RegistryPoll struct { - Interval metav1.Duration `json:"interval"` -} - -type BasicAuth struct { - Username string `json:"username,omitempty"` - Password string `json:"password,omitempty"` -} - -type RepositorySpec struct { - URL string `json:"url,omitempty"` - Description string `json:"description,omitempty"` - BasicAuth *BasicAuth `json:"basicAuth,omitempty"` - UpdateStrategy *UpdateStrategy `json:"updateStrategy,omitempty"` - // The caBundle (base64 string) is used in helmExecutor to verify the helm server. - // +optional - CABundle string `json:"caBundle,omitempty"` - // --insecure-skip-tls-verify. default false - Insecure bool `json:"insecure,omitempty"` - // The maximum number of synchronized versions for each extension. A value of 0 indicates that all versions will be synchronized. The default is 3. - // +optional - Depth *int `json:"depth,omitempty"` -} - -type RepositoryStatus struct { - // +optional - LastSyncTime *metav1.Time `json:"lastSyncTime,omitempty'"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:categories="extensions",scope="Cluster" - -// Repository declared a docker image containing the extension helm chart. -// The extension manager controller will deploy and synchronizes the extensions from the image repository. -type Repository struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec RepositorySpec `json:"spec,omitempty"` - Status RepositoryStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -type RepositoryList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []Repository `json:"items"` -} diff --git a/staging/src/kubesphere.io/api/core/v1alpha1/serviceaccount_types.go b/staging/src/kubesphere.io/api/core/v1alpha1/serviceaccount_types.go deleted file mode 100644 index c0068097a..000000000 --- a/staging/src/kubesphere.io/api/core/v1alpha1/serviceaccount_types.go +++ /dev/null @@ -1,37 +0,0 @@ -package v1alpha1 - -import ( - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -const ( - ServiceAccountName = "kubesphere.io/service-account.name" - ServiceAccountUID = "kubesphere.io/service-account.uid" - ServiceAccountToken = "token" - SecretTypeServiceAccountToken = "kubesphere.io/service-account-token" - - ServiceAccountGroup = "kubesphere:serviceaccount" - ServiceAccountTokenPrefix = ServiceAccountGroup + ":" - ServiceAccountTokenSubFormat = ServiceAccountTokenPrefix + "%s:%s" - ServiceAccountTokenExtraSecretNamespace = "secret-namespace" - ServiceAccountTokenExtraSecretName = "secret-name" -) - -// +kubebuilder:object:root=true -// +kubebuilder:resource:scope="Namespaced" - -type ServiceAccount struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Secrets []corev1.ObjectReference `json:"secrets,omitempty" patchStrategy:"merge" patchMergeKey:"name"` -} - -// +kubebuilder:object:root=true - -type ServiceAccountList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []ServiceAccount `json:"items"` -} diff --git a/staging/src/kubesphere.io/api/core/v1alpha1/extension_types.go b/staging/src/kubesphere.io/api/core/v1alpha1/types.go similarity index 52% rename from staging/src/kubesphere.io/api/core/v1alpha1/extension_types.go rename to staging/src/kubesphere.io/api/core/v1alpha1/types.go index 5bb378d40..ef278a8f6 100644 --- a/staging/src/kubesphere.io/api/core/v1alpha1/extension_types.go +++ b/staging/src/kubesphere.io/api/core/v1alpha1/types.go @@ -10,6 +10,21 @@ type InstallationMode string const ( InstallationModeHostOnly InstallationMode = "HostOnly" InstallationMulticluster InstallationMode = "Multicluster" + + ResourceKindInstallPlan = "InstallPlan" + Automatic UpgradeStrategy = "Automatic" + Manual UpgradeStrategy = "Manual" + + ServiceAccountName = "kubesphere.io/service-account.name" + ServiceAccountUID = "kubesphere.io/service-account.uid" + ServiceAccountToken = "token" + SecretTypeServiceAccountToken = "kubesphere.io/service-account-token" + + ServiceAccountGroup = "kubesphere:serviceaccount" + ServiceAccountTokenPrefix = ServiceAccountGroup + ":" + ServiceAccountTokenSubFormat = ServiceAccountTokenPrefix + "%s:%s" + ServiceAccountTokenExtraSecretNamespace = "secret-namespace" + ServiceAccountTokenExtraSecretName = "secret-name" ) // Provider describes an extension provider. @@ -170,3 +185,147 @@ type CategoryList struct { metav1.ListMeta `json:"metadata,omitempty"` Items []Category `json:"items"` } + +type Placement struct { + // +listType=set + // +optional + Clusters []string `json:"clusters,omitempty"` + ClusterSelector *metav1.LabelSelector `json:"clusterSelector,omitempty"` +} + +type ClusterScheduling struct { + Placement *Placement `json:"placement,omitempty"` + Overrides map[string]string `json:"overrides,omitempty"` +} + +type InstallPlanState struct { + LastTransitionTime metav1.Time `json:"lastTransitionTime"` + State string `json:"state"` +} + +type InstallationStatus struct { + State string `json:"state,omitempty"` + ConfigHash string `json:"configHash,omitempty"` + TargetNamespace string `json:"targetNamespace,omitempty"` + ReleaseName string `json:"releaseName,omitempty"` + Version string `json:"version,omitempty"` + JobName string `json:"jobName,omitempty"` + Conditions []metav1.Condition `json:"conditions,omitempty"` + StateHistory []InstallPlanState `json:"stateHistory,omitempty"` +} + +type ExtensionRef struct { + Name string `json:"name"` + Version string `json:"version"` +} + +type UpgradeStrategy string + +type InstallPlanSpec struct { + Extension ExtensionRef `json:"extension"` + Enabled bool `json:"enabled"` + // +kubebuilder:default:=Manual + UpgradeStrategy UpgradeStrategy `json:"upgradeStrategy,omitempty"` + Config string `json:"config,omitempty"` + ClusterScheduling *ClusterScheduling `json:"clusterScheduling,omitempty"` +} + +type InstallPlanStatus struct { + InstallationStatus `json:",inline"` + Enabled bool `json:"enabled,omitempty"` + // ClusterSchedulingStatuses describes the subchart installation status of the extension + ClusterSchedulingStatuses map[string]InstallationStatus `json:"clusterSchedulingStatuses,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:categories="extensions",scope="Cluster" +// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state" + +// InstallPlan defines how to install an extension in the cluster. +type InstallPlan struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec InstallPlanSpec `json:"spec,omitempty"` + Status InstallPlanStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +type InstallPlanList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []InstallPlan `json:"items"` +} + +type UpdateStrategy struct { + RegistryPoll `json:"registryPoll,omitempty"` + Timeout metav1.Duration `json:"timeout"` +} + +type RegistryPoll struct { + Interval metav1.Duration `json:"interval"` +} + +type BasicAuth struct { + Username string `json:"username,omitempty"` + Password string `json:"password,omitempty"` +} + +type RepositorySpec struct { + URL string `json:"url,omitempty"` + Description string `json:"description,omitempty"` + BasicAuth *BasicAuth `json:"basicAuth,omitempty"` + UpdateStrategy *UpdateStrategy `json:"updateStrategy,omitempty"` + // The caBundle (base64 string) is used in helmExecutor to verify the helm server. + // +optional + CABundle string `json:"caBundle,omitempty"` + // --insecure-skip-tls-verify. default false + Insecure bool `json:"insecure,omitempty"` + // The maximum number of synchronized versions for each extension. A value of 0 indicates that all versions will be synchronized. The default is 3. + // +optional + Depth *int `json:"depth,omitempty"` +} + +type RepositoryStatus struct { + // +optional + LastSyncTime *metav1.Time `json:"lastSyncTime,omitempty'"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:categories="extensions",scope="Cluster" + +// Repository declared a docker image containing the extension helm chart. +// The extension manager controller will deploy and synchronizes the extensions from the image repository. +type Repository struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec RepositorySpec `json:"spec,omitempty"` + Status RepositoryStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +type RepositoryList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Repository `json:"items"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope="Namespaced" + +type ServiceAccount struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Secrets []corev1.ObjectReference `json:"secrets,omitempty" patchStrategy:"merge" patchMergeKey:"name"` +} + +// +kubebuilder:object:root=true + +type ServiceAccountList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ServiceAccount `json:"items"` +} diff --git a/staging/src/kubesphere.io/api/extensions/v1alpha1/apiservice_types.go b/staging/src/kubesphere.io/api/extensions/v1alpha1/apiservice_types.go deleted file mode 100644 index 4867426c5..000000000 --- a/staging/src/kubesphere.io/api/extensions/v1alpha1/apiservice_types.go +++ /dev/null @@ -1,38 +0,0 @@ -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -type APIServiceSpec struct { - Group string `json:"group,omitempty"` - Version string `json:"version,omitempty"` - Endpoint `json:",inline"` -} - -type APIServiceStatus struct { - State string `json:"state,omitempty"` - Conditions []metav1.Condition `json:"conditions,omitempty"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:scope="Cluster" - -// APIService is a special resource used in Ks-apiserver -// declares a directional proxy path for a resource type API, -// it's similar to Kubernetes API Aggregation Layer. -type APIService struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec APIServiceSpec `json:"spec,omitempty"` - Status APIServiceStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -type APIServiceList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []APIService `json:"items"` -} diff --git a/staging/src/kubesphere.io/api/extensions/v1alpha1/doc.go b/staging/src/kubesphere.io/api/extensions/v1alpha1/doc.go new file mode 100644 index 000000000..baa45e271 --- /dev/null +++ b/staging/src/kubesphere.io/api/extensions/v1alpha1/doc.go @@ -0,0 +1,5 @@ +// +k8s:openapi-gen=true +// +kubebuilder:object:generate=true +// +groupName=extensions.kubesphere.io + +package v1alpha1 diff --git a/staging/src/kubesphere.io/api/extensions/v1alpha1/extensionentry_types.go b/staging/src/kubesphere.io/api/extensions/v1alpha1/extensionentry_types.go deleted file mode 100644 index 79d1ebae6..000000000 --- a/staging/src/kubesphere.io/api/extensions/v1alpha1/extensionentry_types.go +++ /dev/null @@ -1,36 +0,0 @@ -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" -) - -type ExtensionEntrySpec struct { - Entries []runtime.RawExtension `json:"entries,omitempty"` -} - -type ExtensionEntryStatus struct { - State string `json:"state,omitempty"` - // +optional - Conditions []metav1.Condition `json:"conditions,omitempty"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:scope="Cluster" - -// ExtensionEntry declares an entry endpoint that needs to be injected into ks-console. -type ExtensionEntry struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec ExtensionEntrySpec `json:"spec,omitempty"` - Status ExtensionEntryStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -type ExtensionEntryList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []ExtensionEntry `json:"items"` -} diff --git a/staging/src/kubesphere.io/api/extensions/v1alpha1/jsbundle_types.go b/staging/src/kubesphere.io/api/extensions/v1alpha1/jsbundle_types.go deleted file mode 100644 index 966ee6b49..000000000 --- a/staging/src/kubesphere.io/api/extensions/v1alpha1/jsbundle_types.go +++ /dev/null @@ -1,82 +0,0 @@ -package v1alpha1 - -import ( - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -type JSBundleSpec struct { - // +optional - Raw []byte `json:"raw,omitempty"` - // +optional - RawFrom RawFrom `json:"rawFrom,omitempty"` - // +optional - Assets Assets `json:"assets,omitempty"` -} - -type Assets struct { - Style *AuxiliaryStyle `json:"style,omitempty"` - Files []FileLocation `json:"files,omitempty"` -} - -type AuxiliaryStyle struct { - Link string `json:"link,omitempty"` - Endpoint `json:",inline"` -} - -type FileLocation struct { - Name string `json:"name,omitempty"` - Link string `json:"link,omitempty"` - // Set the MIME Type of the file, if not specified, it will be provided by the content-type response header in the upstream service by default. - // +optional - MIMEType *string `json:"mimeType,omitempty"` - Endpoint `json:",inline"` -} - -type RawFrom struct { - Endpoint `json:",inline"` - // Selects a key of a ConfigMap. - ConfigMapKeyRef *ConfigMapKeyRef `json:"configMapKeyRef,omitempty"` - // Selects a key of a Secret. - SecretKeyRef *SecretKeyRef `json:"secretKeyRef,omitempty"` -} - -type ConfigMapKeyRef struct { - corev1.ConfigMapKeySelector `json:",inline"` - Namespace string `json:"namespace"` -} - -type SecretKeyRef struct { - corev1.SecretKeySelector `json:",inline"` - Namespace string `json:"namespace"` -} - -type JSBundleStatus struct { - // Link is the path for downloading JS file, default to "/dist/{jsBundleName}/index.js". - // +optional - Link string `json:"link,omitempty"` - State string `json:"state,omitempty"` - // +optional - Conditions []metav1.Condition `json:"conditions,omitempty"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:scope="Cluster" - -// JSBundle declares a js bundle that needs to be injected into ks-console, -// the endpoint can be provided by a service or a static file. -type JSBundle struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec JSBundleSpec `json:"spec,omitempty"` - Status JSBundleStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -type JSBundleList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []JSBundle `json:"items"` -} diff --git a/staging/src/kubesphere.io/api/extensions/v1alpha1/register.go b/staging/src/kubesphere.io/api/extensions/v1alpha1/register.go index 8cdef86d3..2c3339027 100644 --- a/staging/src/kubesphere.io/api/extensions/v1alpha1/register.go +++ b/staging/src/kubesphere.io/api/extensions/v1alpha1/register.go @@ -1,33 +1,27 @@ -// NOTE: Boilerplate only. Ignore this file. - -// +kubebuilder:object:generate=true -// +groupName=extensions.kubesphere.io - package v1alpha1 import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" ) +const GroupName = "extensions.kubesphere.io" + var ( // SchemeGroupVersion is group version used to register these objects - SchemeGroupVersion = schema.GroupVersion{Group: "extensions.kubesphere.io", Version: "v1alpha1"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} - - // AddToScheme is required by pkg/client/... - AddToScheme = SchemeBuilder.AddToScheme + SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme ) -// Resource is required by pkg/client/listers/... +// Resource takes an unqualified resource and returns a Group qualified GroupResource func Resource(resource string) schema.GroupResource { return SchemeGroupVersion.WithResource(resource).GroupResource() } -func init() { - SchemeBuilder.Register( +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, &APIService{}, &APIServiceList{}, &JSBundle{}, @@ -37,4 +31,7 @@ func init() { &ExtensionEntry{}, &ExtensionEntryList{}, ) + // Add the watch version that applies + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil } diff --git a/staging/src/kubesphere.io/api/extensions/v1alpha1/reverseproxy_types.go b/staging/src/kubesphere.io/api/extensions/v1alpha1/reverseproxy_types.go deleted file mode 100644 index 8f39b01c5..000000000 --- a/staging/src/kubesphere.io/api/extensions/v1alpha1/reverseproxy_types.go +++ /dev/null @@ -1,63 +0,0 @@ -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -type Matcher struct { - Path string `json:"path"` - Method string `json:"method"` -} - -type ReverseProxySpec struct { - Matcher Matcher `json:"matcher,omitempty"` - Upstream Endpoint `json:"upstream,omitempty"` - Directives Directives `json:"directives,omitempty"` -} - -type Directives struct { - // Changes the request's HTTP verb. - Method string `json:"method,omitempty"` - // Strips the given prefix from the beginning of the URI path. - StripPathPrefix string `json:"stripPathPrefix,omitempty"` - // Strips the given suffix from the end of the URI path. - StripPathSuffix string `json:"stripPathSuffix,omitempty"` - // Sets, adds (with the + prefix), deletes (with the - prefix), or performs a replacement (by using two arguments, a search and replacement) in a request header going upstream to the backend. - HeaderUp []string `json:"headerUp,omitempty"` - // Sets, adds (with the + prefix), deletes (with the - prefix), or performs a replacement (by using two arguments, a search and replacement) in a response header coming downstream from the backend. - HeaderDown []string `json:"headerDown,omitempty"` - // Reject to forward redirect response - RejectForwardingRedirects bool `json:"rejectForwardingRedirects,omitempty"` - // WrapTransport indicates whether the provided Transport should be wrapped with default proxy transport behavior (URL rewriting, X-Forwarded-* header setting) - WrapTransport bool `json:"wrapTransport,omitempty"` - // Add auth proxy header to requests - AuthProxy bool `json:"authProxy,omitempty"` - Rewrite []string `json:"rewrite,omitempty"` - Replace []string `json:"replace,omitempty"` - PathRegexp []string `json:"pathRegexp,omitempty"` -} - -type ReverseProxyStatus struct { - State string `json:"state,omitempty"` - // +optional - Conditions []metav1.Condition `json:"conditions,omitempty"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:scope="Cluster" - -type ReverseProxy struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec ReverseProxySpec `json:"spec,omitempty"` - Status ReverseProxyStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -type ReverseProxyList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []ReverseProxy `json:"items"` -} diff --git a/staging/src/kubesphere.io/api/extensions/v1alpha1/types.go b/staging/src/kubesphere.io/api/extensions/v1alpha1/types.go new file mode 100644 index 000000000..747289b7b --- /dev/null +++ b/staging/src/kubesphere.io/api/extensions/v1alpha1/types.go @@ -0,0 +1,204 @@ +package v1alpha1 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +type APIServiceSpec struct { + Group string `json:"group,omitempty"` + Version string `json:"version,omitempty"` + Endpoint `json:",inline"` +} + +type APIServiceStatus struct { + State string `json:"state,omitempty"` + Conditions []metav1.Condition `json:"conditions,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope="Cluster" + +// APIService is a special resource used in Ks-apiserver +// declares a directional proxy path for a resource type API, +// it's similar to Kubernetes API Aggregation Layer. +type APIService struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec APIServiceSpec `json:"spec,omitempty"` + Status APIServiceStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +type APIServiceList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []APIService `json:"items"` +} + +type JSBundleSpec struct { + // +optional + Raw []byte `json:"raw,omitempty"` + // +optional + RawFrom RawFrom `json:"rawFrom,omitempty"` + // +optional + Assets Assets `json:"assets,omitempty"` +} + +type Assets struct { + Style *AuxiliaryStyle `json:"style,omitempty"` + Files []FileLocation `json:"files,omitempty"` +} + +type AuxiliaryStyle struct { + Link string `json:"link,omitempty"` + Endpoint `json:",inline"` +} + +type FileLocation struct { + Name string `json:"name,omitempty"` + Link string `json:"link,omitempty"` + // Set the MIME Type of the file, if not specified, it will be provided by the content-type response header in the upstream service by default. + // +optional + MIMEType *string `json:"mimeType,omitempty"` + Endpoint `json:",inline"` +} + +type RawFrom struct { + Endpoint `json:",inline"` + // Selects a key of a ConfigMap. + ConfigMapKeyRef *ConfigMapKeyRef `json:"configMapKeyRef,omitempty"` + // Selects a key of a Secret. + SecretKeyRef *SecretKeyRef `json:"secretKeyRef,omitempty"` +} + +type ConfigMapKeyRef struct { + corev1.ConfigMapKeySelector `json:",inline"` + Namespace string `json:"namespace"` +} + +type SecretKeyRef struct { + corev1.SecretKeySelector `json:",inline"` + Namespace string `json:"namespace"` +} + +type JSBundleStatus struct { + // Link is the path for downloading JS file, default to "/dist/{jsBundleName}/index.js". + // +optional + Link string `json:"link,omitempty"` + State string `json:"state,omitempty"` + // +optional + Conditions []metav1.Condition `json:"conditions,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope="Cluster" + +// JSBundle declares a js bundle that needs to be injected into ks-console, +// the endpoint can be provided by a service or a static file. +type JSBundle struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec JSBundleSpec `json:"spec,omitempty"` + Status JSBundleStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +type JSBundleList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []JSBundle `json:"items"` +} + +type Matcher struct { + Path string `json:"path"` + Method string `json:"method"` +} + +type ReverseProxySpec struct { + Matcher Matcher `json:"matcher,omitempty"` + Upstream Endpoint `json:"upstream,omitempty"` + Directives Directives `json:"directives,omitempty"` +} + +type Directives struct { + // Changes the request's HTTP verb. + Method string `json:"method,omitempty"` + // Strips the given prefix from the beginning of the URI path. + StripPathPrefix string `json:"stripPathPrefix,omitempty"` + // Strips the given suffix from the end of the URI path. + StripPathSuffix string `json:"stripPathSuffix,omitempty"` + // Sets, adds (with the + prefix), deletes (with the - prefix), or performs a replacement (by using two arguments, a search and replacement) in a request header going upstream to the backend. + HeaderUp []string `json:"headerUp,omitempty"` + // Sets, adds (with the + prefix), deletes (with the - prefix), or performs a replacement (by using two arguments, a search and replacement) in a response header coming downstream from the backend. + HeaderDown []string `json:"headerDown,omitempty"` + // Reject to forward redirect response + RejectForwardingRedirects bool `json:"rejectForwardingRedirects,omitempty"` + // WrapTransport indicates whether the provided Transport should be wrapped with default proxy transport behavior (URL rewriting, X-Forwarded-* header setting) + WrapTransport bool `json:"wrapTransport,omitempty"` + // Add auth proxy header to requests + AuthProxy bool `json:"authProxy,omitempty"` + Rewrite []string `json:"rewrite,omitempty"` + Replace []string `json:"replace,omitempty"` + PathRegexp []string `json:"pathRegexp,omitempty"` +} + +type ReverseProxyStatus struct { + State string `json:"state,omitempty"` + // +optional + Conditions []metav1.Condition `json:"conditions,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope="Cluster" + +type ReverseProxy struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ReverseProxySpec `json:"spec,omitempty"` + Status ReverseProxyStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +type ReverseProxyList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ReverseProxy `json:"items"` +} + +type ExtensionEntrySpec struct { + Entries []runtime.RawExtension `json:"entries,omitempty"` +} + +type ExtensionEntryStatus struct { + State string `json:"state,omitempty"` + // +optional + Conditions []metav1.Condition `json:"conditions,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope="Cluster" + +// ExtensionEntry declares an entry endpoint that needs to be injected into ks-console. +type ExtensionEntry struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ExtensionEntrySpec `json:"spec,omitempty"` + Status ExtensionEntryStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +type ExtensionEntryList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ExtensionEntry `json:"items"` +} diff --git a/staging/src/kubesphere.io/api/gateway/v1alpha2/doc.go b/staging/src/kubesphere.io/api/gateway/v1alpha2/doc.go new file mode 100644 index 000000000..6a672eab5 --- /dev/null +++ b/staging/src/kubesphere.io/api/gateway/v1alpha2/doc.go @@ -0,0 +1,5 @@ +// Package v1alpha2 contains API Schema definitions for the gateway v1alpha2 API group +// +k8s:openapi-gen=true +// +kubebuilder:object:generate=true +// +groupName=gateway.kubesphere.io +package v1alpha2 diff --git a/staging/src/kubesphere.io/api/gateway/v1alpha2/register.go b/staging/src/kubesphere.io/api/gateway/v1alpha2/register.go index 4db29b6ca..4e8bd6352 100644 --- a/staging/src/kubesphere.io/api/gateway/v1alpha2/register.go +++ b/staging/src/kubesphere.io/api/gateway/v1alpha2/register.go @@ -1,26 +1,18 @@ -// +kubebuilder:object:generate=true -// +groupName=gateway.kubesphere.io - package v1alpha2 import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" ) -const ( - GroupName = "gateway.kubesphere.io" - Version = "v1alpha2" -) +const GroupName = "gateway.kubesphere.io" var ( // SchemeGroupVersion is group version used to register these objects - SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: Version} - - SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} - - // AddToScheme is required by pkg/client/... - AddToScheme = SchemeBuilder.AddToScheme + SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha2"} + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme ) // Resource takes an unqualified resource and returns a Group qualified GroupResource @@ -28,9 +20,12 @@ func Resource(resource string) schema.GroupResource { return SchemeGroupVersion.WithResource(resource).GroupResource() } -func init() { - SchemeBuilder.Register( +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, &IngressClassScope{}, &IngressClassScopeList{}, ) + // Add the watch version that applies + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil } diff --git a/staging/src/kubesphere.io/api/gateway/v1alpha2/ingressclassscope_types.go b/staging/src/kubesphere.io/api/gateway/v1alpha2/types.go similarity index 100% rename from staging/src/kubesphere.io/api/gateway/v1alpha2/ingressclassscope_types.go rename to staging/src/kubesphere.io/api/gateway/v1alpha2/types.go diff --git a/staging/src/kubesphere.io/api/go.mod b/staging/src/kubesphere.io/api/go.mod index ad97fa29c..9b5887879 100644 --- a/staging/src/kubesphere.io/api/go.mod +++ b/staging/src/kubesphere.io/api/go.mod @@ -7,18 +7,13 @@ go 1.23.0 toolchain go1.23.7 require ( - github.com/onsi/gomega v1.34.2 - golang.org/x/net v0.37.0 k8s.io/api v0.31.2 k8s.io/apimachinery v0.31.2 k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 - sigs.k8s.io/controller-runtime v0.19.1 ) require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect - github.com/evanphx/json-patch/v5 v5.9.0 // indirect github.com/fxamacker/cbor/v2 v2.7.0 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-openapi/jsonpointer v0.19.6 // indirect @@ -27,43 +22,28 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/google/gnostic-models v0.6.8 // indirect - github.com/google/go-cmp v0.6.0 // indirect github.com/google/gofuzz v1.2.0 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/imdario/mergo v0.3.16 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/pkg/errors v0.9.1 // indirect github.com/stretchr/testify v1.10.0 // indirect github.com/x448/float16 v0.8.4 // indirect - golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect - golang.org/x/oauth2 v0.22.0 // indirect - golang.org/x/sys v0.31.0 // indirect - golang.org/x/term v0.30.0 // indirect + golang.org/x/net v0.37.0 // indirect golang.org/x/text v0.23.0 // indirect - golang.org/x/time v0.7.0 // indirect - golang.org/x/tools v0.26.0 // indirect google.golang.org/protobuf v1.35.2 // indirect - gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiextensions-apiserver v0.31.2 // indirect - k8s.io/client-go v0.31.2 // indirect k8s.io/klog/v2 v2.130.1 // indirect k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect - sigs.k8s.io/yaml v1.4.0 // indirect ) replace ( golang.org/x/crypto => golang.org/x/crypto v0.32.0 - golang.org/x/oauth2 => golang.org/x/oauth2 v0.21.0 golang.org/x/sync => golang.org/x/sync v0.1.0 golang.org/x/sys => golang.org/x/sys v0.26.0 golang.org/x/text => golang.org/x/text v0.19.0 diff --git a/staging/src/kubesphere.io/api/go.sum b/staging/src/kubesphere.io/api/go.sum index f94767748..284fa9cda 100644 --- a/staging/src/kubesphere.io/api/go.sum +++ b/staging/src/kubesphere.io/api/go.sum @@ -1,33 +1,17 @@ -cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= -github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c= -github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g= +github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= -github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec= -github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= -github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg= -github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= -github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= -github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR8/Gg= github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= @@ -35,16 +19,11 @@ github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= -github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= -github.com/google/cel-go v0.20.1/go.mod h1:kWcIzTsPX0zmQ+H3TirHstLLf9ep5QTsZBN9u4dOYLg= github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -53,21 +32,8 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 h1:5iH8iuqE5apketRbSFBy+X1V0o+l+8NF1avt4HWl7cA= -github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= -github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= -github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= -github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= -github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= @@ -89,31 +55,18 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= -github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= -github.com/onsi/ginkgo/v2 v2.20.1 h1:YlVIbqct+ZmnEph770q9Q7NVAz4wwIiVNahee6JyUzo= -github.com/onsi/ginkgo/v2 v2.20.1/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI= -github.com/onsi/gomega v1.34.2 h1:pNCwDkzrsv7MS9kpaQvVb1aVLahQXyJ/Tv5oAZMI3i8= -github.com/onsi/gomega v1.34.2/go.mod h1:v1xfxRgk0KIsG+QOdm7p8UosrOzPYRo60fd3B/1Dukc= -github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To= +github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= -github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= -github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= -github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= -github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= @@ -124,45 +77,18 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75/go.mod h1:KO6IkyS8Y3j8OdNO85qEYBsRPuteD+YciPomcXdrMnk= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.etcd.io/bbolt v1.3.9/go.mod h1:zaO32+Ti0PK1ivdPtgMESzuzL2VPoIG1PCQNvOdo/dE= -go.etcd.io/etcd/api/v3 v3.5.14/go.mod h1:BmtWcRlQvwa1h3G2jvKYwIQy4PkHlDej5t7uLMUdJUU= -go.etcd.io/etcd/client/pkg/v3 v3.5.14/go.mod h1:8uMgAokyG1czCtIdsq+AGyYQMvpIKnSvPjFMunkgeZI= -go.etcd.io/etcd/client/v2 v2.305.13/go.mod h1:iQnL7fepbiomdXMb3om1rHq96htNNGv2sJkEcZGDRRg= -go.etcd.io/etcd/client/v3 v3.5.14/go.mod h1:k3XfdV/VIHy/97rqWjoUzrj9tk7GgJGH9J8L4dNXmAk= -go.etcd.io/etcd/pkg/v3 v3.5.13/go.mod h1:N+4PLrp7agI/Viy+dUYpX7iRtSPvKq+w8Y14d1vX+m0= -go.etcd.io/etcd/raft/v3 v3.5.13/go.mod h1:uUFibGLn2Ksm2URMxN1fICGhk8Wu96EfDQyuLhAcAmw= -go.etcd.io/etcd/server/v3 v3.5.13/go.mod h1:K/8nbsGupHqmr5MkgaZpLlH1QdX1pcNQLAkODy44XcQ= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0/go.mod h1:azvtTADFQJA8mX80jIH/akaE7h+dbm/sVuaHqN13w74= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg= -go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0/go.mod h1:s75jGIWA9OfCMzF0xr+ZgfrB5FEbbV7UuYo32ahUiFI= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0/go.mod h1:MOiCmryaYtc+V0Ei+Tx9o5S1ZjA7kzLucuVuyzBZloQ= -go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= -go.opentelemetry.io/otel/sdk v1.28.0/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8zjcZEfu7Pg= -go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= -go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= -go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= -go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= -go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= -golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8= -golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= @@ -172,52 +98,37 @@ golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= -golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= -golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= -golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457/go.mod h1:pRgIJT+bRLFKnoM1ldnzKoxTIn14Yxz928LQRYYgIN0= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= -golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y= golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g= golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= -golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= -golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= -golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -gomodules.xyz/jsonpatch/v2 v2.4.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= -google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4= gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= @@ -226,26 +137,15 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= k8s.io/api v0.31.2 h1:3wLBbL5Uom/8Zy98GRPXpJ254nEFpl+hwndmk9RwmL0= k8s.io/api v0.31.2/go.mod h1:bWmGvrGPssSK1ljmLzd3pwCQ9MgoTsRCuK35u6SygUk= -k8s.io/apiextensions-apiserver v0.31.2 h1:W8EwUb8+WXBLu56ser5IudT2cOho0gAKeTOnywBLxd0= -k8s.io/apiextensions-apiserver v0.31.2/go.mod h1:i+Geh+nGCJEGiCGR3MlBDkS7koHIIKWVfWeRFiOsUcM= k8s.io/apimachinery v0.31.2 h1:i4vUt2hPK56W6mlT7Ry+AO8eEsyxMD1U44NR22CLTYw= k8s.io/apimachinery v0.31.2/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= -k8s.io/apiserver v0.31.2/go.mod h1:o3nKZR7lPlJqkU5I3Ove+Zx3JuoFjQobGX1Gctw6XuE= -k8s.io/client-go v0.31.2 h1:Y2F4dxU5d3AQj+ybwSMqQnpZH9F30//1ObxOKlTI9yc= -k8s.io/client-go v0.31.2/go.mod h1:NPa74jSVR/+eez2dFsEIHNa+3o09vtNaWwWwb1qSxSs= -k8s.io/code-generator v0.31.2/go.mod h1:eEQHXgBU/m7LDaToDoiz3t97dUUVyOblQdwOr8rivqc= -k8s.io/component-base v0.31.2/go.mod h1:9PeyyFN/drHjtJZMCTkSpQJS3U9OXORnHQqMLDz0sUQ= k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70/go.mod h1:VH3AT8AaQOqiGjMF9p0/IM1Dj+82ZwjfxUP1IxaHE+8= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/kms v0.31.2/go.mod h1:OZKwl1fan3n3N5FFxnW5C4V3ygrah/3YXeJWS3O6+94= k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag= k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= -sigs.k8s.io/controller-runtime v0.19.1 h1:Son+Q40+Be3QWb+niBXAg2vFiYWolDjjRfO8hn/cxOk= -sigs.k8s.io/controller-runtime v0.19.1/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= diff --git a/staging/src/kubesphere.io/api/iam/group.go b/staging/src/kubesphere.io/api/iam/group.go deleted file mode 100644 index f6e730873..000000000 --- a/staging/src/kubesphere.io/api/iam/group.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package iam contains iam API versions -package iam diff --git a/staging/src/kubesphere.io/api/iam/v1alpha2/doc.go b/staging/src/kubesphere.io/api/iam/v1alpha2/doc.go new file mode 100644 index 000000000..b6e360c8c --- /dev/null +++ b/staging/src/kubesphere.io/api/iam/v1alpha2/doc.go @@ -0,0 +1,5 @@ +// Package v1alpha2 contains API Schema definitions for the iam v1alpha2 API group +// +k8s:openapi-gen=true +// +kubebuilder:object:generate=true +// +groupName=iam.kubesphere.io +package v1alpha2 diff --git a/staging/src/kubesphere.io/api/iam/v1alpha2/register.go b/staging/src/kubesphere.io/api/iam/v1alpha2/register.go index e26bd156b..a9a3535c7 100644 --- a/staging/src/kubesphere.io/api/iam/v1alpha2/register.go +++ b/staging/src/kubesphere.io/api/iam/v1alpha2/register.go @@ -1,9 +1,3 @@ -// NOTE: Boilerplate only. Ignore this file. - -// Package v1alpha2 contains API Schema definitions for the iam v1alpha2 API group -// +k8s:openapi-gen=true -// +kubebuilder:object:generate=true -// +groupName=iam.kubesphere.io package v1alpha2 import ( @@ -12,23 +6,20 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" ) +const GroupName = "iam.kubesphere.io" + var ( // SchemeGroupVersion is group version used to register these objects - SchemeGroupVersion = schema.GroupVersion{Group: "iam.kubesphere.io", Version: "v1alpha2"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - - // AddToScheme is required by pkg/client/... - AddToScheme = SchemeBuilder.AddToScheme + SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha2"} + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme ) -// Resource is required by pkg/client/listers/... +// Resource takes an unqualified resource and returns a Group qualified GroupResource func Resource(resource string) schema.GroupResource { return SchemeGroupVersion.WithResource(resource).GroupResource() } -// Adds the list of known types to the given scheme. func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &User{}, @@ -48,6 +39,7 @@ func addKnownTypes(scheme *runtime.Scheme) error { &GroupBinding{}, &GroupBindingList{}, ) + // Add the watch version that applies metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil } diff --git a/staging/src/kubesphere.io/api/iam/v1alpha2/types.go b/staging/src/kubesphere.io/api/iam/v1alpha2/types.go index bf26289f0..2fa3e17c4 100644 --- a/staging/src/kubesphere.io/api/iam/v1alpha2/types.go +++ b/staging/src/kubesphere.io/api/iam/v1alpha2/types.go @@ -73,7 +73,6 @@ const ( ) // +kubebuilder:object:root=true -// +k8s:openapi-gen=true // +kubebuilder:deprecatedversion // +kubebuilder:printcolumn:name="Email",type="string",JSONPath=".spec.email" // +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.state" @@ -90,8 +89,6 @@ type User struct { Status UserStatus `json:"status,omitempty"` } -type FinalizerName string - // UserSpec defines the desired state of User type UserSpec struct { // Unique email address(https://www.ietf.org/rfc/rfc5322.txt). diff --git a/staging/src/kubesphere.io/api/iam/v1beta1/constants.go b/staging/src/kubesphere.io/api/iam/v1beta1/constants.go index 9c8a9507f..df55a7751 100644 --- a/staging/src/kubesphere.io/api/iam/v1beta1/constants.go +++ b/staging/src/kubesphere.io/api/iam/v1beta1/constants.go @@ -74,5 +74,4 @@ const ( GroupReferenceLabel = "iam.kubesphere.io/group-ref" GroupParent = "iam.kubesphere.io/group-parent" ResourcePluralGroupBinding = "groupbindings" - GroupName = "iam.kubesphere.io" ) diff --git a/staging/src/kubesphere.io/api/iam/v1beta1/doc.go b/staging/src/kubesphere.io/api/iam/v1beta1/doc.go index f8aa17259..c6bce21ad 100644 --- a/staging/src/kubesphere.io/api/iam/v1beta1/doc.go +++ b/staging/src/kubesphere.io/api/iam/v1beta1/doc.go @@ -1,7 +1,5 @@ // Package v1beta1 contains API Schema definitions for the iam v1beta1 API group // +k8s:openapi-gen=true // +kubebuilder:object:generate=true -// +k8s:conversion-gen=kubesphere.io/api/iam -// +k8s:defaulter-gen=TypeMeta // +groupName=iam.kubesphere.io package v1beta1 diff --git a/staging/src/kubesphere.io/api/iam/v1beta1/im_types.go b/staging/src/kubesphere.io/api/iam/v1beta1/im_types.go deleted file mode 100644 index 58e8b394f..000000000 --- a/staging/src/kubesphere.io/api/iam/v1beta1/im_types.go +++ /dev/null @@ -1,256 +0,0 @@ -package v1beta1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" -) - -// DefaultInfo provides a simple user information exchange object -// for components that implement the UserInfo interface. -type DefaultInfo struct { - Name string - UID string - Groups []string - Extra map[string][]string -} - -func (i *DefaultInfo) GetName() string { - return i.Name -} - -func (i *DefaultInfo) GetUID() string { - return i.UID -} - -func (i *DefaultInfo) GetGroups() []string { - return i.Groups -} - -func (i *DefaultInfo) GetExtra() map[string][]string { - return i.Extra -} - -// User is the Schema for the users API -// +kubebuilder:printcolumn:name="Email",type="string",JSONPath=".spec.email" -// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.state" -// +kubebuilder:resource:categories="iam",scope="Cluster" -// +kubebuilder:object:root=true -// +kubebuilder:storageversion -type User struct { - metav1.TypeMeta `json:",inline"` - // +optional - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec UserSpec `json:"spec"` - // +optional - Status UserStatus `json:"status,omitempty"` -} - -// UserSpec defines the desired state of User -type UserSpec struct { - // Unique email address(https://www.ietf.org/rfc/rfc5322.txt). - Email string `json:"email"` - // The preferred written or spoken language for the user. - // +optional - Lang string `json:"lang,omitempty"` - // Description of the user. - // +optional - Description string `json:"description,omitempty"` - // +optional - DisplayName string `json:"displayName,omitempty"` - // +optional - Groups []string `json:"groups,omitempty"` - - // password will be encrypted by mutating admission webhook - // +kubebuilder:validation:MinLength=8 - // +kubebuilder:validation:MaxLength=64 - // +kubebuilder:validation:Pattern=`^(.*[a-z].*[A-Z].*[0-9].*)$|^(.*[a-z].*[0-9].*[A-Z].*)$|^(.*[A-Z].*[a-z].*[0-9].*)$|^(.*[A-Z].*[0-9].*[a-z].*)$|^(.*[0-9].*[a-z].*[A-Z].*)$|^(.*[0-9].*[A-Z].*[a-z].*)$|^(\$2[ayb]\$.{56})$` - // Password pattern is tricky here. - // The rule is simple: length between [6,64], at least one uppercase letter, one lowercase letter, one digit. - // The regexp in console(javascript) is quite straightforward: ^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[^]{6,64}$ - // But in Go, we don't have ?= (back tracking) capability in regexp (also in CRD validation pattern) - // So we adopted an alternative scheme to achieve. - // Use 6 different regexp to combine to achieve the same effect. - // These six schemes enumerate the arrangement of numbers, uppercase letters, and lowercase letters that appear for the first time. - // - ^(.*[a-z].*[A-Z].*[0-9].*)$ stands for lowercase letter comes first, then followed by an uppercase letter, then a digit. - // - ^(.*[a-z].*[0-9].*[A-Z].*)$ stands for lowercase letter comes first, then followed by a digit, then an uppercase leeter. - // - ^(.*[A-Z].*[a-z].*[0-9].*)$ ... - // - ^(.*[A-Z].*[0-9].*[a-z].*)$ ... - // - ^(.*[0-9].*[a-z].*[A-Z].*)$ ... - // - ^(.*[0-9].*[A-Z].*[a-z].*)$ ... - // Last but not least, the bcrypt string is also included to match the encrypted password. ^(\$2[ayb]\$.{56})$ - EncryptedPassword string `json:"password,omitempty"` -} - -type UserState string - -// These are the valid phases of a user. -const ( - // UserActive means the user is available. - UserActive UserState = "Active" - // UserDisabled means the user is disabled. - UserDisabled UserState = "Disabled" - // UserAuthLimitExceeded means restrict user login. - UserAuthLimitExceeded UserState = "AuthLimitExceeded" - - AuthenticatedSuccessfully = "authenticated successfully" -) - -// UserStatus defines the observed state of User -type UserStatus struct { - // The user status - // +optional - State UserState `json:"state,omitempty"` - // +optional - Reason string `json:"reason,omitempty"` - // +optional - LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` - // Last login attempt timestamp - // +optional - LastLoginTime *metav1.Time `json:"lastLoginTime,omitempty"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:categories="iam",scope="Cluster" - -// UserList contains a list of User -type UserList struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. - // +optional - metav1.ListMeta `json:"metadata,omitempty"` - Items []User `json:"items"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:categories="iam",scope="Cluster" -// +kubebuilder:storageversion - -type BuiltinRole struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - // +kubebuilder:pruning:PreserveUnknownFields - // +kubebuilder:validation:EmbeddedResource - Role runtime.RawExtension `json:"role"` - TargetSelector metav1.LabelSelector `json:"targetSelector,omitempty"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:categories="iam",scope="Cluster" - -// BuiltinRoleList contains a list of BuiltinRole -type BuiltinRoleList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []BuiltinRole `json:"items"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:printcolumn:name="Type",type="string",JSONPath=".spec.type" -// +kubebuilder:printcolumn:name="Provider",type="string",JSONPath=".spec.provider" -// +kubebuilder:printcolumn:name="From",type="string",JSONPath=".spec.sourceIP" -// +kubebuilder:printcolumn:name="Success",type="string",JSONPath=".spec.success" -// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".spec.reason" -// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:resource:categories="iam",scope="Cluster" -// +kubebuilder:storageversion - -type LoginRecord struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - Spec LoginRecordSpec `json:"spec"` -} - -type LoginRecordSpec struct { - // Which authentication method used, Password/OAuth/Token - Type LoginType `json:"type"` - // Provider of authentication, Ldap/Github etc. - Provider string `json:"provider"` - // Source IP of client - SourceIP string `json:"sourceIP"` - // User agent of login attempt - UserAgent string `json:"userAgent,omitempty"` - // Successful login attempt or not - Success bool `json:"success"` - // States failed login attempt reason - Reason string `json:"reason"` -} - -type LoginType string - -const ( - Password LoginType = "Password" - OAuth LoginType = "OAuth" - Token LoginType = "Token" -) - -// +kubebuilder:object:root=true -// +kubebuilder:object:root=true - -// LoginRecordList contains a list of LoginRecord -type LoginRecordList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []LoginRecord `json:"items"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:printcolumn:name="Workspace",type="string",JSONPath=".metadata.labels.kubesphere\\.io/workspace" -// +kubebuilder:resource:categories="group",scope="Cluster" -// +kubebuilder:storageversion - -// Group is the Schema for the groups API -type Group struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec GroupSpec `json:"spec,omitempty"` - Status GroupStatus `json:"status,omitempty"` -} - -// GroupSpec defines the desired state of Group -type GroupSpec struct{} - -// GroupStatus defines the observed state of Group -type GroupStatus struct{} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:categories="group",scope="Cluster" - -// GroupList contains a list of Group -type GroupList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []Group `json:"items"` -} - -// GroupRef defines the desired relation of GroupBinding -type GroupRef struct { - APIGroup string `json:"apiGroup,omitempty"` - Kind string `json:"kind,omitempty"` - Name string `json:"name,omitempty"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:printcolumn:name="Group",type="string",JSONPath=".groupRef.name" -// +kubebuilder:printcolumn:name="Users",type="string",JSONPath=".users" -// +kubebuilder:resource:categories="group",scope="Cluster" -// +kubebuilder:storageversion - -// GroupBinding is the Schema for the groupbindings API -type GroupBinding struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - GroupRef GroupRef `json:"groupRef,omitempty"` - Users []string `json:"users,omitempty"` -} - -// +kubebuilder:object:root=true - -// GroupBindingList contains a list of GroupBinding -type GroupBindingList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []GroupBinding `json:"items"` -} diff --git a/staging/src/kubesphere.io/api/iam/v1beta1/register.go b/staging/src/kubesphere.io/api/iam/v1beta1/register.go index e1226a2e5..bae1750d3 100644 --- a/staging/src/kubesphere.io/api/iam/v1beta1/register.go +++ b/staging/src/kubesphere.io/api/iam/v1beta1/register.go @@ -1,7 +1,3 @@ -// Package v1beta1 contains API Schema definitions for the iam v1beta1 API group -// +k8s:openapi-gen=true -// +kubebuilder:object:generate=true -// +groupName=iam.kubesphere.io package v1beta1 import ( @@ -10,23 +6,19 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" ) +const GroupName = "iam.kubesphere.io" + var ( // SchemeGroupVersion is group version used to register these objects - SchemeGroupVersion = schema.GroupVersion{Group: "iam.kubesphere.io", Version: "v1beta1"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - - // AddToScheme is required by pkg/client/... - AddToScheme = SchemeBuilder.AddToScheme + SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"} + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme ) -// Resource is required by pkg/client/listers/... func Resource(resource string) schema.GroupResource { return SchemeGroupVersion.WithResource(resource).GroupResource() } -// Adds the list of known types to the given scheme. func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &Category{}, diff --git a/staging/src/kubesphere.io/api/iam/v1beta1/types.go b/staging/src/kubesphere.io/api/iam/v1beta1/types.go index 21ab3069c..9d466730a 100644 --- a/staging/src/kubesphere.io/api/iam/v1beta1/types.go +++ b/staging/src/kubesphere.io/api/iam/v1beta1/types.go @@ -3,10 +3,262 @@ package v1beta1 import ( "fmt" + "k8s.io/apimachinery/pkg/runtime" + rbacv1 "k8s.io/api/rbac/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) +// DefaultInfo provides a simple user information exchange object +// for components that implement the UserInfo interface. +type DefaultInfo struct { + Name string + UID string + Groups []string + Extra map[string][]string +} + +func (i *DefaultInfo) GetName() string { + return i.Name +} + +func (i *DefaultInfo) GetUID() string { + return i.UID +} + +func (i *DefaultInfo) GetGroups() []string { + return i.Groups +} + +func (i *DefaultInfo) GetExtra() map[string][]string { + return i.Extra +} + +// User is the Schema for the users API +// +kubebuilder:printcolumn:name="Email",type="string",JSONPath=".spec.email" +// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.state" +// +kubebuilder:resource:categories="iam",scope="Cluster" +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +type User struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec UserSpec `json:"spec"` + // +optional + Status UserStatus `json:"status,omitempty"` +} + +// UserSpec defines the desired state of User +type UserSpec struct { + // Unique email address(https://www.ietf.org/rfc/rfc5322.txt). + Email string `json:"email"` + // The preferred written or spoken language for the user. + // +optional + Lang string `json:"lang,omitempty"` + // Description of the user. + // +optional + Description string `json:"description,omitempty"` + // +optional + DisplayName string `json:"displayName,omitempty"` + // +optional + Groups []string `json:"groups,omitempty"` + + // password will be encrypted by mutating admission webhook + // +kubebuilder:validation:MinLength=8 + // +kubebuilder:validation:MaxLength=64 + // +kubebuilder:validation:Pattern=`^(.*[a-z].*[A-Z].*[0-9].*)$|^(.*[a-z].*[0-9].*[A-Z].*)$|^(.*[A-Z].*[a-z].*[0-9].*)$|^(.*[A-Z].*[0-9].*[a-z].*)$|^(.*[0-9].*[a-z].*[A-Z].*)$|^(.*[0-9].*[A-Z].*[a-z].*)$|^(\$2[ayb]\$.{56})$` + // Password pattern is tricky here. + // The rule is simple: length between [6,64], at least one uppercase letter, one lowercase letter, one digit. + // The regexp in console(javascript) is quite straightforward: ^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[^]{6,64}$ + // But in Go, we don't have ?= (back tracking) capability in regexp (also in CRD validation pattern) + // So we adopted an alternative scheme to achieve. + // Use 6 different regexp to combine to achieve the same effect. + // These six schemes enumerate the arrangement of numbers, uppercase letters, and lowercase letters that appear for the first time. + // - ^(.*[a-z].*[A-Z].*[0-9].*)$ stands for lowercase letter comes first, then followed by an uppercase letter, then a digit. + // - ^(.*[a-z].*[0-9].*[A-Z].*)$ stands for lowercase letter comes first, then followed by a digit, then an uppercase leeter. + // - ^(.*[A-Z].*[a-z].*[0-9].*)$ ... + // - ^(.*[A-Z].*[0-9].*[a-z].*)$ ... + // - ^(.*[0-9].*[a-z].*[A-Z].*)$ ... + // - ^(.*[0-9].*[A-Z].*[a-z].*)$ ... + // Last but not least, the bcrypt string is also included to match the encrypted password. ^(\$2[ayb]\$.{56})$ + EncryptedPassword string `json:"password,omitempty"` +} + +type UserState string + +// These are the valid phases of a user. +const ( + // UserActive means the user is available. + UserActive UserState = "Active" + // UserDisabled means the user is disabled. + UserDisabled UserState = "Disabled" + // UserAuthLimitExceeded means restrict user login. + UserAuthLimitExceeded UserState = "AuthLimitExceeded" + + AuthenticatedSuccessfully = "authenticated successfully" +) + +// UserStatus defines the observed state of User +type UserStatus struct { + // The user status + // +optional + State UserState `json:"state,omitempty"` + // +optional + Reason string `json:"reason,omitempty"` + // +optional + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` + // Last login attempt timestamp + // +optional + LastLoginTime *metav1.Time `json:"lastLoginTime,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:categories="iam",scope="Cluster" + +// UserList contains a list of User +type UserList struct { + metav1.TypeMeta `json:",inline"` + // Standard object's metadata. + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + Items []User `json:"items"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:categories="iam",scope="Cluster" +// +kubebuilder:storageversion + +type BuiltinRole struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + // +kubebuilder:pruning:PreserveUnknownFields + // +kubebuilder:validation:EmbeddedResource + Role runtime.RawExtension `json:"role"` + TargetSelector metav1.LabelSelector `json:"targetSelector,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:categories="iam",scope="Cluster" + +// BuiltinRoleList contains a list of BuiltinRole +type BuiltinRoleList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []BuiltinRole `json:"items"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:printcolumn:name="Type",type="string",JSONPath=".spec.type" +// +kubebuilder:printcolumn:name="Provider",type="string",JSONPath=".spec.provider" +// +kubebuilder:printcolumn:name="From",type="string",JSONPath=".spec.sourceIP" +// +kubebuilder:printcolumn:name="Success",type="string",JSONPath=".spec.success" +// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".spec.reason" +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +// +kubebuilder:resource:categories="iam",scope="Cluster" +// +kubebuilder:storageversion + +type LoginRecord struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec LoginRecordSpec `json:"spec"` +} + +type LoginRecordSpec struct { + // Which authentication method used, Password/OAuth/Token + Type LoginType `json:"type"` + // Provider of authentication, Ldap/Github etc. + Provider string `json:"provider"` + // Source IP of client + SourceIP string `json:"sourceIP"` + // User agent of login attempt + UserAgent string `json:"userAgent,omitempty"` + // Successful login attempt or not + Success bool `json:"success"` + // States failed login attempt reason + Reason string `json:"reason"` +} + +type LoginType string + +const ( + Password LoginType = "Password" + OAuth LoginType = "OAuth" + Token LoginType = "Token" +) + +// +kubebuilder:object:root=true +// +kubebuilder:object:root=true + +// LoginRecordList contains a list of LoginRecord +type LoginRecordList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []LoginRecord `json:"items"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:printcolumn:name="Workspace",type="string",JSONPath=".metadata.labels.kubesphere\\.io/workspace" +// +kubebuilder:resource:categories="group",scope="Cluster" +// +kubebuilder:storageversion + +// Group is the Schema for the groups API +type Group struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec GroupSpec `json:"spec,omitempty"` + Status GroupStatus `json:"status,omitempty"` +} + +// GroupSpec defines the desired state of Group +type GroupSpec struct{} + +// GroupStatus defines the observed state of Group +type GroupStatus struct{} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:categories="group",scope="Cluster" + +// GroupList contains a list of Group +type GroupList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Group `json:"items"` +} + +// GroupRef defines the desired relation of GroupBinding +type GroupRef struct { + APIGroup string `json:"apiGroup,omitempty"` + Kind string `json:"kind,omitempty"` + Name string `json:"name,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:printcolumn:name="Group",type="string",JSONPath=".groupRef.name" +// +kubebuilder:printcolumn:name="Users",type="string",JSONPath=".users" +// +kubebuilder:resource:categories="group",scope="Cluster" +// +kubebuilder:storageversion + +// GroupBinding is the Schema for the groupbindings API +type GroupBinding struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + GroupRef GroupRef `json:"groupRef,omitempty"` + Users []string `json:"users,omitempty"` +} + +// +kubebuilder:object:root=true + +// GroupBindingList contains a list of GroupBinding +type GroupBindingList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []GroupBinding `json:"items"` +} + // CategorySpec defines the desired state of Category type CategorySpec struct { DisplayName map[string]string `json:"displayName,omitempty"` @@ -396,6 +648,7 @@ type RoleTemplateSpec struct { // +kubebuilder:object:root=true // +kubebuilder:resource:categories=iam,scope=Cluster // +kubebuilder:storageversion + // RoleTemplate is the Schema for the roletemplates API type RoleTemplate struct { metav1.TypeMeta `json:",inline"` diff --git a/staging/src/kubesphere.io/api/quota/group.go b/staging/src/kubesphere.io/api/quota/group.go deleted file mode 100644 index 2421a96e8..000000000 --- a/staging/src/kubesphere.io/api/quota/group.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package quota contains quota API versions -package quota diff --git a/staging/src/kubesphere.io/api/quota/v1alpha2/doc.go b/staging/src/kubesphere.io/api/quota/v1alpha2/doc.go index d52272cd7..e82c4d0b1 100644 --- a/staging/src/kubesphere.io/api/quota/v1alpha2/doc.go +++ b/staging/src/kubesphere.io/api/quota/v1alpha2/doc.go @@ -1,7 +1,5 @@ -// Package v1alpha2 contains API Schema definitions for the quotas v1alpha2 API group // +k8s:openapi-gen=true // +kubebuilder:object:generate=true -// +k8s:conversion-gen=kubesphere.io/api/quota -// +k8s:defaulter-gen=TypeMeta // +groupName=quota.kubesphere.io + package v1alpha2 diff --git a/staging/src/kubesphere.io/api/quota/v1alpha2/register.go b/staging/src/kubesphere.io/api/quota/v1alpha2/register.go index c4a80a505..e0ed4e2b8 100644 --- a/staging/src/kubesphere.io/api/quota/v1alpha2/register.go +++ b/staging/src/kubesphere.io/api/quota/v1alpha2/register.go @@ -1,30 +1,29 @@ -// NOTE: Boilerplate only. Ignore this file. - -// Package v1alpha2 contains API Schema definitions for the quotas v1alpha2 API group -// +k8s:openapi-gen=true -// +kubebuilder:object:generate=true -// +k8s:conversion-gen=kubesphere.io/api/quota -// +k8s:defaulter-gen=TypeMeta -// +groupName=quota.kubesphere.io package v1alpha2 import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" ) +const GroupName = "quota.kubesphere.io" + var ( // SchemeGroupVersion is group version used to register these objects - SchemeGroupVersion = schema.GroupVersion{Group: "quota.kubesphere.io", Version: "v1alpha2"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} - - // AddToScheme is required by pkg/client/... - AddToScheme = SchemeBuilder.AddToScheme + SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha2"} + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme ) -// Resource is required by pkg/client/listers/... func Resource(resource string) schema.GroupResource { return SchemeGroupVersion.WithResource(resource).GroupResource() } + +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &ResourceQuota{}, + &ResourceQuotaList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/staging/src/kubesphere.io/api/quota/v1alpha2/types.go b/staging/src/kubesphere.io/api/quota/v1alpha2/types.go index 2d5173373..8c4625f15 100644 --- a/staging/src/kubesphere.io/api/quota/v1alpha2/types.go +++ b/staging/src/kubesphere.io/api/quota/v1alpha2/types.go @@ -11,10 +11,6 @@ const ( ResourcesPluralCluster = "resourcequotas" ) -func init() { - SchemeBuilder.Register(&ResourceQuota{}, &ResourceQuotaList{}) -} - // +kubebuilder:object:root=true // +kubebuilder:resource:categories="quota",scope="Cluster",path=resourcequotas // +kubebuilder:subresource:status diff --git a/staging/src/kubesphere.io/api/quota/v1alpha2/types_test.go b/staging/src/kubesphere.io/api/quota/v1alpha2/types_test.go deleted file mode 100644 index f9cf2f1a8..000000000 --- a/staging/src/kubesphere.io/api/quota/v1alpha2/types_test.go +++ /dev/null @@ -1,62 +0,0 @@ -package v1alpha2 - -import ( - "log" - "testing" - - "github.com/onsi/gomega" - "golang.org/x/net/context" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/types" - "sigs.k8s.io/controller-runtime/pkg/client/fake" -) - -func TestStorageResourceQuota(t *testing.T) { - scheme := runtime.NewScheme() - err := SchemeBuilder.AddToScheme(scheme) - if err != nil { - log.Fatal(err) - } - c := fake.NewClientBuilder().WithScheme(scheme).Build() - - key := types.NamespacedName{ - Name: "foo", - } - created := &ResourceQuota{ - TypeMeta: metav1.TypeMeta{ - Kind: "ResourceQuota", - APIVersion: "quota.kubesphere.io/v1alpha2", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: "foo", - }, - Spec: ResourceQuotaSpec{ - LabelSelector: map[string]string{}, - }, - } - g := gomega.NewGomegaWithT(t) - - // Test Create - fetched := &ResourceQuota{ - Spec: ResourceQuotaSpec{ - LabelSelector: map[string]string{}, - }, - } - g.Expect(c.Create(context.TODO(), created)).To(gomega.Succeed()) - - g.Expect(c.Get(context.TODO(), key, fetched)).To(gomega.Succeed()) - g.Expect(fetched).To(gomega.Equal(created)) - - // Test Updating the Labels - updated := fetched.DeepCopy() - updated.Labels = map[string]string{"hello": "world"} - g.Expect(c.Update(context.TODO(), updated)).To(gomega.Succeed()) - - g.Expect(c.Get(context.TODO(), key, fetched)).To(gomega.Succeed()) - g.Expect(fetched).To(gomega.Equal(updated)) - - // Test Delete - g.Expect(c.Delete(context.TODO(), fetched)).To(gomega.Succeed()) - g.Expect(c.Get(context.TODO(), key, fetched)).ToNot(gomega.Succeed()) -} diff --git a/staging/src/kubesphere.io/api/quota/v1alpha2/zz_generated.deepcopy.go b/staging/src/kubesphere.io/api/quota/v1alpha2/zz_generated.deepcopy.go index 9b45633fd..9193b80bc 100644 --- a/staging/src/kubesphere.io/api/quota/v1alpha2/zz_generated.deepcopy.go +++ b/staging/src/kubesphere.io/api/quota/v1alpha2/zz_generated.deepcopy.go @@ -5,7 +5,7 @@ package v1alpha2 import ( - runtime "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. diff --git a/staging/src/kubesphere.io/api/storage/group.go b/staging/src/kubesphere.io/api/storage/group.go deleted file mode 100644 index d49d08c2b..000000000 --- a/staging/src/kubesphere.io/api/storage/group.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package storage contains storage API versions -package storage diff --git a/staging/src/kubesphere.io/api/storage/v1alpha1/doc.go b/staging/src/kubesphere.io/api/storage/v1alpha1/doc.go index c05abf9e8..a5feddae5 100644 --- a/staging/src/kubesphere.io/api/storage/v1alpha1/doc.go +++ b/staging/src/kubesphere.io/api/storage/v1alpha1/doc.go @@ -1,7 +1,5 @@ -// Package v1alpha1 contains API Schema definitions for the storage v1alpha1 API group // +k8s:openapi-gen=true // +kubebuilder:object:generate=true -// +k8s:conversion-gen=kubesphere.io/api/storage -// +k8s:defaulter-gen=TypeMeta // +groupName=storage.kubesphere.io + package v1alpha1 diff --git a/staging/src/kubesphere.io/api/storage/v1alpha1/register.go b/staging/src/kubesphere.io/api/storage/v1alpha1/register.go index d6d43bf23..779ba80dd 100644 --- a/staging/src/kubesphere.io/api/storage/v1alpha1/register.go +++ b/staging/src/kubesphere.io/api/storage/v1alpha1/register.go @@ -1,30 +1,31 @@ -// NOTE: Boilerplate only. Ignore this file. - -// Package v1alpha1 contains API Schema definitions for the storage v1alpha1 API group -// +k8s:openapi-gen=true -// +kubebuilder:object:generate=true -// +k8s:conversion-gen=kubesphere.io/api/storage -// +k8s:defaulter-gen=TypeMeta -// +groupName=storage.kubesphere.io package v1alpha1 import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" ) +const GroupName = "storage.kubesphere.io" + var ( // SchemeGroupVersion is group version used to register these objects - SchemeGroupVersion = schema.GroupVersion{Group: "storage.kubesphere.io", Version: "v1alpha1"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} - - // AddToScheme is required by pkg/client/... - AddToScheme = SchemeBuilder.AddToScheme + SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme ) -// Resource is required by pkg/client/listers/... func Resource(resource string) schema.GroupResource { return SchemeGroupVersion.WithResource(resource).GroupResource() } + +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &StorageClassCapability{}, + &StorageClassCapabilityList{}, + &ProvisionerCapability{}, + &ProvisionerCapabilityList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/staging/src/kubesphere.io/api/storage/v1alpha1/capability_types.go b/staging/src/kubesphere.io/api/storage/v1alpha1/types.go similarity index 95% rename from staging/src/kubesphere.io/api/storage/v1alpha1/capability_types.go rename to staging/src/kubesphere.io/api/storage/v1alpha1/types.go index 8d947c898..c7b9bf135 100644 --- a/staging/src/kubesphere.io/api/storage/v1alpha1/capability_types.go +++ b/staging/src/kubesphere.io/api/storage/v1alpha1/types.go @@ -100,11 +100,3 @@ type ProvisionerCapabilityList struct { metav1.ListMeta `json:"metadata"` Items []ProvisionerCapability `json:"items"` } - -func init() { - SchemeBuilder.Register( - &StorageClassCapability{}, - &StorageClassCapabilityList{}, - &ProvisionerCapability{}, - &ProvisionerCapabilityList{}) -} diff --git a/staging/src/kubesphere.io/api/storage/v1alpha1/zz_generated.deepcopy.go b/staging/src/kubesphere.io/api/storage/v1alpha1/zz_generated.deepcopy.go index 83b4e9e3a..c1015a31e 100644 --- a/staging/src/kubesphere.io/api/storage/v1alpha1/zz_generated.deepcopy.go +++ b/staging/src/kubesphere.io/api/storage/v1alpha1/zz_generated.deepcopy.go @@ -5,7 +5,7 @@ package v1alpha1 import ( - runtime "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. diff --git a/staging/src/kubesphere.io/api/tenant/group.go b/staging/src/kubesphere.io/api/tenant/group.go deleted file mode 100644 index 799fec5ef..000000000 --- a/staging/src/kubesphere.io/api/tenant/group.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package tenant contains tenant API versions -package tenant diff --git a/staging/src/kubesphere.io/api/tenant/v1alpha1/doc.go b/staging/src/kubesphere.io/api/tenant/v1alpha1/doc.go new file mode 100644 index 000000000..98e4fd393 --- /dev/null +++ b/staging/src/kubesphere.io/api/tenant/v1alpha1/doc.go @@ -0,0 +1,5 @@ +// +k8s:openapi-gen=true +// +kubebuilder:object:generate=true +// +groupName=tenant.kubesphere.io + +package v1alpha1 diff --git a/staging/src/kubesphere.io/api/tenant/v1alpha1/register.go b/staging/src/kubesphere.io/api/tenant/v1alpha1/register.go index 07f9ba446..84b665482 100644 --- a/staging/src/kubesphere.io/api/tenant/v1alpha1/register.go +++ b/staging/src/kubesphere.io/api/tenant/v1alpha1/register.go @@ -1,25 +1,29 @@ -// +kubebuilder:object:generate=true -// +groupName=tenant.kubesphere.io - package v1alpha1 import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" ) +const GroupName = "tenant.kubesphere.io" + var ( - SchemeGroupVersion = schema.GroupVersion{Group: "tenant.kubesphere.io", Version: "v1alpha1"} - - SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} - - AddToScheme = SchemeBuilder.AddToScheme + // SchemeGroupVersion is group version used to register these objects + SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme ) func Resource(resource string) schema.GroupResource { return SchemeGroupVersion.WithResource(resource).GroupResource() } -func init() { - SchemeBuilder.Register(&Workspace{}, &WorkspaceList{}) +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &Workspace{}, + &WorkspaceList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil } diff --git a/staging/src/kubesphere.io/api/tenant/v1alpha1/workspace_types.go b/staging/src/kubesphere.io/api/tenant/v1alpha1/types.go similarity index 100% rename from staging/src/kubesphere.io/api/tenant/v1alpha1/workspace_types.go rename to staging/src/kubesphere.io/api/tenant/v1alpha1/types.go diff --git a/staging/src/kubesphere.io/api/tenant/v1alpha1/zz_generated.deepcopy.go b/staging/src/kubesphere.io/api/tenant/v1alpha1/zz_generated.deepcopy.go index 55af00ba3..3ba765114 100644 --- a/staging/src/kubesphere.io/api/tenant/v1alpha1/zz_generated.deepcopy.go +++ b/staging/src/kubesphere.io/api/tenant/v1alpha1/zz_generated.deepcopy.go @@ -5,7 +5,7 @@ package v1alpha1 import ( - runtime "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. diff --git a/staging/src/kubesphere.io/api/tenant/v1alpha2/doc.go b/staging/src/kubesphere.io/api/tenant/v1alpha2/doc.go new file mode 100644 index 000000000..1557e1ade --- /dev/null +++ b/staging/src/kubesphere.io/api/tenant/v1alpha2/doc.go @@ -0,0 +1,5 @@ +// +k8s:openapi-gen=true +// +kubebuilder:object:generate=true +// +groupName=tenant.kubesphere.io + +package v1alpha2 diff --git a/staging/src/kubesphere.io/api/tenant/v1alpha2/register.go b/staging/src/kubesphere.io/api/tenant/v1alpha2/register.go index 82292064a..39b618942 100644 --- a/staging/src/kubesphere.io/api/tenant/v1alpha2/register.go +++ b/staging/src/kubesphere.io/api/tenant/v1alpha2/register.go @@ -1,25 +1,29 @@ -// +kubebuilder:object:generate=true -// +groupName=tenant.kubesphere.io - package v1alpha2 import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" ) +const GroupName = "tenant.kubesphere.io" + var ( - SchemeGroupVersion = schema.GroupVersion{Group: "tenant.kubesphere.io", Version: "v1alpha2"} - - SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} - - AddToScheme = SchemeBuilder.AddToScheme + // SchemeGroupVersion is group version used to register these objects + SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha2"} + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme ) func Resource(resource string) schema.GroupResource { return SchemeGroupVersion.WithResource(resource).GroupResource() } -func init() { - SchemeBuilder.Register(&WorkspaceTemplate{}, &WorkspaceTemplateList{}) +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &WorkspaceTemplate{}, + &WorkspaceTemplateList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil } diff --git a/staging/src/kubesphere.io/api/tenant/v1alpha2/workspacetemplate_types.go b/staging/src/kubesphere.io/api/tenant/v1alpha2/types.go similarity index 100% rename from staging/src/kubesphere.io/api/tenant/v1alpha2/workspacetemplate_types.go rename to staging/src/kubesphere.io/api/tenant/v1alpha2/types.go diff --git a/staging/src/kubesphere.io/api/tenant/v1beta1/doc.go b/staging/src/kubesphere.io/api/tenant/v1beta1/doc.go new file mode 100644 index 000000000..c7ccd8f90 --- /dev/null +++ b/staging/src/kubesphere.io/api/tenant/v1beta1/doc.go @@ -0,0 +1,5 @@ +// +k8s:openapi-gen=true +// +kubebuilder:object:generate=true +// +groupName=tenant.kubesphere.io + +package v1beta1 diff --git a/staging/src/kubesphere.io/api/tenant/v1beta1/register.go b/staging/src/kubesphere.io/api/tenant/v1beta1/register.go index b0cf7d282..8e008761b 100644 --- a/staging/src/kubesphere.io/api/tenant/v1beta1/register.go +++ b/staging/src/kubesphere.io/api/tenant/v1beta1/register.go @@ -1,29 +1,31 @@ -// Package v1beta1 contains API Schema definitions for the tenant v1beta1 API group -// +kubebuilder:object:generate=true -// +groupName=tenant.kubesphere.io - package v1beta1 import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" ) +const GroupName = "tenant.kubesphere.io" + var ( - SchemeGroupVersion = schema.GroupVersion{Group: "tenant.kubesphere.io", Version: "v1beta1"} - - SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} - - AddToScheme = SchemeBuilder.AddToScheme + // SchemeGroupVersion is group version used to register these objects + SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"} + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme ) func Resource(resource string) schema.GroupResource { return SchemeGroupVersion.WithResource(resource).GroupResource() } -func init() { - SchemeBuilder.Register(&Workspace{}, +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &Workspace{}, &WorkspaceList{}, &WorkspaceTemplate{}, - &WorkspaceTemplateList{}) + &WorkspaceTemplateList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil } diff --git a/staging/src/kubesphere.io/api/tenant/v1beta1/workspacetemplate_types.go b/staging/src/kubesphere.io/api/tenant/v1beta1/types.go similarity index 57% rename from staging/src/kubesphere.io/api/tenant/v1beta1/workspacetemplate_types.go rename to staging/src/kubesphere.io/api/tenant/v1beta1/types.go index 2ad7b273c..8b62c265d 100644 --- a/staging/src/kubesphere.io/api/tenant/v1beta1/workspacetemplate_types.go +++ b/staging/src/kubesphere.io/api/tenant/v1beta1/types.go @@ -5,12 +5,48 @@ import ( ) const ( + ResourceKindWorkspace = "Workspace" + ResourceSingularWorkspace = "workspace" + ResourcePluralWorkspace = "workspaces" + WorkspaceLabel = "kubesphere.io/workspace" + ResourceKindWorkspaceTemplate = "WorkspaceTemplate" ResourceSingularWorkspaceTemplate = "workspacetemplate" ResourcePluralWorkspaceTemplate = "workspacetemplates" ) -// +k8s:openapi-gen=true +// WorkspaceSpec defines the desired state of Workspace +type WorkspaceSpec struct { + Manager string `json:"manager,omitempty"` +} + +// WorkspaceStatus defines the observed state of Workspace +type WorkspaceStatus struct { + // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster + // Important: Run "make" to regenerate code after modifying this file +} + +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:resource:categories="tenant",scope="Cluster" + +// Workspace is the Schema for the workspaces API +type Workspace struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec WorkspaceSpec `json:"spec,omitempty"` + Status WorkspaceStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// WorkspaceList contains a list of Workspace +type WorkspaceList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Workspace `json:"items"` +} + type WorkspaceTemplateSpec struct { Template Template `json:"template"` Placement GenericPlacement `json:"placement"` @@ -23,7 +59,6 @@ type ObjectMeta struct { Annotations map[string]string `json:"annotations,omitempty"` } -// +k8s:openapi-gen=true type Template struct { ObjectMeta `json:"metadata,omitempty"` Spec WorkspaceSpec `json:"spec,omitempty"` @@ -33,7 +68,6 @@ type GenericClusterReference struct { Name string `json:"name"` } -// +k8s:openapi-gen=true type GenericPlacement struct { // +listType=map // +listMapKey=name @@ -46,7 +80,6 @@ type GenericPlacement struct { // +kubebuilder:resource:categories="tenant",scope="Cluster" // WorkspaceTemplate is the Schema for the workspacetemplates API -// +k8s:openapi-gen=true type WorkspaceTemplate struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` @@ -56,7 +89,6 @@ type WorkspaceTemplate struct { // +kubebuilder:object:root=true // WorkspaceTemplateList contains a list of WorkspaceTemplate -// +k8s:openapi-gen=true type WorkspaceTemplateList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` diff --git a/staging/src/kubesphere.io/api/tenant/v1beta1/workspace_types.go b/staging/src/kubesphere.io/api/tenant/v1beta1/workspace_types.go deleted file mode 100644 index 2630a35b5..000000000 --- a/staging/src/kubesphere.io/api/tenant/v1beta1/workspace_types.go +++ /dev/null @@ -1,48 +0,0 @@ -package v1beta1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -const ( - ResourceKindWorkspace = "Workspace" - ResourceSingularWorkspace = "workspace" - ResourcePluralWorkspace = "workspaces" - WorkspaceLabel = "kubesphere.io/workspace" -) - -// WorkspaceSpec defines the desired state of Workspace -// +k8s:openapi-gen=true -type WorkspaceSpec struct { - Manager string `json:"manager,omitempty"` -} - -// WorkspaceStatus defines the observed state of Workspace -// +k8s:openapi-gen=true -type WorkspaceStatus struct { - // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster - // Important: Run "make" to regenerate code after modifying this file -} - -// +kubebuilder:object:root=true -// +kubebuilder:storageversion -// +kubebuilder:resource:categories="tenant",scope="Cluster" - -// Workspace is the Schema for the workspaces API -// +k8s:openapi-gen=true -type Workspace struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - Spec WorkspaceSpec `json:"spec,omitempty"` - Status WorkspaceStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// WorkspaceList contains a list of Workspace -// +k8s:openapi-gen=true -type WorkspaceList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []Workspace `json:"items"` -} diff --git a/staging/src/kubesphere.io/api/tenant/v1beta1/zz_generated.deepcopy.go b/staging/src/kubesphere.io/api/tenant/v1beta1/zz_generated.deepcopy.go index 8f907d9f7..8e4970982 100644 --- a/staging/src/kubesphere.io/api/tenant/v1beta1/zz_generated.deepcopy.go +++ b/staging/src/kubesphere.io/api/tenant/v1beta1/zz_generated.deepcopy.go @@ -6,7 +6,7 @@ package v1beta1 import ( "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. diff --git a/staging/src/kubesphere.io/client-go/go.mod b/staging/src/kubesphere.io/client-go/go.mod index f826273bd..fbba5d4f1 100644 --- a/staging/src/kubesphere.io/client-go/go.mod +++ b/staging/src/kubesphere.io/client-go/go.mod @@ -12,6 +12,7 @@ require ( github.com/stretchr/testify v1.10.0 golang.org/x/net v0.37.0 k8s.io/api v0.31.2 + k8s.io/apiextensions-apiserver v0.31.2 k8s.io/apimachinery v0.31.2 k8s.io/client-go v0.31.2 k8s.io/klog/v2 v2.130.1 @@ -31,8 +32,8 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/google/gnostic-models v0.6.8 // indirect - github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 // indirect github.com/google/uuid v1.6.0 // indirect + github.com/imdario/mergo v0.3.16 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/mailru/easyjson v0.7.7 // indirect @@ -40,11 +41,13 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/onsi/ginkgo/v2 v2.20.1 // indirect + github.com/onsi/gomega v1.34.2 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/x448/float16 v0.8.4 // indirect golang.org/x/oauth2 v0.22.0 // indirect golang.org/x/text v0.23.0 // indirect golang.org/x/time v0.7.0 // indirect + golang.org/x/tools v0.26.0 // indirect google.golang.org/protobuf v1.35.2 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/staging/src/kubesphere.io/client-go/go.sum b/staging/src/kubesphere.io/client-go/go.sum index 16c148d54..36c9a1be2 100644 --- a/staging/src/kubesphere.io/client-go/go.sum +++ b/staging/src/kubesphere.io/client-go/go.sum @@ -12,6 +12,7 @@ github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbt github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= +github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c= github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= @@ -34,7 +35,6 @@ github.com/blang/semver v3.5.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnweb github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/coreos/bbolt v1.3.1-coreos.6/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= @@ -44,8 +44,10 @@ github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8Nz github.com/coreos/go-oidc v2.1.0+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec= github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180108230652-97fdf19511ea/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= @@ -64,6 +66,7 @@ github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZ github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= @@ -150,6 +153,7 @@ github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zV github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20180513044358-24b0969c4cb7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -198,15 +202,16 @@ github.com/gregjones/httpcache v0.0.0-20170728041850-787624de3eb7/go.mod h1:Fecb github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/go-grpc-middleware v0.0.0-20190222133341-cfaf5686ec79/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.3.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ianlancetaylor/demangle v0.0.0-20240312041847-bd984b5ce465/go.mod h1:gx7rwoVhcfuVKG5uya9Hs3Sxj7EIvldVofAWIUtGouw= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= @@ -214,6 +219,7 @@ github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+h github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= @@ -316,8 +322,10 @@ github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/soheilhy/cmux v0.1.3/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= @@ -349,6 +357,7 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75/go.mod h1:KO6IkyS8Y3j8OdNO85qEYBsRPuteD+YciPomcXdrMnk= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw= @@ -361,11 +370,20 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.9/go.mod h1:zaO32+Ti0PK1ivdPtgMESzuzL2VPoIG1PCQNvOdo/dE= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= +go.etcd.io/etcd/api/v3 v3.5.14/go.mod h1:BmtWcRlQvwa1h3G2jvKYwIQy4PkHlDej5t7uLMUdJUU= +go.etcd.io/etcd/client/pkg/v3 v3.5.14/go.mod h1:8uMgAokyG1czCtIdsq+AGyYQMvpIKnSvPjFMunkgeZI= +go.etcd.io/etcd/client/v2 v2.305.13/go.mod h1:iQnL7fepbiomdXMb3om1rHq96htNNGv2sJkEcZGDRRg= +go.etcd.io/etcd/client/v3 v3.5.14/go.mod h1:k3XfdV/VIHy/97rqWjoUzrj9tk7GgJGH9J8L4dNXmAk= +go.etcd.io/etcd/pkg/v3 v3.5.13/go.mod h1:N+4PLrp7agI/Viy+dUYpX7iRtSPvKq+w8Y14d1vX+m0= +go.etcd.io/etcd/raft/v3 v3.5.13/go.mod h1:uUFibGLn2Ksm2URMxN1fICGhk8Wu96EfDQyuLhAcAmw= +go.etcd.io/etcd/server/v3 v3.5.13/go.mod h1:K/8nbsGupHqmr5MkgaZpLlH1QdX1pcNQLAkODy44XcQ= go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.mongodb.org/mongo-driver v1.1.2/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0/go.mod h1:azvtTADFQJA8mX80jIH/akaE7h+dbm/sVuaHqN13w74= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg= go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0/go.mod h1:s75jGIWA9OfCMzF0xr+ZgfrB5FEbbV7UuYo32ahUiFI= @@ -402,6 +420,7 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180112015858-5ccada7d0a7b/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -434,6 +453,7 @@ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= +golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457/go.mod h1:pRgIJT+bRLFKnoM1ldnzKoxTIn14Yxz928LQRYYgIN0= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= @@ -489,6 +509,7 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -504,13 +525,13 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= -gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4= gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/inf.v0 v0.9.0/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= +gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/square/go-jose.v2 v2.2.2/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= @@ -544,16 +565,17 @@ k8s.io/apimachinery v0.31.2 h1:i4vUt2hPK56W6mlT7Ry+AO8eEsyxMD1U44NR22CLTYw= k8s.io/apimachinery v0.31.2/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= k8s.io/apiserver v0.0.0-20190918160949-bfa5e2e684ad/go.mod h1:XPCXEwhjaFN29a8NldXA901ElnKeKLrLtREO9ZhFyhg= k8s.io/apiserver v0.17.0/go.mod h1:ABM+9x/prjINN6iiffRVNCBR2Wk7uY4z+EtEGZD48cg= -k8s.io/apiserver v0.31.0/go.mod h1:KI9ox5Yu902iBnnyMmy7ajonhKnkeZYJhTZ/YI+WEMk= +k8s.io/apiserver v0.31.2/go.mod h1:o3nKZR7lPlJqkU5I3Ove+Zx3JuoFjQobGX1Gctw6XuE= k8s.io/client-go v0.0.0-20190918160344-1fbdaa4c8d90/go.mod h1:J69/JveO6XESwVgG53q3Uz5OSfgsv4uxpScmmyYOOlk= k8s.io/client-go v0.17.0/go.mod h1:TYgR6EUHs6k45hb6KWjVD6jFZvJV4gHDikv/It0xz+k= k8s.io/client-go v0.31.2 h1:Y2F4dxU5d3AQj+ybwSMqQnpZH9F30//1ObxOKlTI9yc= k8s.io/client-go v0.31.2/go.mod h1:NPa74jSVR/+eez2dFsEIHNa+3o09vtNaWwWwb1qSxSs= k8s.io/code-generator v0.0.0-20190912054826-cd179ad6a269/go.mod h1:V5BD6M4CyaN5m+VthcclXWsVcT1Hu+glwa1bi3MIsyE= k8s.io/code-generator v0.17.0/go.mod h1:DVmfPQgxQENqDIzVR2ddLXMH34qeszkKSdH/N+s+38s= +k8s.io/code-generator v0.31.2/go.mod h1:eEQHXgBU/m7LDaToDoiz3t97dUUVyOblQdwOr8rivqc= k8s.io/component-base v0.0.0-20190918160511-547f6c5d7090/go.mod h1:933PBGtQFJky3TEwYx4aEPZ4IxqhWh3R6DCmzqIn1hA= k8s.io/component-base v0.17.0/go.mod h1:rKuRAokNMY2nn2A6LP/MiwpoaMRHpfRnrPaUJJj1Yoc= -k8s.io/component-base v0.31.0/go.mod h1:TYVuzI1QmN4L5ItVdMSXKvH7/DtvIuas5/mm8YT3rTo= +k8s.io/component-base v0.31.2/go.mod h1:9PeyyFN/drHjtJZMCTkSpQJS3U9OXORnHQqMLDz0sUQ= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20190822140433-26a664648505/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70/go.mod h1:VH3AT8AaQOqiGjMF9p0/IM1Dj+82ZwjfxUP1IxaHE+8= @@ -563,6 +585,7 @@ k8s.io/klog v0.4.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +k8s.io/kms v0.31.2/go.mod h1:OZKwl1fan3n3N5FFxnW5C4V3ygrah/3YXeJWS3O6+94= k8s.io/kube-openapi v0.0.0-20190816220812-743ec37842bf/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E= k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E= k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag= diff --git a/staging/src/kubesphere.io/client-go/kubesphere/scheme/register.go b/staging/src/kubesphere.io/client-go/kubesphere/scheme/register.go index 5096690dc..61aed5cbe 100644 --- a/staging/src/kubesphere.io/client-go/kubesphere/scheme/register.go +++ b/staging/src/kubesphere.io/client-go/kubesphere/scheme/register.go @@ -1,6 +1,7 @@ package scheme import ( + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" @@ -41,4 +42,5 @@ func init() { v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) utilruntime.Must(AddToScheme(Scheme)) utilruntime.Must(k8sscheme.AddToScheme(Scheme)) + utilruntime.Must(apiextensionsv1.AddToScheme(Scheme)) }