-
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.
Check valid kafka topics when disable auto-create topic
- Loading branch information
chenquanzhao
committed
Apr 23, 2019
1 parent
49fad4e
commit eae859d
Showing
9 changed files
with
159 additions
and
4 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
96 changes: 96 additions & 0 deletions
96
examples/with-configmap/filebeat-pilot-kafka-kubernetes.yml
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,96 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: log-pilot-configuration | ||
data: | ||
logging_output: "kafka" | ||
kafka_brokers: "kafka1:9092,kafka2:9092" | ||
# configure all valid topics in kafka | ||
# when disable auto-create topic | ||
kafka_topics: "topic1,topic2,topic3" | ||
--- | ||
apiVersion: extensions/v1beta1 | ||
kind: DaemonSet | ||
metadata: | ||
name: log-pilot | ||
labels: | ||
k8s-app: log-pilot | ||
spec: | ||
updateStrategy: | ||
type: RollingUpdate | ||
template: | ||
metadata: | ||
labels: | ||
k8s-app: log-pilot | ||
spec: | ||
tolerations: | ||
- key: node-role.kubernetes.io/master | ||
effect: NoSchedule | ||
containers: | ||
- name: log-pilot | ||
image: registry.cn-hangzhou.aliyuncs.com/acs/log-pilot:0.9.6-filebeat | ||
env: | ||
- name: "LOGGING_OUTPUT" | ||
valueFrom: | ||
configMapKeyRef: | ||
name: log-pilot-configuration | ||
key: logging_output | ||
- name: "KAFKA_BROKERS" | ||
valueFrom: | ||
configMapKeyRef: | ||
name: log-pilot-configuration | ||
key: kafka_brokers | ||
- name: "NODE_NAME" | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: spec.nodeName | ||
volumeMounts: | ||
- name: sock | ||
mountPath: /var/run/docker.sock | ||
- name: logs | ||
mountPath: /var/log/filebeat | ||
- name: state | ||
mountPath: /var/lib/filebeat | ||
- name: root | ||
mountPath: /host | ||
readOnly: true | ||
- name: localtime | ||
mountPath: /etc/localtime | ||
# configure all valid topics in kafka | ||
# when disable auto-create topic | ||
- name: config-volume | ||
mountPath: /etc/filebeat/config | ||
securityContext: | ||
capabilities: | ||
add: | ||
- SYS_ADMIN | ||
terminationGracePeriodSeconds: 30 | ||
volumes: | ||
- name: sock | ||
hostPath: | ||
path: /var/run/docker.sock | ||
type: Socket | ||
- name: logs | ||
hostPath: | ||
path: /var/log/filebeat | ||
type: DirectoryOrCreate | ||
- name: state | ||
hostPath: | ||
path: /var/lib/filebeat | ||
type: DirectoryOrCreate | ||
- name: root | ||
hostPath: | ||
path: / | ||
type: Directory | ||
- name: localtime | ||
hostPath: | ||
path: /etc/localtime | ||
type: File | ||
# kubelet sync period | ||
- name: config-volume | ||
configMap: | ||
name: log-pilot-configuration | ||
items: | ||
- key: kafka_topics | ||
path: kafka_topics |
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
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
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
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
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,16 @@ | ||
package pilot | ||
|
||
import ( | ||
"io/ioutil" | ||
"strings" | ||
) | ||
|
||
// ReadFile return string list separated by separator | ||
func ReadFile(path string, separator string) ([]string, error) { | ||
data, err := ioutil.ReadFile(path) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return strings.Split(string(data), separator), nil | ||
} |
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
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