diff --git a/staging/src/k8s.io/apiserver/pkg/admission/plugin/resourcequota/controller.go b/staging/src/k8s.io/apiserver/pkg/admission/plugin/resourcequota/controller.go index 8186af7b2cb..4d1576db4e1 100644 --- a/staging/src/k8s.io/apiserver/pkg/admission/plugin/resourcequota/controller.go +++ b/staging/src/k8s.io/apiserver/pkg/admission/plugin/resourcequota/controller.go @@ -393,9 +393,7 @@ func getMatchedLimitedScopes(evaluator quota.Evaluator, inputObject runtime.Obje klog.ErrorS(err, "Error while matching limited Scopes") return []corev1.ScopedResourceSelectorRequirement{}, err } - for _, scope := range matched { - scopes = append(scopes, scope) - } + scopes = append(scopes, matched...) } return scopes, nil } @@ -455,9 +453,7 @@ func CheckRequest(quotas []corev1.ResourceQuota, a admission.Attributes, evaluat if err != nil { return nil, fmt.Errorf("error matching scopes of quota %s, err: %v", resourceQuota.Name, err) } - for _, scope := range localRestrictedScopes { - restrictedScopes = append(restrictedScopes, scope) - } + restrictedScopes = append(restrictedScopes, localRestrictedScopes...) match, err := evaluator.Matches(&resourceQuota, inputObject) if err != nil { @@ -595,9 +591,7 @@ func getScopeSelectorsFromQuota(quota corev1.ResourceQuota) []corev1.ScopedResou Operator: corev1.ScopeSelectorOpExists}) } if quota.Spec.ScopeSelector != nil { - for _, scopeSelector := range quota.Spec.ScopeSelector.MatchExpressions { - selectors = append(selectors, scopeSelector) - } + selectors = append(selectors, quota.Spec.ScopeSelector.MatchExpressions...) } return selectors } diff --git a/staging/src/k8s.io/apiserver/pkg/server/config.go b/staging/src/k8s.io/apiserver/pkg/server/config.go index 570cd1f7840..26c8dbe42a4 100644 --- a/staging/src/k8s.io/apiserver/pkg/server/config.go +++ b/staging/src/k8s.io/apiserver/pkg/server/config.go @@ -450,11 +450,9 @@ type CompletedConfig struct { // of our configured apiserver. We should prefer this to adding healthChecks directly to // the config unless we explicitly want to add a healthcheck only to a specific health endpoint. func (c *Config) AddHealthChecks(healthChecks ...healthz.HealthChecker) { - for _, check := range healthChecks { - c.HealthzChecks = append(c.HealthzChecks, check) - c.LivezChecks = append(c.LivezChecks, check) - c.ReadyzChecks = append(c.ReadyzChecks, check) - } + c.HealthzChecks = append(c.HealthzChecks, healthChecks...) + c.LivezChecks = append(c.LivezChecks, healthChecks...) + c.ReadyzChecks = append(c.ReadyzChecks, healthChecks...) } // AddPostStartHook allows you to add a PostStartHook that will later be added to the server itself in a New call. diff --git a/staging/src/k8s.io/apiserver/pkg/server/dynamiccertificates/named_certificates.go b/staging/src/k8s.io/apiserver/pkg/server/dynamiccertificates/named_certificates.go index e8be133c02e..7b9637bc0e0 100644 --- a/staging/src/k8s.io/apiserver/pkg/server/dynamiccertificates/named_certificates.go +++ b/staging/src/k8s.io/apiserver/pkg/server/dynamiccertificates/named_certificates.go @@ -83,9 +83,7 @@ func getCertificateNames(cert *x509.Certificate) []string { if !cnIsIP && cnIsValidDomain { names = append(names, cn) } - for _, san := range cert.DNSNames { - names = append(names, san) - } + names = append(names, cert.DNSNames...) // intentionally all IPs in the cert are ignored as SNI forbids passing IPs // to select a cert. Before go 1.6 the tls happily passed IPs as SNI values. diff --git a/staging/src/k8s.io/apiserver/pkg/server/dynamiccertificates/util.go b/staging/src/k8s.io/apiserver/pkg/server/dynamiccertificates/util.go index 6906045cd29..4e55a057833 100644 --- a/staging/src/k8s.io/apiserver/pkg/server/dynamiccertificates/util.go +++ b/staging/src/k8s.io/apiserver/pkg/server/dynamiccertificates/util.go @@ -50,9 +50,7 @@ func GetHumanCertDetail(certificate *x509.Certificate) string { for _, ip := range certificate.IPAddresses { validServingNames = append(validServingNames, ip.String()) } - for _, dnsName := range certificate.DNSNames { - validServingNames = append(validServingNames, dnsName) - } + validServingNames = append(validServingNames, certificate.DNSNames...) servingString := "" if len(validServingNames) > 0 { servingString = fmt.Sprintf(" validServingFor=[%s]", strings.Join(validServingNames, ","))