-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reuse workload #245
Merged
Merged
reuse workload #245
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,242 @@ | ||
apiVersion: apps/v1 | ||
kind: DaemonSet | ||
metadata: | ||
name: {{ .Values.kdoctorAgent.name | trunc 63 | trimSuffix "-" }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "project.kdoctorAgent.labels" . | nindent 4 }} | ||
{{- if .Values.global.commonLabels }} | ||
{{- include "tplvalues.render" ( dict "value" .Values.global.commonLabels "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
{{- if .Values.global.commonAnnotations }} | ||
annotations: | ||
{{- include "tplvalues.render" ( dict "value" .Values.global.commonAnnotations "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
selector: | ||
matchLabels: | ||
{{- include "project.kdoctorAgent.selectorLabels" . | nindent 6 }} | ||
{{- with .Values.kdoctorAgent.updateStrategy }} | ||
updateStrategy: | ||
{{- toYaml . | trim | nindent 4 }} | ||
{{- end }} | ||
template: | ||
metadata: | ||
{{- if or .Values.kdoctorAgent.podAnnotations .Values.global.commonAnnotations }} | ||
annotations: | ||
{{- if .Values.global.commonAnnotations }} | ||
{{- include "tplvalues.render" ( dict "value" .Values.global.commonAnnotations "context" $ ) | nindent 8 }} | ||
{{- end }} | ||
{{- if .Values.kdoctorAgent.podAnnotations }} | ||
{{- include "tplvalues.render" ( dict "value" .Values.kdoctorAgent.podAnnotations "context" $ ) | nindent 8 }} | ||
{{- end }} | ||
{{- end }} | ||
labels: | ||
{{- include "project.kdoctorAgent.selectorLabels" . | nindent 8 }} | ||
{{- if .Values.global.commonLabels }} | ||
{{- include "tplvalues.render" ( dict "value" .Values.global.commonLabels "context" $ ) | nindent 8 }} | ||
{{- end }} | ||
{{- if .Values.kdoctorAgent.podLabels }} | ||
{{- include "tplvalues.render" ( dict "value" .Values.kdoctorAgent.podLabels "context" $ ) | nindent 8 }} | ||
{{- end }} | ||
spec: | ||
{{- if .Values.kdoctorAgent.image.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- with .Values.kdoctorAgent.image.imagePullSecrets }} | ||
{{- toYaml . | trim | nindent 6 }} | ||
{{- end }} | ||
{{- end }} | ||
serviceAccountName: {{ .Values.kdoctorAgent.name | trunc 63 | trimSuffix "-" }} | ||
priorityClassName: {{ default "system-node-critical" .Values.kdoctorAgent.priorityClassName }} | ||
{{- if .Values.kdoctorAgent.hostnetwork }} | ||
hostNetwork: true | ||
dnsPolicy: ClusterFirstWithHostNet | ||
{{- else }} | ||
hostNetwork: false | ||
dnsPolicy: ClusterFirst | ||
{{- end }} | ||
restartPolicy: Always | ||
{{- with .Values.kdoctorAgent.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 6 }} | ||
{{- end }} | ||
{{- with .Values.kdoctorAgent.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- if .Values.kdoctorAgent.affinity }} | ||
affinity: | ||
{{- include "tplvalues.render" (dict "value" .Values.kdoctorAgent.affinity "context" $) | nindent 6 }} | ||
{{- else }} | ||
affinity: | ||
nodeAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: kubernetes.io/os | ||
operator: In | ||
values: | ||
- linux | ||
# Compatible with Kubernetes 1.12.x and 1.13.x | ||
- matchExpressions: | ||
- key: beta.kubernetes.io/os | ||
operator: In | ||
values: | ||
- linux | ||
{{- end }} | ||
containers: | ||
- name: {{ .Values.kdoctorAgent.name | trunc 63 | trimSuffix "-" }} | ||
image: {{ include "project.kdoctorAgent.image" . | quote }} | ||
imagePullPolicy: {{ .Values.kdoctorAgent.image.pullPolicy }} | ||
command: | ||
- {{ .Values.kdoctorAgent.cmdBinName }} | ||
args: | ||
- --config-path=/tmp/config-map/conf.yml | ||
- --tls-ca-cert=/etc/tls/ca.crt | ||
- --tls-ca-key=/etc/tls/ca.key | ||
- --default-agent=true | ||
{{- if .Values.feature.enableIPv4 }} | ||
- --service-ipv4-name={{ include "project.kdoctorAgent.serviceIpv4Name" . }} | ||
{{- end }} | ||
{{- if .Values.feature.enableIPv6 }} | ||
- --service-ipv6-name={{ include "project.kdoctorAgent.serviceIpv6Name" . }} | ||
{{- end }} | ||
{{- with .Values.kdoctorAgent.extraArgs }} | ||
{{- toYaml . | trim | nindent 8 }} | ||
{{- end }} | ||
ports: | ||
{{- if .Values.kdoctorAgent.prometheus.enabled }} | ||
- name: metrics | ||
containerPort: {{ .Values.kdoctorAgent.prometheus.port }} | ||
protocol: TCP | ||
{{- end }} | ||
{{- if or .Values.feature.enableIPv4 .Values.feature.enableIPv6 }} | ||
- name: health | ||
containerPort: {{ .Values.kdoctorAgent.httpServer.healthPort }} | ||
protocol: TCP | ||
- name: http | ||
containerPort: {{ .Values.kdoctorAgent.httpServer.appHttpPort }} | ||
protocol: TCP | ||
- name: https | ||
containerPort: {{ .Values.kdoctorAgent.httpServer.appHttpsPort }} | ||
protocol: TCP | ||
{{- end }} | ||
{{- if semverCompare ">=1.20-0" .Capabilities.KubeVersion.Version }} | ||
startupProbe: | ||
httpGet: | ||
path: /healthy/startup | ||
port: {{ .Values.kdoctorAgent.httpServer.healthPort }} | ||
scheme: HTTP | ||
failureThreshold: {{ .Values.kdoctorAgent.httpServer.startupProbe.failureThreshold }} | ||
periodSeconds: {{ .Values.kdoctorAgent.httpServer.startupProbe.periodSeconds }} | ||
successThreshold: 1 | ||
{{- end }} | ||
livenessProbe: | ||
httpGet: | ||
path: /healthy/liveness | ||
port: {{ .Values.kdoctorAgent.httpServer.healthPort }} | ||
scheme: HTTP | ||
initialDelaySeconds: 60 | ||
periodSeconds: {{ .Values.kdoctorAgent.httpServer.livenessProbe.periodSeconds }} | ||
successThreshold: 1 | ||
failureThreshold: {{ .Values.kdoctorAgent.httpServer.livenessProbe.failureThreshold }} | ||
timeoutSeconds: 5 | ||
readinessProbe: | ||
httpGet: | ||
path: /healthy/readiness | ||
port: {{ .Values.kdoctorAgent.httpServer.healthPort }} | ||
scheme: HTTP | ||
initialDelaySeconds: 5 | ||
periodSeconds: {{ .Values.kdoctorAgent.httpServer.readinessProbe.periodSeconds }} | ||
successThreshold: 1 | ||
failureThreshold: {{ .Values.kdoctorAgent.httpServer.readinessProbe.failureThreshold }} | ||
timeoutSeconds: 5 | ||
{{- with .Values.kdoctorAgent.resources }} | ||
resources: | ||
{{- toYaml . | trim | nindent 12 }} | ||
{{- end }} | ||
env: | ||
- name: ENV_LOG_LEVEL | ||
value: {{ .Values.kdoctorAgent.debug.logLevel | quote }} | ||
- name: ENV_ENABLED_METRIC | ||
value: {{ .Values.kdoctorAgent.prometheus.enabled | quote }} | ||
- name: ENV_METRIC_HTTP_PORT | ||
value: {{ .Values.kdoctorAgent.prometheus.port | quote }} | ||
- name: ENV_AGENT_HEALTH_HTTP_PORT | ||
value: {{ .Values.kdoctorAgent.httpServer.healthPort | quote }} | ||
- name: ENV_AGENT_APP_HTTP_PORT | ||
value: {{ .Values.kdoctorAgent.httpServer.appHttpPort | quote }} | ||
- name: ENV_AGENT_APP_HTTPS_PORT | ||
value: {{ .Values.kdoctorAgent.httpServer.appHttpsPort | quote }} | ||
- name: ENV_GOPS_LISTEN_PORT | ||
value: {{ .Values.kdoctorAgent.debug.gopsPort | quote }} | ||
- name: ENV_AGENT_GRPC_LISTEN_PORT | ||
value: {{ .Values.kdoctorAgent.grpcServer.port | quote }} | ||
- name: ENV_CLUSTER_DNS_DOMAIN | ||
value: {{ .Values.global.clusterDnsDomain | quote }} | ||
- name: ENV_ENABLE_AGGREGATE_AGENT_REPORT | ||
value: {{ .Values.feature.aggregateReport.enabled | quote }} | ||
{{- if .Values.feature.aggregateReport.enabled }} | ||
- name: ENV_AGENT_REPORT_STORAGE_PATH | ||
value: {{ .Values.feature.aggregateReport.agent.reportPath | quote }} | ||
- name: ENV_CLEAN_AGED_REPORT_INTERVAL_IN_MINUTE | ||
value: {{ .Values.feature.aggregateReport.cleanAgedReportIntervalInMinute | quote }} | ||
{{- end }} | ||
- name: ENV_POD_NAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.name | ||
- name: ENV_LOCAL_NODE_IP | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: status.hostIP | ||
- name: ENV_LOCAL_NODE_NAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: spec.nodeName | ||
- name: ENV_POD_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
{{- with .Values.kdoctorAgent.extraEnv }} | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
{{- with .Values.kdoctorAgent.securityContext }} | ||
securityContext: | ||
{{- toYaml . | nindent 10 }} | ||
{{- end }} | ||
volumeMounts: | ||
- name: config-path | ||
mountPath: /tmp/config-map | ||
readOnly: true | ||
- name: report-data | ||
mountPath: /report | ||
- name: tls | ||
mountPath: /etc/tls | ||
{{- if .Values.kdoctorAgent.extraVolumes }} | ||
{{- include "tplvalues.render" ( dict "value" .Values.kdoctorAgent.extraVolumeMounts "context" $ ) | nindent 12 }} | ||
{{- end }} | ||
volumes: | ||
# To read the configuration from the config map | ||
- name: config-path | ||
configMap: | ||
defaultMode: 0400 | ||
name: {{ .Values.global.configName }} | ||
- name: report-data | ||
hostPath: | ||
path: {{ .Values.kdoctorAgent.reportHostPath }} | ||
type: DirectoryOrCreate | ||
- name: tls | ||
projected: | ||
defaultMode: 0400 | ||
sources: | ||
- secret: | ||
items: | ||
- key: tls.key | ||
path: ca.key | ||
- key: tls.crt | ||
path: ca.crt | ||
name: {{ .Values.tls.ca.secretName }} | ||
{{- if .Values.kdoctorAgent.extraVolumeMounts }} | ||
{{- include "tplvalues.render" ( dict "value" .Values.kdoctorAgent.extraVolumeMounts "context" $ ) | nindent 6 }} | ||
{{- 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
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 @@ | ||
{{- if .Values.kdoctorAgent.ingress.enable }} | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: {{ include "project.kdoctorAgent.ingressName" . }} | ||
namespace: {{ .Release.Namespace | quote }} | ||
spec: | ||
{{- if .Values.kdoctorAgent.ingress.ingressClass }} | ||
ingressClassName: {{ .Values.kdoctorAgent.ingress.ingressClass | quote }} | ||
{{- end }} | ||
rules: | ||
- http: | ||
paths: | ||
- path: {{ .Values.kdoctorAgent.ingress.route | quote }} | ||
pathType: Exact | ||
backend: | ||
service: | ||
{{- if .Values.feature.enableIPv4 }} | ||
name: {{ include "project.kdoctorAgent.serviceIpv4Name" . }} | ||
{{- else }} | ||
name: {{ include "project.kdoctorAgent.serviceIpv6Name" . }} | ||
{{- end }} | ||
port: | ||
number: {{ .Values.kdoctorAgent.httpServer.appHttpPort }} | ||
{{- end }} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个feature 对 原理的新建逻辑 为什么有修改
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个 feature 如果不填写 agentSpec 使用默认的 agent 执行任务,所以将原 agent 改为指针类型,原有的 agent 存在 默认值,会导致无论怎么做都有 agentspec 字段,这个默认值 只是 agentspec 的默认值,不是 agentspec里字段的默认值