-
Notifications
You must be signed in to change notification settings - Fork 18
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
add app mode testing server #22
Conversation
Codecov Report
@@ Coverage Diff @@
## main #22 +/- ##
=======================================
Coverage 40.77% 40.77%
=======================================
Files 8 8
Lines 488 488
=======================================
Hits 199 199
Misses 285 285
Partials 4 4
Flags with carried forward coverage won't be shown. Click here to find out more. |
|
1.This mode is used for kdoctor e2e testing, and readinessProbe still uses http |
0cb2591
to
78cc141
Compare
cf17f54
to
002725e
Compare
conflict |
done |
d5710ff
to
9bf3a72
Compare
charts/templates/service.yaml
Outdated
@@ -29,7 +29,11 @@ spec: | |||
{{- end }} | |||
{{- if .Values.feature.enableIPv4 }} | |||
- name: http | |||
port: {{ .Values.kdoctorAgent.httpServer.port }} | |||
port: {{ .Values.kdoctorAgent.httpServer.healthPort }} |
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.
health 不需要 用 service 暴露出来
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.
done
cmd/agent/cmd/appHttpServer.go
Outdated
RequestMethod: r.HTTPRequest.Method, | ||
ServerName: hostname, | ||
RequestCount: atomic.LoadInt64(&requestCounts), | ||
ParamDetail: ParamInformation, |
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.
supported all method ?
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.
CONNECT 这个方法不支持 剩下的都支持
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.
我说 在 响应中 list 所有支持的 method
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.
done
cmd/agent/cmd/appHttpServer.go
Outdated
} | ||
|
||
func (s *echoGetHandler) Handle(r echo.GetParams) middleware.Responder { | ||
s.logger.Sugar().Debugf("%s method %s request from %s", r.HTTPRequest.Proto, r.HTTPRequest.Method, r.HTTPRequest.RemoteAddr) |
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.
also print r.Delay
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.
done
cmd/agent/cmd/appHttpServer.go
Outdated
srvApp.TLSCertificateKey = flags.Filename(types.AgentConfig.TlsServerKeyPath) | ||
} | ||
} else { | ||
srvApp.Port = int(types.AgentConfig.AgentAppPort) |
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.
if http {
logger.Sugar().Infof("setup agent app http server at port %v", types.AgentConfig.AgentAppPort)
}
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.
done
cmd/agent/cmd/appHttpServer.go
Outdated
srvApp := server.NewServer(api) | ||
srvApp.EnabledListeners = []string{types.AgentConfig.AgentAppProtocol} | ||
if types.AgentConfig.AgentAppProtocol == "https" { | ||
srvApp.TLSPort = int(types.AgentConfig.AgentAppPort) |
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.
logger.Sugar().Infof("setup agent app https server at port %v", types.AgentConfig.AgentAppPort)
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.
done
cmd/agent/cmd/config.go
Outdated
@@ -71,6 +71,10 @@ func init() { | |||
globalFlag := rootCmd.PersistentFlags() | |||
globalFlag.StringVarP(&types.AgentConfig.ConfigMapPath, "config-path", "C", "", "configmap file path") | |||
globalFlag.BoolVarP(&types.AgentConfig.AppMode, "app-mode", "A", false, "app mode") | |||
globalFlag.StringVarP(&types.AgentConfig.AgentAppProtocol, "app-protocol", "P", "http", "app mode protocol") |
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.
AgentAppProtocol -> enableHttpTls : true / false
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.
done
cmd/agent/cmd/daemon.go
Outdated
if types.AgentConfig.AppMode { | ||
// app mode, just used to debug | ||
rootLogger.Info("run in app mode") | ||
// sleep forever | ||
select {} | ||
} else { | ||
rootLogger.Info("run in agent mode") | ||
|
||
initGrpcServer() |
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.
initGrpcServer also could be test in app mode
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.
done
cmd/agent/cmd/appHttpServer.go
Outdated
func SetupAppHttpServer() { | ||
logger := rootLogger.Named("app http") | ||
|
||
if types.AgentConfig.AgentAppPort == 0 { |
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.
AgentAppPort -> AppHttpPort
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.
done
cmd/agent/cmd/appHttpServer.go
Outdated
|
||
srvApp := server.NewServer(api) | ||
srvApp.EnabledListeners = []string{types.AgentConfig.AgentAppProtocol} | ||
if types.AgentConfig.AgentAppProtocol == "https" { |
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.
when tls is enabled, http 1.1 and http2.0 is supported at the same time ?
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.
同时支持
1df2ff0
to
dbee155
Compare
charts/values.yaml
Outdated
@@ -167,7 +167,7 @@ kdoctorAgent: | |||
ingressClass: "" | |||
|
|||
## @param kdoctorAgent.ingress.route the route of agent ingress. Default to "/kdoctoragent", if it changes, ingress please re-write url forwarded to "/kdoctoragent" | |||
route: "/kdoctoragent" |
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.
????
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.
done
@@ -323,8 +327,31 @@ kdoctorAgent: | |||
## @param kdoctorAgent.debug.gopsPort the gops port of template agent | |||
gopsPort: 5712 | |||
|
|||
## @section kdoctorController parameters | |||
## |
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.
????
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.
done
test/yaml/testbody.yaml
Outdated
test2: test2 | ||
kind: ConfigMap | ||
metadata: | ||
name: kdoctor-test-body |
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.
??
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.
done
sed 's?<<EXAMPLE_APP_IMAGE>>?ghcr.io/kdoctor-io/kdoctor-agent:'$(PROJECT_IMAGE_VERSION)'?' yaml/testpod.yaml | kubectl --kubeconfig=$(KIND_KUBECONFIG) apply -f - | ||
@ if ! kubectl rollout status daemonset/test --kubeconfig $(KIND_KUBECONFIG) -w --timeout=120s ; then \ | ||
sed 's?<<EXAMPLE_APP_IMAGE>>?ghcr.io/kdoctor-io/kdoctor-agent:'$(IMAGE_TAG)'?' yaml/testpod.yaml | kubectl --kubeconfig=$(KIND_KUBECONFIG) apply -f - | ||
@ if ! kubectl rollout status daemonset/kdoctor-test -n kube-system --kubeconfig $(KIND_KUBECONFIG) -w --timeout=120s ; then \ |
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.
就一个 app,导致 CI 不能串行,否则 所有的压测数据都不准了
cmd/agent/cmd/appHttpServer.go
Outdated
// Copyright 2023 Authors of kdoctor-io | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package cmd |
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.
这个实现 越来越大了,可 放到 pkg 中 ?
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.
done
f0ee404
to
cf5f327
Compare
charts/values.yaml
Outdated
@@ -26,6 +26,21 @@ global: | |||
## @param global.configName the configmap name | |||
configName: "kdoctor" | |||
|
|||
## TLS configuration for kdoctor | |||
tls: |
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.
tls 不是 一个子层级,是一个 顶级的层级
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.
done
charts/values.yaml
Outdated
|
||
## @param kdoctorAgent.tls.client.certExpiration server cert expiration | ||
# in day, default 200 years | ||
certExpiration: '73000' |
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.
不需要了,我们没有 刷 新的机制,暴露给用户是累赘
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.
done
pkg/utils/cert.go
Outdated
var caKey *rsa.PrivateKey | ||
var caDERBytes []byte | ||
// ----------- generate self-signed ca | ||
if caCertPath == "" && caKeyPath == "" { |
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.
||
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.
done
cmd/agent/cmd/cert.go
Outdated
} | ||
|
||
alternateDNS = append(alternateDNS, types.AgentConfig.PodName) | ||
logger.Sugar().Debugf("alternate ip %v", alternateIP) |
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.
alternate ip for tls cert:
alternate dns for tls cert
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.
done
cmd/agent/cmd/config.go
Outdated
@@ -71,6 +71,9 @@ func init() { | |||
globalFlag := rootCmd.PersistentFlags() | |||
globalFlag.StringVarP(&types.AgentConfig.ConfigMapPath, "config-path", "C", "", "configmap file path") | |||
globalFlag.BoolVarP(&types.AgentConfig.AppMode, "app-mode", "A", false, "app mode") | |||
globalFlag.BoolVarP(&types.AgentConfig.Insecure, "insecure", "K", true, "skip verify tls") |
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.
tls-insecure
Signed-off-by: ii2day <ji.li@daocloud.io>
No description provided.