-
Notifications
You must be signed in to change notification settings - Fork 400
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #313 from Zhang21/zhang
支持ARM64架构,添加Helm部署
- Loading branch information
Showing
12 changed files
with
464 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
FROM golang:1.9-alpine3.6 as builder | ||
|
||
ENV PILOT_DIR /go/src/github.com/AliyunContainerService/log-pilot | ||
ARG GOOS=linux | ||
ARG GOARCH=arm64 | ||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \ | ||
set -ex && apk add --no-cache make git gcc g++ | ||
WORKDIR $PILOT_DIR | ||
COPY . $PILOT_DIR | ||
RUN go install | ||
|
||
FROM alpine:3.6 | ||
|
||
# 注意alpine mul libc 与 gnc libc | ||
ENV FILEBEAT_VERSION=6.1.1-3 | ||
COPY assets/glibc/arm64/glibc-2.23-r3.apk /tmp/ | ||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \ | ||
apk update && \ | ||
apk add python && \ | ||
apk add ca-certificates && \ | ||
apk add wget bash libc6-compat && \ | ||
update-ca-certificates && \ | ||
wget http://acs-logging.oss-cn-hangzhou.aliyuncs.com/beats/filebeat/filebeat-${FILEBEAT_VERSION}-linux-arm64.tar.gz -P /tmp/ && \ | ||
mkdir -p /etc/filebeat /var/lib/filebeat /var/log/filebeat && \ | ||
tar zxf /tmp/filebeat-${FILEBEAT_VERSION}-linux-arm64.tar.gz -C /tmp/ && \ | ||
cp -rf /tmp/filebeat-${FILEBEAT_VERSION}-linux-arm64/filebeat /usr/bin/ && \ | ||
cp -rf /tmp/filebeat-${FILEBEAT_VERSION}-linux-arm64/fields.yml /etc/filebeat/ && \ | ||
cp -rf /tmp/filebeat-${FILEBEAT_VERSION}-linux-arm64/kibana /etc/filebeat/ && \ | ||
cp -rf /tmp/filebeat-${FILEBEAT_VERSION}-linux-arm64/module /etc/filebeat/ && \ | ||
cp -rf /tmp/filebeat-${FILEBEAT_VERSION}-linux-arm64/modules.d /etc/filebeat/ && \ | ||
apk add --allow-untrusted /tmp/glibc-2.23-r3.apk && \ | ||
ln -s /lib/ld-musl-aarch64.so.1 /lib/ld-linux-aarch64.so.1 && \ | ||
rm -rf /var/cache/apk/* /tmp/filebeat-${FILEBEAT_VERSION}-linux-arm64.tar.gz /tmp/filebeat-${FILEBEAT_VERSION}-linux-arm64 /tmp/glibc-2.23-r3.apk | ||
|
||
COPY --from=builder /go/bin/log-pilot /pilot/pilot | ||
COPY assets/entrypoint assets/filebeat/ assets/healthz /pilot/ | ||
|
||
RUN chmod +x /pilot/pilot /pilot/entrypoint /pilot/healthz /pilot/config.filebeat | ||
|
||
HEALTHCHECK CMD /pilot/healthz | ||
|
||
VOLUME /var/log/filebeat | ||
VOLUME /var/lib/filebeat | ||
|
||
WORKDIR /pilot/ | ||
ENV PILOT_TYPE=filebeat | ||
ENTRYPOINT ["/pilot/entrypoint"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
FROM golang:1.9-alpine3.6 as builder | ||
|
||
ENV PILOT_DIR /go/src/github.com/AliyunContainerService/log-pilot | ||
ARG GOOS=linux | ||
ARG GOARCH=arm64 | ||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \ | ||
set -ex && apk add --no-cache make git gcc g++ | ||
WORKDIR $PILOT_DIR | ||
COPY . $PILOT_DIR | ||
RUN go install | ||
|
||
# 注意alpine mul libc 与 gnc libc | ||
FROM alpine:3.6 | ||
COPY assets/glibc/arm64/glibc-2.23-r3.apk /tmp/ | ||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \ | ||
apk update && \ | ||
apk add python && \ | ||
apk add ruby-json ruby-irb && \ | ||
apk add build-base ruby-dev && \ | ||
apk add python && \ | ||
apk add lsof && \ | ||
apk add ca-certificates wget && \ | ||
gem install fluentd -v 1.2.6 --no-ri --no-rdoc && \ | ||
gem install fluent-plugin-elasticsearch -v ">=2.0.0" --no-ri --no-rdoc && \ | ||
gem install gelf -v "~> 3.0.0" --no-ri --no-rdoc && \ | ||
gem install aliyun_sls_sdk -v ">=0.0.9" --no-ri --no-rdoc && \ | ||
gem install remote_syslog_logger -v ">=1.0.1" --no-ri --no-rdoc && \ | ||
gem install fluent-plugin-remote_syslog -v ">=0.2.1" --no-ri --no-rdoc && \ | ||
gem install fluent-plugin-kafka --no-ri --no-rdoc && \ | ||
gem install fluent-plugin-flowcounter --no-ri --no-rdoc && \ | ||
apk del build-base ruby-dev && \ | ||
rm -rf /root/.gem && \ | ||
apk add curl openssl && \ | ||
apk add --allow-untrusted /tmp/glibc-2.23-r3.apk && \ | ||
ln -s /lib/ld-musl-aarch64.so.1 /lib/ld-linux-aarch64.so.1 && \ | ||
rm -rf /tmp/glibc-2.23-r3.apk | ||
|
||
COPY --from=builder /go/bin/log-pilot /pilot/pilot | ||
COPY assets/entrypoint assets/fluentd/ assets/healthz /pilot/ | ||
RUN mkdir -p /etc/fluentd && \ | ||
mv /pilot/plugins /etc/fluentd/ && \ | ||
chmod +x /pilot/pilot /pilot/entrypoint /pilot/healthz /pilot/config.fluentd | ||
|
||
HEALTHCHECK CMD /pilot/healthz | ||
|
||
VOLUME /etc/fluentd/conf.d | ||
VOLUME /pilot/pos | ||
WORKDIR /pilot/ | ||
ENV PILOT_TYPE=fluentd | ||
ENTRYPOINT ["/pilot/entrypoint"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
apiVersion: v2 | ||
name: log-pilot | ||
description: A Helm chart of log-pilot for Kubernetes | ||
|
||
# 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.1.0 | ||
|
||
# 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. | ||
appVersion: 0.9.7 | ||
|
||
home: https://github.com/AliyunContainerService/log-pilot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Helm | ||
|
||
**注意:** | ||
|
||
- 使用Helm v3 | ||
- 请先安装helm | ||
- helm默认使用`~/.kube/config`集群配置文件 | ||
- 使用filebeat,还是fluentd镜像,请修改镜像。 | ||
- 输出到kafka,还是es,请修改对应变量配置。其它输出对象,请参考此两者的文件,自己写。 | ||
|
||
|
||
|
||
<br> | ||
<br> | ||
|
||
|
||
## 安装 | ||
|
||
```sh | ||
cd helm | ||
|
||
# 调试 | ||
helm template --debug log-pilot log-pilot/ | ||
|
||
# 默认输出到kafka,如果需要修改kafka配置,请修改对应文件 | ||
# 安装 | ||
helm install log-pilot log-pilot/ | ||
|
||
|
||
# 也可指定对象 | ||
helm --namespace="default" install --set image.tag="0.9.7-filebeat" -f log-pilot/toKafka.yaml log-pilot log-pilot/ | ||
|
||
# 查看 | ||
helm -n default ls | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Thank you for installing {{ .Chart.Name }} | ||
|
||
Your release is named {{ .Release.Name }} | ||
|
||
To learn more about the release, try: | ||
$ helm -n {{ .Release.Namespace }} ls | ||
$ helm -n {{ .Release.Namespace }} status {{ .Release.Name }} | ||
$ helm -n {{ .Release.Namespace }} get all {{ .Release.Name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "log-pilot.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 "log-pilot.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 "log-pilot.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "log-pilot.labels" -}} | ||
helm.sh/chart: {{ include "log-pilot.chart" . }} | ||
{{ include "log-pilot.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "log-pilot.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "log-pilot.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "log-pilot.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "log-pilot.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
apiVersion: apps/v1 | ||
kind: DaemonSet | ||
metadata: | ||
name: {{ include "log-pilot.fullname" . }} | ||
labels: | ||
{{- include "log-pilot.labels" . | nindent 4 }} | ||
spec: | ||
selector: | ||
matchLabels: | ||
{{- include "log-pilot.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
{{- with .Values.podAnnotations }} | ||
annotations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "log-pilot.selectorLabels" . | nindent 8 }} | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
serviceAccountName: {{ include "log-pilot.serviceAccountName" . }} | ||
securityContext: | ||
{{- toYaml .Values.podSecurityContext | nindent 8 }} | ||
{{- with .Values.volumes }} | ||
volumes: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
securityContext: | ||
{{- toYaml .Values.securityContext | nindent 12 }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
env: | ||
- name: NODE_NAME | ||
valueFrom: | ||
fieldRef: | ||
apiVersion: v1 | ||
fieldPath: spec.nodeName | ||
{{- range .Values.env }} | ||
- name: {{ .name }} | ||
value: {{ .value }} | ||
{{- end }} | ||
{{- with .Values.volumeMounts }} | ||
volumeMounts: | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
livenessProbe: | ||
exec: | ||
command: | ||
- /pilot/healthz | ||
failureThreshold: 3 | ||
initialDelaySeconds: 10 | ||
periodSeconds: 10 | ||
successThreshold: 1 | ||
timeoutSeconds: 2 | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{{- if .Values.serviceAccount.create -}} | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ include "log-pilot.serviceAccountName" . }} | ||
labels: | ||
{{- include "log-pilot.labels" . | nindent 4 }} | ||
{{- with .Values.serviceAccount.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# env of log-pilot to elasticsearch | ||
env: | ||
- name: LOGGING_OUTPUT | ||
value: elasticsearch | ||
- name: ELASTICSEARCH_HOSTS | ||
value: es1:9200,es2:9200,es3:9200 | ||
#- name: ELASTICSEARCH_USER | ||
# value: user | ||
#- name: ELASTICSEARCH_PASSWORD | ||
# value: passwd | ||
#- name: ELASTICSEARCH_PATH | ||
# value: xxx | ||
#- name: ELASTICSEARCH_SCHEME | ||
# value: xxx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# env of log-pilot to kafka | ||
env: | ||
- name: LOGGING_OUTPUT | ||
value: kafka | ||
- name: KAFKA_BROKERS | ||
value: broker1:9092,broker2:9092,broker3:9092 | ||
#- name: KAFKA_DEFAULT_TOPIC | ||
# value: xxx | ||
#- name: KAFKA_VERSION | ||
# value: xxx | ||
#- name: KAFKA_USERNAME | ||
# value: user | ||
#- name: KAFKA_PASSWORD | ||
# value: password | ||
#- name: KAFKA_PARTITION_KEY | ||
# value: xxx | ||
#- name: KAFKA_PARTITION | ||
# value: xxx | ||
#- name: KAFKA_CLIENT_ID | ||
# value: xxx |
Oops, something went wrong.