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 space delimited CRUD operations to Workers using the new client #269

Merged
merged 2 commits into from
Aug 21, 2024

Conversation

kevjt
Copy link
Contributor

@kevjt kevjt commented Aug 21, 2024

Background

The current worker_service is still using the 'old' client which does not utilise the SpaceID on the Worker resource. This means that the worker_service cannot be used in situations where the spaceId is not already set on the base client itself. An example of such a situation is when you want to create the space and worker resource in the same invocation of terraform apply. The spaceId cannot be known ahead of time, and hence cannot be set on the Terraform provider config in advance. The current code then creates a bug as the optional SpaceID field on the Worker suggests that the service supports space delimited operations, whereas in reality the operations fallback to the default space.

Needed for OctopusDeployLabs/terraform-provider-octopusdeploy#655

Results

Copies the same pattern of deprecating old CRUD functions in favour of new ones using the newClient.

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 created a new workers package because the functions are defined as global (within the package). The current worker_service shares the machines package with the machine_service which means that it would otherwise conflict, as machine_service already defines its own global CRUD functions with the new client.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In future, the rest of the machines.Worker types can ideally be deprecated and moved over to the new workers package. However, that is a larger piece of work that I am deferring as only this change is needed to allow the Kubernetes Worker Terraform resource to ship.

@kevjt kevjt requested a review from benPearce1 August 21, 2024 03:26
@kevjt kevjt merged commit 8aa93ee into main Aug 21, 2024
6 checks passed
@kevjt kevjt deleted the kevjt/worker-client-with-space-id branch August 21, 2024 03:29
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.

2 participants