From fb229cbc445ec5946f4ee52a341fd0dc9a8d98eb Mon Sep 17 00:00:00 2001 From: Cyril TOVENA Date: Fri, 8 Jun 2018 10:01:21 -0400 Subject: [PATCH] use the helm --namespace convention and drop agones.namespace to follow helm standard. --- build/Makefile | 4 +-- install/helm/README.md | 11 +++--- install/helm/agones/templates/NOTES.txt | 4 +-- .../templates/admissionregistration.yaml | 11 +++--- install/helm/agones/templates/controller.yaml | 1 - install/helm/agones/templates/namespace.yaml | 23 ------------- install/helm/agones/templates/service.yaml | 1 - .../templates/serviceaccounts/controller.yaml | 5 +-- .../agones/templates/serviceaccounts/sdk.yaml | 1 - install/helm/agones/values.yaml | 1 - install/yaml/install.yaml | 34 ------------------- 11 files changed, 15 insertions(+), 81 deletions(-) delete mode 100644 install/helm/agones/templates/namespace.yaml diff --git a/build/Makefile b/build/Makefile index 224584b388..37c2bcb818 100644 --- a/build/Makefile +++ b/build/Makefile @@ -126,7 +126,7 @@ install: ALWAYS_PULL_SIDECAR := true install: IMAGE_PULL_POLICY := "Always" install: ensure-build-image docker run --rm $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) \ - helm upgrade --install --namespace=default \ + helm upgrade --install --namespace=agones-system \ --set agones.image.tag=$(VERSION),agones.image.registry=$(REGISTRY),agones.image.controller.pullPolicy=$(IMAGE_PULL_POLICY),agones.image.sdk.alwaysPull=$(ALWAYS_PULL_SIDECAR) \ agones $(mount_path)/install/helm/agones/ @@ -176,7 +176,7 @@ push-agones-sdk-image: ensure-build-image # Generate the static install script gen-install: ensure-build-image docker run --rm $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) bash -c \ - 'helm template --name=agones-manual $(mount_path)/install/helm/agones \ + 'helm template --name=agones-manual --namespace agones-system $(mount_path)/install/helm/agones \ --set agones.controller.generateTLS=false \ > $(mount_path)/install/yaml/install.yaml' diff --git a/install/helm/README.md b/install/helm/README.md index 986f0714b6..edfb93a609 100644 --- a/install/helm/README.md +++ b/install/helm/README.md @@ -21,11 +21,13 @@ Download the latest `agones-install` zip from the [releases](https://github.com/ $ wget https://github.com/GoogleCloudPlatform/agones/releases/download/v0.2.0/agones-install-0.2.0.zip $ unzip agones-install-0.2.0.zip $ cd install/helm/ -$ helm install --name my-release agones +$ helm install --name my-release --namespace agones-system agones ``` The command deploys Agones on the Kubernetes cluster with the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. +_We recommend to install Agones in its own namespaces (like `agones-system` as shown above) +you can use the helm `--namespace` parameter to specify a different namespace._ > **Tip**: List all releases using `helm list` @@ -37,7 +39,7 @@ For example to use `default` **and** `xbox` namespaces: ```bash $ kubectl create namespace xbox -$ helm install --set "gameservers.namespaces={default,xbox}"--name my-release agones +$ helm install --set "gameservers.namespaces={default,xbox}" --namespace agones-system --name my-release agones ``` > You need to create your namespaces before installing Agones. @@ -74,7 +76,6 @@ The following tables lists the configurable parameters of the Agones chart and t | Parameter | Description | Default | | ------------------------------------ | ----------------------------------------------------------------| ---------------------------| | `agones.rbacEnabled` | Creates RBAC resources. Must be set for any cluster configured with RBAC | `true` | -| `agones.namespace` | Namespace to use to deploy Agones | `agones-system` | | `agones.serviceaccount.controller` | Service account name for the controller | `agones-controller` | | `agones.serviceaccount.sdk` | Service account name for the sdk | `agones-sdk` | | `agones.image.registry` | Global image registry for all images | `gcr.io/agones-images` | @@ -97,7 +98,7 @@ The following tables lists the configurable parameters of the Agones chart and t Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, ```bash -$ helm install --name my-release \ +$ helm install --name my-release --namespace agones-system \ --set agones.namespace=mynamespace,gameservers.minPort=1000,gamesevers.maxPort=5000 agones ``` @@ -106,7 +107,7 @@ The above command sets the namespace where Agones is deployed to `mynamespace`. Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example, ```bash -$ helm install --name my-release -f values.yaml agones +$ helm install --name my-release --namespace agones-system -f values.yaml agones ``` > **Tip**: You can use the default [values.yaml](agones/values.yaml) diff --git a/install/helm/agones/templates/NOTES.txt b/install/helm/agones/templates/NOTES.txt index 1b6d8df44e..b98556d58b 100644 --- a/install/helm/agones/templates/NOTES.txt +++ b/install/helm/agones/templates/NOTES.txt @@ -1,6 +1,6 @@ -The Agones controller has been installed in the namespace {{ .Values.agones.namespace }}. +The Agones controller has been installed in the namespace {{ .Release.Namespace }}. -You can watch the status by running 'kubectl --namespace {{ .Values.agones.namespace }} get pods -o wide -w {{ .Values.agones.serviceaccount.controller }}' +You can watch the status by running 'kubectl --namespace {{ .Release.Namespace }} get pods -o wide -w {{ .Values.agones.serviceaccount.controller }}' Once ready you can create your first GameServer using our examples: diff --git a/install/helm/agones/templates/admissionregistration.yaml b/install/helm/agones/templates/admissionregistration.yaml index 9a1e9f0c37..b8012ea31d 100644 --- a/install/helm/agones/templates/admissionregistration.yaml +++ b/install/helm/agones/templates/admissionregistration.yaml @@ -13,22 +13,21 @@ # limitations under the License. {{- $ca := genCA "admission-controller-ca" 3650 }} {{- $cn := printf "agones-controller-service" }} -{{- $altName1 := printf "agones-controller-service.%s" .Values.agones.namespace }} -{{- $altName2 := printf "agones-controller-service.%s.svc" .Values.agones.namespace }} +{{- $altName1 := printf "agones-controller-service.%s" .Release.Namespace }} +{{- $altName2 := printf "agones-controller-service.%s.svc" .Release.Namespace }} {{- $cert := genSignedCert $cn nil (list $altName1 $altName2) 3650 $ca }} --- apiVersion: admissionregistration.k8s.io/v1beta1 kind: ValidatingWebhookConfiguration metadata: name: agones-validation-webhook - namespace: {{ .Values.agones.namespace }} webhooks: - name: validations.stable.agones.dev failurePolicy: Fail clientConfig: service: name: agones-controller-service - namespace: {{ .Values.agones.namespace }} + namespace: {{ .Release.Namespace }} path: /validate {{- if .Values.agones.controller.generateTLS }} caBundle: {{ b64enc $ca.Cert }} @@ -59,7 +58,6 @@ apiVersion: admissionregistration.k8s.io/v1beta1 kind: MutatingWebhookConfiguration metadata: name: agones-mutation-webhook - namespace: {{ .Values.agones.namespace }} labels: component: controller app: {{ template "agones.name" . }} @@ -72,7 +70,7 @@ webhooks: clientConfig: service: name: agones-controller-service - namespace: {{ .Values.agones.namespace }} + namespace: {{ .Release.Namespace }} path: /mutate {{- if .Values.agones.controller.generateTLS }} caBundle: {{ b64enc $ca.Cert }} @@ -95,7 +93,6 @@ apiVersion: v1 kind: Secret metadata: name: {{ template "agones.fullname" . }}-cert - namespace: {{ .Values.agones.namespace }} labels: app: {{ template "agones.fullname" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" diff --git a/install/helm/agones/templates/controller.yaml b/install/helm/agones/templates/controller.yaml index 1118bb0cee..3ca1edd906 100644 --- a/install/helm/agones/templates/controller.yaml +++ b/install/helm/agones/templates/controller.yaml @@ -16,7 +16,6 @@ apiVersion: extensions/v1beta1 kind: Deployment metadata: name: agones-controller - namespace: {{ .Values.agones.namespace}} labels: component: controller app: {{ template "agones.name" . }} diff --git a/install/helm/agones/templates/namespace.yaml b/install/helm/agones/templates/namespace.yaml deleted file mode 100644 index 99c75f5a21..0000000000 --- a/install/helm/agones/templates/namespace.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2018 Google Inc. 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. - -apiVersion: v1 -kind: Namespace -metadata: - name: {{ .Values.agones.namespace }} - labels: - app: {{ template "agones.name" . }} - chart: {{ template "agones.chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} \ No newline at end of file diff --git a/install/helm/agones/templates/service.yaml b/install/helm/agones/templates/service.yaml index e073765633..89fe042a7b 100644 --- a/install/helm/agones/templates/service.yaml +++ b/install/helm/agones/templates/service.yaml @@ -16,7 +16,6 @@ apiVersion: v1 kind: Service metadata: name: agones-controller-service - namespace: {{ .Values.agones.namespace }} labels: component: controller app: {{ template "agones.name" . }} diff --git a/install/helm/agones/templates/serviceaccounts/controller.yaml b/install/helm/agones/templates/serviceaccounts/controller.yaml index 87de2d2504..7179a01db6 100644 --- a/install/helm/agones/templates/serviceaccounts/controller.yaml +++ b/install/helm/agones/templates/serviceaccounts/controller.yaml @@ -16,7 +16,6 @@ apiVersion: v1 kind: ServiceAccount metadata: name: {{ .Values.agones.serviceaccount.controller }} - namespace: {{ .Values.agones.namespace }} labels: app: {{ template "agones.name" . }} chart: {{ template "agones.chart" . }} @@ -28,7 +27,6 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: {{ .Values.agones.serviceaccount.controller }} - namespace: {{ .Values.agones.namespace }} labels: app: {{ template "agones.name" . }} chart: {{ template "agones.chart" . }} @@ -58,7 +56,6 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: {{ .Values.agones.serviceaccount.controller }}-access - namespace: {{ .Values.agones.namespace }} labels: app: {{ template "agones.name" . }} chart: {{ template "agones.chart" . }} @@ -66,7 +63,7 @@ metadata: heritage: {{ .Release.Service }} subjects: - kind: User - name: system:serviceaccount:{{ .Values.agones.namespace }}:{{ .Values.agones.serviceaccount.controller }} + name: system:serviceaccount:{{ .Release.Namespace }}:{{ .Values.agones.serviceaccount.controller }} apiGroup: rbac.authorization.k8s.io roleRef: apiGroup: rbac.authorization.k8s.io diff --git a/install/helm/agones/templates/serviceaccounts/sdk.yaml b/install/helm/agones/templates/serviceaccounts/sdk.yaml index 78f5d7b1e6..a00fd5e1c7 100644 --- a/install/helm/agones/templates/serviceaccounts/sdk.yaml +++ b/install/helm/agones/templates/serviceaccounts/sdk.yaml @@ -29,7 +29,6 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: {{ .Values.agones.serviceaccount.sdk }} - namespace: {{ .Values.agones.namespace }} labels: app: {{ template "agones.name" . }} chart: {{ template "agones.chart" . }} diff --git a/install/helm/agones/values.yaml b/install/helm/agones/values.yaml index 45aaa515fc..acc38e467b 100644 --- a/install/helm/agones/values.yaml +++ b/install/helm/agones/values.yaml @@ -15,7 +15,6 @@ # Declare variables to be passed into your templates. agones: - namespace: agones-system rbacEnabled: true serviceaccount: controller: agones-controller diff --git a/install/yaml/install.yaml b/install/yaml/install.yaml index 6bf95080b0..5a443be369 100644 --- a/install/yaml/install.yaml +++ b/install/yaml/install.yaml @@ -1,29 +1,4 @@ --- -# Source: agones/templates/namespace.yaml -# Copyright 2018 Google Inc. 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. - -apiVersion: v1 -kind: Namespace -metadata: - name: agones-system - labels: - app: agones - chart: agones-0.2.0 - release: agones-manual - heritage: Tiller ---- # Source: agones/templates/serviceaccounts/controller.yaml # Copyright 2018 Google Inc. All Rights Reserved. # @@ -43,7 +18,6 @@ apiVersion: v1 kind: ServiceAccount metadata: name: agones-controller - namespace: agones-system labels: app: agones chart: agones-0.2.0 @@ -54,7 +28,6 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: agones-controller - namespace: agones-system labels: app: agones chart: agones-0.2.0 @@ -84,7 +57,6 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: agones-controller-access - namespace: agones-system labels: app: agones chart: agones-0.2.0 @@ -129,7 +101,6 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: agones-sdk - namespace: agones-system labels: app: agones chart: agones-0.2.0 @@ -642,7 +613,6 @@ apiVersion: v1 kind: Service metadata: name: agones-controller-service - namespace: agones-system labels: component: controller app: agones @@ -675,7 +645,6 @@ apiVersion: extensions/v1beta1 kind: Deployment metadata: name: agones-controller - namespace: agones-system labels: component: controller app: agones @@ -748,7 +717,6 @@ apiVersion: admissionregistration.k8s.io/v1beta1 kind: ValidatingWebhookConfiguration metadata: name: agones-validation-webhook - namespace: agones-system webhooks: - name: validations.stable.agones.dev failurePolicy: Fail @@ -782,7 +750,6 @@ apiVersion: admissionregistration.k8s.io/v1beta1 kind: MutatingWebhookConfiguration metadata: name: agones-mutation-webhook - namespace: agones-system labels: component: controller app: agones @@ -814,7 +781,6 @@ apiVersion: v1 kind: Secret metadata: name: agones-manual-cert - namespace: agones-system labels: app: agones-manual chart: "agones-0.2.0"