From 602c3eb0e610520521c0eb750d9b36dd60c64393 Mon Sep 17 00:00:00 2001 From: Humble Chirammal Date: Fri, 18 Jan 2019 15:08:25 +0530 Subject: [PATCH] Better documented exported functions and variables Signed-off-by: Humble Chirammal --- pkg/apis/apps/types.go | 12 ++++++------ pkg/apis/apps/validation/validation.go | 12 ++++++------ pkg/apis/core/helper/helpers.go | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pkg/apis/apps/types.go b/pkg/apis/apps/types.go index c15927d45e..65ca4f62ab 100644 --- a/pkg/apis/apps/types.go +++ b/pkg/apis/apps/types.go @@ -376,14 +376,14 @@ type DeploymentStrategy struct { type DeploymentStrategyType string const ( - // Kill all existing pods before creating new ones. + // RecreateDeploymentStrategyType - kill all existing pods before creating new ones. RecreateDeploymentStrategyType DeploymentStrategyType = "Recreate" - // Replace the old RCs by new one using rolling update i.e gradually scale down the old RCs and scale up the new one. + // RollingUpdateDeploymentStrategyType - Replace the old RCs by new one using rolling update i.e gradually scale down the old RCs and scale up the new one. RollingUpdateDeploymentStrategyType DeploymentStrategyType = "RollingUpdate" ) -// Spec to control the desired behavior of rolling update. +// RollingUpdateDeployment is the spec to control the desired behavior of rolling update. type RollingUpdateDeployment struct { // The maximum number of pods that can be unavailable during the update. // Value can be an absolute number (ex: 5) or a percentage of total pods at the start of update (ex: 10%). @@ -511,14 +511,14 @@ type DaemonSetUpdateStrategy struct { type DaemonSetUpdateStrategyType string const ( - // Replace the old daemons by new ones using rolling update i.e replace them on each node one after the other. + // RollingUpdateDaemonSetStrategyType - Replace the old daemons by new ones using rolling update i.e replace them on each node one after the other. RollingUpdateDaemonSetStrategyType DaemonSetUpdateStrategyType = "RollingUpdate" - // Replace the old daemons only when it's killed + // OnDeleteDaemonSetStrategyType - Replace the old daemons only when it's killed OnDeleteDaemonSetStrategyType DaemonSetUpdateStrategyType = "OnDelete" ) -// Spec to control the desired behavior of daemon set rolling update. +// RollingUpdateDaemonSet is the spec to control the desired behavior of daemon set rolling update. type RollingUpdateDaemonSet struct { // The maximum number of DaemonSet pods that can be unavailable during the // update. Value can be an absolute number (ex: 5) or a percentage of total diff --git a/pkg/apis/apps/validation/validation.go b/pkg/apis/apps/validation/validation.go index a80c0a2093..9a954f13b4 100644 --- a/pkg/apis/apps/validation/validation.go +++ b/pkg/apis/apps/validation/validation.go @@ -43,7 +43,7 @@ func ValidateStatefulSetName(name string, prefix bool) []string { return apimachineryvalidation.NameIsDNSSubdomain(name, prefix) } -// Validates the given template and ensures that it is in accordance with the desired selector. +// ValidatePodTemplateSpecForStatefulSet validates the given template and ensures that it is in accordance with the desired selector. func ValidatePodTemplateSpecForStatefulSet(template *api.PodTemplateSpec, selector labels.Selector, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} if template == nil { @@ -291,7 +291,7 @@ func validateDaemonSetStatus(status *apps.DaemonSetStatus, fldPath *field.Path) return allErrs } -// ValidateDaemonSetStatus validates tests if required fields in the DaemonSet Status section +// ValidateDaemonSetStatusUpdate validates tests if required fields in the DaemonSet Status section func ValidateDaemonSetStatusUpdate(ds, oldDS *apps.DaemonSet) field.ErrorList { allErrs := apivalidation.ValidateObjectMetaUpdate(&ds.ObjectMeta, &oldDS.ObjectMeta, field.NewPath("metadata")) allErrs = append(allErrs, validateDaemonSetStatus(&ds.Status, field.NewPath("status"))...) @@ -375,7 +375,7 @@ func ValidateDaemonSetUpdateStrategy(strategy *apps.DaemonSetUpdateStrategy, fld // trailing dashes are allowed. var ValidateDaemonSetName = apimachineryvalidation.NameIsDNSSubdomain -// Validates that the given name can be used as a deployment name. +// ValidateDeploymentName validates that the given name can be used as a deployment name. var ValidateDeploymentName = apimachineryvalidation.NameIsDNSSubdomain func ValidatePositiveIntOrPercent(intOrPercent intstr.IntOrString, fldPath *field.Path) field.ErrorList { @@ -463,7 +463,7 @@ func ValidateRollback(rollback *apps.RollbackConfig, fldPath *field.Path) field. return allErrs } -// Validates given deployment spec. +// ValidateDeploymentSpec validates given deployment spec. func ValidateDeploymentSpec(spec *apps.DeploymentSpec, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(spec.Replicas), fldPath.Child("replicas"))...) @@ -502,7 +502,7 @@ func ValidateDeploymentSpec(spec *apps.DeploymentSpec, fldPath *field.Path) fiel return allErrs } -// Validates given deployment status. +// ValidateDeploymentStatus validates given deployment status. func ValidateDeploymentStatus(status *apps.DeploymentStatus, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(status.ObservedGeneration, fldPath.Child("observedGeneration"))...) @@ -642,7 +642,7 @@ func ValidateReplicaSetSpec(spec *apps.ReplicaSetSpec, fldPath *field.Path) fiel return allErrs } -// Validates the given template and ensures that it is in accordance with the desired selector and replicas. +// ValidatePodTemplateSpecForReplicaSet validates the given template and ensures that it is in accordance with the desired selector and replicas. func ValidatePodTemplateSpecForReplicaSet(template *api.PodTemplateSpec, selector labels.Selector, replicas int32, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} if template == nil { diff --git a/pkg/apis/core/helper/helpers.go b/pkg/apis/core/helper/helpers.go index 10c33f66bd..75347f034d 100644 --- a/pkg/apis/core/helper/helpers.go +++ b/pkg/apis/core/helper/helpers.go @@ -264,7 +264,7 @@ func IsIntegerResourceName(str string) bool { return integerResources.Has(str) || IsExtendedResourceName(core.ResourceName(str)) } -// 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 *core.Service) bool { return service.Spec.ClusterIP != core.ClusterIPNone && service.Spec.ClusterIP != ""