mirror of https://github.com/k3s-io/k3s
Fix gofmt errors
parent
b4c71b1f26
commit
6681835b0c
|
@ -174,7 +174,7 @@ func main() {
|
|||
arguments.CustomArgs = clientgenargs.Args{
|
||||
Groups: []types.GroupVersions{{Group: "testgroup", Versions: []types.Version{""}}},
|
||||
GroupVersionToInputPath: map[types.GroupVersion]string{
|
||||
types.GroupVersion{Group: "testgroup", Version: ""}: "k8s.io/kubernetes/cmd/libs/go2idl/client-gen/test_apis/testgroup",
|
||||
{Group: "testgroup", Version: ""}: "k8s.io/kubernetes/cmd/libs/go2idl/client-gen/test_apis/testgroup",
|
||||
},
|
||||
ClientsetName: "test_internalclientset",
|
||||
ClientsetOutputPath: "k8s.io/kubernetes/cmd/libs/go2idl/client-gen/testoutput/clientset_generated/",
|
||||
|
|
|
@ -51,9 +51,9 @@ func TestNewGarbageCollector(t *testing.T) {
|
|||
config.ContentConfig.NegotiatedSerializer = nil
|
||||
clientPool := dynamic.NewClientPool(config, api.Registry.RESTMapper(), dynamic.LegacyAPIPathResolverFunc)
|
||||
podResource := map[schema.GroupVersionResource]struct{}{
|
||||
schema.GroupVersionResource{Version: "v1", Resource: "pods"}: {},
|
||||
{Version: "v1", Resource: "pods"}: {},
|
||||
// no monitor will be constructed for non-core resource, the GC construction will not fail.
|
||||
schema.GroupVersionResource{Group: "tpr.io", Version: "v1", Resource: "unknown"}: {},
|
||||
{Group: "tpr.io", Version: "v1", Resource: "unknown"}: {},
|
||||
}
|
||||
gc, err := NewGarbageCollector(metaOnlyClientPool, clientPool, api.Registry.RESTMapper(), podResource)
|
||||
if err != nil {
|
||||
|
@ -118,7 +118,7 @@ func setupGC(t *testing.T, config *restclient.Config) *GarbageCollector {
|
|||
metaOnlyClientPool := dynamic.NewClientPool(config, api.Registry.RESTMapper(), dynamic.LegacyAPIPathResolverFunc)
|
||||
config.ContentConfig.NegotiatedSerializer = nil
|
||||
clientPool := dynamic.NewClientPool(config, api.Registry.RESTMapper(), dynamic.LegacyAPIPathResolverFunc)
|
||||
podResource := map[schema.GroupVersionResource]struct{}{schema.GroupVersionResource{Version: "v1", Resource: "pods"}: {}}
|
||||
podResource := map[schema.GroupVersionResource]struct{}{{Version: "v1", Resource: "pods"}: {}}
|
||||
gc, err := NewGarbageCollector(metaOnlyClientPool, clientPool, api.Registry.RESTMapper(), podResource)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
|
|
@ -195,15 +195,15 @@ func (gb *GraphBuilder) Run(stopCh <-chan struct{}) {
|
|||
}
|
||||
|
||||
var ignoredResources = map[schema.GroupVersionResource]struct{}{
|
||||
schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "replicationcontrollers"}: {},
|
||||
schema.GroupVersionResource{Group: "", Version: "v1", Resource: "bindings"}: {},
|
||||
schema.GroupVersionResource{Group: "", Version: "v1", Resource: "componentstatuses"}: {},
|
||||
schema.GroupVersionResource{Group: "", Version: "v1", Resource: "events"}: {},
|
||||
schema.GroupVersionResource{Group: "authentication.k8s.io", Version: "v1beta1", Resource: "tokenreviews"}: {},
|
||||
schema.GroupVersionResource{Group: "authorization.k8s.io", Version: "v1beta1", Resource: "subjectaccessreviews"}: {},
|
||||
schema.GroupVersionResource{Group: "authorization.k8s.io", Version: "v1beta1", Resource: "selfsubjectaccessreviews"}: {},
|
||||
schema.GroupVersionResource{Group: "authorization.k8s.io", Version: "v1beta1", Resource: "localsubjectaccessreviews"}: {},
|
||||
schema.GroupVersionResource{Group: "apiregistration.k8s.io", Version: "v1alpha1", Resource: "apiservices"}: {},
|
||||
{Group: "extensions", Version: "v1beta1", Resource: "replicationcontrollers"}: {},
|
||||
{Group: "", Version: "v1", Resource: "bindings"}: {},
|
||||
{Group: "", Version: "v1", Resource: "componentstatuses"}: {},
|
||||
{Group: "", Version: "v1", Resource: "events"}: {},
|
||||
{Group: "authentication.k8s.io", Version: "v1beta1", Resource: "tokenreviews"}: {},
|
||||
{Group: "authorization.k8s.io", Version: "v1beta1", Resource: "subjectaccessreviews"}: {},
|
||||
{Group: "authorization.k8s.io", Version: "v1beta1", Resource: "selfsubjectaccessreviews"}: {},
|
||||
{Group: "authorization.k8s.io", Version: "v1beta1", Resource: "localsubjectaccessreviews"}: {},
|
||||
{Group: "apiregistration.k8s.io", Version: "v1alpha1", Resource: "apiservices"}: {},
|
||||
}
|
||||
|
||||
func (gb *GraphBuilder) enqueueChanges(e *event) {
|
||||
|
|
|
@ -206,9 +206,9 @@ func TestOpenPodHostports(t *testing.T) {
|
|||
|
||||
// Socket
|
||||
hostPortMap := map[hostport]closeable{
|
||||
hostport{123, "tcp"}: &fakeSocket{123, "tcp", false},
|
||||
hostport{4567, "tcp"}: &fakeSocket{4567, "tcp", false},
|
||||
hostport{5678, "udp"}: &fakeSocket{5678, "udp", false},
|
||||
{123, "tcp"}: &fakeSocket{123, "tcp", false},
|
||||
{4567, "tcp"}: &fakeSocket{4567, "tcp", false},
|
||||
{5678, "udp"}: &fakeSocket{5678, "udp", false},
|
||||
}
|
||||
if !reflect.DeepEqual(hostPortMap, h.hostPortMap) {
|
||||
t.Fatalf("Mismatch in expected hostPortMap. Expected '%v', got '%v'", hostPortMap, h.hostPortMap)
|
||||
|
|
|
@ -249,11 +249,11 @@ func TestUpdatePodStatus(t *testing.T) {
|
|||
|
||||
// Setup probe "workers" and cached results.
|
||||
m.workers = map[probeKey]*worker{
|
||||
probeKey{testPodUID, unprobed.Name, liveness}: {},
|
||||
probeKey{testPodUID, probedReady.Name, readiness}: {},
|
||||
probeKey{testPodUID, probedPending.Name, readiness}: {},
|
||||
probeKey{testPodUID, probedUnready.Name, readiness}: {},
|
||||
probeKey{testPodUID, terminated.Name, readiness}: {},
|
||||
{testPodUID, unprobed.Name, liveness}: {},
|
||||
{testPodUID, probedReady.Name, readiness}: {},
|
||||
{testPodUID, probedPending.Name, readiness}: {},
|
||||
{testPodUID, probedUnready.Name, readiness}: {},
|
||||
{testPodUID, terminated.Name, readiness}: {},
|
||||
}
|
||||
m.readinessManager.Set(kubecontainer.ParseContainerID(probedReady.ContainerID), results.Success, &v1.Pod{})
|
||||
m.readinessManager.Set(kubecontainer.ParseContainerID(probedUnready.ContainerID), results.Failure, &v1.Pod{})
|
||||
|
@ -262,11 +262,11 @@ func TestUpdatePodStatus(t *testing.T) {
|
|||
m.UpdatePodStatus(testPodUID, &podStatus)
|
||||
|
||||
expectedReadiness := map[probeKey]bool{
|
||||
probeKey{testPodUID, unprobed.Name, readiness}: true,
|
||||
probeKey{testPodUID, probedReady.Name, readiness}: true,
|
||||
probeKey{testPodUID, probedPending.Name, readiness}: false,
|
||||
probeKey{testPodUID, probedUnready.Name, readiness}: false,
|
||||
probeKey{testPodUID, terminated.Name, readiness}: false,
|
||||
{testPodUID, unprobed.Name, readiness}: true,
|
||||
{testPodUID, probedReady.Name, readiness}: true,
|
||||
{testPodUID, probedPending.Name, readiness}: false,
|
||||
{testPodUID, probedUnready.Name, readiness}: false,
|
||||
{testPodUID, terminated.Name, readiness}: false,
|
||||
}
|
||||
for _, c := range podStatus.ContainerStatuses {
|
||||
expected, ok := expectedReadiness[probeKey{testPodUID, c.Name, readiness}]
|
||||
|
|
|
@ -56,10 +56,10 @@ func TestDeepHashObject(t *testing.T) {
|
|||
func() interface{} {
|
||||
return B{[]int{8, 6, 7}, map[string]bool{"5": true, "3": true, "0": true, "9": true}}
|
||||
},
|
||||
func() interface{} { return map[A]bool{A{8675309, "Jenny"}: true, A{9765683, "!Jenny"}: false} },
|
||||
func() interface{} { return map[C]bool{C{8675309, "Jenny"}: true, C{9765683, "!Jenny"}: false} },
|
||||
func() interface{} { return map[*A]bool{&A{8675309, "Jenny"}: true, &A{9765683, "!Jenny"}: false} },
|
||||
func() interface{} { return map[*C]bool{&C{8675309, "Jenny"}: true, &C{9765683, "!Jenny"}: false} },
|
||||
func() interface{} { return map[A]bool{{8675309, "Jenny"}: true, {9765683, "!Jenny"}: false} },
|
||||
func() interface{} { return map[C]bool{{8675309, "Jenny"}: true, {9765683, "!Jenny"}: false} },
|
||||
func() interface{} { return map[*A]bool{{8675309, "Jenny"}: true, {9765683, "!Jenny"}: false} },
|
||||
func() interface{} { return map[*C]bool{{8675309, "Jenny"}: true, {9765683, "!Jenny"}: false} },
|
||||
}
|
||||
|
||||
for _, tc := range successCases {
|
||||
|
|
|
@ -182,14 +182,14 @@ func TestCanSupport(t *testing.T) {
|
|||
assert.NoError(err)
|
||||
|
||||
specs := map[*volume.Spec]bool{
|
||||
&volume.Spec{
|
||||
{
|
||||
Volume: &v1.Volume{
|
||||
VolumeSource: v1.VolumeSource{
|
||||
Flocker: &v1.FlockerVolumeSource{},
|
||||
},
|
||||
},
|
||||
}: true,
|
||||
&volume.Spec{
|
||||
{
|
||||
PersistentVolume: &v1.PersistentVolume{
|
||||
Spec: v1.PersistentVolumeSpec{
|
||||
PersistentVolumeSource: v1.PersistentVolumeSource{
|
||||
|
@ -198,7 +198,7 @@ func TestCanSupport(t *testing.T) {
|
|||
},
|
||||
},
|
||||
}: true,
|
||||
&volume.Spec{
|
||||
{
|
||||
Volume: &v1.Volume{
|
||||
VolumeSource: v1.VolumeSource{},
|
||||
},
|
||||
|
|
|
@ -216,7 +216,7 @@ func (l *lifecycle) Validate() error {
|
|||
// accessReviewResources are resources which give a view into permissions in a namespace. Users must be allowed to create these
|
||||
// resources because returning "not found" errors allows someone to search for the "people I'm going to fire in 2017" namespace.
|
||||
var accessReviewResources = map[schema.GroupResource]bool{
|
||||
schema.GroupResource{Group: "authorization.k8s.io", Resource: "localsubjectaccessreviews"}: true,
|
||||
{Group: "authorization.k8s.io", Resource: "localsubjectaccessreviews"}: true,
|
||||
}
|
||||
|
||||
func isAccessReview(a admission.Attributes) bool {
|
||||
|
|
|
@ -39,7 +39,7 @@ const totalAnnotationSizeLimitB int = 256 * (1 << 10) // 256 kB
|
|||
|
||||
// BannedOwners is a black list of object that are not allowed to be owners.
|
||||
var BannedOwners = map[schema.GroupVersionKind]struct{}{
|
||||
schema.GroupVersionKind{Group: "", Version: "v1", Kind: "Event"}: {},
|
||||
{Group: "", Version: "v1", Kind: "Event"}: {},
|
||||
}
|
||||
|
||||
// ValidateClusterName can be used to check whether the given cluster name is valid.
|
||||
|
|
|
@ -129,13 +129,13 @@ const AllResources = "*"
|
|||
// specialDefaultResourcePrefixes are prefixes compiled into Kubernetes.
|
||||
// TODO: move out of this package, it is not generic
|
||||
var specialDefaultResourcePrefixes = map[schema.GroupResource]string{
|
||||
schema.GroupResource{Group: "", Resource: "replicationControllers"}: "controllers",
|
||||
schema.GroupResource{Group: "", Resource: "replicationcontrollers"}: "controllers",
|
||||
schema.GroupResource{Group: "", Resource: "endpoints"}: "services/endpoints",
|
||||
schema.GroupResource{Group: "", Resource: "nodes"}: "minions",
|
||||
schema.GroupResource{Group: "", Resource: "services"}: "services/specs",
|
||||
schema.GroupResource{Group: "extensions", Resource: "ingresses"}: "ingress",
|
||||
schema.GroupResource{Group: "extensions", Resource: "podsecuritypolicies"}: "podsecuritypolicy",
|
||||
{Group: "", Resource: "replicationControllers"}: "controllers",
|
||||
{Group: "", Resource: "replicationcontrollers"}: "controllers",
|
||||
{Group: "", Resource: "endpoints"}: "services/endpoints",
|
||||
{Group: "", Resource: "nodes"}: "minions",
|
||||
{Group: "", Resource: "services"}: "services/specs",
|
||||
{Group: "extensions", Resource: "ingresses"}: "ingress",
|
||||
{Group: "extensions", Resource: "podsecuritypolicies"}: "podsecuritypolicy",
|
||||
}
|
||||
|
||||
func NewDefaultStorageFactory(config storagebackend.Config, defaultMediaType string, defaultSerializer runtime.StorageSerializer, resourceEncodingConfig ResourceEncodingConfig, resourceConfig APIResourceConfigSource) *DefaultStorageFactory {
|
||||
|
|
|
@ -617,8 +617,8 @@ func TestServerPreferredNamespacedResources(t *testing.T) {
|
|||
w.Write(output)
|
||||
},
|
||||
expected: map[schema.GroupVersionResource]struct{}{
|
||||
schema.GroupVersionResource{Group: "", Version: "v1", Resource: "pods"}: {},
|
||||
schema.GroupVersionResource{Group: "", Version: "v1", Resource: "services"}: {},
|
||||
{Group: "", Version: "v1", Resource: "pods"}: {},
|
||||
{Group: "", Version: "v1", Resource: "services"}: {},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -660,8 +660,8 @@ func TestServerPreferredNamespacedResources(t *testing.T) {
|
|||
w.Write(output)
|
||||
},
|
||||
expected: map[schema.GroupVersionResource]struct{}{
|
||||
schema.GroupVersionResource{Group: "batch", Version: "v1", Resource: "jobs"}: {},
|
||||
schema.GroupVersionResource{Group: "batch", Version: "v2alpha1", Resource: "cronjobs"}: {},
|
||||
{Group: "batch", Version: "v1", Resource: "jobs"}: {},
|
||||
{Group: "batch", Version: "v2alpha1", Resource: "cronjobs"}: {},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -703,8 +703,8 @@ func TestServerPreferredNamespacedResources(t *testing.T) {
|
|||
w.Write(output)
|
||||
},
|
||||
expected: map[schema.GroupVersionResource]struct{}{
|
||||
schema.GroupVersionResource{Group: "batch", Version: "v2alpha1", Resource: "jobs"}: {},
|
||||
schema.GroupVersionResource{Group: "batch", Version: "v2alpha1", Resource: "cronjobs"}: {},
|
||||
{Group: "batch", Version: "v2alpha1", Resource: "jobs"}: {},
|
||||
{Group: "batch", Version: "v2alpha1", Resource: "cronjobs"}: {},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -307,13 +307,13 @@ func TestUpdate(t *testing.T) {
|
|||
// asynchronous, there are a lot of valid possibilities.
|
||||
type pair struct{ from, to string }
|
||||
allowedTransitions := map[pair]bool{
|
||||
pair{FROM, TO}: true,
|
||||
{FROM, TO}: true,
|
||||
|
||||
// Because a resync can happen when we've already observed one
|
||||
// of the above but before the item is deleted.
|
||||
pair{TO, TO}: true,
|
||||
{TO, TO}: true,
|
||||
// Because a resync could happen before we observe an update.
|
||||
pair{FROM, FROM}: true,
|
||||
{FROM, FROM}: true,
|
||||
}
|
||||
|
||||
pod := func(name, check string, final bool) *v1.Pod {
|
||||
|
|
Loading…
Reference in New Issue