Skip to content

Commit

Permalink
Adapt scheduler report
Browse files Browse the repository at this point in the history
Signed-off-by: ii2day <ji.li@daocloud.io>
  • Loading branch information
ii2day committed Aug 11, 2023
1 parent 3f7f778 commit 40f446f
Show file tree
Hide file tree
Showing 33 changed files with 529 additions and 212 deletions.
20 changes: 17 additions & 3 deletions charts/templates/configmap-app-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ data:
targetPort: metrics
protocol: TCP
{{- end }}
{{- if .Values.feature.enableIPv4 }}
- name: http
port: {{ .Values.kdoctorAgent.httpServer.appHttpPort }}
targetPort: http
Expand All @@ -305,9 +304,24 @@ data:
port: {{ .Values.kdoctorAgent.httpServer.appHttpsPort }}
targetPort: https
protocol: TCP
{{- end }}
ipFamilyPolicy: SingleStack
ipFamilies:
- IPv4
selector:
{{- include "project.kdoctorAgent.selectorLabels" . | nindent 8 }}
{{- include "project.kdoctorAgent.selectorLabels" . | nindent 8 }}
ingress.yml: |
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
namespace: {{ .Release.Namespace | quote }}
spec:
rules:
- http:
paths:
- path: {{ .Values.kdoctorAgent.ingress.route | quote }}
pathType: Exact
backend:
service:
name: kdoctor
port:
number: {{ .Values.kdoctorAgent.httpServer.appHttpPort }}
1 change: 1 addition & 0 deletions charts/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ spec:
- --configmap-daemonset-template=/tmp/configmap-app-template/daemonset.yml
- --configmap-pod-template=/tmp/configmap-app-template/pod.yml
- --configmap-service-template=/tmp/configmap-app-template/service.yml
- --configmap-ingress-template=/tmp/configmap-app-template/ingress.yml
- --tls-ca-cert=/etc/tls/ca.crt
- --tls-server-cert=/etc/tls/tls.crt
- --tls-server-key=/etc/tls/tls.key
Expand Down
25 changes: 0 additions & 25 deletions charts/templates/ingress.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions cmd/agent/cmd/cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func GenServerCert(logger *zap.Logger) {
if types.AgentConfig.Configmap.EnableIPv6 {
serviceIPv6, err := k8sObjManager.GetK8sObjManager().GetServiceAccessUrl(context.Background(), types.AgentConfig.ServiceV6Name, types.AgentConfig.PodNamespace, servicePortName)
if err != nil {
logger.Sugar().Fatalf("failed to get kdoctor ipv4 service %s/%s, reason=%v ", types.AgentConfig.PodNamespace, types.AgentConfig.ServiceV6Name, err)
logger.Sugar().Fatalf("failed to get kdoctor ipv6 service %s/%s, reason=%v ", types.AgentConfig.PodNamespace, types.AgentConfig.ServiceV6Name, err)
}
// ipv6 ip
logger.Sugar().Debugf("get ipv6 serviceAccessurl %v", serviceIPv6)
Expand Down Expand Up @@ -129,7 +129,7 @@ func checkServiceReady(logger *zap.Logger) {

if types.AgentConfig.Configmap.EnableIPv6 {
for {
_, err := k8sObjManager.GetK8sObjManager().GetService(ctx, types.AgentConfig.ServiceV4Name, types.AgentConfig.PodNamespace)
_, err := k8sObjManager.GetK8sObjManager().GetService(ctx, types.AgentConfig.ServiceV6Name, types.AgentConfig.PodNamespace)
if nil != err {
if errors.IsNotFound(err) {
logger.Sugar().Errorf("agent runtime IPv6 service %s/%s not exists, wait for controller to create it", types.AgentConfig.PodNamespace, types.AgentConfig.ServiceV6Name)
Expand Down
6 changes: 0 additions & 6 deletions cmd/agent/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ func init() {
globalFlag.StringVar(&types.AgentConfig.TaskName, "task-name", "", "task name")
globalFlag.StringVar(&types.AgentConfig.ServiceV4Name, "service-ipv4-name", "", "agent IPv4 service name")
globalFlag.StringVar(&types.AgentConfig.ServiceV6Name, "service-ipv6-name", "", "agent IPv6 service name")
if err := rootCmd.MarkPersistentFlagRequired("task-kind"); nil != err {
logger.Sugar().Fatalf("failed to mark persistentFlag 'task-kind' as required, error: %v", err)
}
if err := rootCmd.MarkPersistentFlagRequired("task-name"); nil != err {
logger.Sugar().Fatalf("failed to mark persistentFlag 'task-name' as required, error: %v", err)
}

globalFlag.BoolVarP(&types.AgentConfig.AppMode, "app-mode", "A", false, "app mode")
globalFlag.BoolVarP(&types.AgentConfig.TlsInsecure, "tls-insecure", "K", true, "skip verify tls")
Expand Down
3 changes: 3 additions & 0 deletions cmd/controller/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func init() {
globalFlag.StringVar(&types.ControllerConfig.ConfigMapDaemonsetPath, "configmap-daemonset-template", "", "configmap daemonset template file path")
globalFlag.StringVar(&types.ControllerConfig.ConfigMapPodPath, "configmap-pod-template", "", "configmap pod template file path")
globalFlag.StringVar(&types.ControllerConfig.ConfigMapServicePath, "configmap-service-template", "", "configmap service template file path")
globalFlag.StringVar(&types.ControllerConfig.ConfigMapIngressPath, "configmap-ingress-template", "", "configmap ingress template file path")
globalFlag.StringVarP(&types.ControllerConfig.TlsCaCertPath, "tls-ca-cert", "R", "", "ca file path")
globalFlag.StringVarP(&types.ControllerConfig.TlsServerCertPath, "tls-server-cert", "T", "", "server cert file path")
globalFlag.StringVarP(&types.ControllerConfig.TlsServerKeyPath, "tls-server-key", "Y", "", "server key file path")
Expand All @@ -90,6 +91,7 @@ func init() {
logger.Info("configmap-daemonset-template = " + types.ControllerConfig.ConfigMapDaemonsetPath)
logger.Info("configmap-pod-template = " + types.ControllerConfig.ConfigMapPodPath)
logger.Info("configmap-service-template = " + types.ControllerConfig.ConfigMapServicePath)
logger.Info("configmap-ingress-template = " + types.ControllerConfig.ConfigMapIngressPath)
logger.Info("tls-ca-cert = " + types.ControllerConfig.TlsCaCertPath)
logger.Info("tls-server-cert = " + types.ControllerConfig.TlsServerCertPath)
logger.Info("tls-server-key = " + types.ControllerConfig.TlsServerKeyPath)
Expand Down Expand Up @@ -122,6 +124,7 @@ func init() {
fn(types.ControllerConfig.ConfigMapDaemonsetPath, types.DaemonsetTempl)
fn(types.ControllerConfig.ConfigMapPodPath, types.PodTempl)
fn(types.ControllerConfig.ConfigMapServicePath, types.ServiceTempl)
fn(types.ControllerConfig.ConfigMapIngressPath, types.IngressTempl)
}
cobra.OnInitialize(printFlag)

Expand Down
31 changes: 25 additions & 6 deletions docs/reference/apphttphealthy-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ kind: AppHttpHealthy
metadata:
name: apphttphealth
spec:
agentSpec:
hostNetwork: false
kind: DaemonSet
terminationGracePeriodMinutes: 60
expect:
meanAccessDelayInMs: 1500
successRate: 1
Expand Down Expand Up @@ -60,12 +64,27 @@ status:
### Spec
| 字段 | 描述 | 结构 | 验证 | 取值 | 默认值 |
|-----------|------------------|------------------------------------------|---------|-------|------|
| schedule | 调度任务执行 | [schedule](./apphttphealthy-zh_CN.md#Schedule) | 可选 | | |
| request | 对目标地址请求配置 | [request](./apphttphealthy-zh_CN.md#Request) | 可选 | | |
| target | 请求目标设置 | [target](./apphttphealthy-zh_CN.md#Target) | 可选 | | |
| expect | 任务成功条件判断 | [expect](./apphttphealthy-zh_CN.md#Expect) | 可选 | | |
| 字段 | 描述 | 结构 | 验证 | 取值 | 默认值 |
|-----------|-------------|--------------------------------------------|---------|-------|------|
| agentSpec | 任务执行agent配置 | [agentSpec](./apphttphealthy-zh_CN.md#AgentSpec) | 可选 | | |
| schedule | 调度任务执行 | [schedule](./apphttphealthy-zh_CN.md#Schedule) | 可选 | | |
| request | 对目标地址请求配置 | [request](./apphttphealthy-zh_CN.md#Request) | 可选 | | |
| target | 请求目标设置 | [target](./apphttphealthy-zh_CN.md#Target) | 可选 | | |
| expect | 任务成功条件判断 | [expect](./apphttphealthy-zh_CN.md#Expect) | 可选 | | |
#### AgentSpec
| 字段 | 描述 | 结构 | 验证 | 取值 | 默认值 |
|-------------------------------|------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|-----|----------------------|-----------|
| annotation | agent 工作负载的 annotation 配合搭配 multus 多网卡使用 | map[string]string | 可选 | | |
| kind | agent 工作负载的类型 | string | 可选 | Deployment、DaemonSet | DaemonSet |
| deploymentReplicas | agent 工作负载类型为 deployment 时的期望副本数 | int | 可选 | 大于等于 0 | 0 |
| affinity | agent 工作负载亲和性 | [labelSelector](https://github.com/kubernetes/kubernetes/blob/v1.27.0/staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/types.go#L1195) | 可选 | | |
| env | agent 工作负载环境变量 | [env](https://github.com/kubernetes/kubernetes/blob/v1.27.0/staging/src/k8s.io/api/core/v1/types.go#L2012) | 可选 | | |
| hostNetwork | agent 工作负载是否使用宿主机网络 | bool | 可选 | true、false | false |
| resources | agent 工作负载资源使用配置 | [resources](https://github.com/kubernetes/kubernetes/blob/v1.27.0/staging/src/k8s.io/api/core/v1/types.go#L2333) | 可选 | | |
| terminationGracePeriodMinutes | agent 工作负载完成任务后多少分钟之后终止 | int | 可选 | 大于等于 0 | 60 |
#### Schedule
Expand Down
31 changes: 25 additions & 6 deletions docs/reference/netdns-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ kind: Netdns
metadata:
name: netdns-cluster
spec:
agentSpec:
hostNetwork: false
kind: DaemonSet
terminationGracePeriodMinutes: 60
expect:
meanAccessDelayInMs: 1500
successRate: 1
Expand Down Expand Up @@ -98,12 +102,27 @@ spec:
### Spec
| 字段 | 描述 | 结构 | 验证 | 取值 | 默认值 |
|-----------|------------------|------------------------------------------|---------|-------|------|
| schedule | 调度任务执行 | [schedule](./netdns-zh_CN.md#Schedule) | 可选 | | |
| request | 对目标地址请求配置 | [request](./netdns-zh_CN.md#Request) | 可选 | | |
| target | 请求目标设置 | [target](./netdns-zh_CN.md#Target) | 可选 | | |
| expect | 任务成功条件判断 | [expect](./netdns-zh_CN.md#Expect) | 可选 | | |
| 字段 | 描述 | 结构 | 验证 | 取值 | 默认值 |
|-----------|-------------|--------------------------------------------|---------|-------|------|
| agentSpec | 任务执行agent配置 | [agentSpec](./netdns-zh_CN.md#AgentSpec) | 可选 | | |
| schedule | 调度任务执行 | [schedule](./netdns-zh_CN.md#Schedule) | 可选 | | |
| request | 对目标地址请求配置 | [request](./netdns-zh_CN.md#Request) | 可选 | | |
| target | 请求目标设置 | [target](./netdns-zh_CN.md#Target) | 可选 | | |
| expect | 任务成功条件判断 | [expect](./netdns-zh_CN.md#Expect) | 可选 | | |
#### AgentSpec
| 字段 | 描述 | 结构 | 验证 | 取值 | 默认值 |
|-------------------------------|------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|-----|----------------------|-----------|
| annotation | agent 工作负载的 annotation 配合搭配 multus 多网卡使用 | map[string]string | 可选 | | |
| kind | agent 工作负载的类型 | string | 可选 | Deployment、DaemonSet | DaemonSet |
| deploymentReplicas | agent 工作负载类型为 deployment 时的期望副本数 | int | 可选 | 大于等于 0 | 0 |
| affinity | agent 工作负载亲和性 | [labelSelector](https://github.com/kubernetes/kubernetes/blob/v1.27.0/staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/types.go#L1195) | 可选 | | |
| env | agent 工作负载环境变量 | [env](https://github.com/kubernetes/kubernetes/blob/v1.27.0/staging/src/k8s.io/api/core/v1/types.go#L2012) | 可选 | | |
| hostNetwork | agent 工作负载是否使用宿主机网络 | bool | 可选 | true、false | false |
| resources | agent 工作负载资源使用配置 | [resources](https://github.com/kubernetes/kubernetes/blob/v1.27.0/staging/src/k8s.io/api/core/v1/types.go#L2333) | 可选 | | |
| terminationGracePeriodMinutes | agent 工作负载完成任务后多少分钟之后终止 | int | 可选 | 大于等于 0 | 60 |
#### Schedule
Expand Down
Loading

0 comments on commit 40f446f

Please sign in to comment.