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

IBM Cloud Provider Scaffolding #4923

Merged
merged 1 commit into from Jun 16, 2021

Conversation

BobbyRadford
Copy link
Contributor

Initial scaffolding for the IBM Cloud provider

With this PR, a user should be able to:

  1. openshift-install create install-config and follow CLI prompts to generate a bare bones install-config.yaml
  2. openshift-install create install-config --dir=./existing-config where ./existing-config has a customized install-config.yaml with IBM Cloud platform and machine pool customizations.

This connects with the following enhancement doc PR: openshift/enhancements#773 Details about the supported install config customizations can be found there.

CI has not yet been implemented for the IBM Cloud platform, so this PR should not be merged until that is complete. The scaffolding code proposed here is fairly comprehensive, already containing a suite of unit tests. However, it is not fully done. Some validation on customizations is not yet implemented, specifically around byo VPC and subnets. This byo VPC and subnets may not end up in an MVP for the IBM Cloud platform anyway.

With this PR, I hope that we can get some clarity on direction and verification that we are doing this the "right way." Hopefully that can happen prior to CI being fully implemented.

@openshift-ci openshift-ci bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 10, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented May 10, 2021

Hi @BobbyRadford. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@openshift-ci openshift-ci bot requested review from jstuever and rna-afk May 10, 2021 17:27
@openshift-ci openshift-ci bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 10, 2021
@openshift-ci openshift-ci bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 10, 2021
@srcarrier
Copy link

/assign @staebler

@openshift-ci openshift-ci bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 14, 2021
@openshift-ci openshift-ci bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 14, 2021
Copy link
Contributor

@staebler staebler left a comment

Choose a reason for hiding this comment

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

This look generally good. Most of the comments are minor. By biggest concern is with how we are dealing with the OS image.

pkg/asset/installconfig/ibmcloud/client.go Outdated Show resolved Hide resolved
pkg/asset/installconfig/ibmcloud/client.go Outdated Show resolved Hide resolved
pkg/asset/installconfig/ibmcloud/client.go Outdated Show resolved Hide resolved
pkg/asset/installconfig/ibmcloud/client.go Outdated Show resolved Hide resolved
pkg/asset/installconfig/ibmcloud/client.go Outdated Show resolved Hide resolved
pkg/asset/installconfig/ibmcloud/validation.go Outdated Show resolved Hide resolved
pkg/asset/installconfig/ssh.go Outdated Show resolved Hide resolved
pkg/types/ibmcloud/ibmcloud.go Outdated Show resolved Hide resolved
pkg/asset/installconfig/ibmcloud/client.go Outdated Show resolved Hide resolved
pkg/types/ibmcloud/validation/platform.go Outdated Show resolved Hide resolved
@BobbyRadford
Copy link
Contributor Author

I'm going to slide in a commit to use some newer IBM Go SDKs. It will affect some things in the ibmcloud client. I think it's important to get these in the initial PR rather than later. From there, I will work through all of the review comments. Thanks @staebler

@BobbyRadford BobbyRadford force-pushed the scaffolding branch 6 times, most recently from 217833e to 804ffe8 Compare May 17, 2021 20:52
@BobbyRadford BobbyRadford marked this pull request as ready for review May 18, 2021 14:11
@openshift-ci openshift-ci bot added the do-not-merge/invalid-owners-file Indicates that a PR should not merge because it has an invalid OWNERS file in it. label May 18, 2021
Copy link
Contributor

@openshift-ci openshift-ci bot left a comment

Choose a reason for hiding this comment

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

@BobbyRadford: 2 invalid OWNERS files

In response to this:

Initial scaffolding for the IBM Cloud provider

With this PR, a user should be able to:

  1. openshift-install create install-config and follow CLI prompts to generate a bare bones install-config.yaml
  2. openshift-install create install-config --dir=./existing-config where ./existing-config has a customized install-config.yaml with IBM Cloud platform and machine pool customizations.

This connects with the following enhancement doc PR: openshift/enhancements#773 Details about the supported install config customizations can be found there.

CI has not yet been implemented for the IBM Cloud platform, so this PR should not be merged until that is complete. The scaffolding code proposed here is fairly comprehensive, already containing a suite of unit tests. However, it is not fully done. Some validation on customizations is not yet implemented, specifically around byo VPC and subnets. This byo VPC and subnets may not end up in an MVP for the IBM Cloud platform anyway.

With this PR, I hope that we can get some clarity on direction and verification that we are doing this the "right way." Hopefully that can happen prior to CI being fully implemented.

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.

pkg/asset/installconfig/ibmcloud/OWNERS Outdated Show resolved Hide resolved
pkg/types/ibmcloud/OWNERS Outdated Show resolved Hide resolved
Copy link
Contributor

@openshift-ci openshift-ci bot left a comment

Choose a reason for hiding this comment

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

@BobbyRadford: 2 invalid OWNERS files

In response to this:

Initial scaffolding for the IBM Cloud provider

With this PR, a user should be able to:

  1. openshift-install create install-config and follow CLI prompts to generate a bare bones install-config.yaml
  2. openshift-install create install-config --dir=./existing-config where ./existing-config has a customized install-config.yaml with IBM Cloud platform and machine pool customizations.

This connects with the following enhancement doc PR: openshift/enhancements#773 Details about the supported install config customizations can be found there.

CI has not yet been implemented for the IBM Cloud platform, so this PR should not be merged until that is complete. The scaffolding code proposed here is fairly comprehensive, already containing a suite of unit tests. However, it is not fully done. Some validation on customizations is not yet implemented, specifically around byo VPC and subnets. This byo VPC and subnets may not end up in an MVP for the IBM Cloud platform anyway.

With this PR, I hope that we can get some clarity on direction and verification that we are doing this the "right way." Hopefully that can happen prior to CI being fully implemented.

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.

pkg/asset/installconfig/ibmcloud/OWNERS Outdated Show resolved Hide resolved
pkg/types/ibmcloud/OWNERS Outdated Show resolved Hide resolved
@openshift-ci openshift-ci bot added do-not-merge/invalid-owners-file Indicates that a PR should not merge because it has an invalid OWNERS file in it. and removed do-not-merge/invalid-owners-file Indicates that a PR should not merge because it has an invalid OWNERS file in it. labels May 18, 2021
@BobbyRadford
Copy link
Contributor Author

I am going to drop in another commit here with some refactoring around resource groups. I don't want to just keep putting more and more into this PR, but I think this aligns with the mission of scaffolding.

In the commit...

  • I added another resource group field to the install config that will be needed for future work. This will allow for a distinct resource group for VPC resources.
  • I also added a "Name" suffix to the resource group fields to align with other providers.
  • Finally, an empty resource group name is handled. Eventually, through Terraform, we will create a new resource group if it is empty.

@openshift-ci openshift-ci bot removed the do-not-merge/invalid-owners-file Indicates that a PR should not merge because it has an invalid OWNERS file in it. label May 27, 2021
@BobbyRadford
Copy link
Contributor Author

@staebler We were able to implement an automated way to upload and create an RHCOS image. Due to it depending on Terraform, which will come in a subsequent PR, is it OK for that automation piece to come later as well?

@BobbyRadford
Copy link
Contributor Author

My last commit adds a build tag to conditionally show ibmcloud in the platform survey. By default IBM Cloud will now be a hidden platform. I have tested this out locally with several different scenarios and all seems to be good.

@jeffnowicki
Copy link
Contributor

/retest

Copy link
Contributor

@staebler staebler left a comment

Choose a reason for hiding this comment

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

This looks good. My comments are almost all nits, except for the question about whether the CISInstanceCRN field should be optional.

Please squash down the commits into one or a few commits.

pkg/asset/installconfig/basedomain.go Outdated Show resolved Hide resolved
pkg/asset/installconfig/ibmcloud/client.go Show resolved Hide resolved
pkg/asset/installconfig/ibmcloud/client.go Outdated Show resolved Hide resolved
pkg/asset/installconfig/ibmcloud/validation.go Outdated Show resolved Hide resolved
pkg/asset/installconfig/ibmcloud/validation.go Outdated Show resolved Hide resolved
pkg/asset/installconfig/ibmcloud/validation.go Outdated Show resolved Hide resolved
pkg/types/ibmcloud/ibmcloud.go Outdated Show resolved Hide resolved
pkg/types/ibmcloud/platform.go Outdated Show resolved Hide resolved
@droslean
Copy link
Member

/test e2e-aws-fips

@staebler
Copy link
Contributor

go generate ./pkg/types

diff --git a/data/data/install.openshift.io_installconfigs.yaml b/data/data/install.openshift.io_installconfigs.yaml
index 148e357..88dcb4d 100644
--- a/data/data/install.openshift.io_installconfigs.yaml
+++ b/data/data/install.openshift.io_installconfigs.yaml
@@ -1532,10 +1532,6 @@ spec:
                 description: IBMCloud is the configuration used when installing on
                   IBM Cloud.
                 properties:
-                  cisInstanceCRN:
-                    description: CISInstanceCRN is the Cloud Internet Services CRN
-                      of the base domain DNS zone.
-                    type: string
                   clusterOSImage:
                     description: ClusterOSImage is the name of the custom RHCOS image.
                     type: string
@@ -1597,7 +1593,6 @@ spec:
                       defined.
                     type: string
                 required:
-                - cisInstanceCRN
                 - clusterOSImage
                 - region
                 type: object 

ibmcloud: add ibm cloud types

support the new ibm cloud platform by adding required types

ibmcloud: add initial assets

Add ibmcloud assets to support the new ibmcloud platform. These changes are functional, but additional functionality will be built out over time

ibmcloud: resolve linting issues

ibmcloud: obtain the cisInstanceCRN for install-config

The cisInstanceCRN field is derived from the user-provided baseDomain. It is needed for all DNS configuration.

types: fix ibmcloud machinepool file name

ibmcloud: rename platform ResourceGroupID field

Rename the field `ResourceGroupID` in the Platform type to
`ResourceGroup`

ibmcloud: add initial metadata

ibmcloud: add ClusterOSImage customization

The ClusterOSImage field will allow the user to specify the custom
RHCOS image to use for their cluster VSIs

ibmcloud: add fields to Platform type

Add the DefaultMachinePlatform, VPC, VPCResourceGroup, and Subnets
fields to the Platform type. These are needed to fully define a
cluster.

ibmcloud: improve platform validation and tests

Add in additional validation to the ibmcloud Platform. Also,
add unit tests around that new validation. This is just a start
and more validation and unit tests are required.

ibmcloud: fix linting issues

These issues were discovered using golangci-lint

ibmcloud: use resource group name in install config

Use the resource group name instead of ID in the install config. This
will be more human friendly. The ID will also still be valid, but
name will be preferred.

ibmcloud: improve default resource group check

Check for the default resource group based off of the 'default'
field in the resource group struct.

ibmcloud: fix typo

ibmcloud: remove vpcResourceGroup and use vpc ID

vpcResourceGroup is no longer needed if the vpc field holds the
ID of the VPC instead of the name.

ibmcloud: enforce clusterOSImage region

The clusterOSImage refers to a custom image in a user's VPC. That
image is regionally scoped and the region should be honored. Users
should not be allowed to pick a custom image from a region that
differes from the value of the region field in the install config.

ibmcloud: use resourcev2 API

The resourcev2 API should be used in place of v1. This is the most
up-to-date and well supported version.

ibmcloud: fix log message

Co-Authored-By: Hidematsu Sueki <Hidematsu.Sueki@ibm.com>

ibmcloud: add machinepool type and validation

Add the MachinePool type for the IBM Cloud platform. Also include
initial validation on the fields.

ibmcloud: update survey version

ibmcloud: use ibm go sdks instead of bluemix-go

The ibm-go-sdk and corresponding service SDKs in the IBM GH org
are more up-to-date and routinely supported. The old bluemix-go
SDKs should no longer be used.

update go mod

update vendor

fix: make validateVPCConfig a private function

Co-authored-by: Matthew Staebler <staebler@redhat.com>

fix: improve log message for resource group not found

Co-authored-by: Matthew Staebler <staebler@redhat.com>

fix: simplify subnet return statement

Co-authored-by: Matthew Staebler <staebler@redhat.com>

fix: improve log message for vpc not found

Co-authored-by: Matthew Staebler <staebler@redhat.com>

fix: images slice declaration

Co-authored-by: Matthew Staebler <staebler@redhat.com>

fix: improve images range loop

Co-authored-by: Matthew Staebler <staebler@redhat.com>

fix: typo in baseDomain help string

Co-authored-by: Matthew Staebler <staebler@redhat.com>

fix: clarify resource group help message

fix: use platformPath as variable name

Co-authored-by: Matthew Staebler <staebler@redhat.com>

fix: ibmcloud platform reference

Co-authored-by: Matthew Staebler <staebler@redhat.com>

fix: remove unnecessary conditionals in validation

fix: check encryptionKey exists before validation

fix: improve zone validation message

Co-authored-by: Matthew Staebler <staebler@redhat.com>

fix: keep errors out of happy path

fix: add index to subnets validation

fix: create VPCResourceNotFoundError

fix: use sets.String for contains

fix: ibmcloud platform type comments

fix: improve vpc config validation messages

fix: add omitempty for encryptionKey

Co-authored-by: Matthew Staebler <staebler@redhat.com>

fix: improve BootVolume copying

Co-authored-by: Matthew Staebler <staebler@redhat.com>

fix: rename MachinePool.Type to InstanceType

fix: remove validateRegion

fix: remove unnecessary context from client

fix: remove context timeout in ic Platform

fix: remove superfluous edit

fix: update unit tests

fix: move types used by cilent to same package

fix: update OWNERS and OWNERS_ALIASES

fix: improve client call to load services

fix: improve GetZoneIDByName range loop

fix: whitepsace in OWNERS

fix: populate ibmcloud OWNERS_ALIASES

fix: make cisServiceID a const

Co-authored-by: Matthew Staebler <staebler@redhat.com>

ibmcloud: refactor resource groups

Allow users to have VPC resources in a different resource
group from the cluster creation. This will enable CI and E2E
testing along with making it easier to destroy clusters.

This commit also adds a "Name" suffix to resource groups to align
with other platforms naming convention.

fix: error message format

fix: update unit test

ibmcloud: move ibmcloud to hidden platforms

The IBMCloud platform will be in a developer preview for 4.9. As a result
we will move it to the list of hidden platforms. This commit does that by
default, but allows for it to show up in the survey via a build flag:
'ibmcloud'.

ibmcloud: remove cisInstanceCRN field

The cisInstanceCRN platform field is not needed. Though it is possible
to manage a single DNS zone with multiple CIS instances, only one zone
can be in the "Active" state at a time. As a result, we know which CIS
instance to use based off of its managed zone's state.

fix: address pr comments

update codegen
Copy link
Contributor

@staebler staebler left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 15, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 15, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: staebler

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 15, 2021
@staebler
Copy link
Contributor

/ok-to-test

@openshift-ci openshift-ci bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 15, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 15, 2021

@BobbyRadford: The following tests failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/e2e-openstack 49b4da9 link /test e2e-openstack
ci/prow/e2e-metal-ipi-ovn-ipv6 49b4da9 link /test e2e-metal-ipi-ovn-ipv6
ci/prow/e2e-aws-fips 49b4da9 link /test e2e-aws-fips
ci/prow/e2e-crc 49b4da9 link /test e2e-crc
ci/prow/e2e-aws-workers-rhel7 49b4da9 link /test e2e-aws-workers-rhel7

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@staebler
Copy link
Contributor

AWS is having issues with API throttling. I am overriding those tests and will use gcp success as the requirement instead.
/override ci/prow/e2e-aws
/override ci/prow/e2e-aws-upgrade
/test e2e-gcp
/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 16, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 16, 2021

@staebler: Overrode contexts on behalf of staebler: ci/prow/e2e-aws, ci/prow/e2e-aws-upgrade

In response to this:

AWS is having issues with API throttling. I am overriding those tests and will use gcp success as the requirement instead.
/override ci/prow/e2e-aws
/override ci/prow/e2e-aws-upgrade
/test e2e-gcp
/hold

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.

@staebler
Copy link
Contributor

The e2e-gcp job passed.
/hold cancel

Comment on lines +115 to +116
_, cancel := context.WithTimeout(ctx, 1*time.Minute)
defer cancel()
Copy link
Contributor

Choose a reason for hiding this comment

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

@BobbyRadford, what's the purpose of creating a child context with a timeout and throwing that context away? I see this _, cancel pattern repeated throughout this file, and I cannot figure out what its purpose is.

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 think this is just a remnant of early development work that I intended to come back to. The context can and should be passed on to the different API calls made through the various IBM Cloud SDKs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants