Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit 32d569d

Browse files
committed
Fixing all the "composite literal uses unkeyed fields" Vet errors.
1 parent 590038d commit 32d569d

File tree

86 files changed

+177
-178
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+177
-178
lines changed

cmd/kube-controller-manager/app/options/options.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,19 @@ func NewCMServer() *CMServer {
5656
LookupCacheSizeForRC: 4096,
5757
LookupCacheSizeForRS: 4096,
5858
LookupCacheSizeForDaemonSet: 1024,
59-
ServiceSyncPeriod: unversioned.Duration{5 * time.Minute},
60-
NodeSyncPeriod: unversioned.Duration{10 * time.Second},
61-
ResourceQuotaSyncPeriod: unversioned.Duration{5 * time.Minute},
62-
NamespaceSyncPeriod: unversioned.Duration{5 * time.Minute},
63-
PVClaimBinderSyncPeriod: unversioned.Duration{10 * time.Minute},
64-
HorizontalPodAutoscalerSyncPeriod: unversioned.Duration{30 * time.Second},
65-
DeploymentControllerSyncPeriod: unversioned.Duration{30 * time.Second},
66-
MinResyncPeriod: unversioned.Duration{12 * time.Hour},
59+
ServiceSyncPeriod: unversioned.Duration{Duration: 5 * time.Minute},
60+
NodeSyncPeriod: unversioned.Duration{Duration: 10 * time.Second},
61+
ResourceQuotaSyncPeriod: unversioned.Duration{Duration: 5 * time.Minute},
62+
NamespaceSyncPeriod: unversioned.Duration{Duration: 5 * time.Minute},
63+
PVClaimBinderSyncPeriod: unversioned.Duration{Duration: 10 * time.Minute},
64+
HorizontalPodAutoscalerSyncPeriod: unversioned.Duration{Duration: 30 * time.Second},
65+
DeploymentControllerSyncPeriod: unversioned.Duration{Duration: 30 * time.Second},
66+
MinResyncPeriod: unversioned.Duration{Duration: 12 * time.Hour},
6767
RegisterRetryCount: 10,
68-
PodEvictionTimeout: unversioned.Duration{5 * time.Minute},
69-
NodeMonitorGracePeriod: unversioned.Duration{40 * time.Second},
70-
NodeStartupGracePeriod: unversioned.Duration{60 * time.Second},
71-
NodeMonitorPeriod: unversioned.Duration{5 * time.Second},
68+
PodEvictionTimeout: unversioned.Duration{Duration: 5 * time.Minute},
69+
NodeMonitorGracePeriod: unversioned.Duration{Duration: 40 * time.Second},
70+
NodeStartupGracePeriod: unversioned.Duration{Duration: 60 * time.Second},
71+
NodeMonitorPeriod: unversioned.Duration{Duration: 5 * time.Second},
7272
ClusterName: "kubernetes",
7373
TerminatedPodGCThreshold: 12500,
7474
VolumeConfiguration: componentconfig.VolumeConfiguration{
@@ -92,7 +92,7 @@ func NewCMServer() *CMServer {
9292
// AddFlags adds flags for a specific CMServer to the specified FlagSet
9393
func (s *CMServer) AddFlags(fs *pflag.FlagSet) {
9494
fs.IntVar(&s.Port, "port", s.Port, "The port that the controller-manager's http service runs on")
95-
fs.Var(componentconfig.IPVar{&s.Address}, "address", "The IP address to serve on (set to 0.0.0.0 for all interfaces)")
95+
fs.Var(componentconfig.IPVar{Val: &s.Address}, "address", "The IP address to serve on (set to 0.0.0.0 for all interfaces)")
9696
fs.StringVar(&s.CloudProvider, "cloud-provider", s.CloudProvider, "The provider for cloud services. Empty string for no provider.")
9797
fs.StringVar(&s.CloudConfigFile, "cloud-config", s.CloudConfigFile, "The path to the cloud provider configuration file. Empty string for no configuration file.")
9898
fs.IntVar(&s.ConcurrentEndpointSyncs, "concurrent-endpoint-syncs", s.ConcurrentEndpointSyncs, "The number of endpoint syncing operations that will be done concurrently. Larger number = faster endpoint updating, but more CPU (and network) load")

cmd/kube-proxy/app/options/options.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ func NewProxyConfig() *ProxyServerConfig {
6060

6161
// AddFlags adds flags for a specific ProxyServer to the specified FlagSet
6262
func (s *ProxyServerConfig) AddFlags(fs *pflag.FlagSet) {
63-
fs.Var(componentconfig.IPVar{&s.BindAddress}, "bind-address", "The IP address for the proxy server to serve on (set to 0.0.0.0 for all interfaces)")
63+
fs.Var(componentconfig.IPVar{Val: &s.BindAddress}, "bind-address", "The IP address for the proxy server to serve on (set to 0.0.0.0 for all interfaces)")
6464
fs.StringVar(&s.Master, "master", s.Master, "The address of the Kubernetes API server (overrides any value in kubeconfig)")
6565
fs.IntVar(&s.HealthzPort, "healthz-port", s.HealthzPort, "The port to bind the health check server. Use 0 to disable.")
66-
fs.Var(componentconfig.IPVar{&s.HealthzBindAddress}, "healthz-bind-address", "The IP address for the health check server to serve on, defaulting to 127.0.0.1 (set to 0.0.0.0 for all interfaces)")
66+
fs.Var(componentconfig.IPVar{Val: &s.HealthzBindAddress}, "healthz-bind-address", "The IP address for the health check server to serve on, defaulting to 127.0.0.1 (set to 0.0.0.0 for all interfaces)")
6767
fs.IntVar(s.OOMScoreAdj, "oom-score-adj", util.IntPtrDerefOr(s.OOMScoreAdj, qos.KubeProxyOOMScoreAdj), "The oom-score-adj value for kube-proxy process. Values must be within the range [-1000, 1000]")
6868
fs.StringVar(&s.ResourceContainer, "resource-container", s.ResourceContainer, "Absolute name of the resource-only container to create and run the Kube-proxy in (Default: /kube-proxy).")
6969
fs.MarkDeprecated("resource-container", "This feature will be removed in a later release.")
7070
fs.StringVar(&s.Kubeconfig, "kubeconfig", s.Kubeconfig, "Path to kubeconfig file with authorization information (the master location is set by the master flag).")
71-
fs.Var(componentconfig.PortRangeVar{&s.PortRange}, "proxy-port-range", "Range of host ports (beginPort-endPort, inclusive) that may be consumed in order to proxy service traffic. If unspecified (0-0) then ports will be randomly chosen.")
71+
fs.Var(componentconfig.PortRangeVar{Val: &s.PortRange}, "proxy-port-range", "Range of host ports (beginPort-endPort, inclusive) that may be consumed in order to proxy service traffic. If unspecified (0-0) then ports will be randomly chosen.")
7272
fs.StringVar(&s.HostnameOverride, "hostname-override", s.HostnameOverride, "If non-empty, will use this string as identification instead of the actual hostname.")
7373
fs.Var(&s.Mode, "proxy-mode", "Which proxy mode to use: 'userspace' (older) or 'iptables' (faster). If blank, look at the Node object on the Kubernetes API and respect the '"+ExperimentalProxyModeAnnotation+"' annotation if provided. Otherwise use the best-available proxy (currently iptables). If the iptables proxy is selected, regardless of how, but the system's kernel or iptables versions are insufficient, this always falls back to the userspace proxy.")
7474
fs.IntVar(s.IPTablesMasqueradeBit, "iptables-masquerade-bit", util.IntPtrDerefOr(s.IPTablesMasqueradeBit, 14), "If using the pure iptables proxy, the bit of the fwmark space to mark packets requiring SNAT with. Must be within the range [0, 31].")

cmd/kubelet/app/options/options.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func NewKubeletServer() *KubeletServer {
6868
KubeletConfiguration: componentconfig.KubeletConfiguration{
6969
Address: "0.0.0.0",
7070
CAdvisorPort: 4194,
71-
VolumeStatsAggPeriod: unversioned.Duration{time.Minute},
71+
VolumeStatsAggPeriod: unversioned.Duration{Duration: time.Minute},
7272
CertDirectory: "/var/run/kubernetes",
7373
CgroupRoot: "",
7474
ConfigureCBR0: false,
@@ -80,14 +80,14 @@ func NewKubeletServer() *KubeletServer {
8080
EnableCustomMetrics: false,
8181
EnableDebuggingHandlers: true,
8282
EnableServer: true,
83-
FileCheckFrequency: unversioned.Duration{20 * time.Second},
83+
FileCheckFrequency: unversioned.Duration{Duration: 20 * time.Second},
8484
HealthzBindAddress: "127.0.0.1",
8585
HealthzPort: 10248,
8686
HostNetworkSources: kubetypes.AllSource,
8787
HostPIDSources: kubetypes.AllSource,
8888
HostIPCSources: kubetypes.AllSource,
89-
HTTPCheckFrequency: unversioned.Duration{20 * time.Second},
90-
ImageMinimumGCAge: unversioned.Duration{2 * time.Minute},
89+
HTTPCheckFrequency: unversioned.Duration{Duration: 20 * time.Second},
90+
ImageMinimumGCAge: unversioned.Duration{Duration: 2 * time.Minute},
9191
ImageGCHighThresholdPercent: 90,
9292
ImageGCLowThresholdPercent: 80,
9393
LowDiskSpaceThresholdMB: 256,
@@ -96,12 +96,12 @@ func NewKubeletServer() *KubeletServer {
9696
MaxPerPodContainerCount: 2,
9797
MaxOpenFiles: 1000000,
9898
MaxPods: 110,
99-
MinimumGCAge: unversioned.Duration{1 * time.Minute},
99+
MinimumGCAge: unversioned.Duration{Duration: 1 * time.Minute},
100100
NetworkPluginDir: "/usr/libexec/kubernetes/kubelet-plugins/net/exec/",
101101
NetworkPluginName: "",
102102
NonMasqueradeCIDR: "10.0.0.0/8",
103103
VolumePluginDir: "/usr/libexec/kubernetes/kubelet-plugins/volume/exec/",
104-
NodeStatusUpdateFrequency: unversioned.Duration{10 * time.Second},
104+
NodeStatusUpdateFrequency: unversioned.Duration{Duration: 10 * time.Second},
105105
NodeLabels: make(map[string]string),
106106
OOMScoreAdj: qos.KubeletOOMScoreAdj,
107107
LockFilePath: "",
@@ -118,14 +118,14 @@ func NewKubeletServer() *KubeletServer {
118118
RootDirectory: defaultRootDir,
119119
RuntimeCgroups: "",
120120
SerializeImagePulls: true,
121-
StreamingConnectionIdleTimeout: unversioned.Duration{4 * time.Hour},
122-
SyncFrequency: unversioned.Duration{1 * time.Minute},
121+
StreamingConnectionIdleTimeout: unversioned.Duration{Duration: 4 * time.Hour},
122+
SyncFrequency: unversioned.Duration{Duration: 1 * time.Minute},
123123
SystemCgroups: "",
124124
ReconcileCIDR: true,
125125
KubeAPIQPS: 5.0,
126126
KubeAPIBurst: 10,
127127
ExperimentalFlannelOverlay: experimentalFlannelOverlay,
128-
OutOfDiskTransitionFrequency: unversioned.Duration{5 * time.Minute},
128+
OutOfDiskTransitionFrequency: unversioned.Duration{Duration: 5 * time.Minute},
129129
HairpinMode: componentconfig.PromiscuousBridge,
130130
BabysitDaemons: false,
131131
},
@@ -141,7 +141,7 @@ func (s *KubeletServer) AddFlags(fs *pflag.FlagSet) {
141141
fs.StringVar(&s.ManifestURL, "manifest-url", s.ManifestURL, "URL for accessing the container manifest")
142142
fs.StringVar(&s.ManifestURLHeader, "manifest-url-header", s.ManifestURLHeader, "HTTP header to use when accessing the manifest URL, with the key separated from the value with a ':', as in 'key:value'")
143143
fs.BoolVar(&s.EnableServer, "enable-server", s.EnableServer, "Enable the Kubelet's server")
144-
fs.Var(componentconfig.IPVar{&s.Address}, "address", "The IP address for the Kubelet to serve on (set to 0.0.0.0 for all interfaces)")
144+
fs.Var(componentconfig.IPVar{Val: &s.Address}, "address", "The IP address for the Kubelet to serve on (set to 0.0.0.0 for all interfaces)")
145145
fs.UintVar(&s.Port, "port", s.Port, "The port for the Kubelet to serve on.")
146146
fs.UintVar(&s.ReadOnlyPort, "read-only-port", s.ReadOnlyPort, "The read-only port for the Kubelet to serve on with no authentication/authorization (set to 0 to disable)")
147147
fs.StringVar(&s.TLSCertFile, "tls-cert-file", s.TLSCertFile, ""+
@@ -173,7 +173,7 @@ func (s *KubeletServer) AddFlags(fs *pflag.FlagSet) {
173173
fs.Var(&s.KubeConfig, "kubeconfig", "Path to a kubeconfig file, specifying how to authenticate to API server (the master location is set by the api-servers flag).")
174174
fs.UintVar(&s.CAdvisorPort, "cadvisor-port", s.CAdvisorPort, "The port of the localhost cAdvisor endpoint")
175175
fs.IntVar(&s.HealthzPort, "healthz-port", s.HealthzPort, "The port of the localhost healthz endpoint")
176-
fs.Var(componentconfig.IPVar{&s.HealthzBindAddress}, "healthz-bind-address", "The IP address for the healthz server to serve on, defaulting to 127.0.0.1 (set to 0.0.0.0 for all interfaces)")
176+
fs.Var(componentconfig.IPVar{Val: &s.HealthzBindAddress}, "healthz-bind-address", "The IP address for the healthz server to serve on, defaulting to 127.0.0.1 (set to 0.0.0.0 for all interfaces)")
177177
fs.IntVar(&s.OOMScoreAdj, "oom-score-adj", s.OOMScoreAdj, "The oom-score-adj value for kubelet process. Values must be within the range [-1000, 1000]")
178178
fs.StringSliceVar(&s.APIServerList, "api-servers", []string{}, "List of Kubernetes API servers for publishing events, and reading pods and services. (ip:port), comma separated.")
179179
fs.BoolVar(&s.RegisterNode, "register-node", s.RegisterNode, "Register the node with the apiserver (defaults to true if --api-servers is set)")

cmd/kubelet/app/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ func RunKubelet(kcfg *KubeletConfig) error {
608608
eventBroadcaster.StartLogging(glog.V(3).Infof)
609609
if kcfg.EventClient != nil {
610610
glog.V(4).Infof("Sending events to api server.")
611-
eventBroadcaster.StartRecordingToSink(&unversionedcore.EventSinkImpl{kcfg.EventClient.Events("")})
611+
eventBroadcaster.StartRecordingToSink(&unversionedcore.EventSinkImpl{Interface: kcfg.EventClient.Events("")})
612612
} else {
613613
glog.Warning("No api server defined - no events will be sent to API server.")
614614
}

cmd/libs/go2idl/client-gen/generators/normalization/normalization.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ func Version(version string) string {
3333
}
3434

3535
func GroupVersion(gv unversioned.GroupVersion) unversioned.GroupVersion {
36-
return unversioned.GroupVersion{Group(gv.Group), Version(gv.Version)}
36+
return unversioned.GroupVersion{Group: Group(gv.Group), Version: Version(gv.Version)}
3737
}

cmd/libs/go2idl/client-gen/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ func main() {
9797
// We may change the output path later.
9898
arguments.OutputPackagePath = "k8s.io/kubernetes/cmd/libs/go2idl/client-gen/testoutput"
9999
arguments.CustomArgs = clientgenargs.Args{
100-
[]unversioned.GroupVersion{{"testgroup", ""}},
100+
[]unversioned.GroupVersion{{Group: "testgroup", Version: ""}},
101101
map[unversioned.GroupVersion]string{
102-
unversioned.GroupVersion{"testgroup", ""}: "k8s.io/kubernetes/cmd/libs/go2idl/client-gen/testdata/apis/testgroup",
102+
unversioned.GroupVersion{Group: "testgroup", Version: ""}: "k8s.io/kubernetes/cmd/libs/go2idl/client-gen/testdata/apis/testgroup",
103103
},
104104
"test_internalclientset",
105105
"k8s.io/kubernetes/cmd/libs/go2idl/client-gen/testoutput/clientset_generated/",

cmd/libs/go2idl/client-gen/testoutput/testgroup/unversioned/testgroup_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func TestUpdateStatusTestType(t *testing.T) {
109109
"name": "baz",
110110
},
111111
},
112-
Status: testgroup.TestTypeStatus{"I'm in good status"},
112+
Status: testgroup.TestTypeStatus{Blah: "I'm in good status"},
113113
}
114114
c := DecoratedSimpleClient{
115115
simpleClient: simple.Client{

contrib/mesos/pkg/node/registrator_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func calledOnce(h bool, ret runtime.Object, err error) (<-chan struct{}, func(co
5151

5252
func TestRegister_withUnknownNode(t *testing.T) {
5353
fc := &core.Fake{}
54-
nodes := &fakeNodes{&fake.FakeNodes{&fake.FakeCore{fc}}}
54+
nodes := &fakeNodes{&fake.FakeNodes{&fake.FakeCore{Fake: fc}}}
5555
createCalled, createOnce := calledOnce(true, nil, nil)
5656
fc.AddReactor("create", "nodes", createOnce)
5757

@@ -84,7 +84,7 @@ func TestRegister_withUnknownNode(t *testing.T) {
8484

8585
func TestRegister_withKnownNode(t *testing.T) {
8686
fc := &core.Fake{}
87-
nodes := &fakeNodes{&fake.FakeNodes{&fake.FakeCore{fc}}}
87+
nodes := &fakeNodes{&fake.FakeNodes{&fake.FakeCore{Fake: fc}}}
8888
updateCalled, updateOnce := calledOnce(true, nil, nil)
8989
fc.AddReactor("update", "nodes", updateOnce)
9090

@@ -122,9 +122,9 @@ func TestRegister_withSemiKnownNode(t *testing.T) {
122122
// CreateOrUpdate should proceed to attempt an update.
123123

124124
fc := &core.Fake{}
125-
nodes := &fakeNodes{&fake.FakeNodes{&fake.FakeCore{fc}}}
125+
nodes := &fakeNodes{&fake.FakeNodes{&fake.FakeCore{Fake: fc}}}
126126

127-
createCalled, createOnce := calledOnce(true, nil, errors.NewAlreadyExists(unversioned.GroupResource{"", ""}, "nodes"))
127+
createCalled, createOnce := calledOnce(true, nil, errors.NewAlreadyExists(unversioned.GroupResource{Group: "", Resource: ""}, "nodes"))
128128
fc.AddReactor("create", "nodes", createOnce)
129129

130130
updateCalled, updateOnce := calledOnce(true, nil, nil)

contrib/mesos/pkg/node/statusupdater_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ func Test_nodeWithUpdatedStatus(t *testing.T) {
3939
Status: s,
4040
Reason: r,
4141
Message: "some message we don't care about here",
42-
LastTransitionTime: unversioned.Time{now.Add(-time.Minute)},
43-
LastHeartbeatTime: unversioned.Time{now.Add(d)},
42+
LastTransitionTime: unversioned.Time{Time: now.Add(-time.Minute)},
43+
LastHeartbeatTime: unversioned.Time{Time: now.Add(d)},
4444
}},
4545
},
4646
}

contrib/mesos/pkg/scheduler/service/service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ func (s *SchedulerServer) bootstrap(hks hyperkube.Interface, sc *schedcfg.Config
874874
broadcaster := record.NewBroadcaster()
875875
recorder := broadcaster.NewRecorder(api.EventSource{Component: api.DefaultSchedulerName})
876876
broadcaster.StartLogging(log.Infof)
877-
broadcaster.StartRecordingToSink(&unversionedcore.EventSinkImpl{eventsClient.Events("")})
877+
broadcaster.StartRecordingToSink(&unversionedcore.EventSinkImpl{Interface: eventsClient.Events("")})
878878

879879
lw := cache.NewListWatchFromClient(s.client.CoreClient, "pods", api.NamespaceAll, fields.Everything())
880880

pkg/api/helpers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,13 +342,13 @@ func containsAccessMode(modes []PersistentVolumeAccessMode, mode PersistentVolum
342342
// ParseRFC3339 parses an RFC3339 date in either RFC3339Nano or RFC3339 format.
343343
func ParseRFC3339(s string, nowFn func() unversioned.Time) (unversioned.Time, error) {
344344
if t, timeErr := time.Parse(time.RFC3339Nano, s); timeErr == nil {
345-
return unversioned.Time{t}, nil
345+
return unversioned.Time{Time: t}, nil
346346
}
347347
t, err := time.Parse(time.RFC3339, s)
348348
if err != nil {
349349
return unversioned.Time{}, err
350350
}
351-
return unversioned.Time{t}, nil
351+
return unversioned.Time{Time: t}, nil
352352
}
353353

354354
// NodeSelectorRequirementsAsSelector converts the []NodeSelectorRequirement api type into a struct that implements

0 commit comments

Comments
 (0)