diff --git a/cmd/api/app/options/options.go b/cmd/api/app/options/options.go index 33c85574..9b617c3c 100644 --- a/cmd/api/app/options/options.go +++ b/cmd/api/app/options/options.go @@ -39,6 +39,7 @@ type Options struct { OpenAPIEnabled bool } +// NewOptions returns initialized Options. func NewOptions() *Options { return &Options{} } diff --git a/cmd/api/app/types/api/v1/config.go b/cmd/api/app/types/api/v1/config.go index c02bad17..0e650666 100644 --- a/cmd/api/app/types/api/v1/config.go +++ b/cmd/api/app/types/api/v1/config.go @@ -18,6 +18,7 @@ package v1 import "github.com/karmada-io/dashboard/pkg/config" +// SetDashboardConfigRequest is the request for setting dashboard config type SetDashboardConfigRequest struct { DockerRegistries []config.DockerRegistry `json:"docker_registries"` ChartRegistries []config.ChartRegistry `json:"chart_registries"` diff --git a/cmd/api/app/types/common/response.go b/cmd/api/app/types/common/response.go index cbb285fa..da04cb69 100644 --- a/cmd/api/app/types/common/response.go +++ b/cmd/api/app/types/common/response.go @@ -22,6 +22,7 @@ import ( "github.com/gin-gonic/gin" ) +// BaseResponse is the base response type BaseResponse struct { Code int `json:"code"` Msg string `json:"message"` @@ -38,6 +39,7 @@ func Fail(c *gin.Context, err error) { Response(c, err, nil) } +// Response generate response func Response(c *gin.Context, err error, data interface{}) { code := 200 // biz status code message := "success" // biz status message diff --git a/cmd/metrics-scraper/app/options/options.go b/cmd/metrics-scraper/app/options/options.go index 33c85574..9b617c3c 100644 --- a/cmd/metrics-scraper/app/options/options.go +++ b/cmd/metrics-scraper/app/options/options.go @@ -39,6 +39,7 @@ type Options struct { OpenAPIEnabled bool } +// NewOptions returns initialized Options. func NewOptions() *Options { return &Options{} } diff --git a/cmd/metrics-scraper/app/routes/metrics/handler.go b/cmd/metrics-scraper/app/routes/metrics/handler.go index a2195afc..deed68e0 100644 --- a/cmd/metrics-scraper/app/routes/metrics/handler.go +++ b/cmd/metrics-scraper/app/routes/metrics/handler.go @@ -26,6 +26,7 @@ import ( var requests = make(chan scrape.SaveRequest) +// GetMetrics returns the metrics for the given app name func GetMetrics(c *gin.Context) { appName := c.Param("app_name") queryType := c.Query("type") diff --git a/cmd/metrics-scraper/app/routes/metrics/handlerqueries.go b/cmd/metrics-scraper/app/routes/metrics/handlerqueries.go index a7ecc900..3066e10a 100644 --- a/cmd/metrics-scraper/app/routes/metrics/handlerqueries.go +++ b/cmd/metrics-scraper/app/routes/metrics/handlerqueries.go @@ -29,11 +29,13 @@ import ( "github.com/karmada-io/dashboard/cmd/metrics-scraper/app/scrape" ) +// MetricInfo represents the information about a metric. type MetricInfo struct { Help string `json:"help"` Type string `json:"type"` } +// QueryMetrics handles the querying of metrics. func QueryMetrics(c *gin.Context) { appName := c.Param("app_name") podName := c.Param("pod_name") diff --git a/cmd/metrics-scraper/app/scrape/job.go b/cmd/metrics-scraper/app/scrape/job.go index 9a89a934..18991401 100644 --- a/cmd/metrics-scraper/app/scrape/job.go +++ b/cmd/metrics-scraper/app/scrape/job.go @@ -34,7 +34,7 @@ import ( "github.com/karmada-io/dashboard/pkg/client" ) -// Define a struct for save requests +// SaveRequest Define a struct for save requests type SaveRequest struct { appName string podName string @@ -42,6 +42,7 @@ type SaveRequest struct { result chan error } +// FetchMetrics fetches metrics from all pods of the given app name func FetchMetrics(ctx context.Context, appName string, requests chan SaveRequest) (map[string]*db.ParsedData, []string, error) { kubeClient := client.InClusterClient() podsMap, errors := getKarmadaPods(ctx, appName) // Pass context here diff --git a/cmd/metrics-scraper/app/scrape/scrape.go b/cmd/metrics-scraper/app/scrape/scrape.go index 25cb3c23..83663d2b 100644 --- a/cmd/metrics-scraper/app/scrape/scrape.go +++ b/cmd/metrics-scraper/app/scrape/scrape.go @@ -79,6 +79,7 @@ func startAppMetricsFetcher(appName string) { } } +// CheckAppStatus checks the status of all registered apps and returns a map of app names to their status. func CheckAppStatus(c *gin.Context) { statusMap := make(map[string]bool) @@ -107,6 +108,7 @@ func CheckAppStatus(c *gin.Context) { c.JSON(http.StatusOK, statusMap) } +// HandleSyncOperation handles the sync operation for a specific app or all apps. func HandleSyncOperation(c *gin.Context, appName string, syncValue int, queryType string) { if appName == "" { // Stop all apps @@ -188,6 +190,7 @@ func HandleSyncOperation(c *gin.Context, appName string, syncValue int, queryTyp } } +// InitDatabase initializes the database and starts the metrics fetchers. func InitDatabase() { // Initialize contexts and cancel functions appContexts = make(map[string]context.Context) diff --git a/cmd/web/app/options/options.go b/cmd/web/app/options/options.go index a11dc239..4ab9ba51 100644 --- a/cmd/web/app/options/options.go +++ b/cmd/web/app/options/options.go @@ -35,6 +35,7 @@ type Options struct { DashboardConfigPath string } +// NewOptions creates a new Options object with default parameters. func NewOptions() *Options { return &Options{} } diff --git a/pkg/client/auth.go b/pkg/client/auth.go index ea520f2e..1c450ca5 100644 --- a/pkg/client/auth.go +++ b/pkg/client/auth.go @@ -82,6 +82,7 @@ func buildAuthInfo(request *http.Request) (*clientcmdapi.AuthInfo, error) { return authInfo, nil } +// HasAuthorizationHeader checks if the request has an authorization header. func HasAuthorizationHeader(req *http.Request) bool { header := req.Header.Get(authorizationHeader) if len(header) == 0 { @@ -92,11 +93,13 @@ func HasAuthorizationHeader(req *http.Request) bool { return strings.HasPrefix(header, authorizationTokenPrefix) && len(token) > 0 } +// GetBearerToken returns the bearer token from the authorization header. func GetBearerToken(req *http.Request) string { header := req.Header.Get(authorizationHeader) return extractBearerToken(header) } +// SetAuthorizationHeader sets the authorization header for the given request. func SetAuthorizationHeader(req *http.Request, token string) { req.Header.Set(authorizationHeader, authorizationTokenPrefix+token) } diff --git a/pkg/client/verber.go b/pkg/client/verber.go index e4bcf662..c4626dbd 100644 --- a/pkg/client/verber.go +++ b/pkg/client/verber.go @@ -185,6 +185,7 @@ func (v *resourceVerber) Create(object *unstructured.Unstructured) (*unstructure return v.client.Resource(gvr).Namespace(namespace).Create(context.TODO(), object, metav1.CreateOptions{}) } +// VerberClient returns a resourceVerber client. func VerberClient(request *http.Request) (ResourceVerber, error) { // todo currently ignore rest.config from http.Request restConfig, _, err := GetKarmadaConfig() diff --git a/pkg/common/errors/errors.go b/pkg/common/errors/errors.go index 926b9ad9..e11a7278 100644 --- a/pkg/common/errors/errors.go +++ b/pkg/common/errors/errors.go @@ -30,6 +30,7 @@ func NewUnauthorized(reason string) *k8serrors.StatusError { return k8serrors.NewUnauthorized(reason) } +// NewForbidden returns an error indicating the client is not authorized to perform the requested func NewForbidden(name string, err error) *k8serrors.StatusError { return k8serrors.NewForbidden(schema.GroupResource{}, name, err) } @@ -48,17 +49,6 @@ func NewTokenExpired(reason string) *k8serrors.StatusError { } } -func NewCSRFValidationFailed() *k8serrors.StatusError { - return &k8serrors.StatusError{ - ErrStatus: metav1.Status{ - Status: metav1.StatusFailure, - Code: http.StatusUnauthorized, - Reason: metav1.StatusReasonInvalid, - Message: MsgCSRFValidationError, - }, - } -} - // NewBadRequest creates an error that indicates that the request is invalid and can not be processed. func NewBadRequest(reason string) *k8serrors.StatusError { return k8serrors.NewBadRequest(reason) diff --git a/pkg/common/errors/handler.go b/pkg/common/errors/handler.go index 5cd72ec5..e0bfb0dc 100644 --- a/pkg/common/errors/handler.go +++ b/pkg/common/errors/handler.go @@ -26,6 +26,7 @@ import ( // silenced and displayed to the user as a warning on the frontend side. var nonCriticalErrors = []int32{http.StatusForbidden} +// HandleError processes the incoming error and returns the corresponding HTTP status code and error message based on the error type. func HandleError(err error) (int, error) { if IsUnauthorized(err) { return http.StatusUnauthorized, NewUnauthorized(MsgLoginUnauthorizedError) diff --git a/pkg/common/errors/validate.go b/pkg/common/errors/validate.go index b7d77727..699a8497 100644 --- a/pkg/common/errors/validate.go +++ b/pkg/common/errors/validate.go @@ -45,4 +45,5 @@ func IsForbidden(err error) bool { return k8serrors.IsForbidden(err) } +// IsNotFound checks if the given error is of type NotFound. func IsNotFound(err error) bool { return k8serrors.IsNotFound(err) } diff --git a/pkg/config/model.go b/pkg/config/model.go index a8411f41..5af0099c 100644 --- a/pkg/config/model.go +++ b/pkg/config/model.go @@ -16,6 +16,7 @@ limitations under the License. package config +// DockerRegistry represents a Docker registry configuration. type DockerRegistry struct { Name string `yaml:"name" json:"name"` Url string `yaml:"url" json:"url"` @@ -24,6 +25,7 @@ type DockerRegistry struct { AddTime int64 `yaml:"add_time" json:"add_time"` } +// ChartRegistry represents a Helm chart registry configuration. type ChartRegistry struct { Name string `yaml:"name" json:"name"` Url string `yaml:"url" json:"url"` @@ -32,6 +34,7 @@ type ChartRegistry struct { AddTime int64 `yaml:"add_time" json:"add_time"` } +// MenuConfig represents a menu configuration. type MenuConfig struct { Path string `yaml:"path" json:"path"` Enable bool `yaml:"enable" json:"enable"` diff --git a/pkg/resource/clusteroverridepolicy/common.go b/pkg/resource/clusteroverridepolicy/common.go index bafb1c38..84178114 100644 --- a/pkg/resource/clusteroverridepolicy/common.go +++ b/pkg/resource/clusteroverridepolicy/common.go @@ -22,8 +22,10 @@ import ( "github.com/karmada-io/dashboard/pkg/dataselect" ) +// ClusterOverridePolicyCell wraps v1alpha1.ClusterOverridePolicy for data selection. type ClusterOverridePolicyCell v1alpha1.ClusterOverridePolicy +// GetProperty returns a property of the cluster override policy cell. func (self ClusterOverridePolicyCell) GetProperty(name dataselect.PropertyName) dataselect.ComparableValue { switch name { case dataselect.NameProperty: diff --git a/pkg/resource/clusteroverridepolicy/detail.go b/pkg/resource/clusteroverridepolicy/detail.go index baf500ed..1cf12679 100644 --- a/pkg/resource/clusteroverridepolicy/detail.go +++ b/pkg/resource/clusteroverridepolicy/detail.go @@ -26,6 +26,7 @@ import ( "github.com/karmada-io/dashboard/pkg/common/errors" ) +// ClusterOverridePolicyDetail contains clusterPropagationPolicy details and non-critical errors. type ClusterOverridePolicyDetail struct { // Extends list item structure. ClusterOverridePolicy `json:",inline"` diff --git a/pkg/resource/clusteroverridepolicy/list.go b/pkg/resource/clusteroverridepolicy/list.go index e5f0424f..7eb50334 100644 --- a/pkg/resource/clusteroverridepolicy/list.go +++ b/pkg/resource/clusteroverridepolicy/list.go @@ -39,6 +39,7 @@ type ClusterOverridePolicyList struct { Errors []error `json:"errors"` } +// ClusterOverridePolicy contains information about a single clusterOverridePolicy. type ClusterOverridePolicy struct { ObjectMeta types.ObjectMeta `json:"objectMeta"` TypeMeta types.TypeMeta `json:"typeMeta"` diff --git a/pkg/resource/clusterpropagationpolicy/common.go b/pkg/resource/clusterpropagationpolicy/common.go index 274901bd..d5724cad 100644 --- a/pkg/resource/clusterpropagationpolicy/common.go +++ b/pkg/resource/clusterpropagationpolicy/common.go @@ -22,8 +22,10 @@ import ( "github.com/karmada-io/dashboard/pkg/dataselect" ) +// ClusterPropagationPolicyCell wraps v1alpha1.ClusterPropagationPolicy for data selection. type ClusterPropagationPolicyCell v1alpha1.ClusterPropagationPolicy +// GetProperty returns a property of the cluster propagation policy cell. func (self ClusterPropagationPolicyCell) GetProperty(name dataselect.PropertyName) dataselect.ComparableValue { switch name { case dataselect.NameProperty: diff --git a/pkg/resource/clusterpropagationpolicy/detail.go b/pkg/resource/clusterpropagationpolicy/detail.go index 7cae0f08..d3efc90e 100644 --- a/pkg/resource/clusterpropagationpolicy/detail.go +++ b/pkg/resource/clusterpropagationpolicy/detail.go @@ -26,6 +26,7 @@ import ( "github.com/karmada-io/dashboard/pkg/common/errors" ) +// ClusterPropagationPolicyDetail contains clusterPropagationPolicy details. type ClusterPropagationPolicyDetail struct { // Extends list item structure. ClusterPropagationPolicy `json:",inline"` diff --git a/pkg/resource/configmap/common.go b/pkg/resource/configmap/common.go index e1260ad4..37f32d8b 100644 --- a/pkg/resource/configmap/common.go +++ b/pkg/resource/configmap/common.go @@ -24,8 +24,10 @@ import ( // The code below allows to perform complex data section on []api.ConfigMap +// ConfigMapCell is a cell in the table of configmaps. type ConfigMapCell api.ConfigMap +// GetProperty returns a property. func (self ConfigMapCell) GetProperty(name dataselect.PropertyName) dataselect.ComparableValue { switch name { case dataselect.NameProperty: diff --git a/pkg/resource/cronjob/jobs.go b/pkg/resource/cronjob/jobs.go index b03f3236..8e7504ed 100644 --- a/pkg/resource/cronjob/jobs.go +++ b/pkg/resource/cronjob/jobs.go @@ -33,7 +33,9 @@ import ( ) const ( + // CronJobAPIVersion is the version of the api for the cronjob. CronJobAPIVersion = "v1" + // CronJobKindName is the kind name of the api for the cronjob. CronJobKindName = "cronjob" ) diff --git a/pkg/resource/deployment/common.go b/pkg/resource/deployment/common.go index 2a800dc8..a25ccc96 100644 --- a/pkg/resource/deployment/common.go +++ b/pkg/resource/deployment/common.go @@ -25,6 +25,7 @@ import ( "github.com/karmada-io/dashboard/pkg/resource/event" ) +// DeploymentCell is a wrapper for the k8s deployment type DeploymentCell apps.Deployment // GetProperty is used to get property of the deployment diff --git a/pkg/resource/endpoint/endpoint.go b/pkg/resource/endpoint/endpoint.go index d5c8322d..66df60a0 100644 --- a/pkg/resource/endpoint/endpoint.go +++ b/pkg/resource/endpoint/endpoint.go @@ -27,6 +27,7 @@ import ( "github.com/karmada-io/dashboard/pkg/resource/common" ) +// Endpoint represents an endpoint in a Kubernetes cluster. type Endpoint struct { ObjectMeta types.ObjectMeta `json:"objectMeta"` TypeMeta types.TypeMeta `json:"typeMeta"` diff --git a/pkg/resource/endpoint/list.go b/pkg/resource/endpoint/list.go index 38678c76..791059a0 100644 --- a/pkg/resource/endpoint/list.go +++ b/pkg/resource/endpoint/list.go @@ -20,6 +20,7 @@ import ( "github.com/karmada-io/dashboard/pkg/common/types" ) +// EndpointList is a list of endpoints in the cluster. type EndpointList struct { ListMeta types.ListMeta `json:"listMeta"` // List of endpoints diff --git a/pkg/resource/event/common.go b/pkg/resource/event/common.go index 1161eb4e..17c9ab37 100644 --- a/pkg/resource/event/common.go +++ b/pkg/resource/event/common.go @@ -154,8 +154,10 @@ func CreateEventList(events []v1.Event, dsQuery *dataselect.DataSelectQuery) com // The code below allows to perform complex data section on []api.Event +// EventCell wraps v1.Event for data selection. type EventCell v1.Event +// GetProperty returns a property of the cell. func (self EventCell) GetProperty(name dataselect.PropertyName) dataselect.ComparableValue { switch name { case dataselect.NameProperty: diff --git a/pkg/resource/ingress/common.go b/pkg/resource/ingress/common.go index 9a6c26e3..5f897d48 100644 --- a/pkg/resource/ingress/common.go +++ b/pkg/resource/ingress/common.go @@ -24,8 +24,10 @@ import ( // The code below allows to perform complex data section on []extensions.Ingress +// IngressCell is a cell in the table of ingress. type IngressCell v1.Ingress +// GetProperty returns a property. func (self IngressCell) GetProperty(name dataselect.PropertyName) dataselect.ComparableValue { switch name { case dataselect.NameProperty: diff --git a/pkg/resource/ingress/filter.go b/pkg/resource/ingress/filter.go index 4ba56ec6..ad24ecae 100644 --- a/pkg/resource/ingress/filter.go +++ b/pkg/resource/ingress/filter.go @@ -22,6 +22,7 @@ import ( "github.com/karmada-io/dashboard/pkg/common/types" ) +// FilterIngressByService filters the given ingresses based on the service name. func FilterIngressByService(ingresses []networkingv1.Ingress, serviceName string) []networkingv1.Ingress { var matchingIngresses []networkingv1.Ingress for _, ingress := range ingresses { diff --git a/pkg/resource/ingress/list.go b/pkg/resource/ingress/list.go index e04594cf..1710f35f 100644 --- a/pkg/resource/ingress/list.go +++ b/pkg/resource/ingress/list.go @@ -103,6 +103,7 @@ func toIngress(ingress *v1.Ingress) Ingress { } } +// ToIngressList converts a list of Ingresss to IngressList func ToIngressList(ingresses []v1.Ingress, nonCriticalErrors []error, dsQuery *dataselect.DataSelectQuery) *IngressList { newIngressList := &IngressList{ ListMeta: types.ListMeta{TotalItems: len(ingresses)}, diff --git a/pkg/resource/job/list.go b/pkg/resource/job/list.go index c8562afc..a2fcd19d 100644 --- a/pkg/resource/job/list.go +++ b/pkg/resource/job/list.go @@ -44,6 +44,7 @@ type JobList struct { Errors []error `json:"errors"` } +// JobStatusType is a valid value for JobStatus.Status. type JobStatusType string const ( @@ -55,6 +56,7 @@ const ( JobStatusFailed JobStatusType = "Failed" ) +// JobStatus contains inferred job status based on job conditions type JobStatus struct { // Short, machine understandable job status code. Status JobStatusType `json:"status"` @@ -128,6 +130,7 @@ func GetJobListFromChannels(channels *common.ResourceChannels, dsQuery *datasele return jobList, nil } +// ToJobList returns a list of all Jobs in the cluster reading required resource list once from the channel. func ToJobList(jobs []batch.Job, pods []v1.Pod, events []v1.Event, nonCriticalErrors []error, dsQuery *dataselect.DataSelectQuery) *JobList { jobList := &JobList{ diff --git a/pkg/resource/node/common.go b/pkg/resource/node/common.go index f4ca197e..62c552c7 100644 --- a/pkg/resource/node/common.go +++ b/pkg/resource/node/common.go @@ -22,8 +22,10 @@ import ( "github.com/karmada-io/dashboard/pkg/dataselect" ) +// NodeCell represents a cell in the table of nodes. type NodeCell api.Node +// GetProperty returns a property of the cell. func (self NodeCell) GetProperty(name dataselect.PropertyName) dataselect.ComparableValue { switch name { case dataselect.NameProperty: diff --git a/pkg/resource/overridepolicy/list.go b/pkg/resource/overridepolicy/list.go index 6837aebf..d38c7450 100644 --- a/pkg/resource/overridepolicy/list.go +++ b/pkg/resource/overridepolicy/list.go @@ -42,6 +42,7 @@ type OverridePolicyList struct { Errors []error `json:"errors"` } +// OverridePolicy contains information about a single propagation. type OverridePolicy struct { ObjectMeta types.ObjectMeta `json:"objectMeta"` TypeMeta types.TypeMeta `json:"typeMeta"` diff --git a/pkg/resource/pod/common.go b/pkg/resource/pod/common.go index bbcb1591..cdb19d80 100644 --- a/pkg/resource/pod/common.go +++ b/pkg/resource/pod/common.go @@ -22,8 +22,10 @@ import ( "github.com/karmada-io/dashboard/pkg/dataselect" ) +// PodCell is a cell for pod. type PodCell api.Pod +// GetProperty returns a property. func (self PodCell) GetProperty(name dataselect.PropertyName) dataselect.ComparableValue { switch name { case dataselect.NameProperty: diff --git a/pkg/resource/pod/detail.go b/pkg/resource/pod/detail.go index fc915a43..0b212b6d 100644 --- a/pkg/resource/pod/detail.go +++ b/pkg/resource/pod/detail.go @@ -24,7 +24,8 @@ import ( "k8s.io/client-go/kubernetes" ) -type PodDeatil struct { +// PodDetail is a pod detail +type PodDetail struct { ObjectMeta metaV1.ObjectMeta `json:"objectMeta"` TypeMeta metaV1.TypeMeta `json:"typeMeta"` Spec v1.PodSpec `json:"podSpec"` diff --git a/pkg/resource/pod/list.go b/pkg/resource/pod/list.go index faa9ba4f..94391b55 100644 --- a/pkg/resource/pod/list.go +++ b/pkg/resource/pod/list.go @@ -29,6 +29,7 @@ import ( "github.com/karmada-io/dashboard/pkg/resource/common" ) +// Pod contains information about a single Pod. type Pod struct { ObjectMeta types.ObjectMeta `json:"objectMeta"` TypeMeta types.TypeMeta `json:"typeMeta"` @@ -96,6 +97,7 @@ func toPodList(pods []v1.Pod, nonCriticalErrors []error, dsQuery *dataselect.Dat return result } +// NewStatus returns a new status. func NewStatus(status v1.PodStatus) v1.PodStatus { return v1.PodStatus{ Conditions: status.Conditions, diff --git a/pkg/resource/propagationpolicy/list.go b/pkg/resource/propagationpolicy/list.go index eda09bec..8a0a2c29 100644 --- a/pkg/resource/propagationpolicy/list.go +++ b/pkg/resource/propagationpolicy/list.go @@ -46,6 +46,7 @@ type PropagationPolicyList struct { Errors []error `json:"errors"` } +// PropagationPolicy contains information about a single propagation. type PropagationPolicy struct { ObjectMeta types.ObjectMeta `json:"objectMeta"` TypeMeta types.TypeMeta `json:"typeMeta"` diff --git a/pkg/resource/secret/common.go b/pkg/resource/secret/common.go index 24ac3114..3ab73f27 100644 --- a/pkg/resource/secret/common.go +++ b/pkg/resource/secret/common.go @@ -22,8 +22,10 @@ import ( "github.com/karmada-io/dashboard/pkg/dataselect" ) +// SecretCell wraps api.Secret for data selection. type SecretCell api.Secret +// GetProperty returns a property of the secret cell. func (self SecretCell) GetProperty(name dataselect.PropertyName) dataselect.ComparableValue { switch name { case dataselect.NameProperty: diff --git a/pkg/resource/secret/list.go b/pkg/resource/secret/list.go index a3e561e2..f9027ca7 100644 --- a/pkg/resource/secret/list.go +++ b/pkg/resource/secret/list.go @@ -124,6 +124,7 @@ func toSecret(secret *v1.Secret) Secret { } } +// ToSecretList converts a list of Secrets to SecretList func ToSecretList(secrets []v1.Secret, nonCriticalErrors []error, dsQuery *dataselect.DataSelectQuery) *SecretList { newSecretList := &SecretList{ ListMeta: types.ListMeta{TotalItems: len(secrets)}, diff --git a/pkg/resource/service/common.go b/pkg/resource/service/common.go index b1b8106d..08c89e16 100644 --- a/pkg/resource/service/common.go +++ b/pkg/resource/service/common.go @@ -24,8 +24,10 @@ import ( // The code below allows to perform complex data section on []api.Service +// ServiceCell wraps v1.Service for data selection. type ServiceCell v1.Service +// GetProperty returns a property of the service cell. func (self ServiceCell) GetProperty(name dataselect.PropertyName) dataselect.ComparableValue { switch name { case dataselect.NameProperty: diff --git a/pkg/resource/statefulset/common.go b/pkg/resource/statefulset/common.go index 3d6cd84c..e612e529 100644 --- a/pkg/resource/statefulset/common.go +++ b/pkg/resource/statefulset/common.go @@ -27,8 +27,10 @@ import ( // The code below allows to perform complex data section on []apps.StatefulSet +// StatefulSetCell is a cell in the table of statefulsets. type StatefulSetCell apps.StatefulSet +// GetProperty returns a property. func (self StatefulSetCell) GetProperty(name dataselect.PropertyName) dataselect.ComparableValue { switch name { case dataselect.NameProperty: