feat : new service brahma
continuous-integration/drone/push Build was killed Details

master
liuhaotian 2022-01-15 13:08:34 +08:00
parent 9a4cf673f3
commit 61c2b8264d
11 changed files with 215 additions and 0 deletions

View File

@ -29,3 +29,9 @@ service:
root: app/brahma/service/token
type: golang
port: "3100"
- namespace: brahma
name: murder
alias_name: murder
root: app/brahma/service/murder
type: golang
port: "3001"

View File

@ -0,0 +1,20 @@
FROM golang:1.17 as builder
ENV GO111MODULE on
ENV GOPROXY https://goproxy.io,direct
WORKDIR /go/cache
ADD go.mod .
ADD go.sum .
RUN go mod download -x
WORKDIR /go/src
ADD . .
RUN go mod tidy
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o service_murder ./app/brahma/service/murder
FROM reg.icechen.cn/alpine as murder
WORKDIR /go/src
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=builder /go/src/service_murder ./
ENV TZ=Asia/Shanghai
RUN chmod +x ./service_murder
EXPOSE 8080
CMD ["./service_murder"]

View File

@ -0,0 +1,23 @@
# 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
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

View File

@ -0,0 +1,24 @@
apiVersion: v2
name: murder
description: murder
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.0.1
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.0.1"

View File

@ -0,0 +1 @@
notes

View File

@ -0,0 +1,20 @@
apiVersion: app.k8s.io/v1beta1
kind: Application
metadata:
name: {{ .Release.Name }}
namespace: {{ .Values.nameSpace }}
labels:
app: {{ .Release.Name }}
app.kubernetes.io/version: v1
app.kubernetes.io/name: {{ .Release.Name }}
version: v1
annotations:
servicemesh.kubesphere.io/enabled: 'true'
spec:
selector:
matchLabels:
app: {{ .Release.Name }}
app.kubernetes.io/version: v1
app.kubernetes.io/name: {{ .Release.Name }}
version: v1
addOwnerRef: true

View File

@ -0,0 +1,82 @@
kind: Deployment
apiVersion: apps/v1
metadata:
name: {{ .Release.Name }}
namespace: {{ .Values.nameSpace }}
labels:
app: {{ .Release.Name }}
app.kubernetes.io/version: v1
app.kubernetes.io/name: {{ .Release.Name }}
version: v1
app.kubernetes.io/instance: {{ .Release.Name }}
annotations:
kubesphere.io/alias-name: {{ .Values.aliasName }}
kubesphere.io/creator: drone
meta.helm.sh/release-name: {{ .Release.Name }}
meta.helm.sh/release-namespace: {{ .Values.nameSpace }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ .Release.Name }}
app.kubernetes.io/version: v1
app.kubernetes.io/name: {{ .Release.Name }}
version: v1
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ .Release.Name }}
app.kubernetes.io/version: v1
app.kubernetes.io/name: {{ .Release.Name }}
version: v1
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
volumes:
- name: host-time
hostPath:
path: /etc/localtime
type: ''
containers:
- name: {{ .Release.Name }}
image: {{ .Values.image }}:{{ .Values.imageTag }}
ports:
- containerPort: {{ .Values.port }}
protocol: TCP
env:
- name: ENDPOINTS
value: 'etcd:2379'
- name: APP_NAME
value: {{ .Values.appName }}
- name: NAMESPACE
value: {{ .Values.nameSpace }}
- name: APP_TYPE
value: service
resources:
limits:
cpu: 200m
memory: 1000Mi
requests:
cpu: 10m
memory: 200Mi
volumeMounts:
- name: host-time
readOnly: true
mountPath: /etc/localtime
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: IfNotPresent
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
securityContext: {}
imagePullSecrets:
- name: registry-secret
schedulerName: default-scheduler
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
revisionHistoryLimit: 10
progressDeadlineSeconds: 600

View File

@ -0,0 +1,26 @@
kind: Service
apiVersion: v1
metadata:
name: {{ .Release.Name }}
namespace: {{ .Values.nameSpace }}
annotations:
kubesphere.io/creator: drone
labels:
app: {{ .Release.Name }}
app.kubernetes.io/version: v1
app.kubernetes.io/name: {{ .Release.Name }}
version: v1
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
ports:
- name: http-{{ .Release.Name }}
protocol: TCP
port: 80
targetPort: {{ .Values.port }}
selector:
app: {{ .Release.Name }}
type: ClusterIP
sessionAffinity: None
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack

View File

@ -0,0 +1,6 @@
nameSpace: brahma
appName: murder
aliasName: murder
image: reg.icechen.cn/brahma/service-murder
imageTag: latest
port: 3001

View File

@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Println("我是个示例")
}