Fix inspection errors
Signed-off-by: whitewindmills <jayfantasyhjh@gmail.com>
This commit is contained in:
parent
b273800421
commit
89295f9606
|
@ -7,16 +7,16 @@ import (
|
|||
)
|
||||
|
||||
// Validate checks Options and return a slice of found errs.
|
||||
func (opts *Options) Validate() field.ErrorList {
|
||||
func (o *Options) Validate() field.ErrorList {
|
||||
errs := field.ErrorList{}
|
||||
rootPath := field.NewPath("Options")
|
||||
|
||||
if net.ParseIP(opts.BindAddress) == nil {
|
||||
errs = append(errs, field.Invalid(rootPath.Child("BindAddress"), opts.BindAddress, "not a valid textual representation of an IP address"))
|
||||
if net.ParseIP(o.BindAddress) == nil {
|
||||
errs = append(errs, field.Invalid(rootPath.Child("BindAddress"), o.BindAddress, "not a valid textual representation of an IP address"))
|
||||
}
|
||||
|
||||
if opts.SecurePort < 0 || opts.SecurePort > 65535 {
|
||||
errs = append(errs, field.Invalid(rootPath.Child("SecurePort"), opts.SecurePort, "must be a valid port between 0 and 65535 inclusive"))
|
||||
if o.SecurePort < 0 || o.SecurePort > 65535 {
|
||||
errs = append(errs, field.Invalid(rootPath.Child("SecurePort"), o.SecurePort, "must be a valid port between 0 and 65535 inclusive"))
|
||||
}
|
||||
|
||||
return errs
|
||||
|
|
|
@ -26,7 +26,7 @@ type workloadInterpreter struct {
|
|||
|
||||
// Handle implements interpreter.Handler interface.
|
||||
// It yields a response to an ExploreRequest.
|
||||
func (e *workloadInterpreter) Handle(ctx context.Context, req interpreter.Request) interpreter.Response {
|
||||
func (e *workloadInterpreter) Handle(_ context.Context, req interpreter.Request) interpreter.Response {
|
||||
workload := &workloadv1alpha1.Workload{}
|
||||
err := e.decoder.Decode(req, workload)
|
||||
if err != nil {
|
||||
|
|
|
@ -5,6 +5,6 @@ import (
|
|||
)
|
||||
|
||||
// Name returns the image name.
|
||||
func (image Image) Name() string {
|
||||
func (image *Image) Name() string {
|
||||
return fmt.Sprintf("%s:%s", image.ImageRepository, image.ImageTag)
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
operator "github.com/karmada-io/karmada/operator/pkg"
|
||||
operatorv1alpha1 "github.com/karmada-io/karmada/operator/pkg/apis/operator/v1alpha1"
|
||||
workflow "github.com/karmada-io/karmada/operator/pkg/workflow"
|
||||
"github.com/karmada-io/karmada/operator/pkg/workflow"
|
||||
)
|
||||
|
||||
// Action is a intention corresponding karmada resource modification
|
||||
|
|
|
@ -56,7 +56,7 @@ func skipCerts(d workflow.RunData) (bool, error) {
|
|||
}
|
||||
|
||||
func newCertSubTasks() []workflow.Task {
|
||||
subTasks := []workflow.Task{}
|
||||
var subTasks []workflow.Task
|
||||
caCert := map[string]*certs.CertConfig{}
|
||||
|
||||
for _, cert := range certs.GetDefaultCertList() {
|
||||
|
|
|
@ -152,9 +152,9 @@ func runUploadKarmadaCert(r workflow.RunData) error {
|
|||
return errors.New("upload-KarmadaCert task invoked with an invalid data struct")
|
||||
}
|
||||
|
||||
certs := data.CertList()
|
||||
certsData := make(map[string][]byte, len(certs))
|
||||
for _, c := range certs {
|
||||
certList := data.CertList()
|
||||
certsData := make(map[string][]byte, len(certList))
|
||||
for _, c := range certList {
|
||||
certsData[c.KeyName()] = c.KeyData()
|
||||
certsData[c.CertName()] = c.CertData()
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ func (d *ClusterDetector) OnAdd(obj interface{}) {
|
|||
}
|
||||
|
||||
// OnUpdate handles object update event and push the object to queue.
|
||||
func (d *ClusterDetector) OnUpdate(oldObj, newObj interface{}) {
|
||||
func (d *ClusterDetector) OnUpdate(_, newObj interface{}) {
|
||||
d.OnAdd(newObj)
|
||||
}
|
||||
|
||||
|
|
|
@ -195,7 +195,7 @@ func (c *CertRotationController) syncCertRotation(secret *corev1.Secret) error {
|
|||
secret.Data["karmada-kubeconfig"] = karmadaKubeconfigBytes
|
||||
// Update the karmada-kubeconfig secret in the member cluster.
|
||||
if _, err := c.ClusterClient.KubeClient.CoreV1().Secrets(secret.Namespace).Update(context.TODO(), secret, metav1.UpdateOptions{}); err != nil {
|
||||
return fmt.Errorf("Unable to update secret, err: %w", err)
|
||||
return fmt.Errorf("unable to update secret, err: %w", err)
|
||||
}
|
||||
|
||||
newCert, err := certutil.ParseCertsPEM(newCertData)
|
||||
|
|
|
@ -153,7 +153,7 @@ func (c *Controller) buildWorks(namespace *corev1.Namespace, clusters []clusterv
|
|||
}(&clusters[i], errChan)
|
||||
}
|
||||
|
||||
errs := []error{}
|
||||
var errs []error
|
||||
for range clusters {
|
||||
if err := <-errChan; err != nil {
|
||||
errs = append(errs, err)
|
||||
|
|
|
@ -369,7 +369,7 @@ func (c *WorkStatusController) buildStatusIdentifier(work *workv1alpha1.Work, cl
|
|||
return identifier, nil
|
||||
}
|
||||
|
||||
func (c *WorkStatusController) mergeStatus(statuses []workv1alpha1.ManifestStatus, newStatus workv1alpha1.ManifestStatus) []workv1alpha1.ManifestStatus {
|
||||
func (c *WorkStatusController) mergeStatus(_ []workv1alpha1.ManifestStatus, newStatus workv1alpha1.ManifestStatus) []workv1alpha1.ManifestStatus {
|
||||
// TODO(RainbowMango): update 'statuses' if 'newStatus' already exist.
|
||||
// For now, we only have at most one manifest in Work, so just override current 'statuses'.
|
||||
return []workv1alpha1.ManifestStatus{newStatus}
|
||||
|
|
|
@ -151,7 +151,7 @@ func (d *DependenciesDistributor) OnAdd(obj interface{}) {
|
|||
}
|
||||
|
||||
// OnUpdate handles object update event and push the object to queue.
|
||||
func (d *DependenciesDistributor) OnUpdate(oldObj, newObj interface{}) {
|
||||
func (d *DependenciesDistributor) OnUpdate(_, newObj interface{}) {
|
||||
d.OnAdd(newObj)
|
||||
}
|
||||
|
||||
|
@ -537,7 +537,7 @@ func (d *DependenciesDistributor) removeScheduleResultFromAttachedBindings(bindi
|
|||
}
|
||||
|
||||
func buildAttachedBinding(binding *workv1alpha2.ResourceBinding, object *unstructured.Unstructured) *workv1alpha2.ResourceBinding {
|
||||
labels := generateBindingDependedByLabel(binding.Namespace, binding.Name)
|
||||
dependedByLabels := generateBindingDependedByLabel(binding.Namespace, binding.Name)
|
||||
|
||||
var result []workv1alpha2.BindingSnapshot
|
||||
result = append(result, workv1alpha2.BindingSnapshot{
|
||||
|
@ -553,7 +553,7 @@ func buildAttachedBinding(binding *workv1alpha2.ResourceBinding, object *unstruc
|
|||
OwnerReferences: []metav1.OwnerReference{
|
||||
*metav1.NewControllerRef(object, object.GroupVersionKind()),
|
||||
},
|
||||
Labels: labels,
|
||||
Labels: dependedByLabels,
|
||||
Finalizers: []string{util.BindingControllerFinalizer},
|
||||
},
|
||||
Spec: workv1alpha2.ResourceBindingSpec{
|
||||
|
|
|
@ -755,7 +755,7 @@ func (d *ResourceDetector) OnPropagationPolicyAdd(obj interface{}) {
|
|||
}
|
||||
|
||||
// OnPropagationPolicyUpdate handles object update event and push the object to queue.
|
||||
func (d *ResourceDetector) OnPropagationPolicyUpdate(oldObj, newObj interface{}) {
|
||||
func (d *ResourceDetector) OnPropagationPolicyUpdate(_, newObj interface{}) {
|
||||
key, err := ClusterWideKeyFunc(newObj)
|
||||
if err != nil {
|
||||
return
|
||||
|
@ -819,7 +819,7 @@ func (d *ResourceDetector) OnClusterPropagationPolicyAdd(obj interface{}) {
|
|||
}
|
||||
|
||||
// OnClusterPropagationPolicyUpdate handles object update event and push the object to queue.
|
||||
func (d *ResourceDetector) OnClusterPropagationPolicyUpdate(oldObj, newObj interface{}) {
|
||||
func (d *ResourceDetector) OnClusterPropagationPolicyUpdate(_, newObj interface{}) {
|
||||
key, err := ClusterWideKeyFunc(newObj)
|
||||
if err != nil {
|
||||
return
|
||||
|
|
|
@ -28,7 +28,7 @@ func NewGeneralEstimator() *GeneralEstimator {
|
|||
}
|
||||
|
||||
// MaxAvailableReplicas estimates the maximum replicas that can be applied to the target cluster by cluster ResourceSummary.
|
||||
func (ge *GeneralEstimator) MaxAvailableReplicas(ctx context.Context, clusters []*clusterv1alpha1.Cluster, replicaRequirements *workv1alpha2.ReplicaRequirements) ([]workv1alpha2.TargetCluster, error) {
|
||||
func (ge *GeneralEstimator) MaxAvailableReplicas(_ context.Context, clusters []*clusterv1alpha1.Cluster, replicaRequirements *workv1alpha2.ReplicaRequirements) ([]workv1alpha2.TargetCluster, error) {
|
||||
availableTargetClusters := make([]workv1alpha2.TargetCluster, len(clusters))
|
||||
for i, cluster := range clusters {
|
||||
maxReplicas := ge.maxAvailableReplicas(cluster, replicaRequirements)
|
||||
|
|
|
@ -128,7 +128,7 @@ func (o *CommandApplyOptions) Validate() error {
|
|||
for _, cluster := range clusters.Items {
|
||||
clusterSet.Insert(cluster.Name)
|
||||
}
|
||||
errs := []error{}
|
||||
var errs []error
|
||||
for _, cluster := range o.Clusters {
|
||||
if !clusterSet.Has(cluster) {
|
||||
errs = append(errs, fmt.Errorf("cluster %s does not exist", cluster))
|
||||
|
|
|
@ -6,18 +6,16 @@ import (
|
|||
"k8s.io/client-go/kubernetes/fake"
|
||||
)
|
||||
|
||||
var noError = false
|
||||
|
||||
func Test_grantProxyPermissionToAdmin(t *testing.T) {
|
||||
client := fake.NewSimpleClientset()
|
||||
if err := grantProxyPermissionToAdmin(client); (err != nil) != noError {
|
||||
t.Errorf("grantProxyPermissionToAdmin() error = %v, wantErr %v", err, noError)
|
||||
if err := grantProxyPermissionToAdmin(client); err != nil {
|
||||
t.Errorf("grantProxyPermissionToAdmin() expected no error, but got err: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_grantAccessPermissionToAgent(t *testing.T) {
|
||||
client := fake.NewSimpleClientset()
|
||||
if err := grantAccessPermissionToAgent(client); (err != nil) != noError {
|
||||
t.Errorf("grantAccessPermissionToAgent() error = %v, wantErr %v", err, noError)
|
||||
if err := grantAccessPermissionToAgent(client); err != nil {
|
||||
t.Errorf("grantAccessPermissionToAgent() expected no error, but got err: %v", err)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ func (i *CommandInitOption) karmadaAggregatedAPIServerService() *corev1.Service
|
|||
}
|
||||
}
|
||||
|
||||
func (i CommandInitOption) isNodePortExist() bool {
|
||||
func (i *CommandInitOption) isNodePortExist() bool {
|
||||
svc, err := i.KubeClientSet.CoreV1().Services(metav1.NamespaceAll).List(context.TODO(), metav1.ListOptions{})
|
||||
if err != nil {
|
||||
klog.Exit(err)
|
||||
|
|
|
@ -39,7 +39,7 @@ var (
|
|||
etcdLabels = map[string]string{"app": etcdStatefulSetAndServiceName}
|
||||
)
|
||||
|
||||
func (i CommandInitOption) etcdVolume() (*[]corev1.Volume, *corev1.PersistentVolumeClaim) {
|
||||
func (i *CommandInitOption) etcdVolume() (*[]corev1.Volume, *corev1.PersistentVolumeClaim) {
|
||||
var Volumes []corev1.Volume
|
||||
|
||||
secretVolume := corev1.Volume{
|
||||
|
|
|
@ -260,7 +260,7 @@ func (g *CommandGetOptions) Validate(cmd *cobra.Command) error {
|
|||
clusterSet.Insert(cluster.Name)
|
||||
}
|
||||
|
||||
noneExistClusters := []string{}
|
||||
var noneExistClusters []string
|
||||
for _, cluster := range g.Clusters {
|
||||
if !clusterSet.Has(cluster) {
|
||||
noneExistClusters = append(noneExistClusters, cluster)
|
||||
|
@ -358,7 +358,7 @@ func (g *CommandGetOptions) Run(f util.Factory, cmd *cobra.Command, args []strin
|
|||
}
|
||||
|
||||
// printObjs print objects in multi clusters
|
||||
func (g *CommandGetOptions) printObjs(objs []Obj, allErrs *[]error, args []string) {
|
||||
func (g *CommandGetOptions) printObjs(objs []Obj, allErrs *[]error, _ []string) {
|
||||
var err error
|
||||
errs := sets.NewString()
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ func (o *Options) runEdit() error {
|
|||
var (
|
||||
edit = editor.NewDefaultEditor(editorEnvs())
|
||||
results = editResults{}
|
||||
edited = []byte{}
|
||||
edited = make([]byte, 0)
|
||||
file string
|
||||
containsError = false
|
||||
)
|
||||
|
|
|
@ -80,15 +80,15 @@ func (o *Options) runExecute() error {
|
|||
Replica: int64(o.DesiredReplica),
|
||||
}
|
||||
|
||||
interpreter := declarative.NewConfigurableInterpreter(nil)
|
||||
interpreter.LoadConfig(customizations)
|
||||
configurableInterpreter := declarative.NewConfigurableInterpreter(nil)
|
||||
configurableInterpreter.LoadConfig(customizations)
|
||||
|
||||
r := o.Rules.GetByOperation(o.Operation)
|
||||
if r == nil {
|
||||
// Shall never occur, because we validate it before.
|
||||
return fmt.Errorf("operation %s is not supported. Use one of: %s", o.Operation, strings.Join(o.Rules.Names(), ", "))
|
||||
}
|
||||
result := r.Run(interpreter, args)
|
||||
result := r.Run(configurableInterpreter, args)
|
||||
printExecuteResult(o.Out, o.ErrOut, r.Name(), result)
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ type Options struct {
|
|||
}
|
||||
|
||||
// Complete ensures that options are valid and marshals them if necessary
|
||||
func (o *Options) Complete(f util.Factory, cmd *cobra.Command, args []string) error {
|
||||
func (o *Options) Complete(f util.Factory, _ *cobra.Command, args []string) error {
|
||||
if o.Check && o.Edit {
|
||||
return fmt.Errorf("you can't set both --check and --edit options")
|
||||
}
|
||||
|
|
|
@ -121,6 +121,6 @@ func NewKarmadaCtlCommand(cmdUse, parentCommand string) *cobra.Command {
|
|||
return rootCmd
|
||||
}
|
||||
|
||||
func runHelp(cmd *cobra.Command, args []string) error {
|
||||
func runHelp(cmd *cobra.Command, _ []string) error {
|
||||
return cmd.Help()
|
||||
}
|
||||
|
|
|
@ -280,7 +280,7 @@ func reorganizeTaints(cluster *clusterv1alpha1.Cluster, overwrite bool, taintsTo
|
|||
|
||||
// deleteTaints deletes the given taints from the cluster's taintlist.
|
||||
func deleteTaints(taintsToRemove []corev1.Taint, newTaints *[]corev1.Taint) ([]error, bool) {
|
||||
allErrs := []error{}
|
||||
var allErrs []error
|
||||
var removed bool
|
||||
for i, taintToRemove := range taintsToRemove {
|
||||
if len(taintToRemove.Effect) > 0 {
|
||||
|
@ -327,7 +327,7 @@ func checkIfTaintsAlreadyExists(oldTaints []corev1.Taint, taints []corev1.Taint)
|
|||
|
||||
// deleteTaintsByKey removes all the taints that have the same key to given taintKey
|
||||
func deleteTaintsByKey(taints []corev1.Taint, taintKey string) ([]corev1.Taint, bool) {
|
||||
newTaints := []corev1.Taint{}
|
||||
var newTaints []corev1.Taint
|
||||
for i := range taints {
|
||||
if taintKey == taints[i].Key {
|
||||
continue
|
||||
|
@ -339,7 +339,7 @@ func deleteTaintsByKey(taints []corev1.Taint, taintKey string) ([]corev1.Taint,
|
|||
|
||||
// deleteTaint removes all the taints that have the same key and effect to given taintToDelete.
|
||||
func deleteTaint(taints []corev1.Taint, taintToDelete *corev1.Taint) ([]corev1.Taint, bool) {
|
||||
newTaints := []corev1.Taint{}
|
||||
var newTaints []corev1.Taint
|
||||
for i := range taints {
|
||||
if taintToDelete.MatchTaint(&taints[i]) {
|
||||
continue
|
||||
|
|
|
@ -139,14 +139,14 @@ func TestDeleteTaint(t *testing.T) {
|
|||
},
|
||||
},
|
||||
taintToDelete: &corev1.Taint{Key: "foo", Effect: corev1.TaintEffectNoSchedule},
|
||||
expectedTaints: []corev1.Taint{},
|
||||
expectedTaints: nil,
|
||||
expectedResult: true,
|
||||
},
|
||||
{
|
||||
name: "delete taint from empty taint array",
|
||||
taints: []corev1.Taint{},
|
||||
taintToDelete: &corev1.Taint{Key: "foo", Effect: corev1.TaintEffectNoSchedule},
|
||||
expectedTaints: []corev1.Taint{},
|
||||
expectedTaints: nil,
|
||||
expectedResult: false,
|
||||
},
|
||||
}
|
||||
|
@ -199,14 +199,14 @@ func TestDeleteTaintByKey(t *testing.T) {
|
|||
},
|
||||
},
|
||||
taintKey: "foo",
|
||||
expectedTaints: []corev1.Taint{},
|
||||
expectedTaints: nil,
|
||||
expectedResult: true,
|
||||
},
|
||||
{
|
||||
name: "delete taint from empty taint array",
|
||||
taints: []corev1.Taint{},
|
||||
taintKey: "foo",
|
||||
expectedTaints: []corev1.Taint{},
|
||||
expectedTaints: nil,
|
||||
expectedResult: false,
|
||||
},
|
||||
}
|
||||
|
@ -359,7 +359,7 @@ func TestReorganizeTaints(t *testing.T) {
|
|||
Effect: corev1.TaintEffectNoSchedule,
|
||||
},
|
||||
},
|
||||
expectedTaints: []corev1.Taint{},
|
||||
expectedTaints: nil,
|
||||
expectedOperation: UNTAINTED,
|
||||
expectedErr: false,
|
||||
},
|
||||
|
@ -372,7 +372,7 @@ func TestReorganizeTaints(t *testing.T) {
|
|||
Key: "foo",
|
||||
},
|
||||
},
|
||||
expectedTaints: []corev1.Taint{},
|
||||
expectedTaints: nil,
|
||||
expectedOperation: UNTAINTED,
|
||||
expectedErr: false,
|
||||
},
|
||||
|
|
|
@ -185,7 +185,7 @@ func ConvertBootstrapTokenToSecret(bt *BootstrapToken) *corev1.Secret {
|
|||
Name: bootstraputil.BootstrapTokenSecretName(bt.Token.ID),
|
||||
Namespace: metav1.NamespaceSystem,
|
||||
},
|
||||
Type: corev1.SecretType(bootstrapapi.SecretTypeBootstrapToken),
|
||||
Type: bootstrapapi.SecretTypeBootstrapToken,
|
||||
Data: encodeTokenSecretData(bt, time.Now()),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ func (t *TestFactory) KarmadaClientSet() (versioned.Interface, error) {
|
|||
}
|
||||
|
||||
// FactoryForMemberCluster returns a cmdutil.Factory for the member cluster
|
||||
func (t *TestFactory) FactoryForMemberCluster(clusterName string) (cmdutil.Factory, error) {
|
||||
func (t *TestFactory) FactoryForMemberCluster(_ string) (cmdutil.Factory, error) {
|
||||
// TODO implement me
|
||||
panic("implement me")
|
||||
}
|
||||
|
|
|
@ -63,7 +63,8 @@ type ResourceList map[clusterapis.ResourceName]resource.Quantity
|
|||
|
||||
// InitSummary is the init function of modeling data structure
|
||||
func InitSummary(resourceModels []clusterapis.ResourceModel) (ResourceSummary, error) {
|
||||
rsName, rsList := []clusterapis.ResourceName{}, []ResourceList{}
|
||||
var rsName []clusterapis.ResourceName
|
||||
var rsList []ResourceList
|
||||
for _, rm := range resourceModels {
|
||||
tmp := map[clusterapis.ResourceName]resource.Quantity{}
|
||||
for _, rmItem := range rm.Ranges {
|
||||
|
@ -155,7 +156,7 @@ func safeChangeNum(num *int, change int) {
|
|||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
|
||||
(*num) += change
|
||||
*num += change
|
||||
}
|
||||
|
||||
// AddToResourceSummary add resource node into modeling summary
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"reflect"
|
||||
"testing"
|
||||
|
||||
rbt "github.com/emirpasic/gods/trees/redblacktree"
|
||||
"github.com/emirpasic/gods/trees/redblacktree"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
|
||||
|
@ -487,7 +487,7 @@ func TestRbtConvertToLl(t *testing.T) {
|
|||
clusterapis.ResourceMemory: *resource.NewQuantity(1024*12, resource.DecimalSI),
|
||||
},
|
||||
}
|
||||
tree := rbt.NewWith(clusterResourceNodeComparator)
|
||||
tree := redblacktree.NewWith(clusterResourceNodeComparator)
|
||||
|
||||
if actualValue := tree.Size(); actualValue != 0 {
|
||||
t.Errorf("Got %v expected %v", actualValue, 0)
|
||||
|
|
|
@ -24,7 +24,7 @@ import (
|
|||
|
||||
// ResourcePrinter is an interface that knows how to print runtime objects.
|
||||
type ResourcePrinter interface {
|
||||
// Print receives a runtime object, formats it and prints it to a writer.
|
||||
// PrintObj receives a runtime object, formats it and prints it to a writer.
|
||||
PrintObj(runtime.Object, io.Writer) error
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ type TableConvertor struct {
|
|||
}
|
||||
|
||||
// ConvertToTable method - converts objects to metav1.Table objects using TableGenerator
|
||||
func (c TableConvertor) ConvertToTable(ctx context.Context, obj runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
||||
func (c TableConvertor) ConvertToTable(_ context.Context, obj runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
||||
noHeaders := false
|
||||
if tableOptions != nil {
|
||||
switch t := tableOptions.(type) {
|
||||
|
|
|
@ -40,11 +40,11 @@ func (obj *TestPrintType) DeepCopyObject() runtime.Object {
|
|||
return &clone
|
||||
}
|
||||
|
||||
func PrintCustomType(obj *TestPrintType, options GenerateOptions) ([]metav1beta1.TableRow, error) {
|
||||
func PrintCustomType(obj *TestPrintType, _ GenerateOptions) ([]metav1beta1.TableRow, error) {
|
||||
return []metav1beta1.TableRow{{Cells: []interface{}{obj.Data}}}, nil
|
||||
}
|
||||
|
||||
func ErrorPrintHandler(obj *TestPrintType, options GenerateOptions) ([]metav1beta1.TableRow, error) {
|
||||
func ErrorPrintHandler(_ *TestPrintType, _ GenerateOptions) ([]metav1beta1.TableRow, error) {
|
||||
return nil, fmt.Errorf("ErrorPrintHandler error")
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOp
|
|||
}
|
||||
|
||||
// Update alters the status subset of an object.
|
||||
func (r *StatusREST) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc, forceAllowCreate bool, options *metav1.UpdateOptions) (runtime.Object, bool, error) {
|
||||
func (r *StatusREST) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc, _ bool, options *metav1.UpdateOptions) (runtime.Object, bool, error) {
|
||||
// We are explicitly setting forceAllowCreate to false in the call to the underlying storage because
|
||||
// subresources should never allow creating on update.
|
||||
return r.store.Update(ctx, name, objInfo, createValidation, updateValidation, false, options)
|
||||
|
|
|
@ -72,7 +72,7 @@ func (Strategy) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
|||
}
|
||||
|
||||
// PrepareForCreate is invoked on create before validation to normalize the object.
|
||||
func (Strategy) PrepareForCreate(ctx context.Context, obj runtime.Object) {
|
||||
func (Strategy) PrepareForCreate(_ context.Context, obj runtime.Object) {
|
||||
cluster := obj.(*clusterapis.Cluster)
|
||||
cluster.Status = clusterapis.ClusterStatus{}
|
||||
|
||||
|
@ -88,7 +88,7 @@ func (Strategy) PrepareForCreate(ctx context.Context, obj runtime.Object) {
|
|||
}
|
||||
|
||||
// PrepareForUpdate is invoked on update before validation to normalize the object.
|
||||
func (Strategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) {
|
||||
func (Strategy) PrepareForUpdate(_ context.Context, obj, old runtime.Object) {
|
||||
newCluster := obj.(*clusterapis.Cluster)
|
||||
oldCluster := old.(*clusterapis.Cluster)
|
||||
newCluster.Status = oldCluster.Status
|
||||
|
@ -106,13 +106,13 @@ func (Strategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) {
|
|||
}
|
||||
|
||||
// Validate returns an ErrorList with validation errors or nil.
|
||||
func (Strategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList {
|
||||
func (Strategy) Validate(_ context.Context, obj runtime.Object) field.ErrorList {
|
||||
cluster := obj.(*clusterapis.Cluster)
|
||||
return validation.ValidateCluster(cluster)
|
||||
}
|
||||
|
||||
// WarningsOnCreate returns warnings for the creation of the given object.
|
||||
func (Strategy) WarningsOnCreate(ctx context.Context, obj runtime.Object) []string { return nil }
|
||||
func (Strategy) WarningsOnCreate(_ context.Context, _ runtime.Object) []string { return nil }
|
||||
|
||||
// AllowCreateOnUpdate returns true if the object can be created by a PUT.
|
||||
func (Strategy) AllowCreateOnUpdate() bool {
|
||||
|
@ -134,14 +134,14 @@ func (Strategy) Canonicalize(obj runtime.Object) {
|
|||
|
||||
// ValidateUpdate is invoked after default fields in the object have been
|
||||
// filled in before the object is persisted.
|
||||
func (Strategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList {
|
||||
func (Strategy) ValidateUpdate(_ context.Context, obj, old runtime.Object) field.ErrorList {
|
||||
newCluster := obj.(*clusterapis.Cluster)
|
||||
oldCluster := old.(*clusterapis.Cluster)
|
||||
return validation.ValidateClusterUpdate(newCluster, oldCluster)
|
||||
}
|
||||
|
||||
// WarningsOnUpdate returns warnings for the given update.
|
||||
func (Strategy) WarningsOnUpdate(ctx context.Context, obj, old runtime.Object) []string {
|
||||
func (Strategy) WarningsOnUpdate(_ context.Context, _, _ runtime.Object) []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -162,15 +162,15 @@ func (StatusStrategy) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
|||
}
|
||||
|
||||
// PrepareForUpdate clears fields that are not allowed to be set by end users on update of status
|
||||
func (StatusStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) {
|
||||
func (StatusStrategy) PrepareForUpdate(_ context.Context, _, _ runtime.Object) {
|
||||
}
|
||||
|
||||
// ValidateUpdate is the default update validation for an end user updating status
|
||||
func (StatusStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList {
|
||||
func (StatusStrategy) ValidateUpdate(_ context.Context, _, _ runtime.Object) field.ErrorList {
|
||||
return field.ErrorList{}
|
||||
}
|
||||
|
||||
// WarningsOnUpdate returns warnings for the given update.
|
||||
func (StatusStrategy) WarningsOnUpdate(ctx context.Context, obj, old runtime.Object) []string {
|
||||
func (StatusStrategy) WarningsOnUpdate(_ context.Context, _, _ runtime.Object) []string {
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ type reqResponse struct {
|
|||
Items []runtime.Object `json:"items"`
|
||||
}
|
||||
|
||||
func (r *SearchREST) newCacheHandler(info *genericrequest.RequestInfo, responder rest.Responder) (http.Handler, error) {
|
||||
func (r *SearchREST) newCacheHandler(info *genericrequest.RequestInfo, _ rest.Responder) (http.Handler, error) {
|
||||
resourceGVR := schema.GroupVersionResource{
|
||||
Group: info.APIGroup,
|
||||
Version: info.APIVersion,
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"k8s.io/apiserver/pkg/registry/rest"
|
||||
)
|
||||
|
||||
func (r *SearchREST) newOpenSearchHandler(info *genericrequest.RequestInfo, responder rest.Responder) (http.Handler, error) {
|
||||
func (r *SearchREST) newOpenSearchHandler(_ *genericrequest.RequestInfo, _ rest.Responder) (http.Handler, error) {
|
||||
return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
|
||||
// Construct a handler and send the request to the ES.
|
||||
}), nil
|
||||
|
|
|
@ -76,7 +76,7 @@ func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOp
|
|||
}
|
||||
|
||||
// Update alters the status subset of an object.
|
||||
func (r *StatusREST) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc, forceAllowCreate bool, options *metav1.UpdateOptions) (runtime.Object, bool, error) {
|
||||
func (r *StatusREST) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc, _ bool, options *metav1.UpdateOptions) (runtime.Object, bool, error) {
|
||||
// We are explicitly setting forceAllowCreate to false in the call to the underlying storage because
|
||||
// subresources should never allow create on update.
|
||||
return r.store.Update(ctx, name, objInfo, createValidation, updateValidation, false, options)
|
||||
|
|
|
@ -67,21 +67,21 @@ func (Strategy) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
|||
}
|
||||
|
||||
// PrepareForCreate is invoked on create before validation to normalize the object.
|
||||
func (Strategy) PrepareForCreate(ctx context.Context, obj runtime.Object) {
|
||||
func (Strategy) PrepareForCreate(_ context.Context, _ runtime.Object) {
|
||||
}
|
||||
|
||||
// PrepareForUpdate is invoked on update before validation to normalize the object.
|
||||
func (Strategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) {
|
||||
func (Strategy) PrepareForUpdate(_ context.Context, _, _ runtime.Object) {
|
||||
}
|
||||
|
||||
// Validate returns an ErrorList with validation errors or nil.
|
||||
func (Strategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList {
|
||||
func (Strategy) Validate(_ context.Context, _ runtime.Object) field.ErrorList {
|
||||
// TODO: add validation for ResourceRegistry
|
||||
return field.ErrorList{}
|
||||
}
|
||||
|
||||
// WarningsOnCreate returns warnings for the creation of the given object.
|
||||
func (Strategy) WarningsOnCreate(ctx context.Context, obj runtime.Object) []string { return nil }
|
||||
func (Strategy) WarningsOnCreate(_ context.Context, _ runtime.Object) []string { return nil }
|
||||
|
||||
// AllowCreateOnUpdate returns true if the object can be created by a PUT.
|
||||
func (Strategy) AllowCreateOnUpdate() bool {
|
||||
|
@ -96,18 +96,18 @@ func (Strategy) AllowUnconditionalUpdate() bool {
|
|||
}
|
||||
|
||||
// Canonicalize allows an object to be mutated into a canonical form.
|
||||
func (Strategy) Canonicalize(obj runtime.Object) {
|
||||
func (Strategy) Canonicalize(_ runtime.Object) {
|
||||
}
|
||||
|
||||
// ValidateUpdate is invoked after default fields in the object have been
|
||||
// filled in before the object is persisted.
|
||||
func (Strategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList {
|
||||
func (Strategy) ValidateUpdate(_ context.Context, _, _ runtime.Object) field.ErrorList {
|
||||
// TODO: add validation for ResourceRegistry
|
||||
return field.ErrorList{}
|
||||
}
|
||||
|
||||
// WarningsOnUpdate returns warnings for the given update.
|
||||
func (Strategy) WarningsOnUpdate(ctx context.Context, obj, old runtime.Object) []string {
|
||||
func (Strategy) WarningsOnUpdate(_ context.Context, _, _ runtime.Object) []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -128,15 +128,15 @@ func (StatusStrategy) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
|||
}
|
||||
|
||||
// PrepareForUpdate clears fields that are not allowed to be set by end users on update of status
|
||||
func (StatusStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) {
|
||||
func (StatusStrategy) PrepareForUpdate(_ context.Context, _, _ runtime.Object) {
|
||||
}
|
||||
|
||||
// ValidateUpdate is the default update validation for an end user updating status
|
||||
func (StatusStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList {
|
||||
func (StatusStrategy) ValidateUpdate(_ context.Context, _, _ runtime.Object) field.ErrorList {
|
||||
return field.ErrorList{}
|
||||
}
|
||||
|
||||
// WarningsOnUpdate returns warnings for the given update.
|
||||
func (StatusStrategy) WarningsOnUpdate(ctx context.Context, obj, old runtime.Object) []string {
|
||||
func (StatusStrategy) WarningsOnUpdate(_ context.Context, _, _ runtime.Object) []string {
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -30,17 +30,18 @@ func NewCache(clusterLister clusterlister.ClusterLister) Cache {
|
|||
}
|
||||
|
||||
// AddCluster does nothing since clusterLister would synchronize automatically
|
||||
func (c *schedulerCache) AddCluster(cluster *clusterv1alpha1.Cluster) {
|
||||
func (c *schedulerCache) AddCluster(_ *clusterv1alpha1.Cluster) {
|
||||
}
|
||||
|
||||
// UpdateCluster does nothing since clusterLister would synchronize automatically
|
||||
func (c *schedulerCache) UpdateCluster(cluster *clusterv1alpha1.Cluster) {
|
||||
func (c *schedulerCache) UpdateCluster(_ *clusterv1alpha1.Cluster) {
|
||||
}
|
||||
|
||||
// DeleteCluster does nothing since clusterLister would synchronize automatically
|
||||
func (c *schedulerCache) DeleteCluster(cluster *clusterv1alpha1.Cluster) {
|
||||
func (c *schedulerCache) DeleteCluster(_ *clusterv1alpha1.Cluster) {
|
||||
}
|
||||
|
||||
// Snapshot returns clusters' snapshot.
|
||||
// TODO: need optimization, only clone when necessary
|
||||
func (c *schedulerCache) Snapshot() Snapshot {
|
||||
out := NewEmptySnapshot()
|
||||
|
|
|
@ -62,8 +62,8 @@ func (p *ClusterAffinity) Filter(
|
|||
}
|
||||
|
||||
// Score calculates the score on the candidate cluster.
|
||||
func (p *ClusterAffinity) Score(ctx context.Context,
|
||||
spec *workv1alpha2.ResourceBindingSpec, cluster *clusterv1alpha1.Cluster) (int64, *framework.Result) {
|
||||
func (p *ClusterAffinity) Score(_ context.Context,
|
||||
_ *workv1alpha2.ResourceBindingSpec, _ *clusterv1alpha1.Cluster) (int64, *framework.Result) {
|
||||
return framework.MinClusterScore, framework.NewResult(framework.Success)
|
||||
}
|
||||
|
||||
|
@ -73,6 +73,6 @@ func (p *ClusterAffinity) ScoreExtensions() framework.ScoreExtensions {
|
|||
}
|
||||
|
||||
// NormalizeScore normalizes the score for each candidate cluster.
|
||||
func (p *ClusterAffinity) NormalizeScore(ctx context.Context, scores framework.ClusterScoreList) *framework.Result {
|
||||
func (p *ClusterAffinity) NormalizeScore(_ context.Context, _ framework.ClusterScoreList) *framework.Result {
|
||||
return framework.NewResult(framework.Success)
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ func (p *ClusterLocality) Name() string {
|
|||
// Score calculates the score on the candidate cluster.
|
||||
// If the cluster already have the resource(exists in .spec.Clusters of ResourceBinding or ClusterResourceBinding),
|
||||
// then score is 100, otherwise 0.
|
||||
func (p *ClusterLocality) Score(ctx context.Context,
|
||||
func (p *ClusterLocality) Score(_ context.Context,
|
||||
spec *workv1alpha2.ResourceBindingSpec, cluster *clusterv1alpha1.Cluster) (int64, *framework.Result) {
|
||||
if len(spec.Clusters) == 0 {
|
||||
return framework.MinClusterScore, framework.NewResult(framework.Success)
|
||||
|
|
|
@ -320,11 +320,11 @@ func (r *mockPlugin) Order() int {
|
|||
return r.TheOrder
|
||||
}
|
||||
|
||||
func (r *mockPlugin) SupportRequest(request framework.ProxyRequest) bool {
|
||||
func (r *mockPlugin) SupportRequest(_ framework.ProxyRequest) bool {
|
||||
return r.IsSupportRequest
|
||||
}
|
||||
|
||||
func (r *mockPlugin) Connect(ctx context.Context, request framework.ProxyRequest) (http.Handler, error) {
|
||||
func (r *mockPlugin) Connect(_ context.Context, _ framework.ProxyRequest) (http.Handler, error) {
|
||||
return http.HandlerFunc(func(http.ResponseWriter, *http.Request) {
|
||||
r.Called = true
|
||||
}), nil
|
||||
|
@ -446,11 +446,11 @@ func (r *failPlugin) Order() int {
|
|||
return 0
|
||||
}
|
||||
|
||||
func (r *failPlugin) SupportRequest(request framework.ProxyRequest) bool {
|
||||
func (r *failPlugin) SupportRequest(_ framework.ProxyRequest) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (r *failPlugin) Connect(ctx context.Context, request framework.ProxyRequest) (http.Handler, error) {
|
||||
func (r *failPlugin) Connect(_ context.Context, _ framework.ProxyRequest) (http.Handler, error) {
|
||||
return nil, fmt.Errorf("test")
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ func (c *Cache) SupportRequest(request framework.ProxyRequest) bool {
|
|||
}
|
||||
|
||||
// Connect implements Plugin
|
||||
func (c *Cache) Connect(ctx context.Context, request framework.ProxyRequest) (http.Handler, error) {
|
||||
func (c *Cache) Connect(_ context.Context, request framework.ProxyRequest) (http.Handler, error) {
|
||||
requestInfo := request.RequestInfo
|
||||
r := &rester{
|
||||
store: c.store,
|
||||
|
|
|
@ -55,7 +55,7 @@ func (p *Karmada) Order() int {
|
|||
}
|
||||
|
||||
// SupportRequest implements Plugin
|
||||
func (p *Karmada) SupportRequest(request framework.ProxyRequest) bool {
|
||||
func (p *Karmada) SupportRequest(_ framework.ProxyRequest) bool {
|
||||
// This plugin's order is the last one. It's actually a fallback plugin.
|
||||
// So we return true here to indicate we always support the request.
|
||||
return true
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"github.com/karmada-io/karmada/pkg/search/proxy/framework"
|
||||
)
|
||||
|
||||
func emptyPluginFactory(dep PluginDependency) (framework.Plugin, error) {
|
||||
func emptyPluginFactory(_ PluginDependency) (framework.Plugin, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ func NewClusterClientSet(clusterName string, client client.Client, clientOption
|
|||
}
|
||||
|
||||
// NewClusterClientSetForAgent returns a ClusterClient for the given member cluster which will be used in karmada agent.
|
||||
func NewClusterClientSetForAgent(clusterName string, client client.Client, clientOption *ClientOption) (*ClusterClient, error) {
|
||||
func NewClusterClientSetForAgent(clusterName string, _ client.Client, clientOption *ClientOption) (*ClusterClient, error) {
|
||||
clusterConfig, err := controllerruntime.GetConfig()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error building kubeconfig of member cluster: %s", err.Error())
|
||||
|
@ -97,7 +97,7 @@ func NewClusterDynamicClientSet(clusterName string, client client.Client) (*Dyna
|
|||
}
|
||||
|
||||
// NewClusterDynamicClientSetForAgent returns a dynamic client for the given member cluster which will be used in karmada agent.
|
||||
func NewClusterDynamicClientSetForAgent(clusterName string, client client.Client) (*DynamicClusterClient, error) {
|
||||
func NewClusterDynamicClientSetForAgent(clusterName string, _ client.Client) (*DynamicClusterClient, error) {
|
||||
clusterConfig, err := controllerruntime.GetConfig()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error building kubeconfig of member cluster: %s", err.Error())
|
||||
|
|
|
@ -151,7 +151,7 @@ type asyncWorkerReconciler2 struct {
|
|||
receivedTimes atomic.Int64
|
||||
}
|
||||
|
||||
func (a *asyncWorkerReconciler2) ReconcileFunc(key QueueKey) error {
|
||||
func (a *asyncWorkerReconciler2) ReconcileFunc(_ QueueKey) error {
|
||||
a.receivedTimes.Inc()
|
||||
return errors.New("always fail")
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ var _ admission.DecoderInjector = &ValidatingAdmission{}
|
|||
|
||||
// Handle implements admission.Handler interface.
|
||||
// It yields a response to an AdmissionRequest.
|
||||
func (v *ValidatingAdmission) Handle(ctx context.Context, req admission.Request) admission.Response {
|
||||
func (v *ValidatingAdmission) Handle(_ context.Context, req admission.Request) admission.Response {
|
||||
policy := &policyv1alpha1.ClusterOverridePolicy{}
|
||||
|
||||
err := v.decoder.Decode(req, policy)
|
||||
|
|
|
@ -34,7 +34,7 @@ func NewMutatingHandler(notReadyTolerationSeconds, unreachableTolerationSeconds
|
|||
}
|
||||
|
||||
// Handle yields a response to an AdmissionRequest.
|
||||
func (a *MutatingAdmission) Handle(ctx context.Context, req admission.Request) admission.Response {
|
||||
func (a *MutatingAdmission) Handle(_ context.Context, req admission.Request) admission.Response {
|
||||
policy := &policyv1alpha1.ClusterPropagationPolicy{}
|
||||
|
||||
err := a.decoder.Decode(req, policy)
|
||||
|
|
|
@ -24,7 +24,7 @@ var _ admission.DecoderInjector = &ValidatingAdmission{}
|
|||
|
||||
// Handle implements admission.Handler interface.
|
||||
// It yields a response to an AdmissionRequest.
|
||||
func (v *ValidatingAdmission) Handle(ctx context.Context, req admission.Request) admission.Response {
|
||||
func (v *ValidatingAdmission) Handle(_ context.Context, req admission.Request) admission.Response {
|
||||
policy := &policyv1alpha1.ClusterPropagationPolicy{}
|
||||
|
||||
err := v.decoder.Decode(req, policy)
|
||||
|
|
|
@ -27,7 +27,7 @@ var _ admission.DecoderInjector = &ValidatingAdmission{}
|
|||
|
||||
// Handle implements admission.Handler interface.
|
||||
// It yields a response to an AdmissionRequest.
|
||||
func (v *ValidatingAdmission) Handle(ctx context.Context, req admission.Request) admission.Response {
|
||||
func (v *ValidatingAdmission) Handle(_ context.Context, req admission.Request) admission.Response {
|
||||
configuration := &configv1alpha1.ResourceInterpreterWebhookConfiguration{}
|
||||
|
||||
err := v.decoder.Decode(req, configuration)
|
||||
|
|
|
@ -27,7 +27,7 @@ var _ admission.DecoderInjector = &ValidatingAdmission{}
|
|||
|
||||
// Handle implements admission.Handler interface.
|
||||
// It yields a response to an AdmissionRequest.
|
||||
func (v *ValidatingAdmission) Handle(ctx context.Context, req admission.Request) admission.Response {
|
||||
func (v *ValidatingAdmission) Handle(_ context.Context, req admission.Request) admission.Response {
|
||||
quota := &policyv1alpha1.FederatedResourceQuota{}
|
||||
|
||||
err := v.decoder.Decode(req, quota)
|
||||
|
|
|
@ -21,7 +21,7 @@ var _ admission.Handler = &MutatingAdmission{}
|
|||
var _ admission.DecoderInjector = &MutatingAdmission{}
|
||||
|
||||
// Handle yields a response to an AdmissionRequest.
|
||||
func (a *MutatingAdmission) Handle(ctx context.Context, req admission.Request) admission.Response {
|
||||
func (a *MutatingAdmission) Handle(_ context.Context, req admission.Request) admission.Response {
|
||||
policy := &policyv1alpha1.OverridePolicy{}
|
||||
|
||||
err := a.decoder.Decode(req, policy)
|
||||
|
|
|
@ -22,7 +22,7 @@ var _ admission.DecoderInjector = &ValidatingAdmission{}
|
|||
|
||||
// Handle implements admission.Handler interface.
|
||||
// It yields a response to an AdmissionRequest.
|
||||
func (v *ValidatingAdmission) Handle(ctx context.Context, req admission.Request) admission.Response {
|
||||
func (v *ValidatingAdmission) Handle(_ context.Context, req admission.Request) admission.Response {
|
||||
policy := &policyv1alpha1.OverridePolicy{}
|
||||
|
||||
err := v.decoder.Decode(req, policy)
|
||||
|
|
|
@ -35,7 +35,7 @@ func NewMutatingHandler(notReadyTolerationSeconds, unreachableTolerationSeconds
|
|||
}
|
||||
|
||||
// Handle yields a response to an AdmissionRequest.
|
||||
func (a *MutatingAdmission) Handle(ctx context.Context, req admission.Request) admission.Response {
|
||||
func (a *MutatingAdmission) Handle(_ context.Context, req admission.Request) admission.Response {
|
||||
policy := &policyv1alpha1.PropagationPolicy{}
|
||||
|
||||
err := a.decoder.Decode(req, policy)
|
||||
|
|
|
@ -24,7 +24,7 @@ var _ admission.DecoderInjector = &ValidatingAdmission{}
|
|||
|
||||
// Handle implements admission.Handler interface.
|
||||
// It yields a response to an AdmissionRequest.
|
||||
func (v *ValidatingAdmission) Handle(ctx context.Context, req admission.Request) admission.Response {
|
||||
func (v *ValidatingAdmission) Handle(_ context.Context, req admission.Request) admission.Response {
|
||||
policy := &policyv1alpha1.PropagationPolicy{}
|
||||
|
||||
err := v.decoder.Decode(req, policy)
|
||||
|
|
|
@ -24,7 +24,7 @@ var _ admission.Handler = &MutatingAdmission{}
|
|||
var _ admission.DecoderInjector = &MutatingAdmission{}
|
||||
|
||||
// Handle yields a response to an AdmissionRequest.
|
||||
func (a *MutatingAdmission) Handle(ctx context.Context, req admission.Request) admission.Response {
|
||||
func (a *MutatingAdmission) Handle(_ context.Context, req admission.Request) admission.Response {
|
||||
work := &workv1alpha1.Work{}
|
||||
|
||||
err := a.decoder.Decode(req, work)
|
||||
|
|
Loading…
Reference in New Issue