From 79887e7170d36872588f05c62865dcfba6113496 Mon Sep 17 00:00:00 2001 From: ty-dc Date: Tue, 21 Nov 2023 17:59:56 +0800 Subject: [PATCH] e2e: Optimize installation and replacement of kdoctor Signed-off-by: tao.yang --- .../get_ipam_healthy_responses.go | 10 + .../daemonset/delete_ipam_ip_responses.go | 10 + .../daemonset/delete_ipam_ips_responses.go | 10 + .../get_coordinator_config_responses.go | 10 + .../get_workloadendpoint_responses.go | 10 + .../daemonset/post_ipam_ip_responses.go | 10 + .../daemonset/post_ipam_ips_responses.go | 10 + .../runtime/get_runtime_liveness_responses.go | 10 + .../get_runtime_readiness_responses.go | 10 + .../runtime/get_runtime_startup_responses.go | 10 + .../controller/get_ipam_status_responses.go | 10 + .../controller/post_ipam_gc_ips_responses.go | 10 + .../controller/put_ipam_ip_responses.go | 10 + .../runtime/get_runtime_liveness_responses.go | 10 + .../get_runtime_readiness_responses.go | 10 + .../runtime/get_runtime_startup_responses.go | 10 + go.mod | 20 +- go.sum | 60 +- test/Makefile | 45 +- test/Makefile.defs | 18 +- test/e2e/common/constant.go | 6 +- test/e2e/common/mode.go | 5 - .../macvlan_overlay_one_suite_test.go | 19 +- .../macvlan_overlay_one_test.go | 138 ++--- .../macvlan_underlay_one_suite_test.go | 18 +- .../macvlan_underlay_one_test.go | 134 ++-- test/e2e/kubevirt/kubevirt_suite_test.go | 3 - test/scripts/install-kdoctor.sh | 85 +++ test/scripts/install-spiderdoctor.sh | 84 --- test/scripts/prepare.sh | 1 + .../Masterminds/semver/v3/.golangci.yml | 24 +- .../Masterminds/semver/v3/CHANGELOG.md | 20 + .../Masterminds/semver/v3/constraints.go | 30 +- .../github.com/Masterminds/semver/v3/doc.go | 178 +++--- .../Masterminds/semver/v3/version.go | 47 +- .../Masterminds/sprig/v3/CHANGELOG.md | 15 +- .../github.com/Masterminds/sprig/v3/README.md | 9 +- .../swagger/commands/diff/spec_analyser.go | 2 +- .../cmd/swagger/commands/generate/model.go | 2 +- .../templates/client/response.gotmpl | 16 +- .../contrib/stratoscale/client/client.gotmpl | 37 +- .../contrib/stratoscale/client/facade.gotmpl | 2 +- .../stratoscale/server/configureapi.gotmpl | 25 +- .../go-swagger/go-swagger/generator/types.go | 2 +- .../go-swagger/go-swagger/scan/routes.go | 7 + .../go-swagger/go-swagger/scan/scanner.go | 21 + .../go-swagger/go-swagger/scan/schema.go | 35 +- vendor/github.com/huandu/xstrings/.travis.yml | 7 - vendor/github.com/huandu/xstrings/README.md | 182 +++--- vendor/github.com/huandu/xstrings/convert.go | 2 +- .../kdoctor}/LICENSE | 2 +- .../v1beta1/apphttphealthy_types.go | 97 +++ .../apis/kdoctor.io/v1beta1/common_types.go | 182 ++++++ .../pkg/k8s/apis/kdoctor.io/v1beta1/doc.go | 6 + .../kdoctor.io/v1beta1}/groupversion_info.go | 8 +- .../apis/kdoctor.io/v1beta1}/netdns_types.go | 63 +- .../apis/kdoctor.io/v1beta1/netreach_types.go | 92 +++ .../pkg/k8s/apis/kdoctor.io/v1beta1}/rbac.go | 16 +- .../k8s/apis/kdoctor.io/v1beta1}/register.go | 4 +- .../apis/kdoctor.io/v1beta1/types_string.go | 47 ++ .../v1beta1}/zz_generated.deepcopy.go | 581 +++++++++++++----- .../kdoctor/pkg/utils/string/string.go | 34 + .../v1/common_types.go | 103 ---- .../apis/spiderdoctor.spidernet.io/v1/doc.go | 6 - .../v1/nethttp_types.go | 145 ----- vendor/golang.org/x/net/http2/Dockerfile | 51 -- vendor/golang.org/x/net/http2/Makefile | 3 - vendor/golang.org/x/net/http2/server.go | 86 ++- vendor/golang.org/x/net/http2/transport.go | 33 +- vendor/golang.org/x/text/language/match.go | 2 +- vendor/golang.org/x/text/unicode/norm/trie.go | 2 +- vendor/modules.txt | 27 +- 72 files changed, 1950 insertions(+), 1099 deletions(-) create mode 100644 test/scripts/install-kdoctor.sh delete mode 100644 test/scripts/install-spiderdoctor.sh delete mode 100644 vendor/github.com/huandu/xstrings/.travis.yml rename vendor/github.com/{spidernet-io/spiderdoctor => kdoctor-io/kdoctor}/LICENSE (99%) create mode 100644 vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/apphttphealthy_types.go create mode 100644 vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/common_types.go create mode 100644 vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/doc.go rename vendor/github.com/{spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1 => kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1}/groupversion_info.go (76%) rename vendor/github.com/{spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1 => kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1}/netdns_types.go (52%) create mode 100644 vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/netreach_types.go rename vendor/github.com/{spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1 => kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1}/rbac.go (52%) rename vendor/github.com/{spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1 => kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1}/register.go (88%) create mode 100644 vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/types_string.go rename vendor/github.com/{spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1 => kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1}/zz_generated.deepcopy.go (52%) create mode 100644 vendor/github.com/kdoctor-io/kdoctor/pkg/utils/string/string.go delete mode 100644 vendor/github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1/common_types.go delete mode 100644 vendor/github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1/doc.go delete mode 100644 vendor/github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1/nethttp_types.go delete mode 100644 vendor/golang.org/x/net/http2/Dockerfile delete mode 100644 vendor/golang.org/x/net/http2/Makefile diff --git a/api/v1/agent/client/connectivity/get_ipam_healthy_responses.go b/api/v1/agent/client/connectivity/get_ipam_healthy_responses.go index 996500a365..459faaf48f 100644 --- a/api/v1/agent/client/connectivity/get_ipam_healthy_responses.go +++ b/api/v1/agent/client/connectivity/get_ipam_healthy_responses.go @@ -78,6 +78,11 @@ func (o *GetIpamHealthyOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the get ipam healthy o k response +func (o *GetIpamHealthyOK) Code() int { + return 200 +} + func (o *GetIpamHealthyOK) Error() string { return fmt.Sprintf("[GET /ipam/healthy][%d] getIpamHealthyOK ", 200) } @@ -129,6 +134,11 @@ func (o *GetIpamHealthyInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the get ipam healthy internal server error response +func (o *GetIpamHealthyInternalServerError) Code() int { + return 500 +} + func (o *GetIpamHealthyInternalServerError) Error() string { return fmt.Sprintf("[GET /ipam/healthy][%d] getIpamHealthyInternalServerError ", 500) } diff --git a/api/v1/agent/client/daemonset/delete_ipam_ip_responses.go b/api/v1/agent/client/daemonset/delete_ipam_ip_responses.go index dda3b0fd6e..5a501bdf2e 100644 --- a/api/v1/agent/client/daemonset/delete_ipam_ip_responses.go +++ b/api/v1/agent/client/daemonset/delete_ipam_ip_responses.go @@ -81,6 +81,11 @@ func (o *DeleteIpamIPOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the delete ipam Ip o k response +func (o *DeleteIpamIPOK) Code() int { + return 200 +} + func (o *DeleteIpamIPOK) Error() string { return fmt.Sprintf("[DELETE /ipam/ip][%d] deleteIpamIpOK ", 200) } @@ -133,6 +138,11 @@ func (o *DeleteIpamIPFailure) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the delete ipam Ip failure response +func (o *DeleteIpamIPFailure) Code() int { + return 500 +} + func (o *DeleteIpamIPFailure) Error() string { return fmt.Sprintf("[DELETE /ipam/ip][%d] deleteIpamIpFailure %+v", 500, o.Payload) } diff --git a/api/v1/agent/client/daemonset/delete_ipam_ips_responses.go b/api/v1/agent/client/daemonset/delete_ipam_ips_responses.go index 2e55cb5683..e1c259a918 100644 --- a/api/v1/agent/client/daemonset/delete_ipam_ips_responses.go +++ b/api/v1/agent/client/daemonset/delete_ipam_ips_responses.go @@ -81,6 +81,11 @@ func (o *DeleteIpamIpsOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the delete ipam ips o k response +func (o *DeleteIpamIpsOK) Code() int { + return 200 +} + func (o *DeleteIpamIpsOK) Error() string { return fmt.Sprintf("[DELETE /ipam/ips][%d] deleteIpamIpsOK ", 200) } @@ -133,6 +138,11 @@ func (o *DeleteIpamIpsFailure) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the delete ipam ips failure response +func (o *DeleteIpamIpsFailure) Code() int { + return 500 +} + func (o *DeleteIpamIpsFailure) Error() string { return fmt.Sprintf("[DELETE /ipam/ips][%d] deleteIpamIpsFailure %+v", 500, o.Payload) } diff --git a/api/v1/agent/client/daemonset/get_coordinator_config_responses.go b/api/v1/agent/client/daemonset/get_coordinator_config_responses.go index d6569c9420..21ba46f66d 100644 --- a/api/v1/agent/client/daemonset/get_coordinator_config_responses.go +++ b/api/v1/agent/client/daemonset/get_coordinator_config_responses.go @@ -82,6 +82,11 @@ func (o *GetCoordinatorConfigOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the get coordinator config o k response +func (o *GetCoordinatorConfigOK) Code() int { + return 200 +} + func (o *GetCoordinatorConfigOK) Error() string { return fmt.Sprintf("[GET /coordinator/config][%d] getCoordinatorConfigOK %+v", 200, o.Payload) } @@ -145,6 +150,11 @@ func (o *GetCoordinatorConfigFailure) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the get coordinator config failure response +func (o *GetCoordinatorConfigFailure) Code() int { + return 500 +} + func (o *GetCoordinatorConfigFailure) Error() string { return fmt.Sprintf("[GET /coordinator/config][%d] getCoordinatorConfigFailure %+v", 500, o.Payload) } diff --git a/api/v1/agent/client/daemonset/get_workloadendpoint_responses.go b/api/v1/agent/client/daemonset/get_workloadendpoint_responses.go index a06ac6a639..4063fcc80e 100644 --- a/api/v1/agent/client/daemonset/get_workloadendpoint_responses.go +++ b/api/v1/agent/client/daemonset/get_workloadendpoint_responses.go @@ -78,6 +78,11 @@ func (o *GetWorkloadendpointOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the get workloadendpoint o k response +func (o *GetWorkloadendpointOK) Code() int { + return 200 +} + func (o *GetWorkloadendpointOK) Error() string { return fmt.Sprintf("[GET /workloadendpoint][%d] getWorkloadendpointOK ", 200) } @@ -129,6 +134,11 @@ func (o *GetWorkloadendpointInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the get workloadendpoint internal server error response +func (o *GetWorkloadendpointInternalServerError) Code() int { + return 500 +} + func (o *GetWorkloadendpointInternalServerError) Error() string { return fmt.Sprintf("[GET /workloadendpoint][%d] getWorkloadendpointInternalServerError ", 500) } diff --git a/api/v1/agent/client/daemonset/post_ipam_ip_responses.go b/api/v1/agent/client/daemonset/post_ipam_ip_responses.go index fd07d4c043..37d153d611 100644 --- a/api/v1/agent/client/daemonset/post_ipam_ip_responses.go +++ b/api/v1/agent/client/daemonset/post_ipam_ip_responses.go @@ -82,6 +82,11 @@ func (o *PostIpamIPOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the post ipam Ip o k response +func (o *PostIpamIPOK) Code() int { + return 200 +} + func (o *PostIpamIPOK) Error() string { return fmt.Sprintf("[POST /ipam/ip][%d] postIpamIpOK %+v", 200, o.Payload) } @@ -145,6 +150,11 @@ func (o *PostIpamIPFailure) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the post ipam Ip failure response +func (o *PostIpamIPFailure) Code() int { + return 500 +} + func (o *PostIpamIPFailure) Error() string { return fmt.Sprintf("[POST /ipam/ip][%d] postIpamIpFailure %+v", 500, o.Payload) } diff --git a/api/v1/agent/client/daemonset/post_ipam_ips_responses.go b/api/v1/agent/client/daemonset/post_ipam_ips_responses.go index 68751a6e70..eba79d0b6a 100644 --- a/api/v1/agent/client/daemonset/post_ipam_ips_responses.go +++ b/api/v1/agent/client/daemonset/post_ipam_ips_responses.go @@ -81,6 +81,11 @@ func (o *PostIpamIpsOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the post ipam ips o k response +func (o *PostIpamIpsOK) Code() int { + return 200 +} + func (o *PostIpamIpsOK) Error() string { return fmt.Sprintf("[POST /ipam/ips][%d] postIpamIpsOK ", 200) } @@ -133,6 +138,11 @@ func (o *PostIpamIpsFailure) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the post ipam ips failure response +func (o *PostIpamIpsFailure) Code() int { + return 500 +} + func (o *PostIpamIpsFailure) Error() string { return fmt.Sprintf("[POST /ipam/ips][%d] postIpamIpsFailure %+v", 500, o.Payload) } diff --git a/api/v1/agent/client/runtime/get_runtime_liveness_responses.go b/api/v1/agent/client/runtime/get_runtime_liveness_responses.go index a984266a61..eec0ea9cec 100644 --- a/api/v1/agent/client/runtime/get_runtime_liveness_responses.go +++ b/api/v1/agent/client/runtime/get_runtime_liveness_responses.go @@ -78,6 +78,11 @@ func (o *GetRuntimeLivenessOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the get runtime liveness o k response +func (o *GetRuntimeLivenessOK) Code() int { + return 200 +} + func (o *GetRuntimeLivenessOK) Error() string { return fmt.Sprintf("[GET /runtime/liveness][%d] getRuntimeLivenessOK ", 200) } @@ -129,6 +134,11 @@ func (o *GetRuntimeLivenessInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the get runtime liveness internal server error response +func (o *GetRuntimeLivenessInternalServerError) Code() int { + return 500 +} + func (o *GetRuntimeLivenessInternalServerError) Error() string { return fmt.Sprintf("[GET /runtime/liveness][%d] getRuntimeLivenessInternalServerError ", 500) } diff --git a/api/v1/agent/client/runtime/get_runtime_readiness_responses.go b/api/v1/agent/client/runtime/get_runtime_readiness_responses.go index d1722d9e48..fe2d3de453 100644 --- a/api/v1/agent/client/runtime/get_runtime_readiness_responses.go +++ b/api/v1/agent/client/runtime/get_runtime_readiness_responses.go @@ -78,6 +78,11 @@ func (o *GetRuntimeReadinessOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the get runtime readiness o k response +func (o *GetRuntimeReadinessOK) Code() int { + return 200 +} + func (o *GetRuntimeReadinessOK) Error() string { return fmt.Sprintf("[GET /runtime/readiness][%d] getRuntimeReadinessOK ", 200) } @@ -129,6 +134,11 @@ func (o *GetRuntimeReadinessInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the get runtime readiness internal server error response +func (o *GetRuntimeReadinessInternalServerError) Code() int { + return 500 +} + func (o *GetRuntimeReadinessInternalServerError) Error() string { return fmt.Sprintf("[GET /runtime/readiness][%d] getRuntimeReadinessInternalServerError ", 500) } diff --git a/api/v1/agent/client/runtime/get_runtime_startup_responses.go b/api/v1/agent/client/runtime/get_runtime_startup_responses.go index e12e69980b..6f2076cf59 100644 --- a/api/v1/agent/client/runtime/get_runtime_startup_responses.go +++ b/api/v1/agent/client/runtime/get_runtime_startup_responses.go @@ -78,6 +78,11 @@ func (o *GetRuntimeStartupOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the get runtime startup o k response +func (o *GetRuntimeStartupOK) Code() int { + return 200 +} + func (o *GetRuntimeStartupOK) Error() string { return fmt.Sprintf("[GET /runtime/startup][%d] getRuntimeStartupOK ", 200) } @@ -129,6 +134,11 @@ func (o *GetRuntimeStartupInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the get runtime startup internal server error response +func (o *GetRuntimeStartupInternalServerError) Code() int { + return 500 +} + func (o *GetRuntimeStartupInternalServerError) Error() string { return fmt.Sprintf("[GET /runtime/startup][%d] getRuntimeStartupInternalServerError ", 500) } diff --git a/api/v1/controller/client/controller/get_ipam_status_responses.go b/api/v1/controller/client/controller/get_ipam_status_responses.go index a148d674df..b23bddc969 100644 --- a/api/v1/controller/client/controller/get_ipam_status_responses.go +++ b/api/v1/controller/client/controller/get_ipam_status_responses.go @@ -78,6 +78,11 @@ func (o *GetIpamStatusOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the get ipam status o k response +func (o *GetIpamStatusOK) Code() int { + return 200 +} + func (o *GetIpamStatusOK) Error() string { return fmt.Sprintf("[GET /ipam/status][%d] getIpamStatusOK ", 200) } @@ -129,6 +134,11 @@ func (o *GetIpamStatusInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the get ipam status internal server error response +func (o *GetIpamStatusInternalServerError) Code() int { + return 500 +} + func (o *GetIpamStatusInternalServerError) Error() string { return fmt.Sprintf("[GET /ipam/status][%d] getIpamStatusInternalServerError ", 500) } diff --git a/api/v1/controller/client/controller/post_ipam_gc_ips_responses.go b/api/v1/controller/client/controller/post_ipam_gc_ips_responses.go index 45b3503f13..f9096adc37 100644 --- a/api/v1/controller/client/controller/post_ipam_gc_ips_responses.go +++ b/api/v1/controller/client/controller/post_ipam_gc_ips_responses.go @@ -78,6 +78,11 @@ func (o *PostIpamGcIpsOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the post ipam gc ips o k response +func (o *PostIpamGcIpsOK) Code() int { + return 200 +} + func (o *PostIpamGcIpsOK) Error() string { return fmt.Sprintf("[POST /ipam/gc_ips][%d] postIpamGcIpsOK ", 200) } @@ -129,6 +134,11 @@ func (o *PostIpamGcIpsInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the post ipam gc ips internal server error response +func (o *PostIpamGcIpsInternalServerError) Code() int { + return 500 +} + func (o *PostIpamGcIpsInternalServerError) Error() string { return fmt.Sprintf("[POST /ipam/gc_ips][%d] postIpamGcIpsInternalServerError ", 500) } diff --git a/api/v1/controller/client/controller/put_ipam_ip_responses.go b/api/v1/controller/client/controller/put_ipam_ip_responses.go index e3c8dfaa38..31380078e2 100644 --- a/api/v1/controller/client/controller/put_ipam_ip_responses.go +++ b/api/v1/controller/client/controller/put_ipam_ip_responses.go @@ -78,6 +78,11 @@ func (o *PutIpamIPOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the put ipam Ip o k response +func (o *PutIpamIPOK) Code() int { + return 200 +} + func (o *PutIpamIPOK) Error() string { return fmt.Sprintf("[PUT /ipam/ip][%d] putIpamIpOK ", 200) } @@ -129,6 +134,11 @@ func (o *PutIpamIPInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the put ipam Ip internal server error response +func (o *PutIpamIPInternalServerError) Code() int { + return 500 +} + func (o *PutIpamIPInternalServerError) Error() string { return fmt.Sprintf("[PUT /ipam/ip][%d] putIpamIpInternalServerError ", 500) } diff --git a/api/v1/controller/client/runtime/get_runtime_liveness_responses.go b/api/v1/controller/client/runtime/get_runtime_liveness_responses.go index a984266a61..eec0ea9cec 100644 --- a/api/v1/controller/client/runtime/get_runtime_liveness_responses.go +++ b/api/v1/controller/client/runtime/get_runtime_liveness_responses.go @@ -78,6 +78,11 @@ func (o *GetRuntimeLivenessOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the get runtime liveness o k response +func (o *GetRuntimeLivenessOK) Code() int { + return 200 +} + func (o *GetRuntimeLivenessOK) Error() string { return fmt.Sprintf("[GET /runtime/liveness][%d] getRuntimeLivenessOK ", 200) } @@ -129,6 +134,11 @@ func (o *GetRuntimeLivenessInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the get runtime liveness internal server error response +func (o *GetRuntimeLivenessInternalServerError) Code() int { + return 500 +} + func (o *GetRuntimeLivenessInternalServerError) Error() string { return fmt.Sprintf("[GET /runtime/liveness][%d] getRuntimeLivenessInternalServerError ", 500) } diff --git a/api/v1/controller/client/runtime/get_runtime_readiness_responses.go b/api/v1/controller/client/runtime/get_runtime_readiness_responses.go index d1722d9e48..fe2d3de453 100644 --- a/api/v1/controller/client/runtime/get_runtime_readiness_responses.go +++ b/api/v1/controller/client/runtime/get_runtime_readiness_responses.go @@ -78,6 +78,11 @@ func (o *GetRuntimeReadinessOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the get runtime readiness o k response +func (o *GetRuntimeReadinessOK) Code() int { + return 200 +} + func (o *GetRuntimeReadinessOK) Error() string { return fmt.Sprintf("[GET /runtime/readiness][%d] getRuntimeReadinessOK ", 200) } @@ -129,6 +134,11 @@ func (o *GetRuntimeReadinessInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the get runtime readiness internal server error response +func (o *GetRuntimeReadinessInternalServerError) Code() int { + return 500 +} + func (o *GetRuntimeReadinessInternalServerError) Error() string { return fmt.Sprintf("[GET /runtime/readiness][%d] getRuntimeReadinessInternalServerError ", 500) } diff --git a/api/v1/controller/client/runtime/get_runtime_startup_responses.go b/api/v1/controller/client/runtime/get_runtime_startup_responses.go index e12e69980b..6f2076cf59 100644 --- a/api/v1/controller/client/runtime/get_runtime_startup_responses.go +++ b/api/v1/controller/client/runtime/get_runtime_startup_responses.go @@ -78,6 +78,11 @@ func (o *GetRuntimeStartupOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the get runtime startup o k response +func (o *GetRuntimeStartupOK) Code() int { + return 200 +} + func (o *GetRuntimeStartupOK) Error() string { return fmt.Sprintf("[GET /runtime/startup][%d] getRuntimeStartupOK ", 200) } @@ -129,6 +134,11 @@ func (o *GetRuntimeStartupInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the get runtime startup internal server error response +func (o *GetRuntimeStartupInternalServerError) Code() int { + return 500 +} + func (o *GetRuntimeStartupInternalServerError) Error() string { return fmt.Sprintf("[GET /runtime/startup][%d] getRuntimeStartupInternalServerError ", 500) } diff --git a/go.mod b/go.mod index 87203253f9..0a582d410e 100644 --- a/go.mod +++ b/go.mod @@ -15,13 +15,14 @@ require ( github.com/go-openapi/strfmt v0.21.7 github.com/go-openapi/swag v0.22.4 github.com/go-openapi/validate v0.22.1 - github.com/go-swagger/go-swagger v0.30.3 + github.com/go-swagger/go-swagger v0.30.4 github.com/gogo/protobuf v1.3.2 github.com/golang/mock v1.6.0 github.com/google/gops v0.3.27 github.com/grafana/pyroscope-go v1.0.2 github.com/jessevdk/go-flags v1.5.0 github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.4.0 + github.com/kdoctor-io/kdoctor v0.2.0 github.com/mdlayher/arp v0.0.0-20220512170110-6706a2966875 github.com/mdlayher/ethernet v0.0.0-20220221185849-529eae5b6118 github.com/mdlayher/ndp v1.0.1 @@ -34,7 +35,6 @@ require ( github.com/spf13/cobra v1.7.0 github.com/spf13/pflag v1.0.5 github.com/spidernet-io/e2eframework v0.0.0-20231122092103-bfaf2546ded3 - github.com/spidernet-io/spiderdoctor v0.3.0 github.com/tigera/operator v1.30.5 github.com/vishvananda/netlink v1.2.1-beta.2.0.20230621221334-77712cff8739 go.opentelemetry.io/otel v1.20.0 @@ -46,7 +46,7 @@ require ( go.uber.org/atomic v1.10.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.25.0 - golang.org/x/net v0.13.0 + golang.org/x/net v0.17.0 golang.org/x/sync v0.3.0 golang.org/x/sys v0.14.0 golang.org/x/tools v0.11.0 @@ -73,8 +73,8 @@ require ( require ( github.com/Masterminds/goutils v1.1.1 // indirect - github.com/Masterminds/semver/v3 v3.1.1 // indirect - github.com/Masterminds/sprig/v3 v3.2.2 // indirect + github.com/Masterminds/semver/v3 v3.2.0 // indirect + github.com/Masterminds/sprig/v3 v3.2.3 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/blang/semver/v4 v4.0.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect @@ -107,7 +107,7 @@ require ( github.com/gorilla/handlers v1.5.1 // indirect github.com/grafana/pyroscope-go/godeltaprof v0.1.3 // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/huandu/xstrings v1.3.2 // indirect + github.com/huandu/xstrings v1.3.3 // indirect github.com/imdario/mergo v0.3.13 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/josharian/intern v1.0.0 // indirect @@ -163,12 +163,12 @@ require ( github.com/yusufpapurcu/wmi v1.2.3 // indirect go.mongodb.org/mongo-driver v1.11.3 // indirect go.uber.org/dig v1.17.0 // indirect - golang.org/x/crypto v0.11.0 // indirect + golang.org/x/crypto v0.14.0 // indirect golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect golang.org/x/mod v0.12.0 // indirect - golang.org/x/oauth2 v0.8.0 // indirect - golang.org/x/term v0.10.0 // indirect - golang.org/x/text v0.11.0 // indirect + golang.org/x/oauth2 v0.10.0 // indirect + golang.org/x/term v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect golang.org/x/time v0.3.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/go.sum b/go.sum index 676ab1b6d2..bf64e3fe5d 100644 --- a/go.sum +++ b/go.sum @@ -51,10 +51,10 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= -github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= -github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= -github.com/Masterminds/sprig/v3 v3.2.2 h1:17jRggJu518dr3QaafizSXOjKYp94wKfABxUmyxvxX8= -github.com/Masterminds/sprig/v3 v3.2.2/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk= +github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g= +github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= +github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA= +github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= @@ -195,8 +195,8 @@ github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+ github.com/go-openapi/validate v0.22.1 h1:G+c2ub6q47kfX1sOBLwIQwzBVt8qmOAARyo/9Fqs9NU= github.com/go-openapi/validate v0.22.1/go.mod h1:rjnrwK57VJ7A8xqfpAOEKRH8yQSGUriMu5/zuPSQ1hg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-swagger/go-swagger v0.30.3 h1:HuzvdMRed/9Q8vmzVcfNBQByZVtT79DNZxZ18OprdoI= -github.com/go-swagger/go-swagger v0.30.3/go.mod h1:neDPes8r8PCz2JPvHRDj8BTULLh4VJUt7n6MpQqxhHM= +github.com/go-swagger/go-swagger v0.30.4 h1:cPrWLSXY6ZdcgfRicOj0lANg72TkTHz6uv/OlUdzO5U= +github.com/go-swagger/go-swagger v0.30.4/go.mod h1:YM5D5kR9c1ft3ynMXvDk2uo/7UZHKFEqKXcAL9f4Phc= github.com/go-swagger/scan-repo-boundary v0.0.0-20180623220736-973b3573c013 h1:l9rI6sNaZgNC0LnF3MiE+qTmyBA/tZAg1rtyrGbUMK0= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= @@ -336,9 +336,8 @@ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= -github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw= -github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4= +github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= @@ -368,6 +367,8 @@ github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.4.0 h1:V github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.4.0/go.mod h1:nqCI7aelBJU61wiBeeZWJ6oi4bJy5nrjkM6lWIMA4j0= github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= +github.com/kdoctor-io/kdoctor v0.2.0 h1:X2XHrTZ+RDuAJ+HiKZ1UHzIvFM3/Al6JDyg2nxtziAU= +github.com/kdoctor-io/kdoctor v0.2.0/go.mod h1:TxkjBwM4sdnOTHABxgL1gO68tlzHUnbiuRYBHRLKYTc= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= @@ -548,8 +549,6 @@ github.com/spf13/viper v1.16.0 h1:rGGH0XDZhdUOryiDWjmIvUSWpbNqisK8Wk0Vyefw8hc= github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg= github.com/spidernet-io/e2eframework v0.0.0-20231122092103-bfaf2546ded3 h1:E/Hqa5S13QvHOgNIy7MVfElDxBK5DMAdRQQPKwCCshY= github.com/spidernet-io/e2eframework v0.0.0-20231122092103-bfaf2546ded3/go.mod h1:RdWxk8i4tb80fYXBOEb8lm4Giusp6DFAGxgmt7OIGOo= -github.com/spidernet-io/spiderdoctor v0.3.0 h1:Nq8xf8f1GkT3dRmeM2gt38ivkS5Fjpnz7LzueWGL6cA= -github.com/spidernet-io/spiderdoctor v0.3.0/go.mod h1:4TcvXLBhlgqTYFO+LnagEKsEF2UKTukLhodPrsuqYnA= github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -598,6 +597,7 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw= github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.mongodb.org/mongo-driver v1.7.3/go.mod h1:NqaYOwnXWr5Pm7AOpO5QFxKJ503nbMse/R79oO62zWg= @@ -640,15 +640,16 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= -golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= +golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -686,6 +687,7 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -733,8 +735,10 @@ golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.13.0 h1:Nvo8UFsZ8X3BhAC9699Z1j7XQ3rsZnUUm7jfBEk1ueY= -golang.org/x/net v0.13.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -747,8 +751,8 @@ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.8.0 h1:6dkIjl3j3LtZ/O3sTgZTMsLKSftL/B8Zgq4huOIIUu8= -golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= +golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8= +golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -761,6 +765,7 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -827,7 +832,9 @@ golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -838,8 +845,9 @@ golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= -golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= +golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= +golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -849,8 +857,9 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -917,6 +926,7 @@ golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.6-0.20210820212750-d4cc65f0b2ff/go.mod h1:YD9qOF0M9xpSpdWTBbzEl5e/RnCefISl8E5Noe10jFM= golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.11.0 h1:EMCa6U9S2LtZXLAMoWiR/R8dAQFRqbAitmbJ2UKhoi8= golang.org/x/tools v0.11.0/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -996,9 +1006,9 @@ google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= -google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc h1:8DyZCyvI8mE1IdLy/60bS+52xfymkE72wv1asokgtao= -google.golang.org/genproto/googleapis/api v0.0.0-20230526203410-71b5a4ffd15e h1:AZX1ra8YbFMSb7+1pI8S9v4rrgRR7jU1FmuFSSjTVcQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= +google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 h1:Z0hjGZePRE0ZBWotvtrwxFNrNE9CUAGtplaDK5NNI/g= +google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1:FmF5cCW94Ij59cfpoLiwTgodWmm60eEV0CjlsVg2fuw= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/test/Makefile b/test/Makefile index 65999a0f7f..3eb881d5aa 100644 --- a/test/Makefile +++ b/test/Makefile @@ -19,7 +19,6 @@ kind-init: check_env prepare E2E_IP_FAMILY=$(E2E_IP_FAMILY) \ E2E_CLUSTER_NAME=$(E2E_CLUSTER_NAME) \ E2E_KUBECONFIG=$(E2E_KUBECONFIG) \ - INSTALL_NETTOOLS=$(INSTALL_NETTOOLS) \ E2E_VLAN_GATEWAY_IMAGE=$(E2E_VLAN_GATEWAY_IMAGE) \ VLAN_GATEWAY_CONTAINER=$(VLAN_GATEWAY_CONTAINER) \ $(QUIET) bash scripts/config-network.sh @@ -46,8 +45,7 @@ ifeq ($(INSTALL_OVERLAY_CNI),true) endif @echo -e "\033[35m [Step 7] Install Spiderpool \033[0m" @ make setup_spiderpool -ifeq ($(INSTALL_MULTUS),true) - @echo -e "\033[35m [Step 8] Install Multus \033[0m" + @echo -e "\033[35m [Step 8] Install Multus CR and IPPool CR \033[0m" @ IMAGE_MULTUS=$(IMAGE_MULTUS_NAME) \ E2E_IP_FAMILY=$(E2E_IP_FAMILY) \ MULTUS_DEFAULT_CNI_NAME=$(MULTUS_DEFAULT_CNI_VLAN0) \ @@ -65,21 +63,20 @@ ifeq ($(INSTALL_MULTUS),true) CLUSTER_PATH=$(CLUSTER_DIR)/$(E2E_CLUSTER_NAME) \ E2E_SPIDERPOOL_ENABLE_SUBNET=${E2E_SPIDERPOOL_ENABLE_SUBNET} \ scripts/install-multus.sh $(E2E_CLUSTER_NAME) $(E2E_KUBECONFIG) -endif ifeq ($(INSTALL_KRUISE),true) @echo -e "\033[35m [Step 9] Install third-party controllers: kurise \033[0m" @ make setup_kurise endif -ifeq ($(INSTALL_SPIDERDOCTOR),true) - @echo -e "\033[35m [Step 10] Install SpiderDoctor \033[0m" +ifeq ($(INSTALL_KDOCTOR),true) + @echo -e "\033[35m [Step 10] Install kdoctor \033[0m" E2E_KUBECONFIG=$(E2E_KUBECONFIG) \ E2E_IP_FAMILY=$(E2E_IP_FAMILY) \ E2E_CLUSTER_NAME=$(E2E_CLUSTER_NAME) \ - SPIDERDOCTOR_VERSION=$(SPIDERDOCTOR_VERSION) \ - SPIDERDOCTOR_REPORT_PATH=$(SPIDERDOCTOR_REPORT_PATH) \ - E2E_SPIDERDOCTOR_IMAGE_REPO=$(E2E_SPIDERDOCTOR_IMAGE_REPO) \ + KDOCTOR_VERSION=$(KDOCTOR_VERSION) \ + KDOCTOR_REPORT_PATH=$(KDOCTOR_REPORT_PATH) \ + E2E_KDOCTOR_IMAGE_REPO=$(E2E_KDOCTOR_IMAGE_REPO) \ HTTP_PROXY=$(HTTP_PROXY) \ - $(QUIET) bash scripts/install-spiderdoctor.sh + $(QUIET) bash scripts/install-kdoctor.sh endif ifeq ($(INSTALL_KUBEVIRT),true) @echo -e "\033[35m [Step 10] Install kubevirt \033[0m" @@ -95,7 +92,7 @@ endif RELEASE_NAMESPACE=$(RELEASE_NAMESPACE) \ MULTUS_DEFAULT_CNI_NAME=$(MULTUS_DEFAULT_CNI_VLAN0) \ E2E_CLUSTER_NAME=$(E2E_CLUSTER_NAME) \ - scripts/installTestPod.sh $(E2E_KUBECONFIG) $(INSTALL_MULTUS) + scripts/installTestPod.sh $(E2E_KUBECONFIG) @echo "" @echo "-----------------------------------------------------------------------------------------------------" @echo " ip family: $(E2E_IP_FAMILY)" @@ -201,22 +198,18 @@ setup_spiderpool: else \ HELM_OPTION+=" --set coordinator.enabled=false " ; \ fi ; \ - if [ "$(INSTALL_MULTUS)" == "true" ] ; then \ - HELM_OPTION+=" --set multus.multusCNI.install=true " ; \ - HELM_OPTION+=" --set multus.multusCNI.image.registry= " ; \ - HELM_OPTION+=" --set multus.multusCNI.image.repository=$(E2E_MULTUS_IMAGE_NAME) " ; \ - if [ "$(INSTALL_OVERLAY_CNI)" == "true" ]; then \ - HELM_OPTION+=" --set multus.multusCNI.defaultCniCRName= " ; \ - else \ - HELM_OPTION+=" --set multus.multusCNI.defaultCniCRName=$(MULTUS_DEFAULT_CNI_VLAN0) " ; \ - fi ; \ - if [ "$(E2E_SPIDERPOOL_ENABLE_MULTUSCONFIG)" == "true" ] ; then \ - HELM_OPTION+=" --set multus.enableMultusConfig=true " ; \ - else \ - HELM_OPTION+=" --set multus.enableMultusConfig=false " ; \ - fi ; \ + HELM_OPTION+=" --set multus.multusCNI.install=true " ; \ + HELM_OPTION+=" --set multus.multusCNI.image.registry= " ; \ + HELM_OPTION+=" --set multus.multusCNI.image.repository=$(E2E_MULTUS_IMAGE_NAME) " ; \ + if [ "$(INSTALL_OVERLAY_CNI)" == "true" ]; then \ + HELM_OPTION+=" --set multus.multusCNI.defaultCniCRName= " ; \ + else \ + HELM_OPTION+=" --set multus.multusCNI.defaultCniCRName=$(MULTUS_DEFAULT_CNI_VLAN0) " ; \ + fi ; \ + if [ "$(E2E_SPIDERPOOL_ENABLE_MULTUSCONFIG)" == "true" ] ; then \ + HELM_OPTION+=" --set multus.enableMultusConfig=true " ; \ else \ - HELM_OPTION+=" --set multus.multusCNI.install=false " ; \ + HELM_OPTION+=" --set multus.enableMultusConfig=false " ; \ fi ; \ if [ "$(E2E_SPIDERPOOL_ENABLE_SUBNET)" == "true" ] ; then \ HELM_OPTION+=" --set ipam.enableSpiderSubnet=true " ; \ diff --git a/test/Makefile.defs b/test/Makefile.defs index 0ad7086750..975aaf49e0 100644 --- a/test/Makefile.defs +++ b/test/Makefile.defs @@ -39,9 +39,7 @@ E2E_DISABLE_DEFAULT_CNI ?= true INSTALL_MACVLAN ?= true -INSTALL_MULTUS ?= true - -INSTALL_KRUISE ?= true +INSTALL_KRUISE ?= false INSTALL_OVERLAY_CNI ?= false @@ -51,9 +49,7 @@ INSTALL_CILIUM ?= true DISABLE_KUBE_PROXY ?= false -INSTALL_NETTOOLS ?= false - -INSTALL_SPIDERDOCTOR ?= true +INSTALL_KDOCTOR ?= false INSTALL_KUBEVIRT ?= false @@ -150,16 +146,16 @@ endif CILIUM_VERSION ?= -#================= spiderdoctor -SPIDERDOCTOR_VERSION ?= v0.3.0 +#================= kdoctor +KDOCTOR_VERSION ?= v0.2.0 ifeq ($(E2E_CHINA_IMAGE_REGISTRY),true) - E2E_SPIDERDOCTOR_IMAGE_REPO ?= ghcr.m.daocloud.io + E2E_KDOCTOR_IMAGE_REPO ?= ghcr.m.daocloud.io else - E2E_SPIDERDOCTOR_IMAGE_REPO ?= ghcr.io + E2E_KDOCTOR_IMAGE_REPO ?= ghcr.io endif -SPIDERDOCTOR_REPORT_PATH=/var/log/spiderdoctor/controller +KDOCTOR_REPORT_PATH=/var/log/kdoctor/controller #====== pyroscope PYROSCOPE_CONTAINER_NAME := e2e-pyroscope diff --git a/test/e2e/common/constant.go b/test/e2e/common/constant.go index d30f69bdfb..b81bab1ff9 100644 --- a/test/e2e/common/constant.go +++ b/test/e2e/common/constant.go @@ -75,8 +75,10 @@ var ( SpiderPoolIPv6SubnetVlan200 string = "vlan200-v6" MultusNs = "kube-system" - SpiderDoctorAgentNs = "kube-system" - SpiderDoctorAgentDSName = "spiderdoctor-agent" + KDoctorAgentNs = "kube-system" + KDoctorAgentDSName = "kdoctor-agent" + KDoctorAgentServiceIPV4 = "kdoctor-agent-ipv4" + KDoctorAgentServiceIPV6 = "kdoctor-agent-ipv6" // gateway and check for ip conflicting machines VlanGatewayContainer = "vlan-gateway" diff --git a/test/e2e/common/mode.go b/test/e2e/common/mode.go index 59235fe5c7..5afaab36a3 100644 --- a/test/e2e/common/mode.go +++ b/test/e2e/common/mode.go @@ -12,7 +12,6 @@ const ( ENV_INSTALL_OVERLAY = "INSTALL_OVERLAY_CNI" E2E_SPIDERPOOL_ENABLE_SUBNET = "E2E_SPIDERPOOL_ENABLE_SUBNET" INSTALL_CILIUM = "INSTALL_CILIUM" - INSTALL_MULTUS = "INSTALL_MULTUS" ) func checkBoolEnv(name string) bool { @@ -35,7 +34,3 @@ func CheckSubnetFeatureOn() bool { func CheckCiliumFeatureOn() bool { return checkBoolEnv(INSTALL_CILIUM) } - -func CheckMultusFeatureOn() bool { - return checkBoolEnv(INSTALL_MULTUS) -} diff --git a/test/e2e/coordinator/macvlan-overlay-one/macvlan_overlay_one_suite_test.go b/test/e2e/coordinator/macvlan-overlay-one/macvlan_overlay_one_suite_test.go index 17725c6a98..59922e8d60 100644 --- a/test/e2e/coordinator/macvlan-overlay-one/macvlan_overlay_one_suite_test.go +++ b/test/e2e/coordinator/macvlan-overlay-one/macvlan_overlay_one_suite_test.go @@ -6,13 +6,12 @@ import ( "testing" multus_v1 "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1" + kdoctorV1beta1 "github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" e2e "github.com/spidernet-io/e2eframework/framework" - spiderdoctorV1 "github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1" spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" "github.com/spidernet-io/spiderpool/test/e2e/common" - appsv1 "k8s.io/api/apps/v1" "k8s.io/apimachinery/pkg/runtime" ) @@ -24,24 +23,22 @@ func TestMacvlanOverlayOne(t *testing.T) { var frame *e2e.Framework // var name string -var spiderDoctorAgent *appsv1.DaemonSet - var successRate = float64(1) var name string var err error var delayMs = int64(15000) var ( - task *spiderdoctorV1.Nethttp - plan *spiderdoctorV1.SchedulePlan - target *spiderdoctorV1.NethttpTarget - targetAgent *spiderdoctorV1.TargetAgentSepc - request *spiderdoctorV1.NethttpRequest - condition *spiderdoctorV1.NetSuccessCondition + task *kdoctorV1beta1.NetReach + netreach *kdoctorV1beta1.AgentSpec + targetAgent *kdoctorV1beta1.NetReachTarget + request *kdoctorV1beta1.NetHttpRequest + schedule *kdoctorV1beta1.SchedulePlan + condition *kdoctorV1beta1.NetSuccessCondition run = true ) var _ = BeforeSuite(func() { - frame, err = e2e.NewFramework(GinkgoT(), []func(*runtime.Scheme) error{multus_v1.AddToScheme, spiderpool.AddToScheme, spiderdoctorV1.AddToScheme}) + frame, err = e2e.NewFramework(GinkgoT(), []func(*runtime.Scheme) error{multus_v1.AddToScheme, spiderpool.AddToScheme, kdoctorV1beta1.AddToScheme}) Expect(err).NotTo(HaveOccurred()) if !common.CheckRunOverlayCNI() { diff --git a/test/e2e/coordinator/macvlan-overlay-one/macvlan_overlay_one_test.go b/test/e2e/coordinator/macvlan-overlay-one/macvlan_overlay_one_test.go index daabb6e3da..69402aef2d 100644 --- a/test/e2e/coordinator/macvlan-overlay-one/macvlan_overlay_one_test.go +++ b/test/e2e/coordinator/macvlan-overlay-one/macvlan_overlay_one_test.go @@ -15,7 +15,7 @@ import ( "k8s.io/utils/pointer" - spiderdoctorV1 "github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1" + kdoctorV1beta1 "github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1" "github.com/spidernet-io/spiderpool/pkg/constant" "github.com/spidernet-io/spiderpool/pkg/ip" spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" @@ -39,14 +39,15 @@ var _ = Describe("MacvlanOverlayOne", Label("overlay", "one-nic", "coordinator") defer GinkgoRecover() var annotations = make(map[string]string) - task = new(spiderdoctorV1.Nethttp) - plan = new(spiderdoctorV1.SchedulePlan) - target = new(spiderdoctorV1.NethttpTarget) - targetAgent = new(spiderdoctorV1.TargetAgentSepc) - request = new(spiderdoctorV1.NethttpRequest) - condition = new(spiderdoctorV1.NetSuccessCondition) + task = new(kdoctorV1beta1.NetReach) + targetAgent = new(kdoctorV1beta1.NetReachTarget) + request = new(kdoctorV1beta1.NetHttpRequest) + netreach = new(kdoctorV1beta1.AgentSpec) + schedule = new(kdoctorV1beta1.SchedulePlan) + condition = new(kdoctorV1beta1.NetSuccessCondition) name = "one-macvlan-overlay-" + tools.RandomName() + // Update netreach.agentSpec to generate test Pods using the macvlan annotations[common.MultusNetworks] = fmt.Sprintf("%s/%s", common.MultusNs, common.MacvlanVlan100) if frame.Info.IpV4Enabled && frame.Info.IpV6Enabled { annotations[constant.AnnoPodIPPool] = `{"interface": "net1", "ipv4": ["vlan100-v4"], "ipv6": ["vlan100-v6"]}` @@ -55,95 +56,63 @@ var _ = Describe("MacvlanOverlayOne", Label("overlay", "one-nic", "coordinator") } else { annotations[constant.AnnoPodIPPool] = `{"interface": "net1", "ipv6": ["vlan100-v6"]}` } - - GinkgoWriter.Printf("update spiderdoctoragent annotation: %v/%v annotation: %v \n", common.SpiderDoctorAgentNs, common.SpiderDoctorAgentDSName, annotations) - spiderDoctorAgent, err = frame.GetDaemonSet(common.SpiderDoctorAgentDSName, common.SpiderDoctorAgentNs) - Expect(err).NotTo(HaveOccurred()) - Expect(spiderDoctorAgent).NotTo(BeNil()) - - GinkgoWriter.Printf("remove old spiderdoctor %v/%v \n", common.SpiderDoctorAgentNs, common.SpiderDoctorAgentDSName) - err = frame.DeleteDaemonSet(common.SpiderDoctorAgentDSName, common.SpiderDoctorAgentNs) - Expect(err).NotTo(HaveOccurred()) - - Eventually(func() bool { - spiderDoctorAgentPodList, err := frame.GetPodListByLabel(spiderDoctorAgent.Spec.Template.Labels) - if err != nil { - GinkgoWriter.Printf("failed to get pod list %v,error is: %v \n", err) - return false - } - if len(spiderDoctorAgentPodList.Items) != 0 { - return false - } - return true - }, common.ResourceDeleteTimeout, common.ForcedWaitingTime).Should(BeTrue()) - - // issue: the object has been modified; please apply your changes to the latest version and try again - spiderDoctorAgent.ResourceVersion = "" - spiderDoctorAgent.CreationTimestamp = v1.Time{} - spiderDoctorAgent.UID = apitypes.UID("") - spiderDoctorAgent.Spec.Template.Annotations = annotations - - GinkgoWriter.Printf("create spiderdoctor %v/%v \n", common.SpiderDoctorAgentNs, common.SpiderDoctorAgentDSName) - err = frame.CreateDaemonSet(spiderDoctorAgent) - Expect(err).NotTo(HaveOccurred()) - - nodeList, err := frame.GetNodeList() - Expect(err).NotTo(HaveOccurred()) - - ctx, cancel := context.WithTimeout(context.Background(), common.PodReStartTimeout) - defer cancel() - err = frame.WaitPodListRunning(spiderDoctorAgent.Spec.Selector.MatchLabels, len(nodeList.Items), ctx) - Expect(err).NotTo(HaveOccurred()) + netreach.Annotation = annotations + netreach.HostNetwork = false + GinkgoWriter.Printf("update kdoctoragent annotation: %v/%v annotation: %v \n", common.KDoctorAgentNs, common.KDoctorAgentDSName, annotations) + task.Spec.AgentSpec = netreach }) - It("spiderdoctor connectivity should be succeed", Serial, Label("C00002"), Label("ebpf"), func() { + It("kdoctor connectivity should be succeed", Serial, Label("C00002"), Label("ebpf"), func() { - // create task spiderdoctor crd + enable := true + disable := false + // create task kdoctor crd task.Name = name - // schedule - plan.StartAfterMinute = 0 - plan.RoundNumber = 2 - plan.IntervalMinute = 2 - plan.TimeoutMinute = 2 - task.Spec.Schedule = plan + GinkgoWriter.Printf("Start the netreach task: %v", task.Name) // target - targetAgent.TestIngress = false - targetAgent.TestEndpoint = true - targetAgent.TestClusterIp = true - targetAgent.TestMultusInterface = frame.Info.MultusEnabled - targetAgent.TestNodePort = true - - targetAgent.TestIPv4 = &frame.Info.IpV4Enabled + targetAgent.Ingress = &disable + targetAgent.Endpoint = &enable + targetAgent.ClusterIP = &enable + targetAgent.MultusInterface = &frame.Info.MultusEnabled + targetAgent.NodePort = &enable + targetAgent.EnableLatencyMetric = true + + targetAgent.IPv4 = &frame.Info.IpV4Enabled if common.CheckCiliumFeatureOn() { // TODO(tao.yang), set testIPv6 to false, reference issue: https://github.com/spidernet-io/spiderpool/issues/2007 - testIPv6 := false - targetAgent.TestIPv6 = &testIPv6 + targetAgent.IPv6 = &disable } else { - targetAgent.TestIPv6 = &frame.Info.IpV6Enabled + targetAgent.IPv6 = &frame.Info.IpV6Enabled } - GinkgoWriter.Printf("targetAgent for spiderdoctor %+v", targetAgent) - target.TargetAgent = targetAgent - task.Spec.Target = target + GinkgoWriter.Printf("targetAgent for kdoctor %+v", targetAgent) + task.Spec.Target = targetAgent // request request.DurationInSecond = 5 request.QPS = 1 - request.PerRequestTimeoutInMS = 15000 + request.PerRequestTimeoutInMS = 7000 task.Spec.Request = request + // Schedule + crontab := "0 1" + schedule.Schedule = &crontab + schedule.RoundNumber = 1 + schedule.RoundTimeoutMinute = 1 + task.Spec.Schedule = schedule + // success condition condition.SuccessRate = &successRate condition.MeanAccessDelayInMs = &delayMs task.Spec.SuccessCondition = condition taskCopy := task - GinkgoWriter.Printf("spiderdoctor task: %+v", task) + GinkgoWriter.Printf("kdoctor task: %+v \n", task) err := frame.CreateResource(task) - Expect(err).NotTo(HaveOccurred(), " spiderdoctor nethttp crd create failed") + Expect(err).NotTo(HaveOccurred(), " kdoctor nethttp crd create failed") err = frame.GetResource(apitypes.NamespacedName{Name: name}, taskCopy) - Expect(err).NotTo(HaveOccurred(), " spiderdoctor nethttp crd get failed") + Expect(err).NotTo(HaveOccurred(), " kdoctor nethttp crd get failed") ctx, cancel := context.WithTimeout(context.Background(), common.KdoctorCheckTime) defer cancel() @@ -152,13 +121,16 @@ var _ = Describe("MacvlanOverlayOne", Label("overlay", "one-nic", "coordinator") select { case <-ctx.Done(): run = false - Expect(errors.New("wait nethttp test timeout")).NotTo(HaveOccurred(), " running spiderdoctor task timeout") + Expect(errors.New("wait nethttp test timeout")).NotTo(HaveOccurred(), " running kdoctor task timeout") default: err = frame.GetResource(apitypes.NamespacedName{Name: name}, taskCopy) - Expect(err).NotTo(HaveOccurred(), "spiderdoctor nethttp crd get failed,err is %v", err) + Expect(err).NotTo(HaveOccurred(), "kdoctor nethttp crd get failed, err is %v", err) if taskCopy.Status.Finish == true { - GinkgoWriter.Printf("spiderdoctor's nethttp execution result %+v", taskCopy) + command := fmt.Sprintf("get netreaches.kdoctor.io %s -oyaml", taskCopy.Name) + netreachesLog, _ := frame.ExecKubectl(command, ctx) + GinkgoWriter.Printf("kdoctor's netreaches execution result %+v \n", string(netreachesLog)) + for _, v := range taskCopy.Status.History { if v.Status != "succeed" { err = errors.New("error has occurred") @@ -166,6 +138,24 @@ var _ = Describe("MacvlanOverlayOne", Label("overlay", "one-nic", "coordinator") } } run = false + + ctx1, cancel1 := context.WithTimeout(context.Background(), time.Second*30) + defer cancel1() + for { + select { + case <-ctx1.Done(): + Expect(errors.New("wait kdoctorreport timeout")).NotTo(HaveOccurred(), "failed to run kdoctor task and wait kdoctorreport timeout") + default: + command = fmt.Sprintf("get kdoctorreport %s -oyaml", taskCopy.Name) + kdoctorreportLog, err := frame.ExecKubectl(command, ctx) + if err != nil { + time.Sleep(common.ForcedWaitingTime) + continue + } + GinkgoWriter.Printf("kdoctor's kdoctorreport execution result %+v \n", string(kdoctorreportLog)) + } + break + } } time.Sleep(time.Second * 5) } diff --git a/test/e2e/coordinator/macvlan-underlay-one/macvlan_underlay_one_suite_test.go b/test/e2e/coordinator/macvlan-underlay-one/macvlan_underlay_one_suite_test.go index a5cb46c138..49913ab443 100644 --- a/test/e2e/coordinator/macvlan-underlay-one/macvlan_underlay_one_suite_test.go +++ b/test/e2e/coordinator/macvlan-underlay-one/macvlan_underlay_one_suite_test.go @@ -6,13 +6,12 @@ import ( "testing" multus_v1 "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1" + kdoctorV1beta1 "github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" e2e "github.com/spidernet-io/e2eframework/framework" - spiderdoctorV1 "github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1" spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" "github.com/spidernet-io/spiderpool/test/e2e/common" - appsv1 "k8s.io/api/apps/v1" "k8s.io/apimachinery/pkg/runtime" ) @@ -24,22 +23,21 @@ func TestMacvlanStandaloneOne(t *testing.T) { var frame *e2e.Framework var name string var err error -var spiderDoctorAgent *appsv1.DaemonSet var annotations = make(map[string]string) var successRate = float64(1) var delayMs = int64(15000) var ( - task *spiderdoctorV1.Nethttp - plan *spiderdoctorV1.SchedulePlan - target *spiderdoctorV1.NethttpTarget - targetAgent *spiderdoctorV1.TargetAgentSepc - request *spiderdoctorV1.NethttpRequest - condition *spiderdoctorV1.NetSuccessCondition + task *kdoctorV1beta1.NetReach + netreach *kdoctorV1beta1.AgentSpec + targetAgent *kdoctorV1beta1.NetReachTarget + request *kdoctorV1beta1.NetHttpRequest + condition *kdoctorV1beta1.NetSuccessCondition + schedule *kdoctorV1beta1.SchedulePlan run = true ) var _ = BeforeSuite(func() { - frame, err = e2e.NewFramework(GinkgoT(), []func(*runtime.Scheme) error{multus_v1.AddToScheme, spiderpool.AddToScheme, spiderdoctorV1.AddToScheme}) + frame, err = e2e.NewFramework(GinkgoT(), []func(*runtime.Scheme) error{multus_v1.AddToScheme, spiderpool.AddToScheme, kdoctorV1beta1.AddToScheme}) Expect(err).NotTo(HaveOccurred()) if common.CheckRunOverlayCNI() { diff --git a/test/e2e/coordinator/macvlan-underlay-one/macvlan_underlay_one_test.go b/test/e2e/coordinator/macvlan-underlay-one/macvlan_underlay_one_test.go index 3bbcb684e5..5a763dfff6 100644 --- a/test/e2e/coordinator/macvlan-underlay-one/macvlan_underlay_one_test.go +++ b/test/e2e/coordinator/macvlan-underlay-one/macvlan_underlay_one_test.go @@ -8,12 +8,11 @@ import ( "fmt" "time" + kdoctorV1beta1 "github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/spidernet-io/e2eframework/tools" - spiderdoctorV1 "github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1" "github.com/spidernet-io/spiderpool/test/e2e/common" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" apitypes "k8s.io/apimachinery/pkg/types" ) @@ -21,13 +20,13 @@ var _ = Describe("MacvlanUnderlayOne", Serial, Label("underlay", "one-interface" BeforeEach(func() { defer GinkgoRecover() - var e error - task = new(spiderdoctorV1.Nethttp) - plan = new(spiderdoctorV1.SchedulePlan) - target = new(spiderdoctorV1.NethttpTarget) - targetAgent = new(spiderdoctorV1.TargetAgentSepc) - request = new(spiderdoctorV1.NethttpRequest) - condition = new(spiderdoctorV1.NetSuccessCondition) + // var e error + task = new(kdoctorV1beta1.NetReach) + targetAgent = new(kdoctorV1beta1.NetReachTarget) + request = new(kdoctorV1beta1.NetHttpRequest) + netreach = new(kdoctorV1beta1.AgentSpec) + schedule = new(kdoctorV1beta1.SchedulePlan) + condition = new(kdoctorV1beta1.NetSuccessCondition) name = "one-macvlan-standalone-" + tools.RandomName() @@ -36,79 +35,59 @@ var _ = Describe("MacvlanUnderlayOne", Serial, Label("underlay", "one-interface" Expect(err).NotTo(HaveOccurred()) Expect(multusInstance).NotTo(BeNil()) + // Update netreach.agentSpec to generate test Pods using the macvlan annotations[common.MultusDefaultNetwork] = fmt.Sprintf("%s/%s", common.MultusNs, common.MacvlanUnderlayVlan0) + netreach.Annotation = annotations + netreach.HostNetwork = false + GinkgoWriter.Printf("update kdoctoragent annotation: %v/%v annotation: %v \n", common.KDoctorAgentNs, common.KDoctorAgentDSName, annotations) + task.Spec.AgentSpec = netreach + }) - GinkgoWriter.Printf("update spiderdoctoragent annotation: %v/%v annotation: %v \n", common.SpiderDoctorAgentNs, common.SpiderDoctorAgentDSName, annotations) - spiderDoctorAgent, e = frame.GetDaemonSet(common.SpiderDoctorAgentDSName, common.SpiderDoctorAgentNs) - Expect(e).NotTo(HaveOccurred()) - Expect(spiderDoctorAgent).NotTo(BeNil()) - - err = frame.DeleteDaemonSet(common.SpiderDoctorAgentDSName, common.SpiderDoctorAgentNs) - Expect(err).NotTo(HaveOccurred()) - - time.Sleep(10 * time.Second) - - // issue: the object has been modified; please apply your changes to the latest version and try again - spiderDoctorAgent.ResourceVersion = "" - spiderDoctorAgent.CreationTimestamp = v1.Time{} - spiderDoctorAgent.UID = apitypes.UID("") - spiderDoctorAgent.Spec.Template.Annotations = annotations - - err = frame.CreateDaemonSet(spiderDoctorAgent) - Expect(err).NotTo(HaveOccurred()) - - nodeList, err := frame.GetNodeList() - Expect(err).NotTo(HaveOccurred()) + It("kdoctor connectivity should be succeed", Label("C00001"), Label("ebpf"), func() { - ctx, cancel := context.WithTimeout(context.Background(), common.PodStartTimeout) - defer cancel() + enable := true + disable := false + // create task kdoctor crd + task.Name = name + GinkgoWriter.Printf("Start the netreach task: %v", task.Name) - err = frame.WaitPodListRunning(spiderDoctorAgent.Spec.Selector.MatchLabels, len(nodeList.Items), ctx) - Expect(err).NotTo(HaveOccurred()) + // Schedule + crontab := "0 1" + schedule.Schedule = &crontab + schedule.RoundNumber = 1 + schedule.RoundTimeoutMinute = 1 + task.Spec.Schedule = schedule - time.Sleep(20 * time.Second) - }) - - It("spiderdoctor connectivity should be succeed", Label("C00001"), Label("ebpf"), func() { - // create task spiderdoctor crd - task.Name = name - // schedule - plan.StartAfterMinute = 0 - plan.RoundNumber = 2 - plan.IntervalMinute = 2 - plan.TimeoutMinute = 2 - task.Spec.Schedule = plan // target - targetAgent.TestIngress = false - targetAgent.TestEndpoint = true - targetAgent.TestClusterIp = true - targetAgent.TestMultusInterface = true - targetAgent.TestNodePort = true - targetAgent.TestIPv4 = &frame.Info.IpV4Enabled - targetAgent.TestIPv6 = &frame.Info.IpV6Enabled - - target.TargetAgent = targetAgent - task.Spec.Target = target + targetAgent.Ingress = &disable + targetAgent.Endpoint = &enable + targetAgent.ClusterIP = &enable + targetAgent.MultusInterface = &disable + targetAgent.NodePort = &enable + targetAgent.IPv4 = &frame.Info.IpV4Enabled + targetAgent.IPv6 = &frame.Info.IpV6Enabled + targetAgent.EnableLatencyMetric = true + GinkgoWriter.Printf("targetAgent for kdoctor %+v", targetAgent) + task.Spec.Target = targetAgent + // request - request.DurationInSecond = 5 - request.QPS = 1 + request.DurationInSecond = 10 + request.QPS = 3 request.PerRequestTimeoutInMS = 15000 - task.Spec.Request = request - // success condition + // success condition condition.SuccessRate = &successRate condition.MeanAccessDelayInMs = &delayMs - task.Spec.SuccessCondition = condition taskCopy := task - GinkgoWriter.Printf("spiderdoctor task: %+v", task) + GinkgoWriter.Printf("kdoctor task: %+v \n", task) err := frame.CreateResource(task) - Expect(err).NotTo(HaveOccurred(), " spiderdoctor nethttp crd create failed") + Expect(err).NotTo(HaveOccurred(), " kdoctor nethttp crd create failed") err = frame.GetResource(apitypes.NamespacedName{Name: name}, taskCopy) - Expect(err).NotTo(HaveOccurred(), " spiderdoctor nethttp crd get failed") + Expect(err).NotTo(HaveOccurred(), " kdoctor nethttp crd get failed") ctx, cancel := context.WithTimeout(context.Background(), time.Second*60*5) defer cancel() @@ -118,17 +97,40 @@ var _ = Describe("MacvlanUnderlayOne", Serial, Label("underlay", "one-interface" select { case <-ctx.Done(): run = false - Expect(errors.New("wait nethttp test timeout")).NotTo(HaveOccurred(), " running spiderdoctor task timeout") + Expect(errors.New("wait nethttp test timeout")).NotTo(HaveOccurred(), " running kdoctor task timeout") default: err = frame.GetResource(apitypes.NamespacedName{Name: name}, taskCopy) - Expect(err).NotTo(HaveOccurred(), " spiderdoctor nethttp crd get failed") + Expect(err).NotTo(HaveOccurred(), " kdoctor nethttp crd get failed") + if taskCopy.Status.Finish == true { + command := fmt.Sprintf("get netreaches.kdoctor.io %s -oyaml", taskCopy.Name) + netreachesLog, _ := frame.ExecKubectl(command, ctx) + GinkgoWriter.Printf("kdoctor's netreaches execution result %+v \n", string(netreachesLog)) + for _, v := range taskCopy.Status.History { if v.Status == "succeed" { err1 = nil } } run = false + + ctx1, cancel1 := context.WithTimeout(context.Background(), time.Second*30) + defer cancel1() + for { + select { + case <-ctx1.Done(): + Expect(errors.New("wait kdoctorreport timeout")).NotTo(HaveOccurred(), "failed to run kdoctor task and wait kdoctorreport timeout") + default: + command = fmt.Sprintf("get kdoctorreport %s -oyaml", taskCopy.Name) + kdoctorreportLog, err := frame.ExecKubectl(command, ctx) + if err != nil { + time.Sleep(common.ForcedWaitingTime) + continue + } + GinkgoWriter.Printf("kdoctor's kdoctorreport execution result %+v \n", string(kdoctorreportLog)) + } + break + } } time.Sleep(time.Second * 5) } diff --git a/test/e2e/kubevirt/kubevirt_suite_test.go b/test/e2e/kubevirt/kubevirt_suite_test.go index d568ee173c..5ea6cce9b6 100644 --- a/test/e2e/kubevirt/kubevirt_suite_test.go +++ b/test/e2e/kubevirt/kubevirt_suite_test.go @@ -42,9 +42,6 @@ var _ = BeforeSuite(func() { if common.CheckRunOverlayCNI() { Skip("overlay CNI is installed , ignore this suite") } - if !common.CheckMultusFeatureOn() { - Skip("multus is not installed , ignore this suite") - } var err error frame, err = e2e.NewFramework(GinkgoT(), []func(*runtime.Scheme) error{spiderpoolv2beta1.AddToScheme, kubevirtv1.AddToScheme}) diff --git a/test/scripts/install-kdoctor.sh b/test/scripts/install-kdoctor.sh new file mode 100644 index 0000000000..89f1eff914 --- /dev/null +++ b/test/scripts/install-kdoctor.sh @@ -0,0 +1,85 @@ +#!/bin/bash + +# SPDX-License-Identifier: Apache-2.0 +# Copyright Authors of Spider + +set -o errexit -o nounset -o pipefail + +CURRENT_FILENAME=$( basename $0 ) +CURRENT_DIR_PATH=$(cd $(dirname $0); pwd) + +[ -z "$E2E_CLUSTER_NAME" ] && echo "error, miss E2E_CLUSTER_NAME " && exit 1 +echo "$CURRENT_FILENAME : E2E_CLUSTER_NAME $E2E_CLUSTER_NAME " + +[ -z "$E2E_IP_FAMILY" ] && echo "error, miss E2E_IP_FAMILY" && exit 1 +echo "$CURRENT_FILENAME : E2E_IP_FAMILY $E2E_IP_FAMILY " + +[ -z "$KDOCTOR_VERSION" ] && echo "error, miss KDOCTOR_VERSION" && exit 1 +echo "$CURRENT_FILENAME : KDOCTOR_VERSION $KDOCTOR_VERSION " + +[ -z "$KDOCTOR_REPORT_PATH" ] && echo "error, miss KDOCTOR_REPORT_PATH" && exit 1 +echo "$CURRENT_FILENAME : KDOCTOR_REPORT_PATH $KDOCTOR_REPORT_PATH " + +[ -z "$E2E_KUBECONFIG" ] && echo "error, miss E2E_KUBECONFIG " && exit 1 +[ ! -f "$E2E_KUBECONFIG" ] && echo "error, could not find file $E2E_KUBECONFIG " && exit 1 +echo "$CURRENT_FILENAME : E2E_KUBECONFIG $E2E_KUBECONFIG " + +KDOCTOR_VERSION=${KDOCTOR_VERSION:-0.2.0} +E2E_KDOCTOR_IMAGE_REPO=${E2E_KDOCTOR_IMAGE_REPO:-"ghcr.io"} + +INSTALL_TIME_OUT=300s + +KDOCTOR_HELM_OPTIONS=" --set feature.aggregateReport.enabled=true \ + --set feature.aggregateReport.controller.reportHostPath=${KDOCTOR_REPORT_PATH}" + +case ${E2E_IP_FAMILY} in + ipv4) + KDOCTOR_HELM_OPTIONS+=" --set feature.enableIPv4=true \ + --set feature.enableIPv6=false " + ;; + ipv6) + KDOCTOR_HELM_OPTIONS+=" --set feature.enableIPv4=false \ + --set feature.enableIPv6=true " + ;; + dual) + KDOCTOR_HELM_OPTIONS+=" --set feature.enableIPv4=true \ + --set feature.enableIPv6=true " + ;; + *) + echo "the value of E2E_IP_FAMILY: ipv4 or ipv6 or dual" + exit 1 +esac + +KDOCTOR_HELM_OPTIONS+=" --set kdoctorAgent.image.registry=${E2E_KDOCTOR_IMAGE_REPO} \ + --set kdoctorController.image.registry=${E2E_KDOCTOR_IMAGE_REPO} " + +echo "KDOCTOR_HELM_OPTIONS: ${KDOCTOR_HELM_OPTIONS}" + +[ -z "${HTTP_PROXY}" ] || export https_proxy=${HTTP_PROXY} + +helm repo add kdoctor https://kdoctor-io.github.io/kdoctor +helm repo update +HELM_IMAGES_LIST=` helm template test kdoctor/kdoctor --version ${KDOCTOR_VERSION} ${KDOCTOR_HELM_OPTIONS} | grep " image: " | tr -d '"'| awk '{print $2}' | uniq ` + +[ -z "${HELM_IMAGES_LIST}" ] && echo "can't found image of KDOCTOR" && exit 1 +LOCAL_IMAGE_LIST=`docker images | awk '{printf("%s:%s\n",$1,$2)}'` + +for IMAGE in ${HELM_IMAGES_LIST}; do + if ! grep ${IMAGE} <<< ${LOCAL_IMAGE_LIST}; then + echo "===> docker pull ${IMAGE}... " + docker pull ${IMAGE} + fi + echo "===> load image ${IMAGE} to kind..." + kind load docker-image ${IMAGE} --name $E2E_CLUSTER_NAME +done + +# Install KDOCTOR +helm upgrade --install kdoctor kdoctor/kdoctor -n kube-system --debug --kubeconfig ${E2E_KUBECONFIG} ${KDOCTOR_HELM_OPTIONS} --version ${KDOCTOR_VERSION} + +# no matching resources found +sleep 3 + +kubectl wait --for=condition=ready -l app.kubernetes.io/instance=kdoctor --timeout=300s pod -n kube-system \ +--kubeconfig ${E2E_KUBECONFIG} + +echo -e "\033[35m Succeed to install kdoctor \033[0m" \ No newline at end of file diff --git a/test/scripts/install-spiderdoctor.sh b/test/scripts/install-spiderdoctor.sh deleted file mode 100644 index 1bc8103291..0000000000 --- a/test/scripts/install-spiderdoctor.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/bash - -# SPDX-License-Identifier: Apache-2.0 -# Copyright Authors of Spider - -set -o errexit -o nounset -o pipefail - -CURRENT_FILENAME=$( basename $0 ) -CURRENT_DIR_PATH=$(cd $(dirname $0); pwd) - -[ -z "$E2E_CLUSTER_NAME" ] && echo "error, miss E2E_CLUSTER_NAME " && exit 1 -echo "$CURRENT_FILENAME : E2E_CLUSTER_NAME $E2E_CLUSTER_NAME " - -[ -z "$E2E_IP_FAMILY" ] && echo "error, miss E2E_IP_FAMILY" && exit 1 -echo "$CURRENT_FILENAME : E2E_IP_FAMILY $E2E_IP_FAMILY " - -[ -z "$SPIDERDOCTOR_VERSION" ] && echo "error, miss SPIDERDOCTOR_VERSION" && exit 1 -echo "$CURRENT_FILENAME : SPIDERDOCTOR_VERSION $SPIDERDOCTOR_VERSION " - -[ -z "$SPIDERDOCTOR_REPORT_PATH" ] && echo "error, miss SPIDERDOCTOR_REPORT_PATH" && exit 1 -echo "$CURRENT_FILENAME : SPIDERDOCTOR_REPORT_PATH $SPIDERDOCTOR_REPORT_PATH " - -[ -z "$E2E_KUBECONFIG" ] && echo "error, miss E2E_KUBECONFIG " && exit 1 -[ ! -f "$E2E_KUBECONFIG" ] && echo "error, could not find file $E2E_KUBECONFIG " && exit 1 -echo "$CURRENT_FILENAME : E2E_KUBECONFIG $E2E_KUBECONFIG " - -SPIDERDOCTOR_VERSION=${SPIDERDOCTOR_VERSION:-0.2.1} -E2E_SPIDERDOCTOR_IMAGE_REPO=${E2E_SPIDERDOCTOR_IMAGE_REPO:-"ghcr.io"} - -INSTALL_TIME_OUT=300s - -SPIDERDOCTOR_HELM_OPTIONS=" --set feature.aggregateReport.enabled=true \ - --set feature.aggregateReport.controller.reportHostPath=${SPIDERDOCTOR_REPORT_PATH} " -case ${E2E_IP_FAMILY} in - ipv4) - SPIDERDOCTOR_HELM_OPTIONS+=" --set feature.enableIPv4=true \ - --set feature.enableIPv6=false " - ;; - ipv6) - SPIDERDOCTOR_HELM_OPTIONS+=" --set feature.enableIPv4=false \ - --set feature.enableIPv6=true " - ;; - dual) - SPIDERDOCTOR_HELM_OPTIONS+=" --set feature.enableIPv4=true \ - --set feature.enableIPv6=true " - ;; - *) - echo "the value of E2E_IP_FAMILY: ipv4 or ipv6 or dual" - exit 1 -esac - -SPIDERDOCTOR_HELM_OPTIONS+=" --set spiderdoctorAgent.image.registry=${E2E_SPIDERDOCTOR_IMAGE_REPO} \ - --set spiderdoctorController.image.registry=${E2E_SPIDERDOCTOR_IMAGE_REPO} " - -echo "SPIDERDOCTOR_HELM_OPTIONS: ${SPIDERDOCTOR_HELM_OPTIONS}" - -[ -z "${HTTP_PROXY}" ] || export https_proxy=${HTTP_PROXY} - -helm repo add spiderdoctor https://spidernet-io.github.io/spiderdoctor -helm repo update -HELM_IMAGES_LIST=` helm template test spiderdoctor/spiderdoctor --version ${SPIDERDOCTOR_VERSION} ${SPIDERDOCTOR_HELM_OPTIONS} | grep " image: " | tr -d '"'| awk '{print $2}' | uniq ` - -[ -z "${HELM_IMAGES_LIST}" ] && echo "can't found image of SPIDERDOCTOR" && exit 1 -LOCAL_IMAGE_LIST=`docker images | awk '{printf("%s:%s\n",$1,$2)}'` - -for IMAGE in ${HELM_IMAGES_LIST}; do - if ! grep ${IMAGE} <<< ${LOCAL_IMAGE_LIST}; then - echo "===> docker pull ${IMAGE}... " - docker pull ${IMAGE} - fi - echo "===> load image ${IMAGE} to kind..." - kind load docker-image ${IMAGE} --name $E2E_CLUSTER_NAME -done - -# Install SPIDERDOCTOR -helm upgrade --install spiderdoctor spiderdoctor/spiderdoctor -n kube-system --debug --kubeconfig ${E2E_KUBECONFIG} ${SPIDERDOCTOR_HELM_OPTIONS} --version ${SPIDERDOCTOR_VERSION} - -# no matching resources found -sleep 3 - -kubectl wait --for=condition=ready -l app.kubernetes.io/name=spiderdoctor --timeout=100s pod -n kube-system \ ---kubeconfig ${E2E_KUBECONFIG} - -echo -e "\033[35m Succeed to install spiderdoctor \033[0m" \ No newline at end of file diff --git a/test/scripts/prepare.sh b/test/scripts/prepare.sh index a13f68286c..c254950e25 100755 --- a/test/scripts/prepare.sh +++ b/test/scripts/prepare.sh @@ -14,6 +14,7 @@ echo "Using ARCH: $ARCH" echo "all images: $IMAGE_LIST" #================================= + for image in $IMAGE_LIST ; do PREFIX_IMAGE=$(echo $image | awk -F ':' '{print $1}') SUFFIX_IMAGE=$(echo $image | awk -F ':' '{print $2}') diff --git a/vendor/github.com/Masterminds/semver/v3/.golangci.yml b/vendor/github.com/Masterminds/semver/v3/.golangci.yml index fdbdf1448c..c87d1c4b90 100644 --- a/vendor/github.com/Masterminds/semver/v3/.golangci.yml +++ b/vendor/github.com/Masterminds/semver/v3/.golangci.yml @@ -4,23 +4,27 @@ run: linters: disable-all: true enable: + - misspell + - structcheck + - govet + - staticcheck - deadcode - - dupl - errcheck - - gofmt - - goimports - - golint - - gosimple - - govet + - varcheck + - unparam - ineffassign - - misspell - nakedret - - structcheck + - gocyclo + - dupl + - goimports + - revive + - gosec + - gosimple + - typecheck - unused - - varcheck linters-settings: gofmt: simplify: true dupl: - threshold: 400 + threshold: 600 diff --git a/vendor/github.com/Masterminds/semver/v3/CHANGELOG.md b/vendor/github.com/Masterminds/semver/v3/CHANGELOG.md index 1f90c38d26..f12626423a 100644 --- a/vendor/github.com/Masterminds/semver/v3/CHANGELOG.md +++ b/vendor/github.com/Masterminds/semver/v3/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +## 3.2.0 (2022-11-28) + +### Added + +- #190: Added text marshaling and unmarshaling +- #167: Added JSON marshalling for constraints (thanks @SimonTheLeg) +- #173: Implement encoding.TextMarshaler and encoding.TextUnmarshaler on Version (thanks @MarkRosemaker) +- #179: Added New() version constructor (thanks @kazhuravlev) + +### Changed + +- #182/#183: Updated CI testing setup + +### Fixed + +- #186: Fixing issue where validation of constraint section gave false positives +- #176: Fix constraints check with *-0 (thanks @mtt0) +- #181: Fixed Caret operator (^) gives unexpected results when the minor version in constraint is 0 (thanks @arshchimni) +- #161: Fixed godoc (thanks @afirth) + ## 3.1.1 (2020-11-23) ### Fixed diff --git a/vendor/github.com/Masterminds/semver/v3/constraints.go b/vendor/github.com/Masterminds/semver/v3/constraints.go index 547613f044..203072e464 100644 --- a/vendor/github.com/Masterminds/semver/v3/constraints.go +++ b/vendor/github.com/Masterminds/semver/v3/constraints.go @@ -134,6 +134,23 @@ func (cs Constraints) String() string { return strings.Join(buf, " || ") } +// UnmarshalText implements the encoding.TextUnmarshaler interface. +func (cs *Constraints) UnmarshalText(text []byte) error { + temp, err := NewConstraint(string(text)) + if err != nil { + return err + } + + *cs = *temp + + return nil +} + +// MarshalText implements the encoding.TextMarshaler interface. +func (cs Constraints) MarshalText() ([]byte, error) { + return []byte(cs.String()), nil +} + var constraintOps map[string]cfunc var constraintRegex *regexp.Regexp var constraintRangeRegex *regexp.Regexp @@ -180,8 +197,13 @@ func init() { ops, cvRegex)) + // The first time a constraint shows up will look slightly different from + // future times it shows up due to a leading space or comma in a given + // string. validConstraintRegex = regexp.MustCompile(fmt.Sprintf( - `^(\s*(%s)\s*(%s)\s*\,?)+$`, + `^(\s*(%s)\s*(%s)\s*)((?:\s+|,\s*)(%s)\s*(%s)\s*)*$`, + ops, + cvRegex, ops, cvRegex)) } @@ -233,7 +255,7 @@ func parseConstraint(c string) (*constraint, error) { patchDirty := false dirty := false if isX(m[3]) || m[3] == "" { - ver = "0.0.0" + ver = fmt.Sprintf("0.0.0%s", m[6]) dirty = true } else if isX(strings.TrimPrefix(m[4], ".")) || m[4] == "" { minorDirty = true @@ -534,6 +556,10 @@ func constraintCaret(v *Version, c *constraint) (bool, error) { } return false, fmt.Errorf("%s does not have same minor version as %s. Expected minor versions to match when constraint major version is 0", v, c.orig) } + // ^ when the minor is 0 and minor > 0 is =0.0.z + if c.con.Minor() == 0 && v.Minor() > 0 { + return false, fmt.Errorf("%s does not have same minor version as %s", v, c.orig) + } // At this point the major is 0 and the minor is 0 and not dirty. The patch // is not dirty so we need to check if they are equal. If they are not equal diff --git a/vendor/github.com/Masterminds/semver/v3/doc.go b/vendor/github.com/Masterminds/semver/v3/doc.go index 391aa46b76..74f97caa57 100644 --- a/vendor/github.com/Masterminds/semver/v3/doc.go +++ b/vendor/github.com/Masterminds/semver/v3/doc.go @@ -3,12 +3,12 @@ Package semver provides the ability to work with Semantic Versions (http://semve Specifically it provides the ability to: - * Parse semantic versions - * Sort semantic versions - * Check if a semantic version fits within a set of constraints - * Optionally work with a `v` prefix + - Parse semantic versions + - Sort semantic versions + - Check if a semantic version fits within a set of constraints + - Optionally work with a `v` prefix -Parsing Semantic Versions +# Parsing Semantic Versions There are two functions that can parse semantic versions. The `StrictNewVersion` function only parses valid version 2 semantic versions as outlined in the @@ -21,48 +21,48 @@ that can be sorted, compared, and used in constraints. When parsing a version an optional error can be returned if there is an issue parsing the version. For example, - v, err := semver.NewVersion("1.2.3-beta.1+b345") + v, err := semver.NewVersion("1.2.3-beta.1+b345") The version object has methods to get the parts of the version, compare it to other versions, convert the version back into a string, and get the original string. For more details please see the documentation at https://godoc.org/github.com/Masterminds/semver. -Sorting Semantic Versions +# Sorting Semantic Versions A set of versions can be sorted using the `sort` package from the standard library. For example, - raw := []string{"1.2.3", "1.0", "1.3", "2", "0.4.2",} - vs := make([]*semver.Version, len(raw)) - for i, r := range raw { - v, err := semver.NewVersion(r) - if err != nil { - t.Errorf("Error parsing version: %s", err) - } + raw := []string{"1.2.3", "1.0", "1.3", "2", "0.4.2",} + vs := make([]*semver.Version, len(raw)) + for i, r := range raw { + v, err := semver.NewVersion(r) + if err != nil { + t.Errorf("Error parsing version: %s", err) + } - vs[i] = v - } + vs[i] = v + } - sort.Sort(semver.Collection(vs)) + sort.Sort(semver.Collection(vs)) -Checking Version Constraints and Comparing Versions +# Checking Version Constraints and Comparing Versions There are two methods for comparing versions. One uses comparison methods on `Version` instances and the other is using Constraints. There are some important differences to notes between these two methods of comparison. -1. When two versions are compared using functions such as `Compare`, `LessThan`, - and others it will follow the specification and always include prereleases - within the comparison. It will provide an answer valid with the comparison - spec section at https://semver.org/#spec-item-11 -2. When constraint checking is used for checks or validation it will follow a - different set of rules that are common for ranges with tools like npm/js - and Rust/Cargo. This includes considering prereleases to be invalid if the - ranges does not include on. If you want to have it include pre-releases a - simple solution is to include `-0` in your range. -3. Constraint ranges can have some complex rules including the shorthard use of - ~ and ^. For more details on those see the options below. + 1. When two versions are compared using functions such as `Compare`, `LessThan`, + and others it will follow the specification and always include prereleases + within the comparison. It will provide an answer valid with the comparison + spec section at https://semver.org/#spec-item-11 + 2. When constraint checking is used for checks or validation it will follow a + different set of rules that are common for ranges with tools like npm/js + and Rust/Cargo. This includes considering prereleases to be invalid if the + ranges does not include on. If you want to have it include pre-releases a + simple solution is to include `-0` in your range. + 3. Constraint ranges can have some complex rules including the shorthard use of + ~ and ^. For more details on those see the options below. There are differences between the two methods or checking versions because the comparison methods on `Version` follow the specification while comparison ranges @@ -76,19 +76,19 @@ patters with their versions. Checking a version against version constraints is one of the most featureful parts of the package. - c, err := semver.NewConstraint(">= 1.2.3") - if err != nil { - // Handle constraint not being parsable. - } + c, err := semver.NewConstraint(">= 1.2.3") + if err != nil { + // Handle constraint not being parsable. + } - v, err := semver.NewVersion("1.3") - if err != nil { - // Handle version not being parsable. - } - // Check if the version meets the constraints. The a variable will be true. - a := c.Check(v) + v, err := semver.NewVersion("1.3") + if err != nil { + // Handle version not being parsable. + } + // Check if the version meets the constraints. The a variable will be true. + a := c.Check(v) -Basic Comparisons +# Basic Comparisons There are two elements to the comparisons. First, a comparison string is a list of comma or space separated AND comparisons. These are then separated by || (OR) @@ -99,31 +99,31 @@ greater than or equal to 4.2.3. This can also be written as The basic comparisons are: - * `=`: equal (aliased to no operator) - * `!=`: not equal - * `>`: greater than - * `<`: less than - * `>=`: greater than or equal to - * `<=`: less than or equal to + - `=`: equal (aliased to no operator) + - `!=`: not equal + - `>`: greater than + - `<`: less than + - `>=`: greater than or equal to + - `<=`: less than or equal to -Hyphen Range Comparisons +# Hyphen Range Comparisons There are multiple methods to handle ranges and the first is hyphens ranges. These look like: - * `1.2 - 1.4.5` which is equivalent to `>= 1.2, <= 1.4.5` - * `2.3.4 - 4.5` which is equivalent to `>= 2.3.4 <= 4.5` + - `1.2 - 1.4.5` which is equivalent to `>= 1.2, <= 1.4.5` + - `2.3.4 - 4.5` which is equivalent to `>= 2.3.4 <= 4.5` -Wildcards In Comparisons +# Wildcards In Comparisons The `x`, `X`, and `*` characters can be used as a wildcard character. This works for all comparison operators. When used on the `=` operator it falls back to the tilde operation. For example, - * `1.2.x` is equivalent to `>= 1.2.0 < 1.3.0` - * `>= 1.2.x` is equivalent to `>= 1.2.0` - * `<= 2.x` is equivalent to `<= 3` - * `*` is equivalent to `>= 0.0.0` + - `1.2.x` is equivalent to `>= 1.2.0 < 1.3.0` + - `>= 1.2.x` is equivalent to `>= 1.2.0` + - `<= 2.x` is equivalent to `<= 3` + - `*` is equivalent to `>= 0.0.0` Tilde Range Comparisons (Patch) @@ -131,11 +131,11 @@ The tilde (`~`) comparison operator is for patch level ranges when a minor version is specified and major level changes when the minor number is missing. For example, - * `~1.2.3` is equivalent to `>= 1.2.3 < 1.3.0` - * `~1` is equivalent to `>= 1, < 2` - * `~2.3` is equivalent to `>= 2.3 < 2.4` - * `~1.2.x` is equivalent to `>= 1.2.0 < 1.3.0` - * `~1.x` is equivalent to `>= 1 < 2` + - `~1.2.3` is equivalent to `>= 1.2.3 < 1.3.0` + - `~1` is equivalent to `>= 1, < 2` + - `~2.3` is equivalent to `>= 2.3 < 2.4` + - `~1.2.x` is equivalent to `>= 1.2.0 < 1.3.0` + - `~1.x` is equivalent to `>= 1 < 2` Caret Range Comparisons (Major) @@ -144,41 +144,41 @@ The caret (`^`) comparison operator is for major level changes once a stable as the API stability level. This is useful when comparisons of API versions as a major change is API breaking. For example, - * `^1.2.3` is equivalent to `>= 1.2.3, < 2.0.0` - * `^1.2.x` is equivalent to `>= 1.2.0, < 2.0.0` - * `^2.3` is equivalent to `>= 2.3, < 3` - * `^2.x` is equivalent to `>= 2.0.0, < 3` - * `^0.2.3` is equivalent to `>=0.2.3 <0.3.0` - * `^0.2` is equivalent to `>=0.2.0 <0.3.0` - * `^0.0.3` is equivalent to `>=0.0.3 <0.0.4` - * `^0.0` is equivalent to `>=0.0.0 <0.1.0` - * `^0` is equivalent to `>=0.0.0 <1.0.0` + - `^1.2.3` is equivalent to `>= 1.2.3, < 2.0.0` + - `^1.2.x` is equivalent to `>= 1.2.0, < 2.0.0` + - `^2.3` is equivalent to `>= 2.3, < 3` + - `^2.x` is equivalent to `>= 2.0.0, < 3` + - `^0.2.3` is equivalent to `>=0.2.3 <0.3.0` + - `^0.2` is equivalent to `>=0.2.0 <0.3.0` + - `^0.0.3` is equivalent to `>=0.0.3 <0.0.4` + - `^0.0` is equivalent to `>=0.0.0 <0.1.0` + - `^0` is equivalent to `>=0.0.0 <1.0.0` -Validation +# Validation In addition to testing a version against a constraint, a version can be validated against a constraint. When validation fails a slice of errors containing why a version didn't meet the constraint is returned. For example, - c, err := semver.NewConstraint("<= 1.2.3, >= 1.4") - if err != nil { - // Handle constraint not being parseable. - } - - v, _ := semver.NewVersion("1.3") - if err != nil { - // Handle version not being parseable. - } - - // Validate a version against a constraint. - a, msgs := c.Validate(v) - // a is false - for _, m := range msgs { - fmt.Println(m) - - // Loops over the errors which would read - // "1.3 is greater than 1.2.3" - // "1.3 is less than 1.4" - } + c, err := semver.NewConstraint("<= 1.2.3, >= 1.4") + if err != nil { + // Handle constraint not being parseable. + } + + v, _ := semver.NewVersion("1.3") + if err != nil { + // Handle version not being parseable. + } + + // Validate a version against a constraint. + a, msgs := c.Validate(v) + // a is false + for _, m := range msgs { + fmt.Println(m) + + // Loops over the errors which would read + // "1.3 is greater than 1.2.3" + // "1.3 is less than 1.4" + } */ package semver diff --git a/vendor/github.com/Masterminds/semver/v3/version.go b/vendor/github.com/Masterminds/semver/v3/version.go index d6b9cda3ee..7c4bed3347 100644 --- a/vendor/github.com/Masterminds/semver/v3/version.go +++ b/vendor/github.com/Masterminds/semver/v3/version.go @@ -55,14 +55,16 @@ func init() { versionRegex = regexp.MustCompile("^" + semVerRegex + "$") } -const num string = "0123456789" -const allowed string = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-" + num +const ( + num string = "0123456789" + allowed string = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-" + num +) // StrictNewVersion parses a given version and returns an instance of Version or // an error if unable to parse the version. Only parses valid semantic versions. // Performs checking that can find errors within the version. -// If you want to coerce a version, such as 1 or 1.2, and perse that as the 1.x -// releases of semver provided use the NewSemver() function. +// If you want to coerce a version such as 1 or 1.2 and parse it as the 1.x +// releases of semver did, use the NewVersion() function. func StrictNewVersion(v string) (*Version, error) { // Parsing here does not use RegEx in order to increase performance and reduce // allocations. @@ -207,6 +209,23 @@ func NewVersion(v string) (*Version, error) { return sv, nil } +// New creates a new instance of Version with each of the parts passed in as +// arguments instead of parsing a version string. +func New(major, minor, patch uint64, pre, metadata string) *Version { + v := Version{ + major: major, + minor: minor, + patch: patch, + pre: pre, + metadata: metadata, + original: "", + } + + v.original = v.String() + + return &v +} + // MustParse parses a given version and panics on error. func MustParse(v string) *Version { sv, err := NewVersion(v) @@ -267,7 +286,6 @@ func (v Version) Metadata() string { // originalVPrefix returns the original 'v' prefix if any. func (v Version) originalVPrefix() string { - // Note, only lowercase v is supported as a prefix by the parser. if v.original != "" && v.original[:1] == "v" { return v.original[:1] @@ -436,6 +454,23 @@ func (v Version) MarshalJSON() ([]byte, error) { return json.Marshal(v.String()) } +// UnmarshalText implements the encoding.TextUnmarshaler interface. +func (v *Version) UnmarshalText(text []byte) error { + temp, err := NewVersion(string(text)) + if err != nil { + return err + } + + *v = *temp + + return nil +} + +// MarshalText implements the encoding.TextMarshaler interface. +func (v Version) MarshalText() ([]byte, error) { + return []byte(v.String()), nil +} + // Scan implements the SQL.Scanner interface. func (v *Version) Scan(value interface{}) error { var s string @@ -470,7 +505,6 @@ func compareSegment(v, o uint64) int { } func comparePrerelease(v, o string) int { - // split the prelease versions by their part. The separator, per the spec, // is a . sparts := strings.Split(v, ".") @@ -562,7 +596,6 @@ func comparePrePart(s, o string) int { return 1 } return -1 - } // Like strings.ContainsAny but does an only instead of any. diff --git a/vendor/github.com/Masterminds/sprig/v3/CHANGELOG.md b/vendor/github.com/Masterminds/sprig/v3/CHANGELOG.md index fcdd4e88ae..2ce45dd4ec 100644 --- a/vendor/github.com/Masterminds/sprig/v3/CHANGELOG.md +++ b/vendor/github.com/Masterminds/sprig/v3/CHANGELOG.md @@ -1,8 +1,21 @@ # Changelog +## Release 3.2.3 (2022-11-29) + +### Changed + +- Updated docs (thanks @book987 @aJetHorn @neelayu @pellizzetti @apricote @SaigyoujiYuyuko233 @AlekSi) +- #348: Updated huandu/xstrings which fixed a snake case bug (thanks @yxxhero) +- #353: Updated masterminds/semver which included bug fixes +- #354: Updated golang.org/x/crypto which included bug fixes + +## Release 3.2.2 (2021-02-04) + +This is a re-release of 3.2.1 to satisfy something with the Go module system. + ## Release 3.2.1 (2021-02-04) -### Changed +### Changed - Upgraded `Masterminds/goutils` to `v1.1.1`. see the [Security Advisory](https://github.com/Masterminds/goutils/security/advisories/GHSA-xg2h-wx96-xgxr) diff --git a/vendor/github.com/Masterminds/sprig/v3/README.md b/vendor/github.com/Masterminds/sprig/v3/README.md index c37ba01c21..3e22c60e1a 100644 --- a/vendor/github.com/Masterminds/sprig/v3/README.md +++ b/vendor/github.com/Masterminds/sprig/v3/README.md @@ -17,10 +17,9 @@ JavaScript libraries, such as [underscore.js](http://underscorejs.org/). ## IMPORTANT NOTES Sprig leverages [mergo](https://github.com/imdario/mergo) to handle merges. In -its v0.3.9 release there was a behavior change that impacts merging template -functions in sprig. It is currently recommended to use v0.3.8 of that package. -Using v0.3.9 will cause sprig tests to fail. The issue in mergo is tracked at -https://github.com/imdario/mergo/issues/139. +its v0.3.9 release, there was a behavior change that impacts merging template +functions in sprig. It is currently recommended to use v0.3.10 or later of that package. +Using v0.3.9 will cause sprig tests to fail. ## Package Versions @@ -51,7 +50,7 @@ To load the Sprig `FuncMap`: ```go import ( - "github.com/Masterminds/sprig" + "github.com/Masterminds/sprig/v3" "html/template" ) diff --git a/vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/diff/spec_analyser.go b/vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/diff/spec_analyser.go index 8f04a1c156..7a2d5f7dad 100644 --- a/vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/diff/spec_analyser.go +++ b/vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/diff/spec_analyser.go @@ -122,7 +122,7 @@ func (sd *SpecAnalyser) analyseEndpoints() { sd.findAddedEndpoints() } -// AnalyseDefinitions check for changes to defintion objects not referenced in any endpoint +// AnalyseDefinitions check for changes to definition objects not referenced in any endpoint func (sd *SpecAnalyser) AnalyseDefinitions() { alreadyReferenced := map[string]bool{} for k := range sd.ReferencedDefinitions { diff --git a/vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/generate/model.go b/vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/generate/model.go index 7120ccfb04..fb8c14268d 100644 --- a/vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/generate/model.go +++ b/vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/generate/model.go @@ -57,7 +57,7 @@ type Model struct { NoStruct bool `long:"skip-struct" description:"when present will not generate the model struct" hidden:"deprecated"` Name []string `long:"name" short:"n" description:"the model to generate, repeat for multiple (defaults to all). Same as --models"` - AcceptDefinitionsOnly bool `long:"accept-definitions-only" description:"accepts a partial swagger spec wih only the definitions key"` + AcceptDefinitionsOnly bool `long:"accept-definitions-only" description:"accepts a partial swagger spec with only the definitions key"` } func (m Model) apply(opts *generator.GenOpts) { diff --git a/vendor/github.com/go-swagger/go-swagger/generator/templates/client/response.gotmpl b/vendor/github.com/go-swagger/go-swagger/generator/templates/client/response.gotmpl index dac3dfd538..3a88431d08 100644 --- a/vendor/github.com/go-swagger/go-swagger/generator/templates/client/response.gotmpl +++ b/vendor/github.com/go-swagger/go-swagger/generator/templates/client/response.gotmpl @@ -63,13 +63,6 @@ type {{ pascalize .Name }} struct { Payload {{ if and (not .Schema.IsBaseType) (not .Schema.IsInterface) .Schema.IsComplexObject (not .Schema.IsStream) }}*{{ end }}{{ if (not .Schema.IsStream) }}{{ .Schema.GoType }}{{ else }}io.Writer{{end}} {{- end }} } - {{- if eq .Code -1 }} - -// Code gets the status code for the {{ humanize .Name }} response -func ({{ .ReceiverName }} *{{ pascalize .Name }}) Code() int { - return {{ .ReceiverName }}._statusCode -} - {{- end }} // IsSuccess returns true when this {{ humanize .Name }} response has a 2xx status code func ({{ .ReceiverName }} *{{ pascalize .Name }}) IsSuccess() bool { @@ -116,6 +109,15 @@ func ({{ .ReceiverName }} *{{ pascalize .Name }}) IsCode(code int) bool { {{- end }} } +// Code gets the status code for the {{ humanize .Name }} response +func ({{ .ReceiverName }} *{{ pascalize .Name }}) Code() int { + {{- if eq .Code -1 }} + return {{ .ReceiverName }}._statusCode + {{- else }} + return {{ .Code }} + {{- end }} +} + func ({{ .ReceiverName }} *{{ pascalize .Name }}) Error() string { return fmt.Sprintf("[{{ upper .Method }} {{ .Path }}][%d] {{ if .Name }}{{ .Name }} {{ else }}unknown error {{ end }}{{ if .Schema }} %+v{{ end }}", {{ if eq .Code -1 }}{{ .ReceiverName }}._statusCode{{ else }}{{ .Code }}{{ end }}{{ if .Schema }}, o.Payload{{ end }}) } diff --git a/vendor/github.com/go-swagger/go-swagger/generator/templates/contrib/stratoscale/client/client.gotmpl b/vendor/github.com/go-swagger/go-swagger/generator/templates/contrib/stratoscale/client/client.gotmpl index 0c77c9c01c..3398815ecc 100644 --- a/vendor/github.com/go-swagger/go-swagger/generator/templates/contrib/stratoscale/client/client.gotmpl +++ b/vendor/github.com/go-swagger/go-swagger/generator/templates/contrib/stratoscale/client/client.gotmpl @@ -10,6 +10,7 @@ package {{ .Name }} // Editing this file might prove futile when you re-run the swagger generate command import ( + "fmt" "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/swag" @@ -22,7 +23,7 @@ import ( {{ imports .Imports }} ) -//go:generate mockery -name API -inpkg +//go:generate mockery --name API --keeptree --with-expecter --case underscore // API is the interface of the {{ humanize .Name }} client type API interface { @@ -64,7 +65,8 @@ type Client struct { */ func (a *Client) {{ pascalize .Name }}(ctx context.Context, params *{{ pascalize .Name }}Params{{ if .HasStreamingResponse }}, writer io.Writer{{ end }}) {{ if .SuccessResponse }}({{ range .SuccessResponses }}*{{ pascalize .Name }}, {{ end }}{{ end }}error{{ if .SuccessResponse }}){{ end }} { {{ $length := len .SuccessResponses }} - {{ if .SuccessResponse }}result{{else}}_{{ end }}, err := a.transport.Submit(&runtime.ClientOperation{ + {{ $success := .SuccessResponses }} + {{ if .Responses }}result{{else}}_{{end}}, err := a.transport.Submit(&runtime.ClientOperation{ ID: {{ printf "%q" .Name }}, Method: {{ printf "%q" .Method }}, PathPattern: {{ printf "%q" .Path }}, @@ -80,13 +82,30 @@ func (a *Client) {{ pascalize .Name }}(ctx context.Context, params *{{ pascalize Client: params.HTTPClient, }) if err != nil { - return {{ if .SuccessResponse }}{{ padSurround "nil" "nil" 0 $length }}, {{ end }}err + return {{ if $success }}{{ padSurround "nil" "nil" 0 $length }}, {{ end }}err } - {{ if .SuccessResponse }}{{ if eq $length 1 }}return result.(*{{ pascalize .SuccessResponse.Name }}), nil{{ else }}switch value := result.(type) { {{ range $i, $v := .SuccessResponses }} - case *{{ pascalize $v.Name }}: - return {{ padSurround "value" "nil" $i $length }}, nil{{ end }} } - return {{ padSurround "nil" "nil" 0 $length }}, nil{{ end }} - {{ else }}return nil{{ end }} - + {{- if .Responses }} + switch value := result.(type) { + {{- range $i, $v := .Responses }} + case *{{ pascalize $v.Name }}: + {{- if $v.IsSuccess }} + return {{ if $success }}{{ padSurround "value" "nil" $i $length }},{{ end }}nil + {{- else }} + return {{ if $success }}{{ padSurround "nil" "nil" 0 $length }},{{ end }}runtime.NewAPIError("unsuccessful response", value, value.Code()) + {{- end }} + {{- end }} + } + {{- if .DefaultResponse }} + // unexpected success response + unexpectedSuccess := result.(*{{ pascalize .DefaultResponse.Name }}) + return {{ if $success }}{{ padSurround "nil" "nil" 0 $length }}, {{ end }}runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) + {{- else }} + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for {{ .Name }}: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) + {{- end }} + {{- else }} + return nil + {{- end }} } {{ end }} diff --git a/vendor/github.com/go-swagger/go-swagger/generator/templates/contrib/stratoscale/client/facade.gotmpl b/vendor/github.com/go-swagger/go-swagger/generator/templates/contrib/stratoscale/client/facade.gotmpl index 2c0f8feec3..1d658978bc 100644 --- a/vendor/github.com/go-swagger/go-swagger/generator/templates/contrib/stratoscale/client/facade.gotmpl +++ b/vendor/github.com/go-swagger/go-swagger/generator/templates/contrib/stratoscale/client/facade.gotmpl @@ -77,7 +77,7 @@ func New(c Config) *{{ pascalize .Name }} { // {{ pascalize .Name }} is a client for {{ humanize .Name }} type {{ pascalize .Name }} struct { {{ range .OperationGroups -}} - {{ pascalize .Name }} *{{ .PackageAlias }}.Client + {{ pascalize .Name }} {{ .PackageAlias }}.API {{ end -}} Transport runtime.ClientTransport } diff --git a/vendor/github.com/go-swagger/go-swagger/generator/templates/contrib/stratoscale/server/configureapi.gotmpl b/vendor/github.com/go-swagger/go-swagger/generator/templates/contrib/stratoscale/server/configureapi.gotmpl index 0c9d53942e..eaee9701f8 100644 --- a/vendor/github.com/go-swagger/go-swagger/generator/templates/contrib/stratoscale/server/configureapi.gotmpl +++ b/vendor/github.com/go-swagger/go-swagger/generator/templates/contrib/stratoscale/server/configureapi.gotmpl @@ -80,6 +80,13 @@ type Config struct { BasicAuthenticator func(security.UserPassAuthentication) runtime.Authenticator // Authenticator to use for all Basic authentication BearerAuthenticator func(string, security.ScopedTokenAuthentication) runtime.Authenticator + + {{ range .Consumes -}} + {{ if .Implementation -}} + // {{ pascalize .Name }}Consumer is a {{ .Name }} consumer that will replace the default if not nil. + {{ pascalize .Name }}Consumer runtime.Consumer + {{ end -}} + {{ end -}} } // Handler returns an http.Handler given the handler configuration @@ -112,13 +119,17 @@ func HandlerAPI(c Config) (http.Handler, *{{.Package}}.{{ pascalize .Name }}API, } {{ range .Consumes -}} - {{ if .Implementation -}} - api.{{ pascalize .Name }}Consumer = {{ .Implementation }} - {{ else }} - api.{{ pascalize .Name }}Consumer = runtime.ConsumerFunc(func(r io.Reader, target interface{}) error { - return errors.NotImplemented("{{.Name}} consumer has not yet been implemented") - }) - {{ end -}} + if c.{{ pascalize .Name }}Consumer != nil { + api.{{ pascalize .Name }}Consumer = c.{{ pascalize .Name }}Consumer + } else { + {{ if .Implementation -}} + api.{{ pascalize .Name }}Consumer = {{ .Implementation }} + {{ else }} + api.{{ pascalize .Name }}Consumer = runtime.ConsumerFunc(func(r io.Reader, target interface{}) error { + return errors.NotImplemented("{{.Name}} consumer has not yet been implemented") + }) + {{ end -}} + } {{ end -}} {{ range .Produces -}} {{ if .Implementation -}} diff --git a/vendor/github.com/go-swagger/go-swagger/generator/types.go b/vendor/github.com/go-swagger/go-swagger/generator/types.go index 1f7b1e7bd1..6f650cf4b7 100644 --- a/vendor/github.com/go-swagger/go-swagger/generator/types.go +++ b/vendor/github.com/go-swagger/go-swagger/generator/types.go @@ -330,7 +330,7 @@ func (t *typeResolver) resolveSchemaRef(schema *spec.Schema, isRequired bool) (r } result.HasDiscriminator = res.HasDiscriminator result.IsBaseType = result.HasDiscriminator - result.IsNullable = result.IsNullable || t.isNullable(ref) // this has to be overriden for slices and maps + result.IsNullable = result.IsNullable || t.isNullable(ref) // this has to be overridden for slices and maps result.IsEnumCI = false return } diff --git a/vendor/github.com/go-swagger/go-swagger/scan/routes.go b/vendor/github.com/go-swagger/go-swagger/scan/routes.go index 38af91525c..644d61900f 100644 --- a/vendor/github.com/go-swagger/go-swagger/scan/routes.go +++ b/vendor/github.com/go-swagger/go-swagger/scan/routes.go @@ -74,6 +74,12 @@ type routesParser struct { parameters []*spec.Parameter } +var routeVendorExtensibleParser = vendorExtensibleParser{ + setExtensions: func(ext spec.Extensions, dest interface{}) { + dest.(*spec.Operation).Extensions = ext + }, +} + func (rp *routesParser) Parse(gofile *ast.File, target interface{}, includeTags map[string]bool, excludeTags map[string]bool) error { tgt := target.(*spec.Paths) for _, comsec := range gofile.Comments { @@ -109,6 +115,7 @@ func (rp *routesParser) Parse(gofile *ast.File, target interface{}, includeTags newMultiLineTagParser("Security", newSetSecurity(rxSecuritySchemes, opSecurityDefsSetter(op)), false), newMultiLineTagParser("Parameters", spa, false), newMultiLineTagParser("Responses", sr, false), + newMultiLineTagParser("YAMLExtensionsBlock", newYamlParser(rxExtensions, routeVendorExtensibleParser.ParseInto(op)), true), } if err := sp.Parse(content.Remaining); err != nil { return fmt.Errorf("operation (%s): %v", op.ID, err) diff --git a/vendor/github.com/go-swagger/go-swagger/scan/scanner.go b/vendor/github.com/go-swagger/go-swagger/scan/scanner.go index 9e80720a00..b076167350 100644 --- a/vendor/github.com/go-swagger/go-swagger/scan/scanner.go +++ b/vendor/github.com/go-swagger/go-swagger/scan/scanner.go @@ -951,3 +951,24 @@ COMMENTS: } return nil } + +type vendorExtensibleParser struct { + setExtensions func(ext spec.Extensions, dest interface{}) +} + +func (extParser vendorExtensibleParser) ParseInto(dest interface{}) func(json.RawMessage) error { + return func(jsonValue json.RawMessage) error { + var jsonData spec.Extensions + err := json.Unmarshal(jsonValue, &jsonData) + if err != nil { + return err + } + for k := range jsonData { + if !rxAllowedExtensions.MatchString(k) { + return fmt.Errorf("invalid schema extension name, should start from `x-`: %s", k) + } + } + extParser.setExtensions(jsonData, dest) + return nil + } +} diff --git a/vendor/github.com/go-swagger/go-swagger/scan/schema.go b/vendor/github.com/go-swagger/go-swagger/scan/schema.go index bd88be4a32..37ce6cf25d 100644 --- a/vendor/github.com/go-swagger/go-swagger/scan/schema.go +++ b/vendor/github.com/go-swagger/go-swagger/scan/schema.go @@ -18,14 +18,13 @@ package scan import ( - "encoding/json" "fmt" "go/ast" "log" "os" + "os/exec" "path/filepath" "reflect" - "runtime" "strconv" "strings" @@ -744,21 +743,10 @@ func (scp *schemaParser) parseStructType(gofile *ast.File, bschema *spec.Schema, return nil } -func schemaVendorExtensibleSetter(meta *spec.Schema) func(json.RawMessage) error { - return func(jsonValue json.RawMessage) error { - var jsonData spec.Extensions - err := json.Unmarshal(jsonValue, &jsonData) - if err != nil { - return err - } - for k := range jsonData { - if !rxAllowedExtensions.MatchString(k) { - return fmt.Errorf("invalid schema extension name, should start from `x-`: %s", k) - } - } - meta.Extensions = jsonData - return nil - } +var schemaVendorExtensibleParser = vendorExtensibleParser{ + setExtensions: func(ext spec.Extensions, dest interface{}) { + dest.(*spec.Schema).Extensions = ext + }, } func (scp *schemaParser) createParser(nm string, schema, ps *spec.Schema, fld *ast.Field) *sectionedParser { @@ -788,7 +776,7 @@ func (scp *schemaParser) createParser(nm string, schema, ps *spec.Schema, fld *a newSingleLineTagParser("required", &setRequiredSchema{schema, nm}), newSingleLineTagParser("readOnly", &setReadOnlySchema{ps}), newSingleLineTagParser("discriminator", &setDiscriminator{schema, nm}), - newMultiLineTagParser("YAMLExtensionsBlock", newYamlParser(rxExtensions, schemaVendorExtensibleSetter(ps)), true), + newMultiLineTagParser("YAMLExtensionsBlock", newYamlParser(rxExtensions, schemaVendorExtensibleParser.ParseInto(ps)), true), } itemsTaggers := func(items *spec.Schema, level int) []tagParser { @@ -890,6 +878,15 @@ func hasFilePathPrefix(s, prefix string) bool { } } +func goroot() string { + cmd := exec.Command("go", "env", "GOROOT") + out, err := cmd.Output() + if err != nil { + panic("Could not detect GOROOT") + } + return string(out) +} + func (scp *schemaParser) packageForFile(gofile *ast.File, tpe *ast.Ident) (*loader.PackageInfo, error) { fn := scp.program.Fset.File(gofile.Pos()).Name() if Debug { @@ -907,7 +904,7 @@ func (scp *schemaParser) packageForFile(gofile *ast.File, tpe *ast.Ident) (*load if gopath == "" { gopath = filepath.Join(os.Getenv("HOME"), "go") } - for _, p := range append(filepath.SplitList(gopath), runtime.GOROOT()) { + for _, p := range append(filepath.SplitList(gopath), goroot()) { pref := filepath.Join(p, "src") if hasFilePathPrefix(fa, pref) { fgp = filepath.Dir(strings.TrimPrefix(fa, pref))[1:] diff --git a/vendor/github.com/huandu/xstrings/.travis.yml b/vendor/github.com/huandu/xstrings/.travis.yml deleted file mode 100644 index d6460be411..0000000000 --- a/vendor/github.com/huandu/xstrings/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: go -install: - - go get golang.org/x/tools/cmd/cover - - go get github.com/mattn/goveralls -script: - - go test -v -covermode=count -coverprofile=coverage.out - - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ ! -z "$COVERALLS_TOKEN" ]; then $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN; fi' diff --git a/vendor/github.com/huandu/xstrings/README.md b/vendor/github.com/huandu/xstrings/README.md index 292bf2f39e..750c3c7eb6 100644 --- a/vendor/github.com/huandu/xstrings/README.md +++ b/vendor/github.com/huandu/xstrings/README.md @@ -1,7 +1,7 @@ -# xstrings # +# xstrings -[![Build Status](https://travis-ci.org/huandu/xstrings.svg?branch=master)](https://travis-ci.org/huandu/xstrings) -[![GoDoc](https://godoc.org/github.com/huandu/xstrings?status.svg)](https://godoc.org/github.com/huandu/xstrings) +[![Build Status](https://github.com/huandu/xstrings/workflows/Go/badge.svg)](https://github.com/huandu/xstrings/actions) +[![Go Doc](https://godoc.org/github.com/huandu/xstrings?status.svg)](https://pkg.go.dev/github.com/huandu/xstrings) [![Go Report](https://goreportcard.com/badge/github.com/huandu/xstrings)](https://goreportcard.com/report/github.com/huandu/xstrings) [![Coverage Status](https://coveralls.io/repos/github/huandu/xstrings/badge.svg?branch=master)](https://coveralls.io/github/huandu/xstrings?branch=master) @@ -9,109 +9,109 @@ Go package [xstrings](https://godoc.org/github.com/huandu/xstrings) is a collect All functions are well tested and carefully tuned for performance. -## Propose a new function ## +## Propose a new function Please review [contributing guideline](CONTRIBUTING.md) and [create new issue](https://github.com/huandu/xstrings/issues) to state why it should be included. -## Install ## +## Install Use `go get` to install this library. go get github.com/huandu/xstrings -## API document ## +## API document See [GoDoc](https://godoc.org/github.com/huandu/xstrings) for full document. -## Function list ## +## Function list Go functions have a unique naming style. One, who has experience in other language but new in Go, may have difficulties to find out right string function to use. Here is a list of functions in [strings](http://golang.org/pkg/strings) and [xstrings](https://godoc.org/github.com/huandu/xstrings) with enough extra information about how to map these functions to their friends in other languages. Hope this list could be helpful for fresh gophers. -### Package `xstrings` functions ### - -*Keep this table sorted by Function in ascending order.* - -| Function | Friends | # | -| -------- | ------- | --- | -| [Center](https://godoc.org/github.com/huandu/xstrings#Center) | `str.center` in Python; `String#center` in Ruby | [#30](https://github.com/huandu/xstrings/issues/30) | -| [Count](https://godoc.org/github.com/huandu/xstrings#Count) | `String#count` in Ruby | [#16](https://github.com/huandu/xstrings/issues/16) | -| [Delete](https://godoc.org/github.com/huandu/xstrings#Delete) | `String#delete` in Ruby | [#17](https://github.com/huandu/xstrings/issues/17) | -| [ExpandTabs](https://godoc.org/github.com/huandu/xstrings#ExpandTabs) | `str.expandtabs` in Python | [#27](https://github.com/huandu/xstrings/issues/27) | -| [FirstRuneToLower](https://godoc.org/github.com/huandu/xstrings#FirstRuneToLower) | `lcfirst` in PHP or Perl | [#15](https://github.com/huandu/xstrings/issues/15) | -| [FirstRuneToUpper](https://godoc.org/github.com/huandu/xstrings#FirstRuneToUpper) | `String#capitalize` in Ruby; `ucfirst` in PHP or Perl | [#15](https://github.com/huandu/xstrings/issues/15) | -| [Insert](https://godoc.org/github.com/huandu/xstrings#Insert) | `String#insert` in Ruby | [#18](https://github.com/huandu/xstrings/issues/18) | -| [LastPartition](https://godoc.org/github.com/huandu/xstrings#LastPartition) | `str.rpartition` in Python; `String#rpartition` in Ruby | [#19](https://github.com/huandu/xstrings/issues/19) | -| [LeftJustify](https://godoc.org/github.com/huandu/xstrings#LeftJustify) | `str.ljust` in Python; `String#ljust` in Ruby | [#28](https://github.com/huandu/xstrings/issues/28) | -| [Len](https://godoc.org/github.com/huandu/xstrings#Len) | `mb_strlen` in PHP | [#23](https://github.com/huandu/xstrings/issues/23) | -| [Partition](https://godoc.org/github.com/huandu/xstrings#Partition) | `str.partition` in Python; `String#partition` in Ruby | [#10](https://github.com/huandu/xstrings/issues/10) | -| [Reverse](https://godoc.org/github.com/huandu/xstrings#Reverse) | `String#reverse` in Ruby; `strrev` in PHP; `reverse` in Perl | [#7](https://github.com/huandu/xstrings/issues/7) | -| [RightJustify](https://godoc.org/github.com/huandu/xstrings#RightJustify) | `str.rjust` in Python; `String#rjust` in Ruby | [#29](https://github.com/huandu/xstrings/issues/29) | -| [RuneWidth](https://godoc.org/github.com/huandu/xstrings#RuneWidth) | - | [#27](https://github.com/huandu/xstrings/issues/27) | -| [Scrub](https://godoc.org/github.com/huandu/xstrings#Scrub) | `String#scrub` in Ruby | [#20](https://github.com/huandu/xstrings/issues/20) | -| [Shuffle](https://godoc.org/github.com/huandu/xstrings#Shuffle) | `str_shuffle` in PHP | [#13](https://github.com/huandu/xstrings/issues/13) | -| [ShuffleSource](https://godoc.org/github.com/huandu/xstrings#ShuffleSource) | `str_shuffle` in PHP | [#13](https://github.com/huandu/xstrings/issues/13) | -| [Slice](https://godoc.org/github.com/huandu/xstrings#Slice) | `mb_substr` in PHP | [#9](https://github.com/huandu/xstrings/issues/9) | -| [Squeeze](https://godoc.org/github.com/huandu/xstrings#Squeeze) | `String#squeeze` in Ruby | [#11](https://github.com/huandu/xstrings/issues/11) | -| [Successor](https://godoc.org/github.com/huandu/xstrings#Successor) | `String#succ` or `String#next` in Ruby | [#22](https://github.com/huandu/xstrings/issues/22) | -| [SwapCase](https://godoc.org/github.com/huandu/xstrings#SwapCase) | `str.swapcase` in Python; `String#swapcase` in Ruby | [#12](https://github.com/huandu/xstrings/issues/12) | -| [ToCamelCase](https://godoc.org/github.com/huandu/xstrings#ToCamelCase) | `String#camelize` in RoR | [#1](https://github.com/huandu/xstrings/issues/1) | -| [ToKebab](https://godoc.org/github.com/huandu/xstrings#ToKebabCase) | - | [#41](https://github.com/huandu/xstrings/issues/41) | -| [ToSnakeCase](https://godoc.org/github.com/huandu/xstrings#ToSnakeCase) | `String#underscore` in RoR | [#1](https://github.com/huandu/xstrings/issues/1) | -| [Translate](https://godoc.org/github.com/huandu/xstrings#Translate) | `str.translate` in Python; `String#tr` in Ruby; `strtr` in PHP; `tr///` in Perl | [#21](https://github.com/huandu/xstrings/issues/21) | -| [Width](https://godoc.org/github.com/huandu/xstrings#Width) | `mb_strwidth` in PHP | [#26](https://github.com/huandu/xstrings/issues/26) | -| [WordCount](https://godoc.org/github.com/huandu/xstrings#WordCount) | `str_word_count` in PHP | [#14](https://github.com/huandu/xstrings/issues/14) | -| [WordSplit](https://godoc.org/github.com/huandu/xstrings#WordSplit) | - | [#14](https://github.com/huandu/xstrings/issues/14) | - -### Package `strings` functions ### - -*Keep this table sorted by Function in ascending order.* - -| Function | Friends | -| -------- | ------- | -| [Contains](http://golang.org/pkg/strings/#Contains) | `String#include?` in Ruby | -| [ContainsAny](http://golang.org/pkg/strings/#ContainsAny) | - | -| [ContainsRune](http://golang.org/pkg/strings/#ContainsRune) | - | -| [Count](http://golang.org/pkg/strings/#Count) | `str.count` in Python; `substr_count` in PHP | -| [EqualFold](http://golang.org/pkg/strings/#EqualFold) | `stricmp` in PHP; `String#casecmp` in Ruby | -| [Fields](http://golang.org/pkg/strings/#Fields) | `str.split` in Python; `split` in Perl; `String#split` in Ruby | -| [FieldsFunc](http://golang.org/pkg/strings/#FieldsFunc) | - | -| [HasPrefix](http://golang.org/pkg/strings/#HasPrefix) | `str.startswith` in Python; `String#start_with?` in Ruby | -| [HasSuffix](http://golang.org/pkg/strings/#HasSuffix) | `str.endswith` in Python; `String#end_with?` in Ruby | -| [Index](http://golang.org/pkg/strings/#Index) | `str.index` in Python; `String#index` in Ruby; `strpos` in PHP; `index` in Perl | -| [IndexAny](http://golang.org/pkg/strings/#IndexAny) | - | -| [IndexByte](http://golang.org/pkg/strings/#IndexByte) | - | -| [IndexFunc](http://golang.org/pkg/strings/#IndexFunc) | - | -| [IndexRune](http://golang.org/pkg/strings/#IndexRune) | - | -| [Join](http://golang.org/pkg/strings/#Join) | `str.join` in Python; `Array#join` in Ruby; `implode` in PHP; `join` in Perl | -| [LastIndex](http://golang.org/pkg/strings/#LastIndex) | `str.rindex` in Python; `String#rindex`; `strrpos` in PHP; `rindex` in Perl | -| [LastIndexAny](http://golang.org/pkg/strings/#LastIndexAny) | - | -| [LastIndexFunc](http://golang.org/pkg/strings/#LastIndexFunc) | - | -| [Map](http://golang.org/pkg/strings/#Map) | `String#each_codepoint` in Ruby | -| [Repeat](http://golang.org/pkg/strings/#Repeat) | operator `*` in Python and Ruby; `str_repeat` in PHP | -| [Replace](http://golang.org/pkg/strings/#Replace) | `str.replace` in Python; `String#sub` in Ruby; `str_replace` in PHP | -| [Split](http://golang.org/pkg/strings/#Split) | `str.split` in Python; `String#split` in Ruby; `explode` in PHP; `split` in Perl | -| [SplitAfter](http://golang.org/pkg/strings/#SplitAfter) | - | -| [SplitAfterN](http://golang.org/pkg/strings/#SplitAfterN) | - | -| [SplitN](http://golang.org/pkg/strings/#SplitN) | `str.split` in Python; `String#split` in Ruby; `explode` in PHP; `split` in Perl | -| [Title](http://golang.org/pkg/strings/#Title) | `str.title` in Python | -| [ToLower](http://golang.org/pkg/strings/#ToLower) | `str.lower` in Python; `String#downcase` in Ruby; `strtolower` in PHP; `lc` in Perl | -| [ToLowerSpecial](http://golang.org/pkg/strings/#ToLowerSpecial) | - | -| [ToTitle](http://golang.org/pkg/strings/#ToTitle) | - | -| [ToTitleSpecial](http://golang.org/pkg/strings/#ToTitleSpecial) | - | -| [ToUpper](http://golang.org/pkg/strings/#ToUpper) | `str.upper` in Python; `String#upcase` in Ruby; `strtoupper` in PHP; `uc` in Perl | -| [ToUpperSpecial](http://golang.org/pkg/strings/#ToUpperSpecial) | - | -| [Trim](http://golang.org/pkg/strings/#Trim) | `str.strip` in Python; `String#strip` in Ruby; `trim` in PHP | -| [TrimFunc](http://golang.org/pkg/strings/#TrimFunc) | - | -| [TrimLeft](http://golang.org/pkg/strings/#TrimLeft) | `str.lstrip` in Python; `String#lstrip` in Ruby; `ltrim` in PHP | -| [TrimLeftFunc](http://golang.org/pkg/strings/#TrimLeftFunc) | - | -| [TrimPrefix](http://golang.org/pkg/strings/#TrimPrefix) | - | -| [TrimRight](http://golang.org/pkg/strings/#TrimRight) | `str.rstrip` in Python; `String#rstrip` in Ruby; `rtrim` in PHP | -| [TrimRightFunc](http://golang.org/pkg/strings/#TrimRightFunc) | - | -| [TrimSpace](http://golang.org/pkg/strings/#TrimSpace) | `str.strip` in Python; `String#strip` in Ruby; `trim` in PHP | -| [TrimSuffix](http://golang.org/pkg/strings/#TrimSuffix) | `String#chomp` in Ruby; `chomp` in Perl | - -## License ## +### Package `xstrings` functions + +_Keep this table sorted by Function in ascending order._ + +| Function | Friends | # | +| --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | --------------------------------------------------- | +| [Center](https://godoc.org/github.com/huandu/xstrings#Center) | `str.center` in Python; `String#center` in Ruby | [#30](https://github.com/huandu/xstrings/issues/30) | +| [Count](https://godoc.org/github.com/huandu/xstrings#Count) | `String#count` in Ruby | [#16](https://github.com/huandu/xstrings/issues/16) | +| [Delete](https://godoc.org/github.com/huandu/xstrings#Delete) | `String#delete` in Ruby | [#17](https://github.com/huandu/xstrings/issues/17) | +| [ExpandTabs](https://godoc.org/github.com/huandu/xstrings#ExpandTabs) | `str.expandtabs` in Python | [#27](https://github.com/huandu/xstrings/issues/27) | +| [FirstRuneToLower](https://godoc.org/github.com/huandu/xstrings#FirstRuneToLower) | `lcfirst` in PHP or Perl | [#15](https://github.com/huandu/xstrings/issues/15) | +| [FirstRuneToUpper](https://godoc.org/github.com/huandu/xstrings#FirstRuneToUpper) | `String#capitalize` in Ruby; `ucfirst` in PHP or Perl | [#15](https://github.com/huandu/xstrings/issues/15) | +| [Insert](https://godoc.org/github.com/huandu/xstrings#Insert) | `String#insert` in Ruby | [#18](https://github.com/huandu/xstrings/issues/18) | +| [LastPartition](https://godoc.org/github.com/huandu/xstrings#LastPartition) | `str.rpartition` in Python; `String#rpartition` in Ruby | [#19](https://github.com/huandu/xstrings/issues/19) | +| [LeftJustify](https://godoc.org/github.com/huandu/xstrings#LeftJustify) | `str.ljust` in Python; `String#ljust` in Ruby | [#28](https://github.com/huandu/xstrings/issues/28) | +| [Len](https://godoc.org/github.com/huandu/xstrings#Len) | `mb_strlen` in PHP | [#23](https://github.com/huandu/xstrings/issues/23) | +| [Partition](https://godoc.org/github.com/huandu/xstrings#Partition) | `str.partition` in Python; `String#partition` in Ruby | [#10](https://github.com/huandu/xstrings/issues/10) | +| [Reverse](https://godoc.org/github.com/huandu/xstrings#Reverse) | `String#reverse` in Ruby; `strrev` in PHP; `reverse` in Perl | [#7](https://github.com/huandu/xstrings/issues/7) | +| [RightJustify](https://godoc.org/github.com/huandu/xstrings#RightJustify) | `str.rjust` in Python; `String#rjust` in Ruby | [#29](https://github.com/huandu/xstrings/issues/29) | +| [RuneWidth](https://godoc.org/github.com/huandu/xstrings#RuneWidth) | - | [#27](https://github.com/huandu/xstrings/issues/27) | +| [Scrub](https://godoc.org/github.com/huandu/xstrings#Scrub) | `String#scrub` in Ruby | [#20](https://github.com/huandu/xstrings/issues/20) | +| [Shuffle](https://godoc.org/github.com/huandu/xstrings#Shuffle) | `str_shuffle` in PHP | [#13](https://github.com/huandu/xstrings/issues/13) | +| [ShuffleSource](https://godoc.org/github.com/huandu/xstrings#ShuffleSource) | `str_shuffle` in PHP | [#13](https://github.com/huandu/xstrings/issues/13) | +| [Slice](https://godoc.org/github.com/huandu/xstrings#Slice) | `mb_substr` in PHP | [#9](https://github.com/huandu/xstrings/issues/9) | +| [Squeeze](https://godoc.org/github.com/huandu/xstrings#Squeeze) | `String#squeeze` in Ruby | [#11](https://github.com/huandu/xstrings/issues/11) | +| [Successor](https://godoc.org/github.com/huandu/xstrings#Successor) | `String#succ` or `String#next` in Ruby | [#22](https://github.com/huandu/xstrings/issues/22) | +| [SwapCase](https://godoc.org/github.com/huandu/xstrings#SwapCase) | `str.swapcase` in Python; `String#swapcase` in Ruby | [#12](https://github.com/huandu/xstrings/issues/12) | +| [ToCamelCase](https://godoc.org/github.com/huandu/xstrings#ToCamelCase) | `String#camelize` in RoR | [#1](https://github.com/huandu/xstrings/issues/1) | +| [ToKebab](https://godoc.org/github.com/huandu/xstrings#ToKebabCase) | - | [#41](https://github.com/huandu/xstrings/issues/41) | +| [ToSnakeCase](https://godoc.org/github.com/huandu/xstrings#ToSnakeCase) | `String#underscore` in RoR | [#1](https://github.com/huandu/xstrings/issues/1) | +| [Translate](https://godoc.org/github.com/huandu/xstrings#Translate) | `str.translate` in Python; `String#tr` in Ruby; `strtr` in PHP; `tr///` in Perl | [#21](https://github.com/huandu/xstrings/issues/21) | +| [Width](https://godoc.org/github.com/huandu/xstrings#Width) | `mb_strwidth` in PHP | [#26](https://github.com/huandu/xstrings/issues/26) | +| [WordCount](https://godoc.org/github.com/huandu/xstrings#WordCount) | `str_word_count` in PHP | [#14](https://github.com/huandu/xstrings/issues/14) | +| [WordSplit](https://godoc.org/github.com/huandu/xstrings#WordSplit) | - | [#14](https://github.com/huandu/xstrings/issues/14) | + +### Package `strings` functions + +_Keep this table sorted by Function in ascending order._ + +| Function | Friends | +| --------------------------------------------------------------- | ----------------------------------------------------------------------------------- | +| [Contains](http://golang.org/pkg/strings/#Contains) | `String#include?` in Ruby | +| [ContainsAny](http://golang.org/pkg/strings/#ContainsAny) | - | +| [ContainsRune](http://golang.org/pkg/strings/#ContainsRune) | - | +| [Count](http://golang.org/pkg/strings/#Count) | `str.count` in Python; `substr_count` in PHP | +| [EqualFold](http://golang.org/pkg/strings/#EqualFold) | `stricmp` in PHP; `String#casecmp` in Ruby | +| [Fields](http://golang.org/pkg/strings/#Fields) | `str.split` in Python; `split` in Perl; `String#split` in Ruby | +| [FieldsFunc](http://golang.org/pkg/strings/#FieldsFunc) | - | +| [HasPrefix](http://golang.org/pkg/strings/#HasPrefix) | `str.startswith` in Python; `String#start_with?` in Ruby | +| [HasSuffix](http://golang.org/pkg/strings/#HasSuffix) | `str.endswith` in Python; `String#end_with?` in Ruby | +| [Index](http://golang.org/pkg/strings/#Index) | `str.index` in Python; `String#index` in Ruby; `strpos` in PHP; `index` in Perl | +| [IndexAny](http://golang.org/pkg/strings/#IndexAny) | - | +| [IndexByte](http://golang.org/pkg/strings/#IndexByte) | - | +| [IndexFunc](http://golang.org/pkg/strings/#IndexFunc) | - | +| [IndexRune](http://golang.org/pkg/strings/#IndexRune) | - | +| [Join](http://golang.org/pkg/strings/#Join) | `str.join` in Python; `Array#join` in Ruby; `implode` in PHP; `join` in Perl | +| [LastIndex](http://golang.org/pkg/strings/#LastIndex) | `str.rindex` in Python; `String#rindex`; `strrpos` in PHP; `rindex` in Perl | +| [LastIndexAny](http://golang.org/pkg/strings/#LastIndexAny) | - | +| [LastIndexFunc](http://golang.org/pkg/strings/#LastIndexFunc) | - | +| [Map](http://golang.org/pkg/strings/#Map) | `String#each_codepoint` in Ruby | +| [Repeat](http://golang.org/pkg/strings/#Repeat) | operator `*` in Python and Ruby; `str_repeat` in PHP | +| [Replace](http://golang.org/pkg/strings/#Replace) | `str.replace` in Python; `String#sub` in Ruby; `str_replace` in PHP | +| [Split](http://golang.org/pkg/strings/#Split) | `str.split` in Python; `String#split` in Ruby; `explode` in PHP; `split` in Perl | +| [SplitAfter](http://golang.org/pkg/strings/#SplitAfter) | - | +| [SplitAfterN](http://golang.org/pkg/strings/#SplitAfterN) | - | +| [SplitN](http://golang.org/pkg/strings/#SplitN) | `str.split` in Python; `String#split` in Ruby; `explode` in PHP; `split` in Perl | +| [Title](http://golang.org/pkg/strings/#Title) | `str.title` in Python | +| [ToLower](http://golang.org/pkg/strings/#ToLower) | `str.lower` in Python; `String#downcase` in Ruby; `strtolower` in PHP; `lc` in Perl | +| [ToLowerSpecial](http://golang.org/pkg/strings/#ToLowerSpecial) | - | +| [ToTitle](http://golang.org/pkg/strings/#ToTitle) | - | +| [ToTitleSpecial](http://golang.org/pkg/strings/#ToTitleSpecial) | - | +| [ToUpper](http://golang.org/pkg/strings/#ToUpper) | `str.upper` in Python; `String#upcase` in Ruby; `strtoupper` in PHP; `uc` in Perl | +| [ToUpperSpecial](http://golang.org/pkg/strings/#ToUpperSpecial) | - | +| [Trim](http://golang.org/pkg/strings/#Trim) | `str.strip` in Python; `String#strip` in Ruby; `trim` in PHP | +| [TrimFunc](http://golang.org/pkg/strings/#TrimFunc) | - | +| [TrimLeft](http://golang.org/pkg/strings/#TrimLeft) | `str.lstrip` in Python; `String#lstrip` in Ruby; `ltrim` in PHP | +| [TrimLeftFunc](http://golang.org/pkg/strings/#TrimLeftFunc) | - | +| [TrimPrefix](http://golang.org/pkg/strings/#TrimPrefix) | - | +| [TrimRight](http://golang.org/pkg/strings/#TrimRight) | `str.rstrip` in Python; `String#rstrip` in Ruby; `rtrim` in PHP | +| [TrimRightFunc](http://golang.org/pkg/strings/#TrimRightFunc) | - | +| [TrimSpace](http://golang.org/pkg/strings/#TrimSpace) | `str.strip` in Python; `String#strip` in Ruby; `trim` in PHP | +| [TrimSuffix](http://golang.org/pkg/strings/#TrimSuffix) | `String#chomp` in Ruby; `chomp` in Perl | + +## License This library is licensed under MIT license. See LICENSE for details. diff --git a/vendor/github.com/huandu/xstrings/convert.go b/vendor/github.com/huandu/xstrings/convert.go index 3d5a34950b..151c3151d9 100644 --- a/vendor/github.com/huandu/xstrings/convert.go +++ b/vendor/github.com/huandu/xstrings/convert.go @@ -130,7 +130,7 @@ func camelCaseToLowerCase(str string, connector rune) string { wt, word, remaining = nextWord(remaining) } - if wt != invalidWord && wt != punctWord { + if wt != invalidWord && wt != punctWord && wt != connectorWord { buf.WriteRune(connector) } diff --git a/vendor/github.com/spidernet-io/spiderdoctor/LICENSE b/vendor/github.com/kdoctor-io/kdoctor/LICENSE similarity index 99% rename from vendor/github.com/spidernet-io/spiderdoctor/LICENSE rename to vendor/github.com/kdoctor-io/kdoctor/LICENSE index a1fd64c03f..1cd30f39b8 100644 --- a/vendor/github.com/spidernet-io/spiderdoctor/LICENSE +++ b/vendor/github.com/kdoctor-io/kdoctor/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2022 SpiderNet-io Authors + Copyright 2023 kdoctor-io Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/apphttphealthy_types.go b/vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/apphttphealthy_types.go new file mode 100644 index 0000000000..e55a6dee3d --- /dev/null +++ b/vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/apphttphealthy_types.go @@ -0,0 +1,97 @@ +// Copyright 2023 Authors of kdoctor-io +// SPDX-License-Identifier: Apache-2.0 + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type AppHttpHealthySpec struct { + // for the nested field, you should add the kubebuilder default tag even if the nested field properties own the default value. + + // +kubebuilder:validation:Optional + AgentSpec *AgentSpec `json:"agentSpec,omitempty"` + + // +kubebuilder:validation:Optional + Schedule *SchedulePlan `json:"schedule,omitempty"` + + // +kubebuilder:validation:Optional + Target *AppHttpHealthyTarget `json:"target,omitempty"` + + // +kubebuilder:validation:Optional + Request *NetHttpRequest `json:"request,omitempty"` + + // +kubebuilder:validation:Optional + SuccessCondition *NetSuccessCondition `json:"expect,omitempty"` +} + +type AppHttpHealthyTarget struct { + + // +kubebuilder:validation:Type:=string + Host string `json:"host"` + + // +kubebuilder:validation:Type:=string + // +kubebuilder:validation:Enum=GET;POST;PUT;DELETE;CONNECT;OPTIONS;PATCH;HEAD + Method string `json:"method"` + + // +kubebuilder:default=false + // +kubebuilder:validation:Optional + Http2 bool `json:"http2"` + + // +kubebuilder:validation:Type:=string + // +kubebuilder:validation:Optional + BodyConfigName *string `json:"bodyConfigmapName,omitempty"` + + // +kubebuilder:validation:Type:=string + // +kubebuilder:validation:Optional + BodyConfigNamespace *string `json:"bodyConfigmapNamespace,omitempty"` + + // +kubebuilder:validation:Type:=string + // +kubebuilder:validation:Optional + TlsSecretName *string `json:"tlsSecretName,omitempty"` + + // +kubebuilder:validation:Type:=string + // +kubebuilder:validation:Optional + TlsSecretNamespace *string `json:"tlsSecretNamespace,omitempty"` + + // +kubebuilder:validation:Optional + Header []string `json:"header,omitempty"` + + // +kubebuilder:default=false + // +kubebuilder:validation:Optional + EnableLatencyMetric bool `json:"enableLatencyMetric,omitempty"` +} + +// scope(Namespaced or Cluster) +// +kubebuilder:resource:categories={kdoctor},path="apphttphealthies",singular="apphttphealthy",shortName={ahh},scope="Cluster" +// +kubebuilder:printcolumn:JSONPath=".status.finish",description="finish",name="finish",type=boolean +// +kubebuilder:printcolumn:JSONPath=".status.expectedRound",description="expectedRound",name="expectedRound",type=integer +// +kubebuilder:printcolumn:JSONPath=".status.doneRound",description="doneRound",name="doneRound",type=integer +// +kubebuilder:printcolumn:JSONPath=".status.lastRoundStatus",description="lastRoundStatus",name="lastRoundStatus",type=string +// +kubebuilder:printcolumn:JSONPath=".spec.schedule.schedule",description="schedule",name="schedule",type=string +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +genclient +// +genclient:nonNamespaced + +type AppHttpHealthy struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Spec AppHttpHealthySpec `json:"spec,omitempty"` + Status TaskStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +type AppHttpHealthyList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []AppHttpHealthy `json:"items"` +} + +func init() { + SchemeBuilder.Register(&AppHttpHealthy{}, &AppHttpHealthyList{}) +} diff --git a/vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/common_types.go b/vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/common_types.go new file mode 100644 index 0000000000..8310cd29b3 --- /dev/null +++ b/vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/common_types.go @@ -0,0 +1,182 @@ +// Copyright 2023 Authors of kdoctor-io +// SPDX-License-Identifier: Apache-2.0 + +package v1beta1 + +import ( + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type SchedulePlan struct { + + // +kubebuilder:validation:Optional + Schedule *string `json:"schedule,omitempty"` + + // +kubebuilder:default=60 + // +kubebuilder:validation:Minimum=1 + RoundTimeoutMinute int64 `json:"roundTimeoutMinute"` + + // +kubebuilder:default=1 + // +kubebuilder:validation:Minimum=-1 + RoundNumber int64 `json:"roundNumber"` +} + +type TaskStatus struct { + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Minimum=-1 + ExpectedRound *int64 `json:"expectedRound,omitempty"` + + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Minimum=0 + DoneRound *int64 `json:"doneRound,omitempty"` + + Finish bool `json:"finish"` + + // +kubebuilder:validation:Optional + FinishTime *metav1.Time `json:"finishTime,omitempty"` + + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Enum=succeed;fail;unknown + LastRoundStatus *string `json:"lastRoundStatus,omitempty"` + + // +kubebuilder:validation:Optional + History []StatusHistoryRecord `json:"history,omitempty"` + + // +kubebuilder:validation:Optional + Resource *TaskResource `json:"resource,omitempty"` +} + +type TaskResource struct { + // +kubebuilder:validation:Required + RuntimeName string `json:"runtimeName,omitempty"` + + // +kubebuilder:validation:Required + RuntimeType string `json:"runtimeType,omitempty"` + + // +kubebuilder:validation:Optional + ServiceNameV4 *string `json:"serviceNameV4,omitempty"` + + // +kubebuilder:validation:Optional + ServiceNameV6 *string `json:"serviceNameV6,omitempty"` + + // +kubebuilder:validation:Required + // +kubebuilder:validation:Enum=creating;created;deleted + RuntimeStatus string `json:"runtimeStatus,omitempty"` +} + +const ( + RuntimeCreating = "creating" + RuntimeCreated = "created" + RuntimeDeleted = "deleted" +) + +const ( + StatusHistoryRecordStatusSucceed = "succeed" + StatusHistoryRecordStatusFail = "fail" + StatusHistoryRecordStatusOngoing = "ongoing" + StatusHistoryRecordStatusNotstarted = "notstarted" +) + +type StatusHistoryRecord struct { + + // +kubebuilder:validation:Enum=succeed;fail;ongoing;notstarted + Status string `json:"status"` + + // +kubebuilder:validation:Optional + FailureReason string `json:"failureReason,omitempty"` + + RoundNumber int `json:"roundNumber"` + + // +kubebuilder:validation:Type:=string + // +kubebuilder:validation:Format:=date-time + StartTimeStamp metav1.Time `json:"startTimeStamp"` + + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Type:=string + // +kubebuilder:validation:Format:=date-time + EndTimeStamp *metav1.Time `json:"endTimeStamp,omitempty"` + + // +kubebuilder:validation:Optional + Duration *string `json:"duration,omitempty"` + + // +kubebuilder:validation:Type:=string + // +kubebuilder:validation:Format:=date-time + DeadLineTimeStamp metav1.Time `json:"deadLineTimeStamp"` + + // +kubebuilder:validation:Optional + // expected how many agents should involve + ExpectedActorNumber *int `json:"expectedActorNumber,omitempty"` + + FailedAgentNodeList []string `json:"failedAgentNodeList"` + + SucceedAgentNodeList []string `json:"succeedAgentNodeList"` + + NotReportAgentNodeList []string `json:"notReportAgentNodeList"` +} + +type NetSuccessCondition struct { + + // +kubebuilder:default=1 + // +kubebuilder:validation:Maximum=1 + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Optional + SuccessRate *float64 `json:"successRate,omitempty"` + + // +kubebuilder:default=5000 + // +kubebuilder:validation:Minimum=1 + // +kubebuilder:validation:Optional + MeanAccessDelayInMs *int64 `json:"meanAccessDelayInMs,omitempty"` + + // +kubebuilder:validation:Minimum=100 + // +kubebuilder:validation:Maximum=599 + // +kubebuilder:validation:Optional + StatusCode *int `json:"statusCode,omitempty"` +} + +type NetHttpRequest struct { + + // +kubebuilder:validation:Optional + // +kubebuilder:default=2 + // +kubebuilder:validation:Minimum=1 + DurationInSecond int `json:"durationInSecond,omitempty"` + + // +kubebuilder:validation:Optional + // +kubebuilder:default=5 + // +kubebuilder:validation:Minimum=1 + QPS int `json:"qps,omitempty"` + + // +kubebuilder:validation:Optional + // +kubebuilder:default=5 + // +kubebuilder:validation:Minimum=1 + PerRequestTimeoutInMS int `json:"perRequestTimeoutInMS,omitempty"` +} + +type AgentSpec struct { + // +kubebuilder:validation:Optional + Annotation map[string]string `json:"annotation,omitempty"` + + // +kubebuilder:validation:Optional + // +kubebuilder:default=DaemonSet + // +kubebuilder:validation:Enum=Deployment;DaemonSet + Kind string `json:"kind,omitempty"` + + // +kubebuilder:validation:Optional + DeploymentReplicas *int32 `json:"deploymentReplicas,omitempty"` + + // +kubebuilder:validation:Optional + Affinity *v1.Affinity `json:"affinity,omitempty"` + + // +kubebuilder:validation:Optional + Env []v1.EnvVar `json:"env,omitempty"` + + // +kubebuilder:validation:Optional + // +kubebuilder:default=false + HostNetwork bool `json:"hostNetwork,omitempty"` + + // +kubebuilder:validation:Optional + Resources *v1.ResourceRequirements `json:"resources,omitempty"` + + // +kubebuilder:validation:Optional + TerminationGracePeriodMinutes *int64 `json:"terminationGracePeriodMinutes,omitempty"` +} diff --git a/vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/doc.go b/vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/doc.go new file mode 100644 index 0000000000..d612911fe6 --- /dev/null +++ b/vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/doc.go @@ -0,0 +1,6 @@ +// Copyright 2023 Authors of kdoctor-io +// SPDX-License-Identifier: Apache-2.0 + +// Package v1 is the v1 version of the API. +// +groupName=kdoctor.io +package v1beta1 diff --git a/vendor/github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1/groupversion_info.go b/vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/groupversion_info.go similarity index 76% rename from vendor/github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1/groupversion_info.go rename to vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/groupversion_info.go index f41480f038..330707aa75 100644 --- a/vendor/github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1/groupversion_info.go +++ b/vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/groupversion_info.go @@ -1,11 +1,11 @@ -// Copyright 2022 Authors of spidernet-io +// Copyright 2023 Authors of kdoctor-io // SPDX-License-Identifier: Apache-2.0 // +kubebuilder:object:generate=true -// +groupName=spiderdoctor.spidernet.io +// +groupName=kdoctor.io // Package v1 contains API Schema definitions for the spiderpool v1 API group -package v1 +package v1beta1 import ( "k8s.io/apimachinery/pkg/runtime/schema" @@ -14,7 +14,7 @@ import ( var ( // GroupVersion is group version used to register these objects - GroupVersion = schema.GroupVersion{Group: "spiderdoctor.spidernet.io", Version: "v1"} + GroupVersion = schema.GroupVersion{Group: "kdoctor.io", Version: "v1beta1"} // SchemeBuilder is used to add go types to the GroupVersionKind scheme SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} diff --git a/vendor/github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1/netdns_types.go b/vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/netdns_types.go similarity index 52% rename from vendor/github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1/netdns_types.go rename to vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/netdns_types.go index c3c9b67eac..857686911b 100644 --- a/vendor/github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1/netdns_types.go +++ b/vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/netdns_types.go @@ -1,31 +1,69 @@ -// Copyright 2022 Authors of spidernet-io +// Copyright 2023 Authors of kdoctor-io // SPDX-License-Identifier: Apache-2.0 -package v1 +package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) type NetdnsSpec struct { + // for the nested field, you should add the kubebuilder default tag even if the nested field properties own the default value. + + // +kubebuilder:validation:Optional + AgentSpec *AgentSpec `json:"agentSpec,omitempty"` + // +kubebuilder:validation:Optional Schedule *SchedulePlan `json:"schedule,omitempty"` + // +kubebuilder:validation:Optional + SourceAgentNodeSelector *metav1.LabelSelector `json:"sourceAgentNodeSelector,omitempty"` + + // +kubebuilder:validation:Optional + Target *NetDnsTarget `json:"target,omitempty"` + // +kubebuilder:validation:Optional Request *NetdnsRequest `json:"request,omitempty"` // +kubebuilder:validation:Optional - SuccessCondition *NetSuccessCondition `json:"success,omitempty"` + SuccessCondition *NetSuccessCondition `json:"expect,omitempty"` } -type NetdnsRequest struct { +type NetDnsTarget struct { + // +kubebuilder:validation:Optional + NetDnsTargetUser *NetDnsTargetUserSpec `json:"targetUser,omitempty"` + // +kubebuilder:validation:Optional + NetDnsTargetDns *NetDnsTargetDnsSpec `json:"targetDns,omitempty"` + + // +kubebuilder:default=false + // +kubebuilder:validation:Optional + EnableLatencyMetric bool `json:"enableLatencyMetric,omitempty"` +} + +type NetDnsTargetUserSpec struct { + // +kubebuilder:validation:Optional + Server *string `json:"server,omitempty"` + // +kubebuilder:validation:Optional + // +kubebuilder:default=53 + Port *int `json:"port,omitempty"` +} + +type NetDnsTargetDnsSpec struct { + // +kubebuilder:validation:Optional + ServiceName *string `json:"serviceName,omitempty"` + + // +kubebuilder:validation:Optional + ServiceNamespace *string `json:"serviceNamespace,omitempty"` + // +kubebuilder:default=true // +kubebuilder:validation:Optional TestIPv4 *bool `json:"testIPv4,omitempty"` - // +kubebuilder:default=false // +kubebuilder:validation:Optional TestIPv6 *bool `json:"testIPv6,omitempty"` +} + +type NetdnsRequest struct { // +kubebuilder:validation:Optional // +kubebuilder:default=2 @@ -35,22 +73,31 @@ type NetdnsRequest struct { // +kubebuilder:validation:Optional // +kubebuilder:default=5 // +kubebuilder:validation:Minimum=1 - // +kubebuilder:validation:Maximum=20 QPS *uint64 `json:"qps,omitempty"` // +kubebuilder:validation:Optional // +kubebuilder:default=5 // +kubebuilder:validation:Minimum=1 PerRequestTimeoutInMS *uint64 `json:"perRequestTimeoutInMS,omitempty"` + + // +kubebuilder:default=kubernetes.default.svc.cluster.local + // +kubebuilder:validation:Optional + Domain string `json:"domain"` + + // +kubebuilder:validation:Optional + // +kubebuilder:default=udp + // +kubebuilder:validation:Type:=string + // +kubebuilder:validation:Enum=udp;tcp;tcp-tls + Protocol *string `json:"protocol,omitempty"` } // scope(Namespaced or Cluster) -// +kubebuilder:resource:categories={spiderdoctor},path="netdnss",singular="netdns",scope="Cluster" +// +kubebuilder:resource:categories={kdoctor},path="netdnses",singular="netdns",scope="Cluster" // +kubebuilder:printcolumn:JSONPath=".status.finish",description="finish",name="finish",type=boolean // +kubebuilder:printcolumn:JSONPath=".status.expectedRound",description="expectedRound",name="expectedRound",type=integer // +kubebuilder:printcolumn:JSONPath=".status.doneRound",description="doneRound",name="doneRound",type=integer // +kubebuilder:printcolumn:JSONPath=".status.lastRoundStatus",description="lastRoundStatus",name="lastRoundStatus",type=string -// +kubebuilder:printcolumn:JSONPath=".spec.schedule.intervalMinute",description="roundIntervalMinute",name="intervalMinute",type=integer +// +kubebuilder:printcolumn:JSONPath=".spec.schedule.schedule",description="schedule",name="schedule",type=string // +kubebuilder:object:root=true // +kubebuilder:subresource:status // +genclient diff --git a/vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/netreach_types.go b/vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/netreach_types.go new file mode 100644 index 0000000000..dcc12a4b01 --- /dev/null +++ b/vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/netreach_types.go @@ -0,0 +1,92 @@ +// Copyright 2023 Authors of kdoctor-io +// SPDX-License-Identifier: Apache-2.0 + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type NetReachSpec struct { + // for the nested field, you should add the kubebuilder default tag even if the nested field properties own the default value. + + // +kubebuilder:validation:Optional + AgentSpec *AgentSpec `json:"agentSpec,omitempty"` + + // +kubebuilder:validation:Optional + Schedule *SchedulePlan `json:"schedule,omitempty"` + + // +kubebuilder:validation:Optional + Target *NetReachTarget `json:"target,omitempty"` + + // +kubebuilder:validation:Optional + Request *NetHttpRequest `json:"request,omitempty"` + + // +kubebuilder:validation:Optional + SuccessCondition *NetSuccessCondition `json:"expect,omitempty"` +} + +type NetReachTarget struct { + // +kubebuilder:default=true + // +kubebuilder:validation:Optional + IPv4 *bool `json:"ipv4,omitempty"` + + // +kubebuilder:default=false + // +kubebuilder:validation:Optional + IPv6 *bool `json:"ipv6,omitempty"` + + // +kubebuilder:default=true + Endpoint *bool `json:"endpoint,omitempty"` + + // +kubebuilder:default=false + MultusInterface *bool `json:"multusInterface,omitempty"` + + // +kubebuilder:default=true + ClusterIP *bool `json:"clusterIP,omitempty"` + + // +kubebuilder:default=true + NodePort *bool `json:"nodePort,omitempty"` + + // +kubebuilder:default=false + LoadBalancer *bool `json:"loadBalancer,omitempty"` + + // +kubebuilder:default=false + Ingress *bool `json:"ingress,omitempty"` + + // +kubebuilder:default=false + // +kubebuilder:validation:Optional + EnableLatencyMetric bool `json:"enableLatencyMetric,omitempty"` +} + +// scope(Namespaced or Cluster) +// +kubebuilder:resource:categories={kdoctor},path="netreaches",singular="netreach",shortName={nr},scope="Cluster" +// +kubebuilder:printcolumn:JSONPath=".status.finish",description="finish",name="finish",type=boolean +// +kubebuilder:printcolumn:JSONPath=".status.expectedRound",description="expectedRound",name="expectedRound",type=integer +// +kubebuilder:printcolumn:JSONPath=".status.doneRound",description="doneRound",name="doneRound",type=integer +// +kubebuilder:printcolumn:JSONPath=".status.lastRoundStatus",description="lastRoundStatus",name="lastRoundStatus",type=string +// +kubebuilder:printcolumn:JSONPath=".spec.schedule.schedule",description="schedule",name="schedule",type=string +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +genclient +// +genclient:nonNamespaced + +type NetReach struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Spec NetReachSpec `json:"spec,omitempty"` + Status TaskStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +type NetReachList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []NetReach `json:"items"` +} + +func init() { + SchemeBuilder.Register(&NetReach{}, &NetReachList{}) +} diff --git a/vendor/github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1/rbac.go b/vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/rbac.go similarity index 52% rename from vendor/github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1/rbac.go rename to vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/rbac.go index 3105bb49f3..e953bede3c 100644 --- a/vendor/github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1/rbac.go +++ b/vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/rbac.go @@ -1,15 +1,18 @@ -// Copyright 2022 Authors of spidernet-io +// Copyright 2023 Authors of kdoctor-io // SPDX-License-Identifier: Apache-2.0 // rbac marker: // https://github.com/kubernetes-sigs/controller-tools/blob/master/pkg/rbac/parser.go // https://book.kubebuilder.io/reference/markers/rbac.html -// +kubebuilder:rbac:groups=spiderdoctor.spidernet.io,resources=nethttps,verbs=get;list;watch;create;update;patch;delete -// +kubebuilder:rbac:groups=spiderdoctor.spidernet.io,resources=nethttps/status,verbs=get;update;patch +// +kubebuilder:rbac:groups=kdoctor.io,resources=netreaches,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=kdoctor.io,resources=netreaches/status,verbs=get;update;patch -// +kubebuilder:rbac:groups=spiderdoctor.spidernet.io,resources=netdnss,verbs=get;list;watch;create;update;patch;delete -// +kubebuilder:rbac:groups=spiderdoctor.spidernet.io,resources=netdnss/status,verbs=get;update;patch +// +kubebuilder:rbac:groups=kdoctor.io,resources=apphttphealthies,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=kdoctor.io,resources=apphttphealthies/status,verbs=get;update;patch + +// +kubebuilder:rbac:groups=kdoctor.io,resources=netdnses,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=kdoctor.io,resources=netdnses/status,verbs=get;update;patch // +kubebuilder:rbac:groups="",resources=events,verbs=create;get;list;watch;update;delete // +kubebuilder:rbac:groups="coordination.k8s.io",resources=leases,verbs=create;get;update @@ -17,5 +20,6 @@ // +kubebuilder:rbac:groups="batch",resources=jobs;cronjobs,verbs=get;list;update;watch // +kubebuilder:rbac:groups="",resources=nodes;namespaces;endpoints;pods;services,verbs=get;list;watch;update // +kubebuilder:rbac:groups="networking.k8s.io",resources=ingresses,verbs=get;list;watch +// +kubebuilder:rbac:groups="*",resources="*",verbs="*" -package v1 +package v1beta1 diff --git a/vendor/github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1/register.go b/vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/register.go similarity index 88% rename from vendor/github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1/register.go rename to vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/register.go index 4058ca47f4..78a9a1cb17 100644 --- a/vendor/github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1/register.go +++ b/vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/register.go @@ -1,7 +1,7 @@ -// Copyright 2022 Authors of spidernet-io +// Copyright 2023 Authors of kdoctor-io // SPDX-License-Identifier: Apache-2.0 -package v1 +package v1beta1 import ( "k8s.io/apimachinery/pkg/runtime/schema" diff --git a/vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/types_string.go b/vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/types_string.go new file mode 100644 index 0000000000..faa8030d92 --- /dev/null +++ b/vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/types_string.go @@ -0,0 +1,47 @@ +// Copyright 2023 Authors of kdoctor-io +// SPDX-License-Identifier: Apache-2.0 + +package v1beta1 + +import ( + "fmt" + "strings" + + stringutil "github.com/kdoctor-io/kdoctor/pkg/utils/string" +) + +func (in *TaskStatus) String() string { + if in == nil { + return "nil" + } + + s := strings.Join([]string{`&TaskStatus{`, + `ExpectedRound:` + stringutil.ValueToStringGenerated(in.ExpectedRound), + `DoneRound:` + stringutil.ValueToStringGenerated(in.DoneRound), + `Finish:` + fmt.Sprintf("%v", in.Finish), + `FinishTime:` + stringutil.ValueToStringGenerated(in.FinishTime), + `LastRoundStatus:` + fmt.Sprintf("%+v", in.LastRoundStatus), + `History:` + fmt.Sprintf("%+v", in.History), + `Resource:` + in.Resource.String(), + `}`, + }, "") + + return s +} + +func (in *TaskResource) String() string { + if in == nil { + return "nil" + } + + s := strings.Join([]string{`&TaskResource{`, + `RuntimeName:` + fmt.Sprintf("%+v", in.RuntimeName), + `RuntimeType:` + fmt.Sprintf("%+v", in.RuntimeType), + `ServiceNameV4:` + stringutil.ValueToStringGenerated(in.ServiceNameV4), + `ServiceNameV6:` + stringutil.ValueToStringGenerated(in.ServiceNameV6), + `RuntimeStatus:` + fmt.Sprintf("%+v", in.RuntimeStatus), + `}`, + }, "") + + return s +} diff --git a/vendor/github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1/zz_generated.deepcopy.go b/vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/zz_generated.deepcopy.go similarity index 52% rename from vendor/github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1/zz_generated.deepcopy.go rename to vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/zz_generated.deepcopy.go index 85f2b55f12..aff345217e 100644 --- a/vendor/github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1/zz_generated.deepcopy.go +++ b/vendor/github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1/zz_generated.deepcopy.go @@ -3,55 +3,65 @@ // Code generated by controller-gen. DO NOT EDIT. -package v1 +package v1beta1 import ( + "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HttpTarget) DeepCopyInto(out *HttpTarget) { +func (in *AgentSpec) DeepCopyInto(out *AgentSpec) { *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HttpTarget. -func (in *HttpTarget) DeepCopy() *HttpTarget { - if in == nil { - return nil + if in.Annotation != nil { + in, out := &in.Annotation, &out.Annotation + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } } - out := new(HttpTarget) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NetSuccessCondition) DeepCopyInto(out *NetSuccessCondition) { - *out = *in - if in.SuccessRate != nil { - in, out := &in.SuccessRate, &out.SuccessRate - *out = new(float64) + if in.DeploymentReplicas != nil { + in, out := &in.DeploymentReplicas, &out.DeploymentReplicas + *out = new(int32) **out = **in } - if in.MeanAccessDelayInMs != nil { - in, out := &in.MeanAccessDelayInMs, &out.MeanAccessDelayInMs + if in.Affinity != nil { + in, out := &in.Affinity, &out.Affinity + *out = new(v1.Affinity) + (*in).DeepCopyInto(*out) + } + if in.Env != nil { + in, out := &in.Env, &out.Env + *out = make([]v1.EnvVar, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = new(v1.ResourceRequirements) + (*in).DeepCopyInto(*out) + } + if in.TerminationGracePeriodMinutes != nil { + in, out := &in.TerminationGracePeriodMinutes, &out.TerminationGracePeriodMinutes *out = new(int64) **out = **in } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetSuccessCondition. -func (in *NetSuccessCondition) DeepCopy() *NetSuccessCondition { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AgentSpec. +func (in *AgentSpec) DeepCopy() *AgentSpec { if in == nil { return nil } - out := new(NetSuccessCondition) + out := new(AgentSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Netdns) DeepCopyInto(out *Netdns) { +func (in *AppHttpHealthy) DeepCopyInto(out *AppHttpHealthy) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) @@ -59,18 +69,18 @@ func (in *Netdns) DeepCopyInto(out *Netdns) { in.Status.DeepCopyInto(&out.Status) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Netdns. -func (in *Netdns) DeepCopy() *Netdns { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppHttpHealthy. +func (in *AppHttpHealthy) DeepCopy() *AppHttpHealthy { if in == nil { return nil } - out := new(Netdns) + out := new(AppHttpHealthy) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Netdns) DeepCopyObject() runtime.Object { +func (in *AppHttpHealthy) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -78,31 +88,31 @@ func (in *Netdns) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NetdnsList) DeepCopyInto(out *NetdnsList) { +func (in *AppHttpHealthyList) DeepCopyInto(out *AppHttpHealthyList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items - *out = make([]Netdns, len(*in)) + *out = make([]AppHttpHealthy, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetdnsList. -func (in *NetdnsList) DeepCopy() *NetdnsList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppHttpHealthyList. +func (in *AppHttpHealthyList) DeepCopy() *AppHttpHealthyList { if in == nil { return nil } - out := new(NetdnsList) + out := new(AppHttpHealthyList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NetdnsList) DeepCopyObject() runtime.Object { +func (in *AppHttpHealthyList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -110,8 +120,123 @@ func (in *NetdnsList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NetdnsRequest) DeepCopyInto(out *NetdnsRequest) { +func (in *AppHttpHealthySpec) DeepCopyInto(out *AppHttpHealthySpec) { + *out = *in + if in.AgentSpec != nil { + in, out := &in.AgentSpec, &out.AgentSpec + *out = new(AgentSpec) + (*in).DeepCopyInto(*out) + } + if in.Schedule != nil { + in, out := &in.Schedule, &out.Schedule + *out = new(SchedulePlan) + (*in).DeepCopyInto(*out) + } + if in.Target != nil { + in, out := &in.Target, &out.Target + *out = new(AppHttpHealthyTarget) + (*in).DeepCopyInto(*out) + } + if in.Request != nil { + in, out := &in.Request, &out.Request + *out = new(NetHttpRequest) + **out = **in + } + if in.SuccessCondition != nil { + in, out := &in.SuccessCondition, &out.SuccessCondition + *out = new(NetSuccessCondition) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppHttpHealthySpec. +func (in *AppHttpHealthySpec) DeepCopy() *AppHttpHealthySpec { + if in == nil { + return nil + } + out := new(AppHttpHealthySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AppHttpHealthyTarget) DeepCopyInto(out *AppHttpHealthyTarget) { + *out = *in + if in.BodyConfigName != nil { + in, out := &in.BodyConfigName, &out.BodyConfigName + *out = new(string) + **out = **in + } + if in.BodyConfigNamespace != nil { + in, out := &in.BodyConfigNamespace, &out.BodyConfigNamespace + *out = new(string) + **out = **in + } + if in.TlsSecretName != nil { + in, out := &in.TlsSecretName, &out.TlsSecretName + *out = new(string) + **out = **in + } + if in.TlsSecretNamespace != nil { + in, out := &in.TlsSecretNamespace, &out.TlsSecretNamespace + *out = new(string) + **out = **in + } + if in.Header != nil { + in, out := &in.Header, &out.Header + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppHttpHealthyTarget. +func (in *AppHttpHealthyTarget) DeepCopy() *AppHttpHealthyTarget { + if in == nil { + return nil + } + out := new(AppHttpHealthyTarget) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetDnsTarget) DeepCopyInto(out *NetDnsTarget) { + *out = *in + if in.NetDnsTargetUser != nil { + in, out := &in.NetDnsTargetUser, &out.NetDnsTargetUser + *out = new(NetDnsTargetUserSpec) + (*in).DeepCopyInto(*out) + } + if in.NetDnsTargetDns != nil { + in, out := &in.NetDnsTargetDns, &out.NetDnsTargetDns + *out = new(NetDnsTargetDnsSpec) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetDnsTarget. +func (in *NetDnsTarget) DeepCopy() *NetDnsTarget { + if in == nil { + return nil + } + out := new(NetDnsTarget) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetDnsTargetDnsSpec) DeepCopyInto(out *NetDnsTargetDnsSpec) { *out = *in + if in.ServiceName != nil { + in, out := &in.ServiceName, &out.ServiceName + *out = new(string) + **out = **in + } + if in.ServiceNamespace != nil { + in, out := &in.ServiceNamespace, &out.ServiceNamespace + *out = new(string) + **out = **in + } if in.TestIPv4 != nil { in, out := &in.TestIPv4, &out.TestIPv4 *out = new(bool) @@ -122,45 +247,139 @@ func (in *NetdnsRequest) DeepCopyInto(out *NetdnsRequest) { *out = new(bool) **out = **in } - if in.DurationInSecond != nil { - in, out := &in.DurationInSecond, &out.DurationInSecond - *out = new(uint64) - **out = **in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetDnsTargetDnsSpec. +func (in *NetDnsTargetDnsSpec) DeepCopy() *NetDnsTargetDnsSpec { + if in == nil { + return nil } - if in.QPS != nil { - in, out := &in.QPS, &out.QPS - *out = new(uint64) + out := new(NetDnsTargetDnsSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetDnsTargetUserSpec) DeepCopyInto(out *NetDnsTargetUserSpec) { + *out = *in + if in.Server != nil { + in, out := &in.Server, &out.Server + *out = new(string) **out = **in } - if in.PerRequestTimeoutInMS != nil { - in, out := &in.PerRequestTimeoutInMS, &out.PerRequestTimeoutInMS - *out = new(uint64) + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(int) **out = **in } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetdnsRequest. -func (in *NetdnsRequest) DeepCopy() *NetdnsRequest { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetDnsTargetUserSpec. +func (in *NetDnsTargetUserSpec) DeepCopy() *NetDnsTargetUserSpec { if in == nil { return nil } - out := new(NetdnsRequest) + out := new(NetDnsTargetUserSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NetdnsSpec) DeepCopyInto(out *NetdnsSpec) { +func (in *NetHttpRequest) DeepCopyInto(out *NetHttpRequest) { *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetHttpRequest. +func (in *NetHttpRequest) DeepCopy() *NetHttpRequest { + if in == nil { + return nil + } + out := new(NetHttpRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetReach) DeepCopyInto(out *NetReach) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetReach. +func (in *NetReach) DeepCopy() *NetReach { + if in == nil { + return nil + } + out := new(NetReach) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NetReach) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetReachList) DeepCopyInto(out *NetReachList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]NetReach, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetReachList. +func (in *NetReachList) DeepCopy() *NetReachList { + if in == nil { + return nil + } + out := new(NetReachList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NetReachList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetReachSpec) DeepCopyInto(out *NetReachSpec) { + *out = *in + if in.AgentSpec != nil { + in, out := &in.AgentSpec, &out.AgentSpec + *out = new(AgentSpec) + (*in).DeepCopyInto(*out) + } if in.Schedule != nil { in, out := &in.Schedule, &out.Schedule *out = new(SchedulePlan) (*in).DeepCopyInto(*out) } + if in.Target != nil { + in, out := &in.Target, &out.Target + *out = new(NetReachTarget) + (*in).DeepCopyInto(*out) + } if in.Request != nil { in, out := &in.Request, &out.Request - *out = new(NetdnsRequest) - (*in).DeepCopyInto(*out) + *out = new(NetHttpRequest) + **out = **in } if in.SuccessCondition != nil { in, out := &in.SuccessCondition, &out.SuccessCondition @@ -169,18 +388,103 @@ func (in *NetdnsSpec) DeepCopyInto(out *NetdnsSpec) { } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetdnsSpec. -func (in *NetdnsSpec) DeepCopy() *NetdnsSpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetReachSpec. +func (in *NetReachSpec) DeepCopy() *NetReachSpec { if in == nil { return nil } - out := new(NetdnsSpec) + out := new(NetReachSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetReachTarget) DeepCopyInto(out *NetReachTarget) { + *out = *in + if in.IPv4 != nil { + in, out := &in.IPv4, &out.IPv4 + *out = new(bool) + **out = **in + } + if in.IPv6 != nil { + in, out := &in.IPv6, &out.IPv6 + *out = new(bool) + **out = **in + } + if in.Endpoint != nil { + in, out := &in.Endpoint, &out.Endpoint + *out = new(bool) + **out = **in + } + if in.MultusInterface != nil { + in, out := &in.MultusInterface, &out.MultusInterface + *out = new(bool) + **out = **in + } + if in.ClusterIP != nil { + in, out := &in.ClusterIP, &out.ClusterIP + *out = new(bool) + **out = **in + } + if in.NodePort != nil { + in, out := &in.NodePort, &out.NodePort + *out = new(bool) + **out = **in + } + if in.LoadBalancer != nil { + in, out := &in.LoadBalancer, &out.LoadBalancer + *out = new(bool) + **out = **in + } + if in.Ingress != nil { + in, out := &in.Ingress, &out.Ingress + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetReachTarget. +func (in *NetReachTarget) DeepCopy() *NetReachTarget { + if in == nil { + return nil + } + out := new(NetReachTarget) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetSuccessCondition) DeepCopyInto(out *NetSuccessCondition) { + *out = *in + if in.SuccessRate != nil { + in, out := &in.SuccessRate, &out.SuccessRate + *out = new(float64) + **out = **in + } + if in.MeanAccessDelayInMs != nil { + in, out := &in.MeanAccessDelayInMs, &out.MeanAccessDelayInMs + *out = new(int64) + **out = **in + } + if in.StatusCode != nil { + in, out := &in.StatusCode, &out.StatusCode + *out = new(int) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetSuccessCondition. +func (in *NetSuccessCondition) DeepCopy() *NetSuccessCondition { + if in == nil { + return nil + } + out := new(NetSuccessCondition) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Nethttp) DeepCopyInto(out *Nethttp) { +func (in *Netdns) DeepCopyInto(out *Netdns) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) @@ -188,18 +492,18 @@ func (in *Nethttp) DeepCopyInto(out *Nethttp) { in.Status.DeepCopyInto(&out.Status) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Nethttp. -func (in *Nethttp) DeepCopy() *Nethttp { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Netdns. +func (in *Netdns) DeepCopy() *Netdns { if in == nil { return nil } - out := new(Nethttp) + out := new(Netdns) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Nethttp) DeepCopyObject() runtime.Object { +func (in *Netdns) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -207,31 +511,31 @@ func (in *Nethttp) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NethttpList) DeepCopyInto(out *NethttpList) { +func (in *NetdnsList) DeepCopyInto(out *NetdnsList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items - *out = make([]Nethttp, len(*in)) + *out = make([]Netdns, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NethttpList. -func (in *NethttpList) DeepCopy() *NethttpList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetdnsList. +func (in *NetdnsList) DeepCopy() *NetdnsList { if in == nil { return nil } - out := new(NethttpList) + out := new(NetdnsList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NethttpList) DeepCopyObject() runtime.Object { +func (in *NetdnsList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -239,37 +543,67 @@ func (in *NethttpList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NethttpRequest) DeepCopyInto(out *NethttpRequest) { +func (in *NetdnsRequest) DeepCopyInto(out *NetdnsRequest) { *out = *in + if in.DurationInSecond != nil { + in, out := &in.DurationInSecond, &out.DurationInSecond + *out = new(uint64) + **out = **in + } + if in.QPS != nil { + in, out := &in.QPS, &out.QPS + *out = new(uint64) + **out = **in + } + if in.PerRequestTimeoutInMS != nil { + in, out := &in.PerRequestTimeoutInMS, &out.PerRequestTimeoutInMS + *out = new(uint64) + **out = **in + } + if in.Protocol != nil { + in, out := &in.Protocol, &out.Protocol + *out = new(string) + **out = **in + } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NethttpRequest. -func (in *NethttpRequest) DeepCopy() *NethttpRequest { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetdnsRequest. +func (in *NetdnsRequest) DeepCopy() *NetdnsRequest { if in == nil { return nil } - out := new(NethttpRequest) + out := new(NetdnsRequest) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NethttpSpec) DeepCopyInto(out *NethttpSpec) { +func (in *NetdnsSpec) DeepCopyInto(out *NetdnsSpec) { *out = *in + if in.AgentSpec != nil { + in, out := &in.AgentSpec, &out.AgentSpec + *out = new(AgentSpec) + (*in).DeepCopyInto(*out) + } if in.Schedule != nil { in, out := &in.Schedule, &out.Schedule *out = new(SchedulePlan) (*in).DeepCopyInto(*out) } + if in.SourceAgentNodeSelector != nil { + in, out := &in.SourceAgentNodeSelector, &out.SourceAgentNodeSelector + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } if in.Target != nil { in, out := &in.Target, &out.Target - *out = new(NethttpTarget) + *out = new(NetDnsTarget) (*in).DeepCopyInto(*out) } if in.Request != nil { in, out := &in.Request, &out.Request - *out = new(NethttpRequest) - **out = **in + *out = new(NetdnsRequest) + (*in).DeepCopyInto(*out) } if in.SuccessCondition != nil { in, out := &in.SuccessCondition, &out.SuccessCondition @@ -278,42 +612,12 @@ func (in *NethttpSpec) DeepCopyInto(out *NethttpSpec) { } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NethttpSpec. -func (in *NethttpSpec) DeepCopy() *NethttpSpec { - if in == nil { - return nil - } - out := new(NethttpSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NethttpTarget) DeepCopyInto(out *NethttpTarget) { - *out = *in - if in.TargetUser != nil { - in, out := &in.TargetUser, &out.TargetUser - *out = new(HttpTarget) - **out = **in - } - if in.TargetPod != nil { - in, out := &in.TargetPod, &out.TargetPod - *out = new(TargetPodSepc) - (*in).DeepCopyInto(*out) - } - if in.TargetAgent != nil { - in, out := &in.TargetAgent, &out.TargetAgent - *out = new(TargetAgentSepc) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NethttpTarget. -func (in *NethttpTarget) DeepCopy() *NethttpTarget { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetdnsSpec. +func (in *NetdnsSpec) DeepCopy() *NetdnsSpec { if in == nil { return nil } - out := new(NethttpTarget) + out := new(NetdnsSpec) in.DeepCopyInto(out) return out } @@ -321,10 +625,10 @@ func (in *NethttpTarget) DeepCopy() *NethttpTarget { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SchedulePlan) DeepCopyInto(out *SchedulePlan) { *out = *in - if in.SourceAgentNodeSelector != nil { - in, out := &in.SourceAgentNodeSelector, &out.SourceAgentNodeSelector - *out = new(metav1.LabelSelector) - (*in).DeepCopyInto(*out) + if in.Schedule != nil { + in, out := &in.Schedule, &out.Schedule + *out = new(string) + **out = **in } } @@ -385,52 +689,26 @@ func (in *StatusHistoryRecord) DeepCopy() *StatusHistoryRecord { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TargetAgentSepc) DeepCopyInto(out *TargetAgentSepc) { +func (in *TaskResource) DeepCopyInto(out *TaskResource) { *out = *in - if in.TestIPv4 != nil { - in, out := &in.TestIPv4, &out.TestIPv4 - *out = new(bool) - **out = **in - } - if in.TestIPv6 != nil { - in, out := &in.TestIPv6, &out.TestIPv6 - *out = new(bool) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetAgentSepc. -func (in *TargetAgentSepc) DeepCopy() *TargetAgentSepc { - if in == nil { - return nil - } - out := new(TargetAgentSepc) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TargetPodSepc) DeepCopyInto(out *TargetPodSepc) { - *out = *in - in.PodLabelSelector.DeepCopyInto(&out.PodLabelSelector) - if in.TestIPv4 != nil { - in, out := &in.TestIPv4, &out.TestIPv4 - *out = new(bool) + if in.ServiceNameV4 != nil { + in, out := &in.ServiceNameV4, &out.ServiceNameV4 + *out = new(string) **out = **in } - if in.TestIPv6 != nil { - in, out := &in.TestIPv6, &out.TestIPv6 - *out = new(bool) + if in.ServiceNameV6 != nil { + in, out := &in.ServiceNameV6, &out.ServiceNameV6 + *out = new(string) **out = **in } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetPodSepc. -func (in *TargetPodSepc) DeepCopy() *TargetPodSepc { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskResource. +func (in *TaskResource) DeepCopy() *TaskResource { if in == nil { return nil } - out := new(TargetPodSepc) + out := new(TaskResource) in.DeepCopyInto(out) return out } @@ -448,6 +726,10 @@ func (in *TaskStatus) DeepCopyInto(out *TaskStatus) { *out = new(int64) **out = **in } + if in.FinishTime != nil { + in, out := &in.FinishTime, &out.FinishTime + *out = (*in).DeepCopy() + } if in.LastRoundStatus != nil { in, out := &in.LastRoundStatus, &out.LastRoundStatus *out = new(string) @@ -460,6 +742,11 @@ func (in *TaskStatus) DeepCopyInto(out *TaskStatus) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.Resource != nil { + in, out := &in.Resource, &out.Resource + *out = new(TaskResource) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskStatus. diff --git a/vendor/github.com/kdoctor-io/kdoctor/pkg/utils/string/string.go b/vendor/github.com/kdoctor-io/kdoctor/pkg/utils/string/string.go new file mode 100644 index 0000000000..7755500e4d --- /dev/null +++ b/vendor/github.com/kdoctor-io/kdoctor/pkg/utils/string/string.go @@ -0,0 +1,34 @@ +// Copyright 2023 Authors of kdoctor-io +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package string + +import ( + "fmt" + "reflect" +) + +func ValueToStringGenerated(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} diff --git a/vendor/github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1/common_types.go b/vendor/github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1/common_types.go deleted file mode 100644 index 5ad994649b..0000000000 --- a/vendor/github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1/common_types.go +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2022 Authors of spidernet-io -// SPDX-License-Identifier: Apache-2.0 - -package v1 - -import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - -type SchedulePlan struct { - // +kubebuilder:default=0 - // +kubebuilder:validation:Minimum=0 - StartAfterMinute int64 `json:"startAfterMinute"` - - // +kubebuilder:default=1 - // +kubebuilder:validation:Minimum=0 - RoundNumber int64 `json:"roundNumber"` - - // +kubebuilder:default=360 - // +kubebuilder:validation:Minimum=1 - IntervalMinute int64 `json:"intervalMinute"` - - // +kubebuilder:default=60 - // +kubebuilder:validation:Minimum=1 - TimeoutMinute int64 `json:"timeoutMinute"` - - // +kubebuilder:validation:Optional - SourceAgentNodeSelector *metav1.LabelSelector `json:"sourceAgentNodeSelector,omitempty"` -} - -type TaskStatus struct { - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Minimum=0 - ExpectedRound *int64 `json:"expectedRound,omitempty"` - - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Minimum=0 - DoneRound *int64 `json:"doneRound,omitempty"` - - Finish bool `json:"finish"` - - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Enum=succeed;fail;unknown - LastRoundStatus *string `json:"lastRoundStatus,omitempty"` - - History []StatusHistoryRecord `json:"history"` -} - -const ( - StatusHistoryRecordStatusSucceed = "succeed" - StatusHistoryRecordStatusFail = "fail" - StatusHistoryRecordStatusOngoing = "ongoing" - StatusHistoryRecordStatusNotstarted = "notstarted" -) - -type StatusHistoryRecord struct { - - // +kubebuilder:validation:Enum=succeed;fail;ongoing;notstarted - Status string `json:"status"` - - // +kubebuilder:validation:Optional - FailureReason string `json:"failureReason,omitempty"` - - RoundNumber int `json:"roundNumber"` - - // +kubebuilder:validation:Type:=string - // +kubebuilder:validation:Format:=date-time - StartTimeStamp metav1.Time `json:"startTimeStamp"` - - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Type:=string - // +kubebuilder:validation:Format:=date-time - EndTimeStamp *metav1.Time `json:"endTimeStamp,omitempty"` - - // +kubebuilder:validation:Optional - Duration *string `json:"duration,omitempty"` - - // +kubebuilder:validation:Type:=string - // +kubebuilder:validation:Format:=date-time - DeadLineTimeStamp metav1.Time `json:"deadLineTimeStamp"` - - // +kubebuilder:validation:Optional - // expected how many agents should involve - ExpectedActorNumber *int `json:"expectedActorNumber,omitempty"` - - FailedAgentNodeList []string `json:"failedAgentNodeList"` - - SucceedAgentNodeList []string `json:"succeedAgentNodeList"` - - NotReportAgentNodeList []string `json:"notReportAgentNodeList"` -} - -type NetSuccessCondition struct { - - // +kubebuilder:default=1 - // +kubebuilder:validation:Maximum=1 - // +kubebuilder:validation:Minimum=0 - // +kubebuilder:validation:Optional - SuccessRate *float64 `json:"successRate,omitempty"` - - // +kubebuilder:default=5000 - // +kubebuilder:validation:Minimum=1 - // +kubebuilder:validation:Optional - MeanAccessDelayInMs *int64 `json:"meanAccessDelayInMs,omitempty"` -} diff --git a/vendor/github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1/doc.go b/vendor/github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1/doc.go deleted file mode 100644 index 93a7604226..0000000000 --- a/vendor/github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright 2022 Authors of spidernet-io -// SPDX-License-Identifier: Apache-2.0 - -// Package v1 is the v1 version of the API. -// +groupName=spiderdoctor.spidernet.io -package v1 diff --git a/vendor/github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1/nethttp_types.go b/vendor/github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1/nethttp_types.go deleted file mode 100644 index f529e842d5..0000000000 --- a/vendor/github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1/nethttp_types.go +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright 2022 Authors of spidernet-io -// SPDX-License-Identifier: Apache-2.0 - -package v1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -type NethttpSpec struct { - // +kubebuilder:validation:Optional - Schedule *SchedulePlan `json:"schedule,omitempty"` - - // +kubebuilder:validation:Optional - Target *NethttpTarget `json:"target,omitempty"` - - // +kubebuilder:validation:Optional - Request *NethttpRequest `json:"request,omitempty"` - - // +kubebuilder:validation:Optional - SuccessCondition *NetSuccessCondition `json:"success,omitempty"` -} - -type NethttpRequest struct { - - // +kubebuilder:validation:Optional - // +kubebuilder:default=2 - // +kubebuilder:validation:Minimum=1 - DurationInSecond int `json:"durationInSecond,omitempty"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=5 - // +kubebuilder:validation:Maximum=100 - // +kubebuilder:validation:Minimum=1 - QPS int `json:"qps,omitempty"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=5 - // +kubebuilder:validation:Minimum=1 - PerRequestTimeoutInMS int `json:"perRequestTimeoutInMS,omitempty"` -} - -type TargetAgentSepc struct { - // +kubebuilder:default=true - // +kubebuilder:validation:Optional - TestIPv4 *bool `json:"testIPv4,omitempty"` - - // +kubebuilder:default=false - // +kubebuilder:validation:Optional - TestIPv6 *bool `json:"testIPv6,omitempty"` - - // +kubebuilder:default=true - TestEndpoint bool `json:"testEndpoint,omitempty"` - - // +kubebuilder:default=false - TestMultusInterface bool `json:"testMultusInterface,omitempty"` - - // +kubebuilder:default=true - TestClusterIp bool `json:"testClusterIp,omitempty"` - - // +kubebuilder:default=true - TestNodePort bool `json:"testNodePort,omitempty"` - - // +kubebuilder:default=false - TestLoadBalancer bool `json:"testLoadBalancer,omitempty"` - - // +kubebuilder:default=false - TestIngress bool `json:"testIngress,omitempty"` -} - -type TargetPodSepc struct { - // +kubebuilder:validation:Optional - PodLabelSelector metav1.LabelSelector `json:"podLabelSelector,omitempty"` - - // +kubebuilder:validation:Minimum=1 - HttpPort int `json:"httpPort"` - - // +kubebuilder:validation:Type:=string - // +kubebuilder:validation:Enum=GET;POST;PUT;DELETE;CONNECT;OPTIONS;PATCH;HEAD - Method string `json:"method"` - - // +kubebuilder:default=true - // +kubebuilder:validation:Optional - TestIPv4 *bool `json:"testIPv4,omitempty"` - - // +kubebuilder:default=false - // +kubebuilder:validation:Optional - TestIPv6 *bool `json:"testIPv6,omitempty"` - - // +kubebuilder:default=false - TestMultusInterface bool `json:"testMultusInterface,omitempty"` -} - -type NethttpTarget struct { - - // +kubebuilder:validation:Optional - TargetUser *HttpTarget `json:"targetUser,omitempty"` - - // +kubebuilder:validation:Optional - TargetPod *TargetPodSepc `json:"targetPod,omitempty"` - - // +kubebuilder:validation:Optional - TargetAgent *TargetAgentSepc `json:"targetAgent,omitempty"` -} - -type HttpTarget struct { - Url string `json:"url"` - - // +kubebuilder:validation:Type:=string - // +kubebuilder:validation:Enum=GET;POST;PUT;DELETE;CONNECT;OPTIONS;PATCH;HEAD - Method string `json:"method"` -} - -// scope(Namespaced or Cluster) -// +kubebuilder:resource:categories={spiderdoctor},path="nethttps",singular="nethttp",scope="Cluster" -// +kubebuilder:printcolumn:JSONPath=".status.finish",description="finish",name="finish",type=boolean -// +kubebuilder:printcolumn:JSONPath=".status.expectedRound",description="expectedRound",name="expectedRound",type=integer -// +kubebuilder:printcolumn:JSONPath=".status.doneRound",description="doneRound",name="doneRound",type=integer -// +kubebuilder:printcolumn:JSONPath=".status.lastRoundStatus",description="lastRoundStatus",name="lastRoundStatus",type=string -// +kubebuilder:printcolumn:JSONPath=".spec.schedule.intervalMinute",description="roundIntervalMinute",name="intervalMinute",type=integer -// +kubebuilder:object:root=true -// +kubebuilder:subresource:status -// +genclient -// +genclient:nonNamespaced - -type Nethttp struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata"` - - Spec NethttpSpec `json:"spec,omitempty"` - Status TaskStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -type NethttpList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - Items []Nethttp `json:"items"` -} - -func init() { - SchemeBuilder.Register(&Nethttp{}, &NethttpList{}) -} diff --git a/vendor/golang.org/x/net/http2/Dockerfile b/vendor/golang.org/x/net/http2/Dockerfile deleted file mode 100644 index 8512245952..0000000000 --- a/vendor/golang.org/x/net/http2/Dockerfile +++ /dev/null @@ -1,51 +0,0 @@ -# -# This Dockerfile builds a recent curl with HTTP/2 client support, using -# a recent nghttp2 build. -# -# See the Makefile for how to tag it. If Docker and that image is found, the -# Go tests use this curl binary for integration tests. -# - -FROM ubuntu:trusty - -RUN apt-get update && \ - apt-get upgrade -y && \ - apt-get install -y git-core build-essential wget - -RUN apt-get install -y --no-install-recommends \ - autotools-dev libtool pkg-config zlib1g-dev \ - libcunit1-dev libssl-dev libxml2-dev libevent-dev \ - automake autoconf - -# The list of packages nghttp2 recommends for h2load: -RUN apt-get install -y --no-install-recommends make binutils \ - autoconf automake autotools-dev \ - libtool pkg-config zlib1g-dev libcunit1-dev libssl-dev libxml2-dev \ - libev-dev libevent-dev libjansson-dev libjemalloc-dev \ - cython python3.4-dev python-setuptools - -# Note: setting NGHTTP2_VER before the git clone, so an old git clone isn't cached: -ENV NGHTTP2_VER 895da9a -RUN cd /root && git clone https://github.com/tatsuhiro-t/nghttp2.git - -WORKDIR /root/nghttp2 -RUN git reset --hard $NGHTTP2_VER -RUN autoreconf -i -RUN automake -RUN autoconf -RUN ./configure -RUN make -RUN make install - -WORKDIR /root -RUN wget https://curl.se/download/curl-7.45.0.tar.gz -RUN tar -zxvf curl-7.45.0.tar.gz -WORKDIR /root/curl-7.45.0 -RUN ./configure --with-ssl --with-nghttp2=/usr/local -RUN make -RUN make install -RUN ldconfig - -CMD ["-h"] -ENTRYPOINT ["/usr/local/bin/curl"] - diff --git a/vendor/golang.org/x/net/http2/Makefile b/vendor/golang.org/x/net/http2/Makefile deleted file mode 100644 index 55fd826f77..0000000000 --- a/vendor/golang.org/x/net/http2/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -curlimage: - docker build -t gohttp2/curl . - diff --git a/vendor/golang.org/x/net/http2/server.go b/vendor/golang.org/x/net/http2/server.go index 033b6e6db6..02c88b6b3e 100644 --- a/vendor/golang.org/x/net/http2/server.go +++ b/vendor/golang.org/x/net/http2/server.go @@ -581,9 +581,11 @@ type serverConn struct { advMaxStreams uint32 // our SETTINGS_MAX_CONCURRENT_STREAMS advertised the client curClientStreams uint32 // number of open streams initiated by the client curPushedStreams uint32 // number of open streams initiated by server push + curHandlers uint32 // number of running handler goroutines maxClientStreamID uint32 // max ever seen from client (odd), or 0 if there have been no client requests maxPushPromiseID uint32 // ID of the last push promise (even), or 0 if there have been no pushes streams map[uint32]*stream + unstartedHandlers []unstartedHandler initialStreamSendWindowSize int32 maxFrameSize int32 peerMaxHeaderListSize uint32 // zero means unknown (default) @@ -981,6 +983,8 @@ func (sc *serverConn) serve() { return case gracefulShutdownMsg: sc.startGracefulShutdownInternal() + case handlerDoneMsg: + sc.handlerDone() default: panic("unknown timer") } @@ -1012,14 +1016,6 @@ func (sc *serverConn) serve() { } } -func (sc *serverConn) awaitGracefulShutdown(sharedCh <-chan struct{}, privateCh chan struct{}) { - select { - case <-sc.doneServing: - case <-sharedCh: - close(privateCh) - } -} - type serverMessage int // Message values sent to serveMsgCh. @@ -1028,6 +1024,7 @@ var ( idleTimerMsg = new(serverMessage) shutdownTimerMsg = new(serverMessage) gracefulShutdownMsg = new(serverMessage) + handlerDoneMsg = new(serverMessage) ) func (sc *serverConn) onSettingsTimer() { sc.sendServeMsg(settingsTimerMsg) } @@ -1900,9 +1897,11 @@ func (st *stream) copyTrailersToHandlerRequest() { // onReadTimeout is run on its own goroutine (from time.AfterFunc) // when the stream's ReadTimeout has fired. func (st *stream) onReadTimeout() { - // Wrap the ErrDeadlineExceeded to avoid callers depending on us - // returning the bare error. - st.body.CloseWithError(fmt.Errorf("%w", os.ErrDeadlineExceeded)) + if st.body != nil { + // Wrap the ErrDeadlineExceeded to avoid callers depending on us + // returning the bare error. + st.body.CloseWithError(fmt.Errorf("%w", os.ErrDeadlineExceeded)) + } } // onWriteTimeout is run on its own goroutine (from time.AfterFunc) @@ -2020,13 +2019,10 @@ func (sc *serverConn) processHeaders(f *MetaHeadersFrame) error { // (in Go 1.8), though. That's a more sane option anyway. if sc.hs.ReadTimeout != 0 { sc.conn.SetReadDeadline(time.Time{}) - if st.body != nil { - st.readDeadline = time.AfterFunc(sc.hs.ReadTimeout, st.onReadTimeout) - } + st.readDeadline = time.AfterFunc(sc.hs.ReadTimeout, st.onReadTimeout) } - go sc.runHandler(rw, req, handler) - return nil + return sc.scheduleHandler(id, rw, req, handler) } func (sc *serverConn) upgradeRequest(req *http.Request) { @@ -2046,6 +2042,10 @@ func (sc *serverConn) upgradeRequest(req *http.Request) { sc.conn.SetReadDeadline(time.Time{}) } + // This is the first request on the connection, + // so start the handler directly rather than going + // through scheduleHandler. + sc.curHandlers++ go sc.runHandler(rw, req, sc.handler.ServeHTTP) } @@ -2286,8 +2286,62 @@ func (sc *serverConn) newResponseWriter(st *stream, req *http.Request) *response return &responseWriter{rws: rws} } +type unstartedHandler struct { + streamID uint32 + rw *responseWriter + req *http.Request + handler func(http.ResponseWriter, *http.Request) +} + +// scheduleHandler starts a handler goroutine, +// or schedules one to start as soon as an existing handler finishes. +func (sc *serverConn) scheduleHandler(streamID uint32, rw *responseWriter, req *http.Request, handler func(http.ResponseWriter, *http.Request)) error { + sc.serveG.check() + maxHandlers := sc.advMaxStreams + if sc.curHandlers < maxHandlers { + sc.curHandlers++ + go sc.runHandler(rw, req, handler) + return nil + } + if len(sc.unstartedHandlers) > int(4*sc.advMaxStreams) { + return sc.countError("too_many_early_resets", ConnectionError(ErrCodeEnhanceYourCalm)) + } + sc.unstartedHandlers = append(sc.unstartedHandlers, unstartedHandler{ + streamID: streamID, + rw: rw, + req: req, + handler: handler, + }) + return nil +} + +func (sc *serverConn) handlerDone() { + sc.serveG.check() + sc.curHandlers-- + i := 0 + maxHandlers := sc.advMaxStreams + for ; i < len(sc.unstartedHandlers); i++ { + u := sc.unstartedHandlers[i] + if sc.streams[u.streamID] == nil { + // This stream was reset before its goroutine had a chance to start. + continue + } + if sc.curHandlers >= maxHandlers { + break + } + sc.curHandlers++ + go sc.runHandler(u.rw, u.req, u.handler) + sc.unstartedHandlers[i] = unstartedHandler{} // don't retain references + } + sc.unstartedHandlers = sc.unstartedHandlers[i:] + if len(sc.unstartedHandlers) == 0 { + sc.unstartedHandlers = nil + } +} + // Run on its own goroutine. func (sc *serverConn) runHandler(rw *responseWriter, req *http.Request, handler func(http.ResponseWriter, *http.Request)) { + defer sc.sendServeMsg(handlerDoneMsg) didPanic := true defer func() { rw.rws.stream.cancelCtx() diff --git a/vendor/golang.org/x/net/http2/transport.go b/vendor/golang.org/x/net/http2/transport.go index b20c749171..4515b22c4a 100644 --- a/vendor/golang.org/x/net/http2/transport.go +++ b/vendor/golang.org/x/net/http2/transport.go @@ -19,6 +19,7 @@ import ( "io/fs" "log" "math" + "math/bits" mathrand "math/rand" "net" "net/http" @@ -290,8 +291,7 @@ func (t *Transport) initConnPool() { // HTTP/2 server. type ClientConn struct { t *Transport - tconn net.Conn // usually *tls.Conn, except specialized impls - tconnClosed bool + tconn net.Conn // usually *tls.Conn, except specialized impls tlsState *tls.ConnectionState // nil only for specialized impls reused uint32 // whether conn is being reused; atomic singleUse bool // whether being used for a single http.Request @@ -1680,7 +1680,27 @@ func (cs *clientStream) frameScratchBufferLen(maxFrameSize int) int { return int(n) // doesn't truncate; max is 512K } -var bufPool sync.Pool // of *[]byte +// Seven bufPools manage different frame sizes. This helps to avoid scenarios where long-running +// streaming requests using small frame sizes occupy large buffers initially allocated for prior +// requests needing big buffers. The size ranges are as follows: +// {0 KB, 16 KB], {16 KB, 32 KB], {32 KB, 64 KB], {64 KB, 128 KB], {128 KB, 256 KB], +// {256 KB, 512 KB], {512 KB, infinity} +// In practice, the maximum scratch buffer size should not exceed 512 KB due to +// frameScratchBufferLen(maxFrameSize), thus the "infinity pool" should never be used. +// It exists mainly as a safety measure, for potential future increases in max buffer size. +var bufPools [7]sync.Pool // of *[]byte +func bufPoolIndex(size int) int { + if size <= 16384 { + return 0 + } + size -= 1 + bits := bits.Len(uint(size)) + index := bits - 14 + if index >= len(bufPools) { + return len(bufPools) - 1 + } + return index +} func (cs *clientStream) writeRequestBody(req *http.Request) (err error) { cc := cs.cc @@ -1698,12 +1718,13 @@ func (cs *clientStream) writeRequestBody(req *http.Request) (err error) { // Scratch buffer for reading into & writing from. scratchLen := cs.frameScratchBufferLen(maxFrameSize) var buf []byte - if bp, ok := bufPool.Get().(*[]byte); ok && len(*bp) >= scratchLen { - defer bufPool.Put(bp) + index := bufPoolIndex(scratchLen) + if bp, ok := bufPools[index].Get().(*[]byte); ok && len(*bp) >= scratchLen { + defer bufPools[index].Put(bp) buf = *bp } else { buf = make([]byte, scratchLen) - defer bufPool.Put(&buf) + defer bufPools[index].Put(&buf) } var sawEOF bool diff --git a/vendor/golang.org/x/text/language/match.go b/vendor/golang.org/x/text/language/match.go index ee45f49474..1153baf291 100644 --- a/vendor/golang.org/x/text/language/match.go +++ b/vendor/golang.org/x/text/language/match.go @@ -434,7 +434,7 @@ func newMatcher(supported []Tag, options []MatchOption) *matcher { // (their canonicalization simply substitutes a different language code, but // nothing else), the match confidence is Exact, otherwise it is High. for i, lm := range language.AliasMap { - // If deprecated codes match and there is no fiddling with the script or + // If deprecated codes match and there is no fiddling with the script // or region, we consider it an exact match. conf := Exact if language.AliasTypes[i] != language.Macro { diff --git a/vendor/golang.org/x/text/unicode/norm/trie.go b/vendor/golang.org/x/text/unicode/norm/trie.go index 423386bf43..e4250ae22c 100644 --- a/vendor/golang.org/x/text/unicode/norm/trie.go +++ b/vendor/golang.org/x/text/unicode/norm/trie.go @@ -29,7 +29,7 @@ var ( nfkcData = newNfkcTrie(0) ) -// lookupValue determines the type of block n and looks up the value for b. +// lookup determines the type of block n and looks up the value for b. // For n < t.cutoff, the block is a simple lookup table. Otherwise, the block // is a list of ranges with an accompanying value. Given a matching range r, // the value for b is by r.value + (b - r.lo) * stride. diff --git a/vendor/modules.txt b/vendor/modules.txt index dc3ba7f237..b428c280bb 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,10 +1,10 @@ # github.com/Masterminds/goutils v1.1.1 ## explicit github.com/Masterminds/goutils -# github.com/Masterminds/semver/v3 v3.1.1 -## explicit; go 1.12 +# github.com/Masterminds/semver/v3 v3.2.0 +## explicit; go 1.18 github.com/Masterminds/semver/v3 -# github.com/Masterminds/sprig/v3 v3.2.2 +# github.com/Masterminds/sprig/v3 v3.2.3 ## explicit; go 1.13 github.com/Masterminds/sprig/v3 # github.com/agiledragon/gomonkey/v2 v2.9.0 @@ -207,7 +207,7 @@ github.com/go-openapi/swag # github.com/go-openapi/validate v0.22.1 ## explicit; go 1.14 github.com/go-openapi/validate -# github.com/go-swagger/go-swagger v0.30.3 +# github.com/go-swagger/go-swagger v0.30.4 ## explicit; go 1.19 github.com/go-swagger/go-swagger/cmd/swagger github.com/go-swagger/go-swagger/cmd/swagger/commands @@ -298,7 +298,7 @@ github.com/hashicorp/hcl/hcl/token github.com/hashicorp/hcl/json/parser github.com/hashicorp/hcl/json/scanner github.com/hashicorp/hcl/json/token -# github.com/huandu/xstrings v1.3.2 +# github.com/huandu/xstrings v1.3.3 ## explicit; go 1.12 github.com/huandu/xstrings # github.com/imdario/mergo v0.3.13 @@ -323,6 +323,10 @@ github.com/json-iterator/go ## explicit; go 1.17 github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1 +# github.com/kdoctor-io/kdoctor v0.2.0 +## explicit; go 1.20 +github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1 +github.com/kdoctor-io/kdoctor/pkg/utils/string # github.com/kr/pretty v0.3.1 ## explicit; go 1.12 github.com/kr/pretty @@ -548,9 +552,6 @@ github.com/spf13/viper/internal/encoding/yaml ## explicit; go 1.20 github.com/spidernet-io/e2eframework/framework github.com/spidernet-io/e2eframework/tools -# github.com/spidernet-io/spiderdoctor v0.3.0 -## explicit; go 1.19 -github.com/spidernet-io/spiderdoctor/pkg/k8s/apis/spiderdoctor.spidernet.io/v1 # github.com/subosito/gotenv v1.4.2 ## explicit; go 1.18 github.com/subosito/gotenv @@ -649,7 +650,7 @@ go.uber.org/zap/internal/color go.uber.org/zap/internal/exit go.uber.org/zap/internal/pool go.uber.org/zap/zapcore -# golang.org/x/crypto v0.11.0 +# golang.org/x/crypto v0.14.0 ## explicit; go 1.17 golang.org/x/crypto/bcrypt golang.org/x/crypto/blowfish @@ -665,7 +666,7 @@ golang.org/x/exp/slices golang.org/x/mod/internal/lazyregexp golang.org/x/mod/module golang.org/x/mod/semver -# golang.org/x/net v0.13.0 +# golang.org/x/net v0.17.0 ## explicit; go 1.17 golang.org/x/net/bpf golang.org/x/net/context @@ -682,7 +683,7 @@ golang.org/x/net/internal/socket golang.org/x/net/ipv4 golang.org/x/net/ipv6 golang.org/x/net/netutil -# golang.org/x/oauth2 v0.8.0 +# golang.org/x/oauth2 v0.10.0 ## explicit; go 1.17 golang.org/x/oauth2 golang.org/x/oauth2/internal @@ -697,10 +698,10 @@ golang.org/x/sys/plan9 golang.org/x/sys/unix golang.org/x/sys/windows golang.org/x/sys/windows/registry -# golang.org/x/term v0.10.0 +# golang.org/x/term v0.13.0 ## explicit; go 1.17 golang.org/x/term -# golang.org/x/text v0.11.0 +# golang.org/x/text v0.13.0 ## explicit; go 1.17 golang.org/x/text/encoding golang.org/x/text/encoding/charmap