Skip to content

Commit

Permalink
Create a dev mixer instance (#536)
Browse files Browse the repository at this point in the history
* Create a dev mixer instance

* copyright year

* gitignore
  • Loading branch information
shifucun authored Jun 14, 2021
1 parent 247bd31 commit 3ddaa4b
Show file tree
Hide file tree
Showing 9 changed files with 117 additions and 30 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@ deploy/overlays/prod/prod.yaml
deploy/overlays/staging/staging.yaml
deploy/overlays/autopush/autopush.yaml
deploy/overlays/encode/encode.yaml
deploy/overlays/dev/dev.yaml

deploy/git/mixer_hash.txt
23 changes: 23 additions & 0 deletions deploy/gke/dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2021 Google LLC
#
# 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
#
# https://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.

# Dev Mixer GKE params

project: datcom-mixer-dev-316822
region: us-central1
ip: 35.244.157.41
domain: dev.api.datacommons.org
api_title: DataCommons API (Dev)
nodes: 1
store: datcom-store
44 changes: 20 additions & 24 deletions deploy/overlays/dev/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,38 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Kustomization for dev mixer in local Minikube environment.
# - Adds "dev" suffix to all the resources
# - Use "serviceaccount.yaml" to create service account explicitly.
# Note the GKE cluster service account is created once at cluster creation time.
# - Patch deployment with "api-compiler" image that can updates the gRPC config on code change.
# - Update the esp startup options for local container.
# Kustomization for dev mixer running on GCP `datcom-mixer-dev` project.
# - Adds "dev" suffix to all the resources.
# - Use replica of 8.

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

nameSuffix: -dev
namespace: mixer

bases:
- ../../datacommons

resources:
- serviceaccount.yaml
- ../../datacommons

configMapGenerator:
- name: mixer-configmap
behavior: create
namespace: mixer
literals:
- mixerProject=datcom-mixer-dev
- serviceName=

generatorOptions:
disableNameSuffixHash: true
- mixerProject=datcom-mixer-dev-316822
- serviceName=dev.api.datacommons.org

patchesStrategicMerge:
- patch_deployment.yaml

patchesJson6902:
- target:
group: apps
version: v1
kind: Deployment
- |-
apiVersion: apps/v1
kind: Deployment
metadata:
name: mixer-grpc
path: patch_esp.yaml
spec:
replicas: 8
- |-
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: mixer-ingress
annotations:
ingress.gcp.kubernetes.io/pre-shared-cert: mixer-certificate
53 changes: 53 additions & 0 deletions deploy/overlays/local/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Copyright 2021 Google LLC
#
# 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
#
# https://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.

# Kustomization for local mixer in local Minikube environment.
# - Adds "local" suffix to all the resources
# - Use "serviceaccount.yaml" to create service account explicitly.
# Note the GKE cluster service account is created once at cluster creation time.
# - Patch deployment with "api-compiler" image that can updates the gRPC config on code change.
# - Update the esp startup options for local container.

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

nameSuffix: -local
namespace: mixer

bases:
- ../../datacommons

resources:
- serviceaccount.yaml

configMapGenerator:
- name: mixer-configmap
behavior: create
literals:
- mixerProject=datcom-mixer-dev-316822
- serviceName=

generatorOptions:
disableNameSuffixHash: true

patchesStrategicMerge:
- patch_deployment.yaml

patchesJson6902:
- target:
group: apps
version: v1
kind: Deployment
name: mixer-grpc
path: patch_esp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,24 @@ spec:
- name: mixer
image: datacommons/mixer
imagePullPolicy: Never
resources:
limits:
memory: "3G"
cpu: "800m"
requests:
memory: "3G"
cpu: "800m"
- name: esp
volumeMounts:
- mountPath: /esp
name: mixer-grpc-json
resources:
limits:
memory: "1G"
cpu: "200m"
requests:
memory: "1G"
cpu: "200m"
- name: api-compiler
image: datacommons/api-compiler
imagePullPolicy: Never
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions scripts/deploy_gke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#
# Usage:
#
# ./deploy_key.sh <"prod"|"staging"|"autopush"|"encode"> <commit_hash>
# ./deploy_key.sh <"prod"|"staging"|"autopush"|"encode"|"dev"> <commit_hash>
#
# First argument is either "prod" or "staging" or "autopush" or "encode".
# First argument is either "prod" or "staging" or "autopush" or "encode" or "dev".
# (Optional) second argument is the git commit hash of the mixer repo.
#
# !!! WARNING: Run this script in a clean Git checkout at the desired commit.
Expand All @@ -33,8 +33,8 @@ set -e

ENV=$1

if [[ $ENV != "staging" && $ENV != "prod" && $ENV != "autopush" && $ENV != "encode" ]]; then
echo "First argument should be 'staging' or 'prod' 'autopush' or 'encode'"
if [[ $ENV != "staging" && $ENV != "prod" && $ENV != "autopush" && $ENV != "encode" && $ENV != "dev" ]]; then
echo "First argument should be 'staging' or 'prod' or 'autopush' or 'encode' or 'dev'"
exit
fi

Expand Down
4 changes: 2 additions & 2 deletions skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ deploy:
kubeContext: minikube
kustomize:
paths:
- deploy/overlays/dev
- deploy/overlays/local
portForward:
- resourceType: service
resourceName: mixer-service-dev
resourceName: mixer-service-local
namespace: mixer
port: 80
localPort: 9090

0 comments on commit 3ddaa4b

Please sign in to comment.