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

Infrastructure Deployment API implementation #16

Closed
wants to merge 6 commits into from

Conversation

tsebastiani
Copy link
Member

@tsebastiani tsebastiani commented Jan 10, 2023

With this PR will be introduced the Infrastructure Deployer API in order to split the Infrastructure deployment logic from the Openshift Instance provisioning. This feature will simplify the proposed integrations with Terraform, Pulumi or even other custom deployment logic not yet mentioned giving to CRC-Cloud the ability to selectively load the preferred logic with a CLI/ENV Parameter.
Adding a plugin won't affect other plugins so we could potentially implement an undefined amount of infrastructure deployment strategies and approaches that can coexist as plugins and can be utilized depending on the user needs.
Moreover this implementation lays the ground for a pluggable API architecture that can be reused on the project for other future purposes.
Even though bash is not an OO language, I created some functions to enforce the correct API implementation and methods naming conventions respect.
Version bumped to 1.1 (maybe should be v2.0?)

@tsebastiani
Copy link
Member Author

I was wondering if "api" folder should be renamed "plugin", this is not actually containing the API but the implementations so probably plugin is more appropriate, thoughts?

crc-cloud.sh Outdated
Comment on lines 292 to 296
# check AWS credentials
[[ -z $AWS_ACCESS_KEY_ID ]] && stop_if_failed 1 "AWS_ACCESS_KEY_ID must be set, please refer to AWS CLI documentation https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html"
[[ -z $AWS_SECRET_ACCESS_KEY ]] && stop_if_failed 1 "AWS_ACCESS_KEY_ID must be set, please refer to AWS CLI documentation https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html"
[[ -z $AWS_DEFAULT_REGION ]] && stop_if_failed 1 "AWS_ACCESS_KEY_ID must be set, please refer to AWS CLI documentation https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html"
[[ ( $WORKING_MODE == "T" ) && ($TEARDOWN_RUN_ID == "latest") ]] && stop_if_failed 1 "TEARDOWN_RUN_ID must be set in container mode. Please set this value with the run id that you want to teardown, refer to README.md for further instructions"
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this logic be part of deployer/bash-aws/main.sh otherwise adding more provider means we have to again use a logic to parse those. Instead crc-cloud.sh should be just entry point and require deployer and platform as of now default deployer can be bash and platform can be aws but if we able to make this separation now then it would be easy to rebase the gcp and openstack PR on top of it.

Also I will create another PR from the commits of gcp provider PR which doesn't have any implementation around cloud provider but just some fix and breaking the logic.

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right, I missed it!

@praveenkumar
Copy link
Member

I have create #17 which should be in and then this PR need to be rebased to make sure we have proper logic to add new cloud providers.

Tullio Sebastiani added 2 commits January 11, 2023 10:23
@@ -302,6 +300,8 @@ else

fi

## LOAD DEPLOYER API
api_load_deployer $DEPLOYER_API
Copy link
Member Author

Choose a reason for hiding this comment

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

the position of this call was wrong, was loading the plugin before the -D argument was parsed resulting on always loading the default plugin

@lmilbaum
Copy link
Contributor

It is a good habit to have one commit (as atomic as possible) per PR. The following are just a few reasons why it is a good habit:

  • Faster lead time (from open to merge)
  • Lower risk for breaking the code
  • Easier validation
  • CI is run on every commit which is the only commit in the PR

@lmilbaum
Copy link
Contributor

A general question: is there a need for supporting multiple bootstrapping technologies? I am asking it because in my sense this project should be opinionated about the technology.

@tsebastiani
Copy link
Member Author

You're right, I had to open this PR as a draft. It's actually a huge change that touched several parts of the code so even if made a single commit the review could have been not so comfortable.

Copy link
Contributor

@lmilbaum lmilbaum left a comment

Choose a reason for hiding this comment

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

I suggest to reconsider the approach of supporting multiple backend bootstrapping technologies

@praveenkumar
Copy link
Member

Closing this PR since we are going to use the pulumi and that would be default main branch.

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.

[Architecture] Infrastructure Deployment API & Plugin development
3 participants