From 8853a985fdb454a69a2c0f43b6f139f51916941b Mon Sep 17 00:00:00 2001 From: gkarthiks Date: Sun, 16 Feb 2020 15:09:45 -0800 Subject: [PATCH] fix: golint failures Signed-off-by: gkarthiks --- hack/.golint_failures | 1 - pkg/apis/core/v1/helper/helpers.go | 13 +++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/hack/.golint_failures b/hack/.golint_failures index 40e538bbbe9..6386a1c94c4 100644 --- a/hack/.golint_failures +++ b/hack/.golint_failures @@ -25,7 +25,6 @@ pkg/apis/certificates/v1beta1 pkg/apis/certificates/validation pkg/apis/core/helper/qos pkg/apis/core/v1 -pkg/apis/core/v1/helper pkg/apis/core/v1/helper/qos pkg/apis/core/v1/validation pkg/apis/core/validation diff --git a/pkg/apis/core/v1/helper/helpers.go b/pkg/apis/core/v1/helper/helpers.go index a930520f1b1..82937eeb663 100644 --- a/pkg/apis/core/v1/helper/helpers.go +++ b/pkg/apis/core/v1/helper/helpers.go @@ -110,22 +110,25 @@ func IsOvercommitAllowed(name v1.ResourceName) bool { !IsHugePageResourceName(name) } +// IsAttachableVolumeResourceName returns true when the resource name is prefixed in attachable volume func IsAttachableVolumeResourceName(name v1.ResourceName) bool { return strings.HasPrefix(string(name), v1.ResourceAttachableVolumesPrefix) } -// Extended and Hugepages resources +// IsScalarResourceName validates the resource for Extended, Hugepages, Native and AttachableVolume resources func IsScalarResourceName(name v1.ResourceName) bool { return IsExtendedResourceName(name) || IsHugePageResourceName(name) || IsPrefixedNativeResource(name) || IsAttachableVolumeResourceName(name) } -// this function aims to check if the service's ClusterIP is set or not +// IsServiceIPSet aims to check if the service's ClusterIP is set or not // the objective is not to perform validation here func IsServiceIPSet(service *v1.Service) bool { return service.Spec.ClusterIP != v1.ClusterIPNone && service.Spec.ClusterIP != "" } +// LoadBalancerStatusEqual evaluates the given load balancers' ingress IP addresses +// and hostnames and returns true if equal or false if otherwise // TODO: make method on LoadBalancerStatus? func LoadBalancerStatusEqual(l, r *v1.LoadBalancerStatus) bool { return ingressSliceEqual(l.Ingress, r.Ingress) @@ -170,7 +173,7 @@ func GetAccessModesAsString(modes []v1.PersistentVolumeAccessMode) string { return strings.Join(modesStr, ",") } -// GetAccessModesAsString returns an array of AccessModes from a string created by GetAccessModesAsString +// GetAccessModesFromString returns an array of AccessModes from a string created by GetAccessModesAsString func GetAccessModesFromString(modes string) []v1.PersistentVolumeAccessMode { strmodes := strings.Split(modes, ",") accessModes := []v1.PersistentVolumeAccessMode{} @@ -446,7 +449,7 @@ func getFilteredTaints(taints []v1.Taint, inclusionFilter taintsFilterFunc) []v1 return filteredTaints } -// Returns true and list of Tolerations matching all Taints if all are tolerated, or false otherwise. +// GetMatchingTolerations returns true and list of Tolerations matching all Taints if all are tolerated, or false otherwise. func GetMatchingTolerations(taints []v1.Taint, tolerations []v1.Toleration) (bool, []v1.Toleration) { if len(taints) == 0 { return true, []v1.Toleration{} @@ -471,6 +474,8 @@ func GetMatchingTolerations(taints []v1.Taint, tolerations []v1.Toleration) (boo return true, result } +// GetAvoidPodsFromNodeAnnotations scans the list of annotations and +// returns the pods that needs to be avoided for this node from scheduling func GetAvoidPodsFromNodeAnnotations(annotations map[string]string) (v1.AvoidPods, error) { var avoidPods v1.AvoidPods if len(annotations) > 0 && annotations[v1.PreferAvoidPodsAnnotationKey] != "" {