Commit 02de6876 authored by 钟尚武's avatar 钟尚武

Merge branch 'helm' into 'master'

add helm

See merge request alpha/saturn!107
parents a0fbaf05 857f1340
kind: pipeline
name: greeting
name: saturn
steps:
- name: en
image: alpine
commands:
- echo hello
- echo world
- name: build
image: plugins/docker
settings:
registry: ccr.ccs.tencentyun.com
username: 100009168942
password: 3m4V#TMrUTSIebv1
repo: ccr.ccs.tencentyun.com/gm-ai/saturn-test
tags: ${DRONE_COMMIT}
- name: es
image: alpine
commands:
- echo hola
- echo mundo
- name: helm
image: quay.io/ipedrazas/drone-helm
skip_tls_verify: true
environment:
API_SERVER:
from_secret: api_server
KUBERNETES_TOKEN:
from_secret: kubernetes_token
settings:
skip_tls_verify: true
chart: deploy
stable_repo_url: http://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
namespace: like-test
values: image.tag=${DRONE_COMMIT}
release: "saturn"
- name: fr
image: alpine
commands:
- echo bonjour
- echo monde
trigger:
branch:
- test
\ No newline at end of file
......@@ -24,4 +24,4 @@ RUN apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 3B4FE6ACC0B21F32 \
RUN pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
CMD bash -c 'source ~/.bashrc && celery -A physical worker -Q tapir-alpha --loglevel=DEBUG --maxtasksperchild 500 -c 62'
CMD bash -c 'source ~/.bashrc && gunicorn saturn.wsgi:application -w 16 -b 0.0.0.0:80 -k gevent'
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for Kubernetes
name: deploy
version: 0.1.0
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range .Values.ingress.hosts }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "deploy.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ include "deploy.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "deploy.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ include "deploy.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:80
{{- end }}
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "deploy.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "deploy.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "deploy.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: saturn-app-conf
namespace: like-test
data:
app_conf.xml: |-
<?xml version="1.0" encoding="utf-8"?>
<gm_rpcd_config>
<info config_name="app" version="1.0"/>
<config name="sentry_dsn" value="http://39f1236352c04a80826878f459ef1b05:333fbf94113c4879addaf656f233eb8e@sentry.igengmei.com/138"/>
<config name="application_name" value="earth"/>
<config name="service_list">
<element value="earth"/>
</config>
<config name="initializer_list">
<element value="earth.django_init"/>
</config>
</gm_rpcd_config>
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: {{ include "deploy.fullname" . }}
labels:
app: {{ include "deploy.name" . }}
chart: {{ include "deploy.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ include "deploy.name" . }}
release: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ include "deploy.name" . }}
release: {{ .Release.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 80
protocol: TCP
volumeMounts:
- name: log
mountPath: /data/log/saturn/app
- mountPath: /etc/gm-config/storage/static.dir/gm_logging.dir/
name: logging-global
- mountPath: /etc/gm-config/storage/static.dir/helios.dir/
name: helios-global
- mountPath: /etc/gm-config/storage/static.dir/gm_mq.dir/
name: mq-global
- mountPath: /etc/gm-config/storage/static.dir/dev_env.dir/
name: dev-env-global
- mountPath: /etc/gm-config/storage/static.dir/gm_shield.dir/
name: shield-global
- name: saturn-settings-local
mountPath: /srv/apps/saturn/settings/settings_local.py
readOnly: true
subPath: settings_local.py
- mountPath: /srv/apps/saturn/app_conf.xml
name: saturn-app-conf
subPath: app_conf.xml
imagePullSecrets:
- name: {{ .Values.image.pullSecret }}
volumes:
- name: log
hostPath:
path: /data/log/saturn/app
- configMap:
items:
- key: global_important_sentry.json
path: global_important_sentry.json
- key: kafka.json
path: kafka.json
name: logging-global
name: logging-global
- configMap:
items:
- key: static_route_table.json
path: static_route_table.json
name: helios-global
name: helios-global
- configMap:
items:
- key: celery.json
path: celery.json
name: mq-global
name: mq-global
- configMap:
items:
- key: resource.json
path: resource.json
name: dev-env-global
name: dev-env-global
- configMap:
items:
- key: shield.json
path: shield.json
name: shield-global
name: shield-global
- name: saturn-settings-local
configMap:
name: saturn-settings-local
items:
- key: settings_local.py
path: settings_local.py
- name: saturn-app-conf
configMap:
name: saturn-app-conf
items:
- key: app_conf.xml
path: app_conf.xml
\ No newline at end of file
apiVersion: v1
kind: ConfigMap
metadata:
name: saturn-settings-local
namespace: like-test
data:
settings_local.py: |-
import helios
DEBUG = True
# QINIU_ACCESS_KEY = "ln5otz9s46t3LcpAFXcA1faYO8y1K34f6cvVBXiz"
# QINIU_SECRET_KEY = "hDZJAfVecAn0qj3pCONyd9ba-cTiekQZs2HIJalI"
SENTRY_CELERY_ENDPOINT = 'http://45b0ef6a79204d6988b59c32c9dd4bef:fa018677fb4f49be88d2ba61cdc7ee32@sentry.igengmei.com/135'
REDIS_HOST = '172.21.52.8'
REDIS_GROUP = {
'ins_cache': {'host': REDIS_HOST, 'port': 6379, 'db': 1, 'password': 'Gengmei123'},
}
# ALLOWED_HOSTS = ["xxx"]
USER_COOKIE_NAME = 'sessionid'
RPC_INVOKER = helios.rpc.create_default_invoker(debug=DEBUG)
DEBUG_PROPAGATE_EXCEPTIONS = True
TMP_STATIC_DOMAIN = "earth.igengmei.com"
SESSION_COOKIE_DOMAIN_IGENGMEI = '127.0.0.1'
\ No newline at end of file
# Default values for deploy.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
repository: ccr.ccs.tencentyun.com/gm-ai/saturn-test
tag: latest
pullPolicy: Always
pullSecret: gm-secret
nameOverride: ""
fullnameOverride: ""
service:
type: ClusterIP
port: 80
ingress:
enabled: false
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
path: /
hosts:
- chart-example.local
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}
tolerations: []
affinity: {}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment