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

Support both AMD64 and ARM64 Promtail binary URLs #158

Merged
merged 1 commit into from
May 4, 2022
Merged

Conversation

balbirthomas
Copy link
Contributor

@balbirthomas balbirthomas commented Apr 28, 2022

Issue

LogProxyConsumer currently only supports AMD64 architectures. Hence it can not install and use Promtail on other architectures such as ARM64. The purpose of this PR is to support both AMD64 and ARM64 architectures and ensure additional architectures can be easily added in the future.

Solution

The following changes were made as part of this refactor.

  • The relation data structure with promtail information set by LokiPushApiProvider has been extended so that it includes
    • information for multiple architectures
    • URL and filename of Promtail for each architecture
    • sha256 sum of Promtail zip for each architecture
    • sha256 sum of Promtail binary for each architecture
  • All hardcoding of filename and paths for Promtail binaries were removed. The filenames are extracted from relation data provided by the LokiPushApiProvider, in a architecture dependent way. The LogProxyConsumer selects the correct Promtail filename based on its architecture from the choices offered to by the LokiPushApiProvider.
  • The _setup_promtail() method has been made idempotent and the check if _is_promtail_installed() has been moved into this method. Hence _setup_promtail() only installs promtail if it has not already been installed.

Context

Explained in "Issue" above.

Testing Instructions

Just deploy Loki and Log proxy consumer and check that logs from promtail are forwarded.

Release Notes

LokiPushApiProvider and LogProxyConsumer objects now support AMD64 and ARM64 architectures for Promtail.

@github-actions
Copy link

Libraries are not up to date with their remote counterparts. If this was
not intentional, run charmcraft fetch-libs and commit the updated libs
to your PR branch.

stdout
Library charms.alertmanager_k8s.v0.alertmanager_dispatch was already up to date in version 0.3.                                                                
Library charms.grafana_k8s.v0.grafana_source was already up to date in version 0.9.                                                                            
Library charms.loki_k8s.v0.loki_push_api has local changes, cannot be updated. 
Library charms.observability_libs.v0.kubernetes_service_patch was already up to date in version 0.6.                                                           

stderr

1 similar comment
@github-actions
Copy link

Libraries are not up to date with their remote counterparts. If this was
not intentional, run charmcraft fetch-libs and commit the updated libs
to your PR branch.

stdout
Library charms.alertmanager_k8s.v0.alertmanager_dispatch was already up to date in version 0.3.                                                                
Library charms.grafana_k8s.v0.grafana_source was already up to date in version 0.9.                                                                            
Library charms.loki_k8s.v0.loki_push_api has local changes, cannot be updated. 
Library charms.observability_libs.v0.kubernetes_service_patch was already up to date in version 0.6.                                                           

stderr

@github-actions
Copy link

github-actions bot commented May 3, 2022

Libraries are not up to date with their remote counterparts. If this was
not intentional, run charmcraft fetch-libs and commit the updated libs
to your PR branch.

stdout
Library charms.alertmanager_k8s.v0.alertmanager_dispatch was already up to date in version 0.3.                                                                
Library charms.grafana_k8s.v0.grafana_source was already up to date in version 0.9.                                                                            
Library charms.loki_k8s.v0.loki_push_api has local changes, cannot be updated. 
Library charms.observability_libs.v0.kubernetes_service_patch was already up to date in version 0.6.                                                           

stderr

1 similar comment
@github-actions
Copy link

github-actions bot commented May 3, 2022

Libraries are not up to date with their remote counterparts. If this was
not intentional, run charmcraft fetch-libs and commit the updated libs
to your PR branch.

stdout
Library charms.alertmanager_k8s.v0.alertmanager_dispatch was already up to date in version 0.3.                                                                
Library charms.grafana_k8s.v0.grafana_source was already up to date in version 0.9.                                                                            
Library charms.loki_k8s.v0.loki_push_api has local changes, cannot be updated. 
Library charms.observability_libs.v0.kubernetes_service_patch was already up to date in version 0.6.                                                           

stderr

@balbirthomas balbirthomas marked this pull request as ready for review May 3, 2022 15:43
@github-actions
Copy link

github-actions bot commented May 3, 2022

Libraries are not up to date with their remote counterparts. If this was
not intentional, run charmcraft fetch-libs and commit the updated libs
to your PR branch.

stdout
Library charms.alertmanager_k8s.v0.alertmanager_dispatch was already up to date in version 0.3.                                                                
Library charms.grafana_k8s.v0.grafana_source was already up to date in version 0.9.                                                                            
Library charms.loki_k8s.v0.loki_push_api has local changes, cannot be updated. 
Library charms.observability_libs.v0.kubernetes_service_patch was already up to date in version 0.6.                                                           

stderr

Abuelodelanada
Abuelodelanada previously approved these changes May 3, 2022
lib/charms/loki_k8s/v0/loki_push_api.py Outdated Show resolved Hide resolved
This commit refactors the LogProxyConsumer object so that it
can be used on different hardware architectures such as
AMD64 and ARM64. The following changes were made as part of
this refactor.

- The relation data structure with promtail information set
  by LokiPushApiProvider has been extended so that it includes
  + information for multiple architectures
  + filename of Promtail for each architecture
  + sha256 sum of Promtail zip for each architecture
  + sha256 sum of Promtail binary for each architecture
- All hardcoding of filename and paths for Promtail binaries
  were removed. The filenames are extracted from relation data
  provided by the LokiPushApiProvider, in a architecture dependent
  way. The LogProxyConsumer selects the correct Promtail filename
  based on its architecture from the choices offered to by the
  LokiPushApiProvider.
- The _setup_promtail() method has been made idempotent and the
  check if _is_promtail_installed() has been moved into this
  method. Hence _setup_promtail() only installs promtail if
  it has not already been installed.

This commit also refactors the Promtail unit tests to be compatible
with new method signatures as a result of refactoring LogProxyConsumer
to support multiple Promtail architectures.
@github-actions
Copy link

github-actions bot commented May 4, 2022

Libraries are not up to date with their remote counterparts. If this was
not intentional, run charmcraft fetch-libs and commit the updated libs
to your PR branch.

stdout
Library charms.alertmanager_k8s.v0.alertmanager_dispatch was already up to date in version 0.3.                                                                
Library charms.grafana_k8s.v0.grafana_source was already up to date in version 0.9.                                                                            
Library charms.loki_k8s.v0.loki_push_api has local changes, cannot be updated. 
Library charms.observability_libs.v0.kubernetes_service_patch was already up to date in version 0.6.                                                           

stderr

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.

None yet

3 participants