troubleshoot
troubleshoot copied to clipboard
Preflight TestAnalyse regex is not working well
Bug Description
By using Preflight to check the result of a curl it is not working well
Expected Behavior
Passed on the check when found the value.
Steps To Reproduce
- Install kurl: curl https://kurl.sh/latest | sudo bash
- Install Preflight curl https://krew.sh/preflight | bash
- Run the following check
apiVersion: troubleshoot.sh/v1beta2
kind: Preflight
metadata:
name: kurl-builtin-oncluster
spec:
collectors:
- clusterResources: {}
- run:
collectorName: test
image: busybox:1
key: test
command: [ "curl" ]
args: ["-k", "https://localhost:6443/healthz?verbose"]
analyzers:
- textAnalyze:
checkName: Kubernetes API health check
key: test
regex: ".*passed*"
outcomes:
- fail:
when: "false"
message: "Kubernetes API health check did not pass. One or more components are not working."
- pass:
when: "true"
message: "Kubernetes API health check passed"
See that I expected that it does not Fail since I can found healthz check passed:
$ curl -k https://localhost:6443/healthz?verbose
[+]ping ok
[+]log ok
[+]etcd ok
[+]poststarthook/start-kube-apiserver-admission-initializer ok
[+]poststarthook/generic-apiserver-start-informers ok
[+]poststarthook/priority-and-fairness-config-consumer ok
[+]poststarthook/priority-and-fairness-filter ok
[+]poststarthook/storage-object-count-tracker-hook ok
[+]poststarthook/start-apiextensions-informers ok
[+]poststarthook/start-apiextensions-controllers ok
[+]poststarthook/crd-informer-synced ok
[+]poststarthook/start-system-namespaces-controller ok
[+]poststarthook/bootstrap-controller ok
[+]poststarthook/rbac/bootstrap-roles ok
[+]poststarthook/scheduling/bootstrap-system-priority-classes ok
[+]poststarthook/priority-and-fairness-config-producer ok
[+]poststarthook/start-cluster-authentication-info-controller ok
[+]poststarthook/start-kube-apiserver-identity-lease-controller ok
[+]poststarthook/start-deprecated-kube-apiserver-identity-lease-garbage-collector ok
[+]poststarthook/start-kube-apiserver-identity-lease-garbage-collector ok
[+]poststarthook/start-legacy-token-tracking-controller ok
[+]poststarthook/aggregator-reload-proxy-client-cert ok
[+]poststarthook/start-kube-aggregator-informers ok
[+]poststarthook/apiservice-registration-controller ok
[+]poststarthook/apiservice-status-available-controller ok
[+]poststarthook/kube-apiserver-autoregistration ok
[+]autoregister-completion ok
[+]poststarthook/apiservice-openapi-controller ok
[+]poststarthook/apiservice-openapiv3-controller ok
[+]poststarthook/apiservice-discovery-controller ok
healthz check passed
Additional Context
Include the following information.
-
Troubleshoot version. If you built from source, note that including the version of Go you used to build with. : 0.63.0
-
Operating system
-
Operating system version
-
Other details that might be helpful in diagnosing the problem