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

Add COS integration to Openstack #266

Merged
merged 63 commits into from
Apr 24, 2024

Conversation

cbartz
Copy link
Collaborator

@cbartz cbartz commented Apr 23, 2024

Applicable spec: ISD-145 (internal)

Overview

Add cos integration to the openstack branch. The Openstack code is going to be refactored (see ISD 134), so there are parts that contain code duplication and should be addressed in a follow-on.

Integration tests are not included in this PR and will be added in a future PR.

The log retrieval code will be adapted in a future PR to retrieve logs periodically (also for LXD) and is not included here.

Rationale

This is necessary for observability.

Juju Events Changes

n/a

Module Changes

  • All common metrics-related modules are moved to the metrics package.
  • A python protocol is defined to manage metrics storage, and shared_fs implements it. This is done to reuse the runner metrics module (see also ISD-145).
  • OpenStackRunnerManager is adapted to output runner related metrics.
  • runner_logs is split into general and lxd related code
  • cloud init file (openstack-userdata.j2) is adapted to write out metrics and pre-job content. system shutdown is removed to be able to retrieve metrics (otherwise the instance would have to be restarted).
  • pre-job content is adapted to optionally do the repo policy check

Library Changes

Checklist

The Openstack documentation will be added as soon as we have a MVP landed.

@cbartz cbartz changed the title WIP - Add cos integration to Openstack WIP - Add COS integration to Openstack Apr 23, 2024
@yanksyoon yanksyoon deleted the branch feat/openstack-integration April 24, 2024 02:41
@yanksyoon yanksyoon closed this Apr 24, 2024
@yanksyoon yanksyoon reopened this Apr 24, 2024
cbartz added 2 commits April 24, 2024 07:57
…gration' into ISD-1824-cos-integration-openstack

# Conflicts:
#	src/openstack_cloud/openstack_manager.py
#	templates/openstack-userdata.sh.j2
@cbartz cbartz changed the base branch from feat/create-openstack-runner to feat/openstack-integration April 24, 2024 06:08
@cbartz cbartz changed the title WIP - Add COS integration to Openstack Add COS integration to Openstack Apr 24, 2024
Comment on lines +1271 to +1294
try:
self._pull_file(
ssh_conn=ssh_conn,
remote_path=str(METRICS_EXCHANGE_PATH / "pre-job-metrics.json"),
local_path=str(storage.path / "pre-job-metrics.json"),
max_size=MAX_METRICS_FILE_SIZE,
)
self._pull_file(
ssh_conn=ssh_conn,
remote_path=str(METRICS_EXCHANGE_PATH / "post-job-metrics.json"),
local_path=str(storage.path / "post-job-metrics.json"),
max_size=MAX_METRICS_FILE_SIZE,
)
return
except _PullFileError as exc:
logger.warning(
"Failed to pull metrics for %s: %s . Will not be able to issue all metrics",
instance_name,
exc,
)
return
except _SSHError as exc:
logger.info("Failed to pull metrics for %s: %s", instance_name, exc)
continue
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The downside here is that if only the pre-job-metrics.json is pulled, the runner is considered crashed (see logic in _issue_reconciliation_metric), we may want to revisit this. But for now I kept it the same as for LXD.

@cbartz cbartz marked this pull request as ready for review April 24, 2024 06:55
@cbartz cbartz requested a review from a team as a code owner April 24, 2024 06:55
…gration' into ISD-1824-cos-integration-openstack

# Conflicts:
#	src/charm.py
#	src/openstack_cloud/openstack_manager.py
#	templates/openstack-userdata.sh.j2
Copy link
Collaborator

@yhaliaw yhaliaw left a comment

Choose a reason for hiding this comment

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

Reviewed till _issue_runner_installed_metric.

src/metrics/runner.py Outdated Show resolved Hide resolved
src/openstack_cloud/openstack_manager.py Show resolved Hide resolved
src/openstack_cloud/openstack_manager.py Outdated Show resolved Hide resolved
src/openstack_cloud/openstack_manager.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@yanksyoon yanksyoon left a comment

Choose a reason for hiding this comment

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

LGTM! Minor nitpicks - no need to implement :D

src/metrics/github.py Outdated Show resolved Hide resolved
src/metrics/runner.py Show resolved Hide resolved
src/openstack_cloud/openstack_manager.py Show resolved Hide resolved
@cbartz cbartz merged commit b622bb2 into feat/openstack-integration Apr 24, 2024
3 checks passed
@cbartz cbartz deleted the ISD-1824-cos-integration-openstack branch April 24, 2024 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants