Fix golint errors.
parent
a9460b1dc7
commit
f0618e9133
|
@ -3,8 +3,12 @@
|
|||
package all
|
||||
|
||||
import (
|
||||
// Side-effect import to get all the checks in basic package registered.
|
||||
_ "github.com/digitalocean/clusterlint/checks/basic"
|
||||
// Side-effect import to get all the checks in doks package registered.
|
||||
_ "github.com/digitalocean/clusterlint/checks/doks"
|
||||
// Side-effect import to get all the checks in noop package registered.
|
||||
_ "github.com/digitalocean/clusterlint/checks/noop"
|
||||
// Side-effect import to get all the checks in security package registered.
|
||||
_ "github.com/digitalocean/clusterlint/checks/security"
|
||||
)
|
||||
|
|
|
@ -19,7 +19,7 @@ func (pv *unusedPVCheck) Name() string {
|
|||
}
|
||||
|
||||
// Groups returns a list of group names this check should be part of.
|
||||
func (pvh *unusedPVCheck) Groups() []string {
|
||||
func (pv *unusedPVCheck) Groups() []string {
|
||||
return []string{"basic"}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,19 +20,33 @@ func (d Diagnostic) String() string {
|
|||
d.Kind, d.Object.Name, d.Message)
|
||||
}
|
||||
|
||||
// Severity identifies the level of priority for each diagnostic.
|
||||
type Severity string
|
||||
|
||||
// Kind represents the kind of k8s object the diagnoatic is about
|
||||
type Kind string
|
||||
|
||||
const (
|
||||
Error Severity = "error"
|
||||
Warning Severity = "warning"
|
||||
Suggestion Severity = "suggestion"
|
||||
Pod Kind = "pod"
|
||||
PodTemplate Kind = "pod template"
|
||||
PersistentVolumeClaim Kind = "persistent volume claim"
|
||||
ConfigMap Kind = "config map"
|
||||
Service Kind = "service"
|
||||
Secret Kind = "secret"
|
||||
ServiceAccount Kind = "service account"
|
||||
PersistentVolume Kind = "persistent volume"
|
||||
// Error means that the diagnostic message should be fixed immediately
|
||||
Error Severity = "error"
|
||||
// Warning indicates that the diagnostic should be fixed but okay to ignore in some special cases
|
||||
Warning Severity = "warning"
|
||||
// Suggestion means that a user need not implement it, but is in line with the recommended best practices
|
||||
Suggestion Severity = "suggestion"
|
||||
// Pod identifies Kubernetes objects of kind `pod`
|
||||
Pod Kind = "pod"
|
||||
// PodTemplate identifies Kubernetes objects of kind `pod template`
|
||||
PodTemplate Kind = "pod template"
|
||||
// PersistentVolumeClaim identifies Kubernetes objects of kind `persistent volume claim`
|
||||
PersistentVolumeClaim Kind = "persistent volume claim"
|
||||
// ConfigMap identifies Kubernetes objects of kind `config map`
|
||||
ConfigMap Kind = "config map"
|
||||
// Service identifies Kubernetes objects of kind `service`
|
||||
Service Kind = "service"
|
||||
// Secret identifies Kubernetes objects of kind `secret`
|
||||
Secret Kind = "secret"
|
||||
// ServiceAccount identifies Kubernetes objects of kind `service account`
|
||||
ServiceAccount Kind = "service account"
|
||||
// PersistentVolume identifies Kubernetes objects of kind `persistent volume`
|
||||
PersistentVolume Kind = "persistent volume"
|
||||
)
|
||||
|
|
|
@ -85,6 +85,8 @@ func GetGroup(name string) []Check {
|
|||
return ret
|
||||
}
|
||||
|
||||
// Get retrieves the specified check from the registry,
|
||||
// throws an error if not found
|
||||
func Get(name string) (Check, error) {
|
||||
registry.mu.RLock()
|
||||
defer registry.mu.RUnlock()
|
||||
|
|
|
@ -25,11 +25,6 @@ type Objects struct {
|
|||
LimitRanges *corev1.LimitRangeList
|
||||
}
|
||||
|
||||
type Object struct {
|
||||
TypeInfo *metav1.TypeMeta
|
||||
ObjectInfo *metav1.ObjectMeta
|
||||
}
|
||||
|
||||
// Client encapsulates a client for a Kubernetes cluster.
|
||||
type Client struct {
|
||||
kubeClient kubernetes.Interface
|
||||
|
@ -100,6 +95,9 @@ func (c *Client) FetchObjects() (*Objects, error) {
|
|||
return objects, nil
|
||||
}
|
||||
|
||||
// NewClient builds a kubernetes client to interact with the live cluster.
|
||||
// The kube config file path and the context must be specified for the client
|
||||
// If not specified, defaults are assumed - configPath: ~/.kube/config, configContext: current context
|
||||
func NewClient(configPath, configContext string) (*Client, error) {
|
||||
var config *rest.Config
|
||||
var err error
|
||||
|
|
Loading…
Reference in New Issue