Fix some ci lint (#1233)

This commit is contained in:
Hang Yan 2020-01-05 21:36:32 +08:00 committed by GitHub
parent e7f05588bf
commit 7dbca5df34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 12 deletions

View File

@ -175,7 +175,7 @@ type Volumes struct {
SelectorValue string // Value of the label selector
}
// GetConfigMapKeyFromMeta...
// GetConfigMapKeyFromMeta ...
// given a source name ,find the file and extract the filename which will be act as ConfigMap key
// return "" if not found
func (s *ServiceConfig) GetConfigMapKeyFromMeta(name string) (string, error) {
@ -195,7 +195,7 @@ func (s *ServiceConfig) GetConfigMapKeyFromMeta(name string) (string, error) {
}
// GetUpdateStrategy from compose update_config
// GetKubernetesUpdateStrategy from compose update_config
// 1. only apply to Deployment, but the check is not happened here
// 2. only support `parallelism` and `order`
// return nil if not support
@ -222,7 +222,8 @@ func (s *ServiceConfig) GetKubernetesUpdateStrategy() *extensions.RollingUpdateD
}
func (s *ServiceConfig) GetOCUpdateStrategy() *deployapi.RollingDeploymentStrategyParams {
// GetOSUpdateStrategy ...
func (s *ServiceConfig) GetOSUpdateStrategy() *deployapi.RollingDeploymentStrategyParams {
config := s.DeployUpdateConfig
r := deployapi.RollingDeploymentStrategyParams{}

View File

@ -588,6 +588,7 @@ func (k *Kubernetes) UpdateKubernetesObjects(name string, service kobject.Servic
return nil
}
// TranslatePodResource config pod resources
func TranslatePodResource(service *kobject.ServiceConfig, template *api.PodTemplateSpec) {
// Configure the resource limits
if service.MemLimit != 0 || service.CPULimit != 0 {
@ -623,6 +624,7 @@ func TranslatePodResource(service *kobject.ServiceConfig, template *api.PodTempl
}
// GetImagePullPolicy get image pull settings
func GetImagePullPolicy(name, policy string) (api.PullPolicy, error) {
switch policy {
case "":
@ -639,6 +641,7 @@ func GetImagePullPolicy(name, policy string) (api.PullPolicy, error) {
}
// GetRestartPolicy ...
func GetRestartPolicy(name, restart string) (api.RestartPolicy, error) {
switch restart {
case "", "always", "any":
@ -694,7 +697,7 @@ func (k *Kubernetes) RemoveDupObjects(objs *[]runtime.Object) {
*objs = result
}
func resetWorkloadApiVersion(d runtime.Object) runtime.Object {
func resetWorkloadAPIVersion(d runtime.Object) runtime.Object {
data, err := json.Marshal(d)
if err == nil {
var us runtime.Unstructured
@ -705,12 +708,9 @@ func resetWorkloadApiVersion(d runtime.Object) runtime.Object {
Kind: d.GetObjectKind().GroupVersionKind().Kind,
})
return &us
} else {
return d
}
} else {
return d
}
return d
}
// FixWorkloadVersion force reset deployment/daemonset's apiversion to apps/v1
@ -718,10 +718,10 @@ func (k *Kubernetes) FixWorkloadVersion(objs *[]runtime.Object) {
var result []runtime.Object
for _, obj := range *objs {
if d, ok := obj.(*extensions.Deployment); ok {
nd := resetWorkloadApiVersion(d)
nd := resetWorkloadAPIVersion(d)
result = append(result, nd)
} else if d, ok := obj.(*extensions.DaemonSet); ok {
nd := resetWorkloadApiVersion(d)
nd := resetWorkloadAPIVersion(d)
result = append(result, nd)
} else {
result = append(result, obj)

View File

@ -233,7 +233,7 @@ func (o *OpenShift) initDeploymentConfig(name string, service kobject.ServiceCon
},
}
update := service.GetOCUpdateStrategy()
update := service.GetOSUpdateStrategy()
if update != nil {
dc.Spec.Strategy = deployapi.DeploymentStrategy{
Type: deployapi.DeploymentStrategyTypeRolling,

View File

@ -112,7 +112,7 @@ func ConfigLabels(name string) map[string]string {
return map[string]string{Selector: name}
}
// ConfigLabels configures label and add Network Information in labels
// ConfigLabelsWithNetwork configures label and add Network Information in labels
func ConfigLabelsWithNetwork(name string, net []string) map[string]string {
labels := map[string]string{}