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

Installing node exporter and filebeat as daemonsets in custom namespaces #1839

Conversation

rpudlowski93
Copy link
Contributor

@rpudlowski93 rpudlowski93 commented Nov 9, 2020

Fix related to bug : #1833

  • Installing Node Exporter and FileBeat as DaemonSets in custom namespaces.
  • DaemonSets for k8s as cloud service

@@ -1,3 +1,5 @@
---
filebeat_helm_chart_file_name: filebeat-7.9.2.tgz
filebeat_version: "7.9.2"
# Use custom namespace for logging charts such as filebeat in case of k8s as cloud service.
logging_chart_namespace: epi-logging
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't it be configurable?

Copy link
Contributor

Choose a reason for hiding this comment

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

We've decided to keep it in defaults for now. After this refactor #1756 it will be easier to properly implement upgrades for this case.

become: false
run_once: true

environment: { KUBECONFIG: "{{ vault_location }}/../kubeconfig" }
Copy link
Contributor

Choose a reason for hiding this comment

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

Recently we reduced the number of tasks where we use KUBECONFIG variable. Can't the value be taken from group_vars/all.yml and be specified on a playbook level? The same question for the left part of PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think in case of just the helm feature we have to keep such construction, but for filebeat and node_exporter we have properly defined non-localhost ansible groups, @atsikham I think you're right. 🤔 Actually in both cases lines

environment: { KUBECONFIG: "{{ vault_location }}/../kubeconfig" }

can be removed because it's already defined at playbook level. 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

@rpudlowski93 any thoughts? 🤗

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've just added the kubeconfig env to upgrade playbook level and removed the env from role. Tested, works fine. Small changes also added in order to optimize code

@rpudlowski93 rpudlowski93 requested a review from sk4zuzu November 20, 2020 11:54
Copy link
Contributor

@sk4zuzu sk4zuzu left a comment

Choose a reason for hiding this comment

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

What about something like this? In this case it's not a big performance improvement, but this is a better way to do these things in general, it's faster and we get rid of useless log entries. 🤔

---
- hosts: localhost
  tasks:
    - set_fact:
        specification:
          helm_chart_name: asd2
        helm_ls:
          - {"name":"asd1","namespace":"default","revision":"20","updated":"2020-11-20 03:14:29.269115248 +0100 CET","status":"failed","chart":"asd-0.0.1","app_version":"0.0.1"}
          - {"name":"asd2","namespace":"default","revision":"20","updated":"2020-11-20 03:14:29.269115248 +0100 CET","status":"failed","chart":"asd-0.0.1","app_version":"0.0.1"}

    - set_fact:
        helm_release_exists: >-
          {{ _names | ternary(true, false) }}
      vars:
        _names: >-
          {{ helm_ls | map(attribute='name')
                     | select('eq', specification.helm_chart_name)
                     | list }}

    - debug: msg=OK
      when: helm_release_exists

Also using is defined to check boolean values is dangerous! 🙀

sk4zuzu
sk4zuzu previously approved these changes Nov 23, 2020
Copy link
Contributor

@sk4zuzu sk4zuzu left a comment

Choose a reason for hiding this comment

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

LGTM 👍😍

| map(attribute='name')
| select('==', specification.helm_chart_name)
| list }}
block:
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

environment: { KUBECONFIG: "{{ vault_location }}/../kubeconfig" }
command: helm list --output json
register: helm_list
block:
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

atsikham
atsikham previously approved these changes Nov 24, 2020
@rpudlowski93 rpudlowski93 dismissed stale reviews from atsikham and sk4zuzu via 40e684a November 24, 2020 14:33
@rpudlowski93 rpudlowski93 force-pushed the bug/daemonsets-in-custom-namespaces branch 3 times, most recently from 4524f33 to f6fcc58 Compare November 24, 2020 15:02
@rpudlowski93 rpudlowski93 force-pushed the bug/daemonsets-in-custom-namespaces branch from f6fcc58 to 4b22a13 Compare November 24, 2020 15:39
@rpudlowski93 rpudlowski93 force-pushed the bug/daemonsets-in-custom-namespaces branch from 4b22a13 to 2ce2b4e Compare November 24, 2020 15:43
Copy link
Contributor

@sk4zuzu sk4zuzu left a comment

Choose a reason for hiding this comment

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

🐒

Copy link
Contributor

@atsikham atsikham left a comment

Choose a reason for hiding this comment

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

🥳

@rpudlowski93 rpudlowski93 merged commit 37942b5 into hitachienergy:develop Nov 24, 2020
rafzei pushed a commit to rafzei/epiphany that referenced this pull request Nov 26, 2020
…ces (hitachienergy#1839)

* Installing daemonsets in custom namespaces

* Helm Chart name added to uninstall role

* Upgrade process added

* Including vars moved on the top of task

* Added more strictly condiction

* Obtaining helm releases in different way

* Format improved

* Kubeconfig env moved to playbook level

* Changelog updated

Co-authored-by: Robert Pudłowski <[email protected]>
toszo pushed a commit to toszo/epiphany that referenced this pull request Dec 5, 2020
…ces (hitachienergy#1839)

* Installing daemonsets in custom namespaces

* Helm Chart name added to uninstall role

* Upgrade process added

* Including vars moved on the top of task

* Added more strictly condiction

* Obtaining helm releases in different way

* Format improved

* Kubeconfig env moved to playbook level

* Changelog updated

Co-authored-by: Robert Pudłowski <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants