Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[helm]: integration config for scheduler and controller-manager conditions and containers logs #5853

Merged
merged 3 commits into from
Oct 30, 2024

Conversation

pkoutsovasilis
Copy link
Contributor

@pkoutsovasilis pkoutsovasilis commented Oct 25, 2024

What does this PR do?

I was testing k8s standalone elastic-agent using the plain k8s manifest under deploy/kubernetes/elastic-agent-standalone-kubernetes.yaml but I also tried to get the same results with the elastic-agent helm chart and I tried to replicate the produced data with the elastic-agent helm chart. This effort uncovered some yaml format issues and some inconsistencies for container logs which this PR handles

Why is it important?

Because it fixes bugs 🙂

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in ./changelog/fragments using the changelog tool
  • I have added an integration test or an E2E test

Disruptive User Impact

N/A

How to test this PR locally

 mage integration:kubernetesMatrix

Related issues

@pkoutsovasilis pkoutsovasilis added bug Something isn't working backport-8.x Automated backport to the 8.x branch with mergify backport-8.16 Automated backport with mergify labels Oct 25, 2024
@pkoutsovasilis pkoutsovasilis self-assigned this Oct 25, 2024
@pkoutsovasilis pkoutsovasilis requested a review from a team as a code owner October 25, 2024 12:36
@pkoutsovasilis pkoutsovasilis changed the title fix: integration config for scheduler and controller-manager conditions and containers logs [helm]: integration config for scheduler and controller-manager conditions and containers logs Oct 25, 2024
@ycombinator ycombinator requested review from michalpristas and swiatekm and removed request for kaanyalti and pchila October 25, 2024 13:56
@pierrehilbert pierrehilbert added the Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team label Oct 25, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

id: kubernetes-container-logs-${kubernetes.pod.name}-${kubernetes.container.id}
parsers:
- container:
format: auto
stream: all
paths:
- /var/log/containers/*${kubernetes.container.id}.log
processors:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was these sections removed because it caused the events to not match the integration?

@swiatekm
Copy link
Contributor

If we do want the container logs to be identical, shouldn't we simply copy the standalone config from here:

- id: container-log-${kubernetes.pod.name}-${kubernetes.container.id}
?

@pkoutsovasilis
Copy link
Contributor Author

pkoutsovasilis commented Oct 29, 2024

@swiatekm not entirely sure why the standalone agent manifest doesn't include them but this is what Kibana generates when you try to install the kubernetes integration which includes default values (snippet regards container logs)

      - id: filestream-container-logs-1b427a99-5d73-4e5c-a554-6183c5cf40f7
        revision: 1
        name: kubernetes-1
        type: filestream
        data_stream:
          namespace: default
        use_output: default
        package_policy_id: 1b427a99-5d73-4e5c-a554-6183c5cf40f7
        streams:
          - id: >-
              kubernetes-container-logs-${kubernetes.pod.name}-${kubernetes.container.id}
            data_stream:
              dataset: kubernetes.container_logs
            paths:
              - '/var/log/containers/*${kubernetes.container.id}.log'
            prospector:
              scanner:
                fingerprint.enabled: true
                symlinks: true
            file_identity.fingerprint: null
            parsers:
              - container:
                  stream: all
                  format: auto
            processors:
              - add_fields:
                  target: kubernetes
                  fields:
                    annotations.elastic_co/dataset: '${kubernetes.annotations.elastic.co/dataset|""}'
                    annotations.elastic_co/namespace: '${kubernetes.annotations.elastic.co/namespace|""}'
                    annotations.elastic_co/preserve_original_event: >-
                      ${kubernetes.annotations.elastic.co/preserve_original_event|""}
              - drop_fields:
                  fields:
                    - kubernetes.annotations.elastic_co/dataset
                  when:
                    equals:
                      kubernetes.annotations.elastic_co/dataset: ''
                  ignore_missing: true
              - drop_fields:
                  fields:
                    - kubernetes.annotations.elastic_co/namespace
                  when:
                    equals:
                      kubernetes.annotations.elastic_co/namespace: ''
                  ignore_missing: true
              - drop_fields:
                  fields:
                    - kubernetes.annotations.elastic_co/preserve_original_event
                  when:
                    equals:
                      kubernetes.annotations.elastic_co/preserve_original_event: ''
                  ignore_missing: true
              - add_tags:
                  tags:
                    - preserve_original_event
                  when:
                    and:
                      - has_fields:
                          - >-
                            kubernetes.annotations.elastic_co/preserve_original_event
                      - regexp:
                          kubernetes.annotations.elastic_co/preserve_original_event: ^(?i)true$

So I think that it should not be a copy paste from there?!

@blakerouse thank you for catching that, I was experimenting with some config until I realised I need hostNetwork: true to make the node name appear instead of the pod name, and they shouldn't have been removed 🙂

@pkoutsovasilis pkoutsovasilis marked this pull request as draft October 30, 2024 09:43
@pkoutsovasilis pkoutsovasilis marked this pull request as ready for review October 30, 2024 09:45
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@pkoutsovasilis pkoutsovasilis merged commit 460f44e into elastic:main Oct 30, 2024
9 checks passed
@pkoutsovasilis pkoutsovasilis deleted the fix/agent_helm_chart branch October 30, 2024 10:58
mergify bot pushed a commit that referenced this pull request Oct 30, 2024
…tions and containers logs (#5853)

* fix: integration config for scheduler and controller-manager conditions and containers logs

* fix: update rendered examples

* fix: add back processors

(cherry picked from commit 460f44e)
mergify bot pushed a commit that referenced this pull request Oct 30, 2024
…tions and containers logs (#5853)

* fix: integration config for scheduler and controller-manager conditions and containers logs

* fix: update rendered examples

* fix: add back processors

(cherry picked from commit 460f44e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.x Automated backport to the 8.x branch with mergify backport-8.16 Automated backport with mergify bug Something isn't working skip-changelog Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants