troubleshoot icon indicating copy to clipboard operation
troubleshoot copied to clipboard

fixed runCollector filepath

Open manavellamnimble opened this issue 5 years ago • 2 comments

@laverya @dexhorthy @divolgin The use of the run collector together with the text analyzer, the filepath handling and the fields of the run collector where not entirely clear. I will modify the docks once the PR is merged. I did some changes:

  • CollectorName field was used as the pod's name and the name field was used as collector name, preceding the file path.
  • Changed the name field to PodName and used it as the pod's name.
  • Log file is stored under runCollector.CollectorName/runCollector.PodName.log, previously it was stored under runCollector.Name/runCollector.CollectorName.log. This change makes it compatible with the text analyzer.
  • As CollectorName and PodName are optional, I made PodName default to the image name, and collector name default to "run-collector-pod-"+PodName.

This change is only noticeable when using the text analyzer, which will now work in a more logical way now, making it also easier to use. The text analyzer looks for the files under collectorName/filename, the other way around as how the run collector was saving the file, which made it tricky to use.

apiVersion: troubleshoot.sh/v1beta2
kind: Preflight
metadata:
  name: example
spec:
  collectors:
    - run:
        collectorName: "run-ping"
        image: busybox:1
        podName: ping
        namespace: default
        command: ["ping"]
        args: ["-w", "10", "-c", "10", "-i", "0.3", "www.google.com"]
  analyzers:
    - textAnalyze:
        checkName: "run-ping"
        fileName: "ping.log"
        regexGroup: '(?P<Transmitted>\d+) packets? transmitted, (?P<Received>\d+) packets? received, (?P<Loss>\d+)(\.\d+)?% packet loss'
        outcomes:
          - pass:
              when: "Loss < 5"
              message: Solid connection to google.com
          - fail:
              message: High packet loss

Fix #189

manavellamnimble avatar Oct 16 '20 15:10 manavellamnimble

A decision should be made on this change considering backwards compatibility. The user who opened the issue share its concern about this, and I don't know exactly if there is a policy concerning this situations. I personally think that the changes should be applied, as they would make the run collector clearer to use, and it would work better whit the text analyzer, let me know what you think

manavellamnimble avatar Oct 19 '20 15:10 manavellamnimble

@manavellamnimble Will you provide an example of how this would work in a copy collector, when there are multiple replicas of the pod?

Say I have a copy collector that's copying log files from a pod generated by a deployment. And the deployment has 3 replicas. Will the new (or old?) solution work in this case?

marccampbell avatar Nov 13 '20 00:11 marccampbell