mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-27 16:17:34 +00:00
fix lint issues in /pkg/controller
fix lint issues in /apis Signed-off-by: roy wang <seiwy2010@gmail.com>
This commit is contained in:
@@ -25,12 +25,12 @@ import (
|
||||
|
||||
// ApplicationDeploymentSpec defines the desired state of ApplicationDeployment
|
||||
type ApplicationDeploymentSpec struct {
|
||||
//TODO add spec here
|
||||
// TODO add spec here
|
||||
}
|
||||
|
||||
// ApplicationDeploymentStatus defines the observed state of ApplicationDeployment
|
||||
type ApplicationDeploymentStatus struct {
|
||||
//TODO add status field here
|
||||
// TODO add status field here
|
||||
runtimev1alpha1.ConditionedStatus `json:",inline"`
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ type Capability struct {
|
||||
Status string `json:"status,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
|
||||
//trait only
|
||||
// trait only
|
||||
AppliesTo []string `json:"appliesTo,omitempty"`
|
||||
|
||||
// Plugin Source
|
||||
@@ -73,7 +73,7 @@ type Chart struct {
|
||||
// Installation defines the installation method for this Capability, currently only helm is supported
|
||||
type Installation struct {
|
||||
Helm Chart `json:"helm"`
|
||||
//TODO(wonderflow) add raw yaml file support for install capability
|
||||
// TODO(wonderflow) add raw yaml file support for install capability
|
||||
}
|
||||
|
||||
// CapType defines the type of capability
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//nolint
|
||||
package common
|
||||
|
||||
// error msg for common usage
|
||||
const (
|
||||
ErrLocatingWorkload = "failed to locate the workload"
|
||||
ErrLocatingService = "failed to locate any the services"
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
|
||||
}
|
||||
log.Info("Get the applicationdeployment", "apiVersion", appdeploy.APIVersion, "kind", appdeploy.Kind)
|
||||
|
||||
//TODO add reconcile logic here
|
||||
// TODO add reconcile logic here
|
||||
|
||||
return ctrl.Result{}, nil
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ func (r *AutoscalerReconciler) scaleByKEDA(scaler v1alpha1.Autoscaler, namespace
|
||||
Name: t.Name,
|
||||
Metadata: t.Condition,
|
||||
|
||||
//TODO(wonderflow): add auth in the future
|
||||
// TODO(wonderflow): add auth in the future
|
||||
AuthenticationRef: nil,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
//nolint:golint
|
||||
package autoscalers
|
||||
|
||||
import (
|
||||
"github.com/oam-dev/kubevela/apis/standard.oam.dev/v1alpha1"
|
||||
)
|
||||
|
||||
// constants used in autoscaler controller
|
||||
const (
|
||||
CronType v1alpha1.TriggerType = "cron"
|
||||
CPUType v1alpha1.TriggerType = "cpu"
|
||||
|
||||
@@ -46,7 +46,7 @@ func (n *Nginx) CheckStatus(routeTrait *standardv1alpha1.Route) (string, []runti
|
||||
Status: v1.ConditionFalse, LastTransitionTime: metav1.Now(), Reason: runtimev1alpha1.ReasonUnavailable,
|
||||
Message: message}}
|
||||
}
|
||||
//TODO(wonderflow): handle more than one condition case
|
||||
// TODO(wonderflow): handle more than one condition case
|
||||
condition := issuer.Status.Conditions[0]
|
||||
if condition.Status != cmmeta.ConditionTrue {
|
||||
return StatusSynced, []runtimev1alpha1.Condition{{Type: runtimev1alpha1.TypeSynced,
|
||||
@@ -74,7 +74,7 @@ func (n *Nginx) CheckStatus(routeTrait *standardv1alpha1.Route) (string, []runti
|
||||
Status: v1.ConditionFalse, LastTransitionTime: metav1.Now(), Reason: runtimev1alpha1.ReasonUnavailable,
|
||||
Message: message}}
|
||||
}
|
||||
//TODO(wonderflow): handle more than one condition case
|
||||
// TODO(wonderflow): handle more than one condition case
|
||||
certcondition := cert.Status.Conditions[0]
|
||||
if certcondition.Status != cmmeta.ConditionTrue || certcondition.Type != certmanager.CertificateConditionReady {
|
||||
return StatusSynced, []runtimev1alpha1.Condition{{Type: runtimev1alpha1.TypeSynced,
|
||||
@@ -145,12 +145,12 @@ func (*Nginx) Construct(routeTrait *standardv1alpha1.Route) []*v1beta1.Ingress {
|
||||
annotations["nginx.ingress.kubernetes.io/configuration-snippet"] = headerSnippet
|
||||
}
|
||||
|
||||
//Send timeout
|
||||
// Send timeout
|
||||
if backend.SendTimeout != 0 {
|
||||
annotations["nginx.ingress.kubernetes.io/proxy-send-timeout"] = strconv.Itoa(backend.SendTimeout)
|
||||
}
|
||||
|
||||
//Read timeout
|
||||
// Read timeout
|
||||
if backend.ReadTimeout != 0 {
|
||||
annotations["nginx.ingress.kubernetes.io/proxy‑read‑timeout"] = strconv.Itoa(backend.ReadTimeout)
|
||||
}
|
||||
|
||||
@@ -51,11 +51,11 @@ func FillRouteTraitWithService(service *corev1.Service, routeTrait *v1alpha1.Rou
|
||||
for idx, rule := range routeTrait.Spec.Rules {
|
||||
// If backendService.port not specified, will always use the service found and it's first port as backendService.
|
||||
for _, servicePort := range service.Spec.Ports {
|
||||
//We use targetPort rather than port to match with the rule, because if serviceName not specified,
|
||||
//Users will only know containerPort(which is targetPort)
|
||||
// We use targetPort rather than port to match with the rule, because if serviceName not specified,
|
||||
// Users will only know containerPort(which is targetPort)
|
||||
if MatchService(servicePort.TargetPort, rule) {
|
||||
ref := &v1alpha1.BackendServiceRef{
|
||||
//Use port of service rather than targetPort, it will be used in ingress pointing to the service
|
||||
// Use port of service rather than targetPort, it will be used in ingress pointing to the service
|
||||
Port: intstr.FromInt(int(servicePort.Port)),
|
||||
ServiceName: service.Name,
|
||||
}
|
||||
|
||||
@@ -41,12 +41,12 @@ func DiscoveryFromPodSpec(w *unstructured.Unstructured, fieldPath string) ([]int
|
||||
}
|
||||
data, err := json.Marshal(obj)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("discovery podSpec from %s in workload %v err %v", fieldPath, w.GetName(), err)
|
||||
return nil, fmt.Errorf("discovery podSpec from %s in workload %v err %w", fieldPath, w.GetName(), err)
|
||||
}
|
||||
var spec v1.PodSpec
|
||||
err = json.Unmarshal(data, &spec)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("discovery podSpec from %s in workload %v err %v", fieldPath, w.GetName(), err)
|
||||
return nil, fmt.Errorf("discovery podSpec from %s in workload %v err %w", fieldPath, w.GetName(), err)
|
||||
}
|
||||
ports := getContainerPorts(spec.Containers)
|
||||
if len(ports) == 0 {
|
||||
@@ -63,12 +63,12 @@ func DiscoveryFromPodTemplate(w *unstructured.Unstructured, fields ...string) ([
|
||||
}
|
||||
data, err := json.Marshal(obj)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("workload %v convert object err %v", w.GetName(), err)
|
||||
return nil, nil, fmt.Errorf("workload %v convert object err %w", w.GetName(), err)
|
||||
}
|
||||
var spec v1.PodTemplateSpec
|
||||
err = json.Unmarshal(data, &spec)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("workload %v convert object to PodTemplate err %v", w.GetName(), err)
|
||||
return nil, nil, fmt.Errorf("workload %v convert object to PodTemplate err %w", w.GetName(), err)
|
||||
}
|
||||
ports := getContainerPorts(spec.Spec.Containers)
|
||||
if len(ports) == 0 {
|
||||
@@ -79,7 +79,7 @@ func DiscoveryFromPodTemplate(w *unstructured.Unstructured, fields ...string) ([
|
||||
|
||||
func getContainerPorts(cs []v1.Container) []intstr.IntOrString {
|
||||
var ports []intstr.IntOrString
|
||||
//TODO(wonderflow): exclude some sidecars
|
||||
// TODO(wonderflow): exclude some sidecars
|
||||
for _, container := range cs {
|
||||
for _, port := range container.Ports {
|
||||
ports = append(ports, intstr.FromInt(int(port.ContainerPort)))
|
||||
|
||||
Reference in New Issue
Block a user