mirror of
https://github.com/google/nomulus
synced 2026-09-25 01:14:43 +00:00
Add nomulus deployment and service manifests (#2389)
This commit is contained in:
@@ -49,6 +49,15 @@ tasks.register('buildNomulusImage', Exec) {
|
||||
dependsOn(tasks.named('stage'))
|
||||
}
|
||||
|
||||
tasks.register('tagNomulusImage', Exec) {
|
||||
commandLine 'docker', 'tag', 'nomulus', "gcr.io/${rootProject.gcpProject}/nomulus"
|
||||
dependsOn(tasks.named('buildNomulusImage'))
|
||||
}
|
||||
|
||||
tasks.register('pushNomulusImage', Exec) {
|
||||
commandLine 'docker', 'push', "gcr.io/${rootProject.gcpProject}/nomulus"
|
||||
}
|
||||
|
||||
tasks.register('run', JavaExec) {
|
||||
// We do the check when the task actually runs, not when we define it.
|
||||
// This way if one doesn't set the value, one can still run other tasks.
|
||||
@@ -66,4 +75,10 @@ tasks.register('run', JavaExec) {
|
||||
dependsOn(tasks.named('stage'))
|
||||
}
|
||||
|
||||
tasks.register('deployNomulus', Exec) {
|
||||
dependsOn(tasks.named('pushNomulusImage'), tasks.named(":proxy:pushProxyImage"))
|
||||
configure verifyDeploymentConfig
|
||||
commandLine './deploy-nomulus-for-env.sh', "${rootProject.environment}"
|
||||
}
|
||||
|
||||
project.build.dependsOn(tasks.named('buildNomulusImage'))
|
||||
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2024 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 prepares the proxy k8s manifest, pushes it to the clusters, and
|
||||
# kills all running pods to force k8s to create new pods using the just-pushed
|
||||
# manifest.
|
||||
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "Usage: $0 alpha|crash|qa"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
environment=${1}
|
||||
project="domain-registry-"${environment}
|
||||
current_context=$(kubectl config current-context)
|
||||
while read line
|
||||
do
|
||||
parts=(${line})
|
||||
echo "Updating cluster ${parts[0]} in location ${parts[1]}..."
|
||||
gcloud container clusters get-credentials "${parts[0]}" \
|
||||
--project "${project}" --location "${parts[1]}"
|
||||
sed s/GCP_PROJECT/${project}/g "./kubernetes/nomulus-deployment.yaml" | \
|
||||
sed s/ENVIRONMENT/${environment}/g | \
|
||||
kubectl apply -f -
|
||||
kubectl apply -f "./kubernetes/nomulus-service.yaml"
|
||||
#kubectl apply -f "./kubernetes/nomulus-gateway.yaml"
|
||||
# Kills all running pods, new pods created will be pulling the new image.
|
||||
kubectl delete pods --all
|
||||
done < <(gcloud container clusters list --project ${project} | grep nomulus)
|
||||
kubectl config use-context "$current_context"
|
||||
@@ -0,0 +1,69 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nomulus
|
||||
labels:
|
||||
app: nomulus
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: nomulus
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: nomulus
|
||||
spec:
|
||||
containers:
|
||||
- name: nomulus
|
||||
image: gcr.io/GCP_PROJECT/nomulus
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
name: http
|
||||
resources:
|
||||
requests:
|
||||
cpu: "500m"
|
||||
args: [ENVIRONMENT]
|
||||
- name: proxy
|
||||
image: gcr.io/GCP_PROJECT/proxy
|
||||
ports:
|
||||
- containerPort: 30001
|
||||
name: whois
|
||||
- containerPort: 30002
|
||||
name: epp
|
||||
resources:
|
||||
requests:
|
||||
cpu: "500m"
|
||||
args: [--env, ENVIRONMENT, --log, --local]
|
||||
env:
|
||||
- name: POD_ID
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
- name: NAMESPACE_ID
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
- name: CONTAINER_NAME
|
||||
value: proxy
|
||||
---
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: nomulus
|
||||
labels:
|
||||
app: nomulus
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: nomulus
|
||||
minReplicas: 1
|
||||
maxReplicas: 20
|
||||
metrics:
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: 100
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
kind: Gateway
|
||||
apiVersion: gateway.networking.k8s.io/v1beta1
|
||||
metadata:
|
||||
name: nomulus
|
||||
spec:
|
||||
gatewayClassName: gke-l7-global-external-managed-mc
|
||||
listeners:
|
||||
- name: http
|
||||
protocol: HTTP
|
||||
port: 80
|
||||
allowedRoutes:
|
||||
kinds:
|
||||
- kind: HTTPRoute
|
||||
---
|
||||
kind: HTTPRoute
|
||||
apiVersion: gateway.networking.k8s.io/v1beta1
|
||||
metadata:
|
||||
name: nomulus
|
||||
labels:
|
||||
app: nomulus
|
||||
spec:
|
||||
parentRefs:
|
||||
- kind: Gateway
|
||||
name: nomulus
|
||||
rules:
|
||||
- backendRefs:
|
||||
- group: net.gke.io
|
||||
kind: ServiceImport
|
||||
name: nomulus
|
||||
port: 80
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: nomulus
|
||||
spec:
|
||||
selector:
|
||||
app: nomulus
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: http
|
||||
name: http
|
||||
- port: 43
|
||||
targetPort: whois
|
||||
name: whois
|
||||
- port: 700
|
||||
targetPort: epp
|
||||
name: epp
|
||||
#---
|
||||
#kind: ServiceExport
|
||||
#apiVersion: net.gke.io/v1
|
||||
#metadata:
|
||||
# name: nomulus
|
||||
Reference in New Issue
Block a user