Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move FleetAutoscaling to autoscaling.agones.dev group #829

Merged
merged 2 commits into from
Jun 17, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/build-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# ForceUpdate 7 -- change here if you need to force a rebuild
# ForceUpdate 8 -- change here if you need to force a rebuild

FROM debian:stretch

Expand Down
2 changes: 1 addition & 1 deletion build/build-image/gen-crd-client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ rsync -r /go/src/agones.dev/agones/vendor/k8s.io/ /go/src/k8s.io/
cd /go/src/k8s.io/code-generator
./generate-groups.sh "all" \
agones.dev/agones/pkg/client \
agones.dev/agones/pkg/apis "allocation:v1alpha1 stable:v1alpha1 multicluster:v1alpha1" \
agones.dev/agones/pkg/apis "allocation:v1alpha1 stable:v1alpha1 multicluster:v1alpha1 autoscaling:v1alpha1" \
--go-header-file=/go/src/agones.dev/agones/build/boilerplate.go.txt

2 changes: 1 addition & 1 deletion examples/autoscaler-webhook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"os"
"strconv"

"agones.dev/agones/pkg/apis/stable/v1alpha1"
"agones.dev/agones/pkg/apis/autoscaling/v1alpha1"
"agones.dev/agones/pkg/util/runtime" // for the logger
)

Expand Down
2 changes: 1 addition & 1 deletion examples/fleetautoscaler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# automatically depending on load
#

apiVersion: "stable.agones.dev/v1alpha1"
apiVersion: "autoscaling.agones.dev/v1alpha1"
kind: FleetAutoscaler
metadata:
# FleetAutoscaler Metadata
Expand Down
2 changes: 1 addition & 1 deletion examples/simple-udp/fleetautoscaler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# up and down depending on usage
#

apiVersion: "stable.agones.dev/v1alpha1"
apiVersion: "autoscaling.agones.dev/v1alpha1"
kind: FleetAutoscaler
metadata:
name: simple-udp-autoscaler
Expand Down
2 changes: 1 addition & 1 deletion examples/webhookfleetautoscaler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# Full example of a FleetAutoscaler - this is used to scale a Fleet
# automatically depending on load
#
apiVersion: "stable.agones.dev/v1alpha1"
apiVersion: "autoscaling.agones.dev/v1alpha1"
kind: FleetAutoscaler
metadata:
name: webhook-fleet-autoscaler
Expand Down
2 changes: 1 addition & 1 deletion examples/webhookfleetautoscalertls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# Full example of a FleetAutoscaler - this is used to scale a Fleet
# automatically depending on load
#
apiVersion: "stable.agones.dev/v1alpha1"
apiVersion: "autoscaling.agones.dev/v1alpha1"
kind: FleetAutoscaler
metadata:
name: webhook-fleetautoscaler-tls
Expand Down
2 changes: 1 addition & 1 deletion examples/xonotic/fleetautoscaler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# up and down depending on usage
#

apiVersion: "stable.agones.dev/v1alpha1"
apiVersion: "autoscaling.agones.dev/v1alpha1"
kind: FleetAutoscaler
metadata:
name: xonotic-autoscaler
Expand Down
4 changes: 2 additions & 2 deletions install/helm/agones/templates/crds/fleetautoscaler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: fleetautoscalers.stable.agones.dev
name: fleetautoscalers.autoscaling.agones.dev
labels:
component: crd
app: {{ template "agones.name" . }}
chart: {{ template "agones.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
group: stable.agones.dev
group: autoscaling.agones.dev
version: v1alpha1
scope: Namespaced
names:
Expand Down
10 changes: 9 additions & 1 deletion install/helm/agones/templates/extensions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ webhooks:
- "gameservers"
- "gameserversets"
- "fleetallocations"
- "fleetautoscalers"
apiVersions:
- "v1alpha1"
operations:
Expand All @@ -86,11 +85,20 @@ webhooks:
- "fleets"
- "gameserversets"
- "fleetallocations"
apiVersions:
- "v1alpha1"
operations:
- UPDATE
- apiGroups:
- autoscaling.agones.dev
resources:
- "fleetautoscalers"
apiVersions:
- "v1alpha1"
operations:
- CREATE
- UPDATE

---
apiVersion: admissionregistration.k8s.io/v1beta1
kind: MutatingWebhookConfiguration
Expand Down
2 changes: 1 addition & 1 deletion install/helm/agones/templates/hooks/sa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ metadata:
"helm.sh/hook-weight": "-5"
"helm.sh/hook-delete-policy": before-hook-creation
rules:
- apiGroups: ["stable.agones.dev", "multicluster.agones.dev"]
- apiGroups: ["stable.agones.dev", "multicluster.agones.dev", "autoscaling.agones.dev"]
resources: ["fleets", "fleetallocations", "fleetautoscalers", "gameservers", "gameserversets", "gameserverallocationpolicies"]
verbs: ["delete", "list" ]
- apiGroups: [""]
Expand Down
10 changes: 8 additions & 2 deletions install/helm/agones/templates/serviceaccounts/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,20 @@ rules:
resources: ["gameservers"]
verbs: ["patch"]
- apiGroups: ["stable.agones.dev"]
resources: ["fleets", "fleetallocations", "fleetautoscalers"]
resources: ["fleets", "fleetallocations"]
verbs: ["get", "list", "update", "watch"]
- apiGroups: ["stable.agones.dev"]
resources: ["fleets/status", "fleetautoscalers/status", "gameserversets/status"]
resources: ["fleets/status", "gameserversets/status"]
verbs: ["update"]
- apiGroups: ["multicluster.agones.dev"]
resources: ["gameserverallocationpolicies"]
verbs: ["create", "delete", "get", "list", "update", "watch"]
- apiGroups: ["autoscaling.agones.dev"]
resources: ["fleetautoscalers"]
verbs: ["get", "list", "update", "watch"]
- apiGroups: ["autoscaling.agones.dev"]
resources: ["fleetautoscalers/status"]
verbs: ["update"]


---
Expand Down
24 changes: 19 additions & 5 deletions install/yaml/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,20 @@ rules:
resources: ["gameservers"]
verbs: ["patch"]
- apiGroups: ["stable.agones.dev"]
resources: ["fleets", "fleetallocations", "fleetautoscalers"]
resources: ["fleets", "fleetallocations"]
verbs: ["get", "list", "update", "watch"]
- apiGroups: ["stable.agones.dev"]
resources: ["fleets/status", "fleetautoscalers/status", "gameserversets/status"]
resources: ["fleets/status", "gameserversets/status"]
verbs: ["update"]
- apiGroups: ["multicluster.agones.dev"]
resources: ["gameserverallocationpolicies"]
verbs: ["create", "delete", "get", "list", "update", "watch"]
- apiGroups: ["autoscaling.agones.dev"]
resources: ["fleetautoscalers"]
verbs: ["get", "list", "update", "watch"]
- apiGroups: ["autoscaling.agones.dev"]
resources: ["fleetautoscalers/status"]
verbs: ["update"]


---
Expand Down Expand Up @@ -458,15 +464,15 @@ spec:
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: fleetautoscalers.stable.agones.dev
name: fleetautoscalers.autoscaling.agones.dev
labels:
component: crd
app: agones
chart: agones-0.11.0
release: agones-manual
heritage: Tiller
spec:
group: stable.agones.dev
group: autoscaling.agones.dev
version: v1alpha1
scope: Namespaced
names:
Expand Down Expand Up @@ -1483,7 +1489,6 @@ webhooks:
- "gameservers"
- "gameserversets"
- "fleetallocations"
- "fleetautoscalers"
apiVersions:
- "v1alpha1"
operations:
Expand All @@ -1494,11 +1499,20 @@ webhooks:
- "fleets"
- "gameserversets"
- "fleetallocations"
apiVersions:
- "v1alpha1"
operations:
- UPDATE
- apiGroups:
- autoscaling.agones.dev
resources:
- "fleetautoscalers"
apiVersions:
- "v1alpha1"
operations:
- CREATE
- UPDATE

---
apiVersion: admissionregistration.k8s.io/v1beta1
kind: MutatingWebhookConfiguration
Expand Down
18 changes: 18 additions & 0 deletions pkg/apis/allocation/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions pkg/apis/autoscaling/register.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2019 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 autoscaling

const (
// GroupName is the Scheme Group Name for Agones Custom Resource Definitions
GroupName = "autoscaling.agones.dev"
)
19 changes: 19 additions & 0 deletions pkg/apis/autoscaling/v1alpha1/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2019 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.

// +k8s:deepcopy-gen=package,register

// Package v1alpha1 is the v1alpha1 version of the API.
// +groupName=autoscaling.agones.dev
package v1alpha1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2018 Google LLC All Rights Reserved.
// Copyright 2019 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.
Expand All @@ -18,6 +18,7 @@ import (
"crypto/x509"
"net/url"

"agones.dev/agones/pkg/apis/stable/v1alpha1"
admregv1b "k8s.io/api/admissionregistration/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -143,7 +144,7 @@ type FleetAutoscaleRequest struct {
// Namespace is the namespace associated with the request (if any).
Namespace string `json:"namespace"`
// The Fleet's status values
Status FleetStatus `json:"status"`
Status v1alpha1.FleetStatus `json:"status"`
}

// FleetAutoscaleResponse defines the response of webhook autoscaler endpoint
Expand Down
59 changes: 59 additions & 0 deletions pkg/apis/autoscaling/v1alpha1/register.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright 2019 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 v1alpha1

import (
"agones.dev/agones/pkg/apis/autoscaling"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
k8sruntime "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/kubernetes/scheme"
)

// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: autoscaling.GroupName, Version: "v1alpha1"}

// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}

// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}

var (
// SchemeBuilder registers our types
SchemeBuilder = k8sruntime.NewSchemeBuilder(addKnownTypes)
// AddToScheme local alias for SchemeBuilder.AddToScheme
AddToScheme = SchemeBuilder.AddToScheme
)

func init() {
if err := AddToScheme(scheme.Scheme); err != nil {
panic(err)
}
}

// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *k8sruntime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&FleetAutoscaler{},
&FleetAutoscalerList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}
Loading