mirror of
https://github.com/google/nomulus.git
synced 2025-04-30 03:57:51 +02:00
This CL setups up kubernetes configuration files necessary to deploy the proxy service to k8s (GKE to be specific). Because kubernetes service can only expose node ports higher than 30000, the default ports that the containers expose are also changed to >30000 so that they are consistent. This is *not* necessary, but makes it easier to remember which ports are for what purpose. Note that we are not setting up a load balancing service. The way it is set up now, the services are only visible within the clusters, on each node at the specified node ports. The load balancer k8s sets up uses GCP L4 load balancer that does not support IPv6 (because it does not do TCP termination at the LB, rather just routes packages to cluster nodes, and GCE VMs does not support IPv6 yet). The L4 load balancer also only provides regional IPs on the frontend, which means proxies running in different regions (Americas, EMEA, APAC) would all have different IPs, which in turn offload regional routing determination to the DNS system, adding complexity. A user of the proxy instead should set up TCP proxy load balancing in GCP separately and point traffic to the VM group(s) backing the k8s cluster. This allows for a single global anycast IP (IPv4 and IPv6) to be allocated at the load balancer frontend. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=187046521
61 lines
1.6 KiB
Bash
Executable file
61 lines
1.6 KiB
Bash
Executable file
#!/bin/bash
|
|
# Copyright 2018 The Nomulus Authors. 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 script builds the proxy jar file with all of its dependencies included,
|
|
# then puts it in an image with a name compatible with GCR. If a "push"
|
|
# argument is given, it also uploads the image to GCR.
|
|
|
|
function cleanup() {
|
|
rm ${WORKDIR}/${TARGET} -f
|
|
}
|
|
|
|
trap cleanup EXIT
|
|
|
|
PROJECT=`gcloud config list 2>&1 | grep project | awk -F'= ' '{print $2}'`;
|
|
|
|
echo "PROJECT: ${PROJECT}"
|
|
|
|
PACKAGE_PREFIX=""
|
|
|
|
PACKAGE=${PACKAGE_PREFIX}"java/google/registry/proxy"
|
|
|
|
TARGET=proxy_server_deploy.jar
|
|
|
|
BUILD_TOOL=bazel
|
|
|
|
WORKSPACE=`$BUILD_TOOL info workspace`
|
|
|
|
WORKDIR=${WORKSPACE}/${PACKAGE}/kubernetes
|
|
|
|
BINDIR=${WORKSPACE}/${BUILD_TOOL}-bin/${PACKAGE}
|
|
|
|
$BUILD_TOOL build "//"${PACKAGE}:${TARGET}
|
|
|
|
cp ${BINDIR}/${TARGET} ${WORKDIR}/
|
|
|
|
docker build -t gcr.io/${PROJECT}/proxy:latest $WORKDIR
|
|
|
|
# Publish the image to GCR if "push" argument is given.
|
|
if [ -z $1 ]
|
|
then
|
|
exit
|
|
fi
|
|
|
|
if [ $1 = "push" ]
|
|
then
|
|
gcloud docker -- push gcr.io/${PROJECT}/proxy:latest
|
|
else
|
|
echo "usage: $0 [push]"
|
|
fi
|