CORS-2835: use build tags to produce installer with alternate infrastructure providers#7656
Conversation
|
@patrickdillon: This pull request references CORS-2876 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.15.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
Skipping CI for Draft Pull Request. |
|
@patrickdillon: This pull request references CORS-2876 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.15.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Return an error rather than panic for unsupported platforms.
Implements a build tag strategy to allow producing installer binaries using an alternate (to terraform) infrastructure provider. Using build tags we can select different ProviderForPlatform implementations. Because the altinfra implementation of that function does not depend on any terraform dependencies, none are included in the binary.
When building the altinfra or ARO images, no terraform dependencies should be involved, so skip them in the build script.
ecdd91b to
3492c4a
Compare
|
/retest |
|
@patrickdillon: This pull request references CORS-2876 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.15.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
@patrickdillon: This pull request references CORS-2876 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.15.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
Rafael pointed out that we don't need the dockerfile. The only difference is the tag, which can be controlled in the ci job. Updating. |
3492c4a to
7014647
Compare
|
@patrickdillon: This pull request references CORS-2835 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.15.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
@patrickdillon: This pull request references CORS-2835 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.15.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
Dropped the Dockerfile commit |
| return terraform.InitializeProvider([]terraform.Stage{}), nil | ||
| } | ||
| panic(fmt.Sprintf("unsupported platform %q", platform)) | ||
| return nil, fmt.Errorf("unsupported platform %q", platform) |
There was a problem hiding this comment.
nit: since essentially the terraform.InitializeProvider is always invoked for each platform stage type, code could be slightly simplified by storing the relationship in a map, ie:
platformStages := map[string][]terraform.Stage{
alibabacloudtypes.Name: alibabacloud.PlatformStages,
awstypes.Name: aws.PlatformStages,
// ... other types
}
s, ok := platformStages[platform]
if !ok {
return nil, fmt.Errorf("unsupported platform %q", platform)
}
return terraform.InitializeProvider(s)
There was a problem hiding this comment.
This is a good suggestion. I would like to keep it this way, because once #7413 merges, we can introduce alternate providers with feature gates in these case statements, so we would have something like:
case awstypes.Name:
if fg.Enabled(configv1.FeatureGateInstallAWSSDK) {
return aws.InitializeProvider("")
}
return terraform.InitializeProvider(aws.PlatformStages), nilThere was a problem hiding this comment.
Ok, we could eventually review it in future
|
|
||
| # Build terraform binaries before setting environment variables since it messes up make | ||
| if test "${SKIP_TERRAFORM}" != y | ||
| if test "${SKIP_TERRAFORM}" != y && ! (echo "${TAGS}" | grep -q -e 'aro' -e 'altinfra') |
There was a problem hiding this comment.
I wasn't aware about the specific build tag aro, must be skipped as well?
There was a problem hiding this comment.
Yes, so I have also added the aro tag here:
https://github.com/openshift/installer/pull/7656/files#diff-a4f0f6b61545d617e8db370db204ea8d9fbd62f380527ef49351bf617c781e32R1-R2
ARO has a fork of the installer and does not use Terraform (using ARO-RP instead). I believe they use this ARO build tag when building their fork, so the result should be that the ARO version of the installer is built without Terraform dependencies.
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: andfasano The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/skip |
|
@patrickdillon: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Build tags in the
pkg/infrastructure/platform.goandpkg/infrastructure/platform_altinfra.gofiles selectively determine which file is included in the build.platform.gocontains the normal Terraform dependencies for building infrastructure, whileplatform_altinfra.gowill be where we land non-Terraform implementors of the provider interface.By using the
-vflag withgo buildwe can see that no Terraform dependencies are included when building.openshift/release#45169 will promote this build to a separate installer image.