Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Commit 273d5cd

Browse files
authored
Fix linter issues and clean up unused param (#4969)
Signed-off-by: James Sturtevant <[email protected]>
1 parent ae704c0 commit 273d5cd

File tree

13 files changed

+30
-31
lines changed

13 files changed

+30
-31
lines changed

cmd/cli/env.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
66
You may obtain a copy of the License at
77
8-
http://www.apache.org/licenses/LICENSE-2.0
8+
http://www.apache.org/licenses/LICENSE-2.0
99
1010
Unless required by applicable law or agreed to in writing, software
1111
distributed under the License is distributed on an "AS IS" BASIS,
1212
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
16-
Copyright 2020 The OSM contributors
16+
Copyright 2020 The OSM contributors.
1717
1818
Licensed under the MIT License
1919
Permission is hereby granted, free of charge, to any person obtaining a copy

cmd/cli/install.go

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ const (
5757

5858
// chartTGZSource is the `helm package`d representation of the default Helm chart.
5959
// Its value is embedded at build time.
60+
//
6061
//go:embed chart.tgz
6162
var chartTGZSource []byte
6263

cmd/osm-bootstrap/osm-bootstrap.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ func main() {
242242
}
243243

244244
// Initialize the crd conversion webhook server to support the conversion of OSM's CRDs
245-
if err := crdconversion.NewConversionWebhook(ctx, kubeClient, crdClient, certManager, osmNamespace, enableReconciler); err != nil {
245+
if err := crdconversion.NewConversionWebhook(ctx, crdClient, certManager, osmNamespace, enableReconciler); err != nil {
246246
events.GenericEventRecorder().FatalEvent(err, events.InitializationError, "Error creating crd conversion webhook")
247247
}
248248

@@ -327,8 +327,8 @@ func (b *bootstrap) ensureMeshConfig() error {
327327
}
328328

329329
// initiatilizeKubernetesEventsRecorder initializes the generic Kubernetes event recorder and associates it with
330-
// the osm-bootstrap pod resource. The events recorder allows the osm-bootstap to publish Kubernets events to
331-
// report fatal errors with initializing this application. These events will show up in the output of `kubectl get events`
330+
// the osm-bootstrap pod resource. The events recorder allows the osm-bootstap to publish Kubernets events to
331+
// report fatal errors with initializing this application. These events will show up in the output of `kubectl get events`
332332
func (b *bootstrap) initiatilizeKubernetesEventsRecorder() error {
333333
bootstrapPod, err := b.getBootstrapPod()
334334
if err != nil {

pkg/catalog/inbound_traffic_policies.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ func (mc *MeshCatalog) getRoutingRulesFromTrafficTarget(trafficTarget access.Tra
202202
}
203203

204204
// routesFromRules takes a set of traffic target rules and the namespace of the traffic target and returns a list of
205-
// http route matches (trafficpolicy.HTTPRouteMatch)
205+
// http route matches (trafficpolicy.HTTPRouteMatch)
206206
func (mc *MeshCatalog) routesFromRules(rules []access.TrafficTargetRule, trafficTargetNamespace string) ([]trafficpolicy.HTTPRouteMatch, error) {
207207
var routes []trafficpolicy.HTTPRouteMatch
208208

pkg/catalog/outbound_traffic_policies.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ import (
1717
// GetOutboundMeshTrafficPolicy returns the outbound mesh traffic policy for the given downstream identity
1818
//
1919
// The function works as follows:
20-
// 1. If permissive mode is enabled, builds outbound mesh traffic policies to reach every upstream service
21-
// discovered using service discovery, using wildcard routes.
22-
// 2. In SMI mode, builds outbound mesh traffic policies to reach every upstream service corresponding
23-
// to every upstream service account that this downstream is authorized to access using SMI TrafficTarget
24-
// policies.
25-
// 3. Process TraficSplit policies and update the weights for the upstream services based on the policies.
20+
// 1. If permissive mode is enabled, builds outbound mesh traffic policies to reach every upstream service
21+
// discovered using service discovery, using wildcard routes.
22+
// 2. In SMI mode, builds outbound mesh traffic policies to reach every upstream service corresponding
23+
// to every upstream service account that this downstream is authorized to access using SMI TrafficTarget
24+
// policies.
25+
// 3. Process TraficSplit policies and update the weights for the upstream services based on the policies.
2626
//
2727
// The route configurations are consolidated per port, such that upstream services using the same port are a part
2828
// of the same route configuration. This is required to avoid route conflicts that can occur when the same hostname

pkg/cli/environment.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ Licensed under the Apache License, Version 2.0 (the "License");
88
you may not use this file except in compliance with the License.
99
You may obtain a copy of the License at
1010
11-
http://www.apache.org/licenses/LICENSE-2.0
11+
http://www.apache.org/licenses/LICENSE-2.0
1212
1313
Unless required by applicable law or agreed to in writing, software
1414
distributed under the License is distributed on an "AS IS" BASIS,
1515
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1616
See the License for the specific language governing permissions and
1717
limitations under the License.
1818
19-
Copyright 2020 The OSM contributors
19+
Copyright 2020 The OSM contributors.
2020
2121
Licensed under the MIT License
2222
Permission is hereby granted, free of charge, to any person obtaining a copy

pkg/crdconversion/crdconversion.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
apiv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
88
apiclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1"
99
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
10-
"k8s.io/client-go/kubernetes"
1110
"k8s.io/utils/pointer"
1211

1312
"github.com/openservicemesh/osm/pkg/certificate"
@@ -38,7 +37,7 @@ var apiKindToPath = map[string]string{
3837
var conversionReviewVersions = []string{"v1beta1", "v1"}
3938

4039
// NewConversionWebhook starts a new web server handling requests from the CRD's
41-
func NewConversionWebhook(ctx context.Context, kubeClient kubernetes.Interface, crdClient apiclient.ApiextensionsV1Interface, certManager *certificate.Manager, osmNamespace string, enableReconciler bool) error {
40+
func NewConversionWebhook(ctx context.Context, crdClient apiclient.ApiextensionsV1Interface, certManager *certificate.Manager, osmNamespace string, enableReconciler bool) error {
4241
srv, err := webhook.NewServer(constants.OSMBootstrapName, osmNamespace, constants.CRDConversionWebhookPort, certManager, map[string]http.HandlerFunc{
4342
meshConfigConverterPath: serveMeshConfigConversion,
4443
trafficAccessConverterPath: serveTrafficAccessConversion,

pkg/crdconversion/crdconversion_test.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
apiv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
1111
"k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/fake"
1212
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
13-
k8sfake "k8s.io/client-go/kubernetes/fake"
1413

1514
"github.com/openservicemesh/osm/pkg/certificate"
1615
"github.com/openservicemesh/osm/pkg/certificate/pem"
@@ -96,14 +95,13 @@ func TestUpdateCrdConfiguration(t *testing.T) {
9695
func TestNewConversionWebhook(t *testing.T) {
9796
assert := tassert.New(t)
9897
crdClient := fake.NewSimpleClientset()
99-
kubeClient := k8sfake.NewSimpleClientset()
10098
mockCtrl := gomock.NewController(t)
10199
defer mockCtrl.Finish()
102100

103101
fakeCertManager := tresorFake.NewFake(1 * time.Hour)
104102
osmNamespace := "-osm-namespace-"
105103
enablesReconciler := false
106104

107-
actualErr := NewConversionWebhook(context.Background(), kubeClient, crdClient.ApiextensionsV1(), fakeCertManager, osmNamespace, enablesReconciler)
105+
actualErr := NewConversionWebhook(context.Background(), crdClient.ApiextensionsV1(), fakeCertManager, osmNamespace, enablesReconciler)
108106
assert.NotNil(actualErr)
109107
}

pkg/envoy/rds/route/route_config.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ func BuildEgressRouteConfiguration(portSpecificRouteConfigs map[int][]*trafficpo
247247
return routeConfigs
248248
}
249249

250-
//NewRouteConfigurationStub creates the route configuration placeholder
250+
// NewRouteConfigurationStub creates the route configuration placeholder
251251
func NewRouteConfigurationStub(routeConfigName string) *xds_route.RouteConfiguration {
252252
routeConfiguration := xds_route.RouteConfiguration{
253253
Name: routeConfigName,

pkg/tests/stream.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ func (s *XDSServer) Recv() (*xds_discovery.DiscoveryRequest, error) {
5353
// SetHeader sets the header metadata. It may be called multiple times.
5454
// When call multiple times, all the provided metadata will be merged.
5555
// All the metadata will be sent out when one of the following happens:
56-
// - ServerStream.SendHeader() is called;
57-
// - The first response is sent out;
58-
// - An RPC status is sent out (error or success).
56+
// - ServerStream.SendHeader() is called;
57+
// - The first response is sent out;
58+
// - An RPC status is sent out (error or success).
5959
func (s *XDSServer) SetHeader(metadata.MD) error {
6060
return nil
6161
}

pkg/trafficpolicy/trafficpolicy.go

+7-6
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,10 @@ func (rwc *RouteWeightedClusters) TotalClustersWeight() int {
8383
return totalWeight
8484
}
8585

86-
// AddRoute adds a route to an OutboundTrafficPolicy given an HTTP route match and weighted cluster. If a Route with the given HTTP route match
87-
// already exists, an error will be returned. If a Route with the given HTTP route match does not exist,
88-
// a Route with the given HTTP route match and weighted clusters will be added to the Routes on the OutboundTrafficPolicy
86+
// AddRoute adds a route to an OutboundTrafficPolicy given an HTTP route match and weighted cluster.
87+
// If a Route with the given HTTP route match already exists, an error will be returned.
88+
// If a Route with the given HTTP route match does not exist,
89+
// a Route with the given HTTP route match and weighted clusters will be added to the Routes on the OutboundTrafficPolicy
8990
func (out *OutboundTrafficPolicy) AddRoute(httpRouteMatch HTTPRouteMatch, retryPolicy *policyv1alpha1.RetryPolicySpec, weightedClusters ...service.WeightedCluster) error {
9091
wc := mapset.NewSet()
9192
for _, c := range weightedClusters {
@@ -137,7 +138,7 @@ func MergeInboundPolicies(original []*InboundTrafficPolicy, latest ...*InboundTr
137138
}
138139

139140
// MergeRules merges the give slices of rules such that there is one Rule for a Route with all allowed service accounts listed in the
140-
// returned slice of rules
141+
// returned slice of rules
141142
func MergeRules(originalRules, latestRules []*Rule) []*Rule {
142143
for _, latest := range latestRules {
143144
foundRoute := false
@@ -156,8 +157,8 @@ func MergeRules(originalRules, latestRules []*Rule) []*Rule {
156157
}
157158

158159
// mergeRoutesWeightedClusters merges two slices of RouteWeightedClusters and returns a slice where there is one RouteWeightedCluster
159-
// for any HTTPRouteMatch. Where there is an overlap in HTTPRouteMatch between the originalRoutes and latestRoutes, the WeightedClusters
160-
// will be unioned as there can only be one set of WeightedClusters per HTTPRouteMatch.
160+
// for any HTTPRouteMatch. Where there is an overlap in HTTPRouteMatch between the originalRoutes and latestRoutes, the WeightedClusters
161+
// will be unioned as there can only be one set of WeightedClusters per HTTPRouteMatch.
161162
func mergeRoutesWeightedClusters(originalRoutes, latestRoutes []*RouteWeightedClusters) []*RouteWeightedClusters {
162163
for _, latest := range latestRoutes {
163164
foundRoute := false

tests/framework/common_apps.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ func (td *OsmTestData) InstallNginxIngress() (string, error) {
851851
}
852852

853853
// RandomNameWithPrefix generates a random string with the given prefix.
854-
// If the prefix is empty, the default prefix "test" will be used
854+
// If the prefix is empty, the default prefix "test" will be used
855855
func RandomNameWithPrefix(prefix string) string {
856856
if prefix == "" || len(prefix) > 100 {
857857
prefix = "test"

tests/framework/types.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ type InstallOsmOpt func(*InstallOSMOpts)
140140
// CleanupType identifies what triggered the cleanup
141141
type CleanupType string
142142

143-
//DockerConfig and other configs are docker-specific container registry secret structures.
143+
// DockerConfig and other configs are docker-specific container registry secret structures.
144144
// Most of it is taken or referenced from kubectl source itself
145145
type DockerConfig map[string]DockerConfigEntry
146146

0 commit comments

Comments
 (0)