diff --git a/build/build-image/Dockerfile b/build/build-image/Dockerfile index 61774b0e26..c5a2690835 100644 --- a/build/build-image/Dockerfile +++ b/build/build-image/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# ForceUpdate 6 -- change here if you need to force a rebuild +# ForceUpdate 7 -- change here if you need to force a rebuild # compiling proto + grpc takes an exceptionally long time # so we'll use a base from `base` - which is manually built using the below tag. diff --git a/install/helm/agones/scripts/delete_agones_resources.sh b/install/helm/agones/scripts/delete_agones_resources.sh index 776d1af0b9..6376ed8c99 100755 --- a/install/helm/agones/scripts/delete_agones_resources.sh +++ b/install/helm/agones/scripts/delete_agones_resources.sh @@ -33,6 +33,7 @@ for ns in $namespaces; do kubectl -n $ns delete gameservers --all kubectl -n $ns delete fleetallocations --all kubectl -n $ns delete gameserverallocations --all + kubectl -n $ns delete gameserverallocationpolicies --all # Since we don't have the nifty kubectl wait yet, hack one in the meantime for p in $pods; do diff --git a/install/helm/agones/templates/hooks/sa.yaml b/install/helm/agones/templates/hooks/sa.yaml index ab5b16f426..a6e8cfc84f 100644 --- a/install/helm/agones/templates/hooks/sa.yaml +++ b/install/helm/agones/templates/hooks/sa.yaml @@ -45,7 +45,7 @@ metadata: "helm.sh/hook-delete-policy": before-hook-creation rules: - apiGroups: ["stable.agones.dev"] - resources: ["fleets", "fleetallocations", "fleetautoscalers", "gameservers", "gameserversets", "gameserverallocations"] + resources: ["fleets", "fleetallocations", "fleetautoscalers", "gameservers", "gameserversets", "gameserverallocations", "gameserverallocationpolicies"] verbs: ["delete", "list" ] - apiGroups: [""] resources: ["pods"] diff --git a/pkg/apis/stable/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/stable/v1alpha1/zz_generated.deepcopy.go index 4b80f2be36..306ae44573 100644 --- a/pkg/apis/stable/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/stable/v1alpha1/zz_generated.deepcopy.go @@ -43,6 +43,23 @@ func (in *BufferPolicy) DeepCopy() *BufferPolicy { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterConnectionInfo) DeepCopyInto(out *ClusterConnectionInfo) { + *out = *in + in.AllocationServiceSecret.DeepCopyInto(&out.AllocationServiceSecret) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterConnectionInfo. +func (in *ClusterConnectionInfo) DeepCopy() *ClusterConnectionInfo { + if in == nil { + return nil + } + out := new(ClusterConnectionInfo) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Fleet) DeepCopyInto(out *Fleet) { *out = *in @@ -533,6 +550,83 @@ func (in *GameServerAllocationList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GameServerAllocationPolicy) DeepCopyInto(out *GameServerAllocationPolicy) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GameServerAllocationPolicy. +func (in *GameServerAllocationPolicy) DeepCopy() *GameServerAllocationPolicy { + if in == nil { + return nil + } + out := new(GameServerAllocationPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GameServerAllocationPolicy) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GameServerAllocationPolicyList) DeepCopyInto(out *GameServerAllocationPolicyList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]GameServerAllocationPolicy, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GameServerAllocationPolicyList. +func (in *GameServerAllocationPolicyList) DeepCopy() *GameServerAllocationPolicyList { + if in == nil { + return nil + } + out := new(GameServerAllocationPolicyList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GameServerAllocationPolicyList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GameServerAllocationPolicySpec) DeepCopyInto(out *GameServerAllocationPolicySpec) { + *out = *in + in.ConnectionInfo.DeepCopyInto(&out.ConnectionInfo) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GameServerAllocationPolicySpec. +func (in *GameServerAllocationPolicySpec) DeepCopy() *GameServerAllocationPolicySpec { + if in == nil { + return nil + } + out := new(GameServerAllocationPolicySpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GameServerAllocationSpec) DeepCopyInto(out *GameServerAllocationSpec) { *out = *in @@ -884,79 +978,3 @@ func (in *WebhookPolicy) DeepCopy() *WebhookPolicy { in.DeepCopyInto(out) return out } - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GameServerAllocationPolicy) DeepCopyInto(out *GameServerAllocationPolicy) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GameServerAllocationPolicy. -func (in *GameServerAllocationPolicy) DeepCopy() *GameServerAllocationPolicy { - if in == nil { - return nil - } - out := new(GameServerAllocationPolicy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *GameServerAllocationPolicy) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GameServerAllocationPolicyList) DeepCopyInto(out *GameServerAllocationPolicyList) { - *out = *in - out.TypeMeta = in.TypeMeta - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]GameServerAllocationPolicy, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GameServerAllocationPolicyList. -func (in *GameServerAllocationPolicyList) DeepCopy() *GameServerAllocationPolicyList { - if in == nil { - return nil - } - out := new(GameServerAllocationPolicyList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *GameServerAllocationPolicyList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GameServerAllocationPolicySpec) DeepCopyInto(out *GameServerAllocationPolicySpec) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GameServerAllocationPolicySpec. -func (in *GameServerAllocationPolicySpec) DeepCopy() *GameServerAllocationPolicySpec { - if in == nil { - return nil - } - out := new(GameServerAllocationPolicySpec) - in.DeepCopyInto(out) - return out -} diff --git a/pkg/client/clientset/versioned/typed/stable/v1alpha1/fake/fake_gameserverallocationpolicy.go b/pkg/client/clientset/versioned/typed/stable/v1alpha1/fake/fake_gameserverallocationpolicy.go new file mode 100644 index 0000000000..61c3912fa6 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/stable/v1alpha1/fake/fake_gameserverallocationpolicy.go @@ -0,0 +1,128 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was autogenerated. Do not edit directly. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "agones.dev/agones/pkg/apis/stable/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeGameServerAllocationPolicies implements GameServerAllocationPolicyInterface +type FakeGameServerAllocationPolicies struct { + Fake *FakeStableV1alpha1 + ns string +} + +var gameserverallocationpoliciesResource = schema.GroupVersionResource{Group: "stable.agones.dev", Version: "v1alpha1", Resource: "gameserverallocationpolicies"} + +var gameserverallocationpoliciesKind = schema.GroupVersionKind{Group: "stable.agones.dev", Version: "v1alpha1", Kind: "GameServerAllocationPolicy"} + +// Get takes name of the gameServerAllocationPolicy, and returns the corresponding gameServerAllocationPolicy object, and an error if there is any. +func (c *FakeGameServerAllocationPolicies) Get(name string, options v1.GetOptions) (result *v1alpha1.GameServerAllocationPolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(gameserverallocationpoliciesResource, c.ns, name), &v1alpha1.GameServerAllocationPolicy{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.GameServerAllocationPolicy), err +} + +// List takes label and field selectors, and returns the list of GameServerAllocationPolicies that match those selectors. +func (c *FakeGameServerAllocationPolicies) List(opts v1.ListOptions) (result *v1alpha1.GameServerAllocationPolicyList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(gameserverallocationpoliciesResource, gameserverallocationpoliciesKind, c.ns, opts), &v1alpha1.GameServerAllocationPolicyList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.GameServerAllocationPolicyList{ListMeta: obj.(*v1alpha1.GameServerAllocationPolicyList).ListMeta} + for _, item := range obj.(*v1alpha1.GameServerAllocationPolicyList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested gameServerAllocationPolicies. +func (c *FakeGameServerAllocationPolicies) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(gameserverallocationpoliciesResource, c.ns, opts)) + +} + +// Create takes the representation of a gameServerAllocationPolicy and creates it. Returns the server's representation of the gameServerAllocationPolicy, and an error, if there is any. +func (c *FakeGameServerAllocationPolicies) Create(gameServerAllocationPolicy *v1alpha1.GameServerAllocationPolicy) (result *v1alpha1.GameServerAllocationPolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(gameserverallocationpoliciesResource, c.ns, gameServerAllocationPolicy), &v1alpha1.GameServerAllocationPolicy{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.GameServerAllocationPolicy), err +} + +// Update takes the representation of a gameServerAllocationPolicy and updates it. Returns the server's representation of the gameServerAllocationPolicy, and an error, if there is any. +func (c *FakeGameServerAllocationPolicies) Update(gameServerAllocationPolicy *v1alpha1.GameServerAllocationPolicy) (result *v1alpha1.GameServerAllocationPolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(gameserverallocationpoliciesResource, c.ns, gameServerAllocationPolicy), &v1alpha1.GameServerAllocationPolicy{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.GameServerAllocationPolicy), err +} + +// Delete takes name of the gameServerAllocationPolicy and deletes it. Returns an error if one occurs. +func (c *FakeGameServerAllocationPolicies) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(gameserverallocationpoliciesResource, c.ns, name), &v1alpha1.GameServerAllocationPolicy{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeGameServerAllocationPolicies) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(gameserverallocationpoliciesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.GameServerAllocationPolicyList{}) + return err +} + +// Patch applies the patch and returns the patched gameServerAllocationPolicy. +func (c *FakeGameServerAllocationPolicies) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.GameServerAllocationPolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(gameserverallocationpoliciesResource, c.ns, name, data, subresources...), &v1alpha1.GameServerAllocationPolicy{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.GameServerAllocationPolicy), err +} diff --git a/pkg/client/clientset/versioned/typed/stable/v1alpha1/fake/fake_stable_client.go b/pkg/client/clientset/versioned/typed/stable/v1alpha1/fake/fake_stable_client.go index 633eecff88..9d54558fcd 100644 --- a/pkg/client/clientset/versioned/typed/stable/v1alpha1/fake/fake_stable_client.go +++ b/pkg/client/clientset/versioned/typed/stable/v1alpha1/fake/fake_stable_client.go @@ -48,6 +48,10 @@ func (c *FakeStableV1alpha1) GameServerAllocations(namespace string) v1alpha1.Ga return &FakeGameServerAllocations{c, namespace} } +func (c *FakeStableV1alpha1) GameServerAllocationPolicies(namespace string) v1alpha1.GameServerAllocationPolicyInterface { + return &FakeGameServerAllocationPolicies{c, namespace} +} + func (c *FakeStableV1alpha1) GameServerSets(namespace string) v1alpha1.GameServerSetInterface { return &FakeGameServerSets{c, namespace} } diff --git a/pkg/client/clientset/versioned/typed/stable/v1alpha1/gameserverallocationpolicy.go b/pkg/client/clientset/versioned/typed/stable/v1alpha1/gameserverallocationpolicy.go new file mode 100644 index 0000000000..34a86d690b --- /dev/null +++ b/pkg/client/clientset/versioned/typed/stable/v1alpha1/gameserverallocationpolicy.go @@ -0,0 +1,157 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was autogenerated. Do not edit directly. + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "agones.dev/agones/pkg/apis/stable/v1alpha1" + scheme "agones.dev/agones/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// GameServerAllocationPoliciesGetter has a method to return a GameServerAllocationPolicyInterface. +// A group's client should implement this interface. +type GameServerAllocationPoliciesGetter interface { + GameServerAllocationPolicies(namespace string) GameServerAllocationPolicyInterface +} + +// GameServerAllocationPolicyInterface has methods to work with GameServerAllocationPolicy resources. +type GameServerAllocationPolicyInterface interface { + Create(*v1alpha1.GameServerAllocationPolicy) (*v1alpha1.GameServerAllocationPolicy, error) + Update(*v1alpha1.GameServerAllocationPolicy) (*v1alpha1.GameServerAllocationPolicy, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.GameServerAllocationPolicy, error) + List(opts v1.ListOptions) (*v1alpha1.GameServerAllocationPolicyList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.GameServerAllocationPolicy, err error) + GameServerAllocationPolicyExpansion +} + +// gameServerAllocationPolicies implements GameServerAllocationPolicyInterface +type gameServerAllocationPolicies struct { + client rest.Interface + ns string +} + +// newGameServerAllocationPolicies returns a GameServerAllocationPolicies +func newGameServerAllocationPolicies(c *StableV1alpha1Client, namespace string) *gameServerAllocationPolicies { + return &gameServerAllocationPolicies{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the gameServerAllocationPolicy, and returns the corresponding gameServerAllocationPolicy object, and an error if there is any. +func (c *gameServerAllocationPolicies) Get(name string, options v1.GetOptions) (result *v1alpha1.GameServerAllocationPolicy, err error) { + result = &v1alpha1.GameServerAllocationPolicy{} + err = c.client.Get(). + Namespace(c.ns). + Resource("gameserverallocationpolicies"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of GameServerAllocationPolicies that match those selectors. +func (c *gameServerAllocationPolicies) List(opts v1.ListOptions) (result *v1alpha1.GameServerAllocationPolicyList, err error) { + result = &v1alpha1.GameServerAllocationPolicyList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("gameserverallocationpolicies"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested gameServerAllocationPolicies. +func (c *gameServerAllocationPolicies) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("gameserverallocationpolicies"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a gameServerAllocationPolicy and creates it. Returns the server's representation of the gameServerAllocationPolicy, and an error, if there is any. +func (c *gameServerAllocationPolicies) Create(gameServerAllocationPolicy *v1alpha1.GameServerAllocationPolicy) (result *v1alpha1.GameServerAllocationPolicy, err error) { + result = &v1alpha1.GameServerAllocationPolicy{} + err = c.client.Post(). + Namespace(c.ns). + Resource("gameserverallocationpolicies"). + Body(gameServerAllocationPolicy). + Do(). + Into(result) + return +} + +// Update takes the representation of a gameServerAllocationPolicy and updates it. Returns the server's representation of the gameServerAllocationPolicy, and an error, if there is any. +func (c *gameServerAllocationPolicies) Update(gameServerAllocationPolicy *v1alpha1.GameServerAllocationPolicy) (result *v1alpha1.GameServerAllocationPolicy, err error) { + result = &v1alpha1.GameServerAllocationPolicy{} + err = c.client.Put(). + Namespace(c.ns). + Resource("gameserverallocationpolicies"). + Name(gameServerAllocationPolicy.Name). + Body(gameServerAllocationPolicy). + Do(). + Into(result) + return +} + +// Delete takes name of the gameServerAllocationPolicy and deletes it. Returns an error if one occurs. +func (c *gameServerAllocationPolicies) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("gameserverallocationpolicies"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *gameServerAllocationPolicies) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("gameserverallocationpolicies"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched gameServerAllocationPolicy. +func (c *gameServerAllocationPolicies) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.GameServerAllocationPolicy, err error) { + result = &v1alpha1.GameServerAllocationPolicy{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("gameserverallocationpolicies"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/stable/v1alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/stable/v1alpha1/generated_expansion.go index 9142b35894..dd0d563bc8 100644 --- a/pkg/client/clientset/versioned/typed/stable/v1alpha1/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/stable/v1alpha1/generated_expansion.go @@ -28,4 +28,6 @@ type GameServerExpansion interface{} type GameServerAllocationExpansion interface{} +type GameServerAllocationPolicyExpansion interface{} + type GameServerSetExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/stable/v1alpha1/stable_client.go b/pkg/client/clientset/versioned/typed/stable/v1alpha1/stable_client.go index f03f9a3b14..42c878bf57 100644 --- a/pkg/client/clientset/versioned/typed/stable/v1alpha1/stable_client.go +++ b/pkg/client/clientset/versioned/typed/stable/v1alpha1/stable_client.go @@ -32,6 +32,7 @@ type StableV1alpha1Interface interface { FleetAutoscalersGetter GameServersGetter GameServerAllocationsGetter + GameServerAllocationPoliciesGetter GameServerSetsGetter } @@ -60,6 +61,10 @@ func (c *StableV1alpha1Client) GameServerAllocations(namespace string) GameServe return newGameServerAllocations(c, namespace) } +func (c *StableV1alpha1Client) GameServerAllocationPolicies(namespace string) GameServerAllocationPolicyInterface { + return newGameServerAllocationPolicies(c, namespace) +} + func (c *StableV1alpha1Client) GameServerSets(namespace string) GameServerSetInterface { return newGameServerSets(c, namespace) } diff --git a/pkg/client/doc.go b/pkg/client/doc.go deleted file mode 100644 index 6464ba341f..0000000000 --- a/pkg/client/doc.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2018 Google LLC All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package client contains the generated client for the Custom Resource Definitions -package client diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index bef80a7620..76b4e2e66a 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -63,6 +63,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Stable().V1alpha1().GameServers().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("gameserverallocations"): return &genericInformer{resource: resource.GroupResource(), informer: f.Stable().V1alpha1().GameServerAllocations().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("gameserverallocationpolicies"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Stable().V1alpha1().GameServerAllocationPolicies().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("gameserversets"): return &genericInformer{resource: resource.GroupResource(), informer: f.Stable().V1alpha1().GameServerSets().Informer()}, nil diff --git a/pkg/client/informers/externalversions/stable/v1alpha1/gameserverallocationpolicy.go b/pkg/client/informers/externalversions/stable/v1alpha1/gameserverallocationpolicy.go new file mode 100644 index 0000000000..9e3adf28c9 --- /dev/null +++ b/pkg/client/informers/externalversions/stable/v1alpha1/gameserverallocationpolicy.go @@ -0,0 +1,89 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was autogenerated. Do not edit directly. + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + time "time" + + stable_v1alpha1 "agones.dev/agones/pkg/apis/stable/v1alpha1" + versioned "agones.dev/agones/pkg/client/clientset/versioned" + internalinterfaces "agones.dev/agones/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "agones.dev/agones/pkg/client/listers/stable/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// GameServerAllocationPolicyInformer provides access to a shared informer and lister for +// GameServerAllocationPolicies. +type GameServerAllocationPolicyInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.GameServerAllocationPolicyLister +} + +type gameServerAllocationPolicyInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewGameServerAllocationPolicyInformer constructs a new informer for GameServerAllocationPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewGameServerAllocationPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredGameServerAllocationPolicyInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredGameServerAllocationPolicyInformer constructs a new informer for GameServerAllocationPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredGameServerAllocationPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StableV1alpha1().GameServerAllocationPolicies(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StableV1alpha1().GameServerAllocationPolicies(namespace).Watch(options) + }, + }, + &stable_v1alpha1.GameServerAllocationPolicy{}, + resyncPeriod, + indexers, + ) +} + +func (f *gameServerAllocationPolicyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredGameServerAllocationPolicyInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *gameServerAllocationPolicyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&stable_v1alpha1.GameServerAllocationPolicy{}, f.defaultInformer) +} + +func (f *gameServerAllocationPolicyInformer) Lister() v1alpha1.GameServerAllocationPolicyLister { + return v1alpha1.NewGameServerAllocationPolicyLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/stable/v1alpha1/interface.go b/pkg/client/informers/externalversions/stable/v1alpha1/interface.go index aea83baa83..1f188e75cd 100644 --- a/pkg/client/informers/externalversions/stable/v1alpha1/interface.go +++ b/pkg/client/informers/externalversions/stable/v1alpha1/interface.go @@ -34,6 +34,8 @@ type Interface interface { GameServers() GameServerInformer // GameServerAllocations returns a GameServerAllocationInformer. GameServerAllocations() GameServerAllocationInformer + // GameServerAllocationPolicies returns a GameServerAllocationPolicyInformer. + GameServerAllocationPolicies() GameServerAllocationPolicyInformer // GameServerSets returns a GameServerSetInformer. GameServerSets() GameServerSetInformer } @@ -74,6 +76,11 @@ func (v *version) GameServerAllocations() GameServerAllocationInformer { return &gameServerAllocationInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } +// GameServerAllocationPolicies returns a GameServerAllocationPolicyInformer. +func (v *version) GameServerAllocationPolicies() GameServerAllocationPolicyInformer { + return &gameServerAllocationPolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + // GameServerSets returns a GameServerSetInformer. func (v *version) GameServerSets() GameServerSetInformer { return &gameServerSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/pkg/client/listers/stable/v1alpha1/expansion_generated.go b/pkg/client/listers/stable/v1alpha1/expansion_generated.go index 2ea00f1b1d..999eeddb1a 100644 --- a/pkg/client/listers/stable/v1alpha1/expansion_generated.go +++ b/pkg/client/listers/stable/v1alpha1/expansion_generated.go @@ -58,6 +58,14 @@ type GameServerAllocationListerExpansion interface{} // GameServerAllocationNamespaceLister. type GameServerAllocationNamespaceListerExpansion interface{} +// GameServerAllocationPolicyListerExpansion allows custom methods to be added to +// GameServerAllocationPolicyLister. +type GameServerAllocationPolicyListerExpansion interface{} + +// GameServerAllocationPolicyNamespaceListerExpansion allows custom methods to be added to +// GameServerAllocationPolicyNamespaceLister. +type GameServerAllocationPolicyNamespaceListerExpansion interface{} + // GameServerSetListerExpansion allows custom methods to be added to // GameServerSetLister. type GameServerSetListerExpansion interface{} diff --git a/pkg/client/listers/stable/v1alpha1/gameserverallocationpolicy.go b/pkg/client/listers/stable/v1alpha1/gameserverallocationpolicy.go new file mode 100644 index 0000000000..e208c613b7 --- /dev/null +++ b/pkg/client/listers/stable/v1alpha1/gameserverallocationpolicy.go @@ -0,0 +1,94 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was autogenerated. Do not edit directly. + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "agones.dev/agones/pkg/apis/stable/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// GameServerAllocationPolicyLister helps list GameServerAllocationPolicies. +type GameServerAllocationPolicyLister interface { + // List lists all GameServerAllocationPolicies in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.GameServerAllocationPolicy, err error) + // GameServerAllocationPolicies returns an object that can list and get GameServerAllocationPolicies. + GameServerAllocationPolicies(namespace string) GameServerAllocationPolicyNamespaceLister + GameServerAllocationPolicyListerExpansion +} + +// gameServerAllocationPolicyLister implements the GameServerAllocationPolicyLister interface. +type gameServerAllocationPolicyLister struct { + indexer cache.Indexer +} + +// NewGameServerAllocationPolicyLister returns a new GameServerAllocationPolicyLister. +func NewGameServerAllocationPolicyLister(indexer cache.Indexer) GameServerAllocationPolicyLister { + return &gameServerAllocationPolicyLister{indexer: indexer} +} + +// List lists all GameServerAllocationPolicies in the indexer. +func (s *gameServerAllocationPolicyLister) List(selector labels.Selector) (ret []*v1alpha1.GameServerAllocationPolicy, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.GameServerAllocationPolicy)) + }) + return ret, err +} + +// GameServerAllocationPolicies returns an object that can list and get GameServerAllocationPolicies. +func (s *gameServerAllocationPolicyLister) GameServerAllocationPolicies(namespace string) GameServerAllocationPolicyNamespaceLister { + return gameServerAllocationPolicyNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// GameServerAllocationPolicyNamespaceLister helps list and get GameServerAllocationPolicies. +type GameServerAllocationPolicyNamespaceLister interface { + // List lists all GameServerAllocationPolicies in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha1.GameServerAllocationPolicy, err error) + // Get retrieves the GameServerAllocationPolicy from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.GameServerAllocationPolicy, error) + GameServerAllocationPolicyNamespaceListerExpansion +} + +// gameServerAllocationPolicyNamespaceLister implements the GameServerAllocationPolicyNamespaceLister +// interface. +type gameServerAllocationPolicyNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all GameServerAllocationPolicies in the indexer for a given namespace. +func (s gameServerAllocationPolicyNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.GameServerAllocationPolicy, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.GameServerAllocationPolicy)) + }) + return ret, err +} + +// Get retrieves the GameServerAllocationPolicy from the indexer for a given namespace and name. +func (s gameServerAllocationPolicyNamespaceLister) Get(name string) (*v1alpha1.GameServerAllocationPolicy, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("gameserverallocationpolicy"), name) + } + return obj.(*v1alpha1.GameServerAllocationPolicy), nil +}