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

MGMT-15690: Add support for external platform #5738

Merged

Conversation

adriengentil
Copy link
Contributor

@adriengentil adriengentil commented Nov 27, 2023

  • Add a new platform type external and new struct External under Platform in order to configure it
  • Add validations to the External struct and ability to create/update it:
    • platformName: is required and must not be empty
    • cloudControllerManager: set to an empty string (CCM disabled) if not set explicitly
  • Add feature support, OCP 4.14 and user managed networking is required to install a cluster with external platform
  • This new platform is behind an OCM capability, disabled by default

I will plug external platform/platformName=oci with the existing oci integration in a follow-up PR.

Copy link

openshift-ci bot commented Nov 27, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Nov 27, 2023
@adriengentil
Copy link
Contributor Author

/test unit-test edge-e2e-metal-assisted edge-e2e-oci-assisted

@openshift-ci openshift-ci bot added the api-review Categorizes an issue or PR as actively needing an API review. label Nov 27, 2023
Copy link

openshift-ci bot commented Nov 27, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adriengentil

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 Nov 27, 2023
@adriengentil
Copy link
Contributor Author

/test edge-unit-test

Copy link

codecov bot commented Nov 27, 2023

Codecov Report

Merging #5738 (8317fec) into master (25d0ae7) will increase coverage by 1.37%.
Report is 6 commits behind head on master.
The diff coverage is 53.92%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5738      +/-   ##
==========================================
+ Coverage   68.00%   69.38%   +1.37%     
==========================================
  Files         233      234       +1     
  Lines       34324    36233    +1909     
==========================================
+ Hits        23342    25140    +1798     
- Misses       8915     8968      +53     
- Partials     2067     2125      +58     
Files Coverage Δ
internal/bminventory/inventory.go 77.04% <100.00%> (+6.75%) ⬆️
internal/featuresupport/feature_support_level.go 89.28% <ø> (ø)
internal/featuresupport/features_networking.go 83.81% <100.00%> (+0.48%) ⬆️
internal/provider/external/base.go 0.00% <ø> (ø)
internal/provider/registry/registry.go 64.78% <100.00%> (+0.50%) ⬆️
internal/common/conversions.go 5.40% <0.00%> (ø)
internal/provider/external/inventory.go 0.00% <0.00%> (ø)
internal/cluster/validations/validations.go 26.35% <0.00%> (+0.48%) ⬆️
internal/featuresupport/features_platforms.go 91.25% <86.36%> (-0.78%) ⬇️
internal/common/common.go 24.79% <0.00%> (-1.07%) ⬇️
... and 2 more

... and 8 files with indirect coverage changes

@adriengentil adriengentil changed the title support external platform 4 MGMT-15690: Add support for external platform Nov 27, 2023
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Nov 27, 2023
@openshift-ci-robot
Copy link

openshift-ci-robot commented Nov 27, 2023

@adriengentil: This pull request references MGMT-15690 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 task to target the "4.15.0" version, but no target version was set.

In response to this:

  • define external platform type in swagger
  • generate code
  • create external provider
  • Add capability check for external platform
  • add platform name and CCM configuration
  • set external fields can be nullable
  • register external cluster
  • update cluster

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-robot
Copy link

openshift-ci-robot commented Nov 27, 2023

@adriengentil: This pull request references MGMT-15690 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 task to target the "4.15.0" version, but no target version was set.

In response to this:

  • Add a new platform type external and new struct External under Platform in order to configure it
  • Add validations to the External struct:
  • platformName: is required and must not be empty
  • cloudControllerManger: set to an empty string (CCM disabled) if not set explicitly
  • Add feature support, OCP 4.14 and user managed networking is required to install a cluster with external platform
  • This new platform is behind an OCM capability, disabled by default

I will plug external platform/platformName=oci with the existing oci integration in a follow-up PR.

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-robot
Copy link

openshift-ci-robot commented Nov 27, 2023

@adriengentil: This pull request references MGMT-15690 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 task to target the "4.15.0" version, but no target version was set.

In response to this:

  • Add a new platform type external and new struct External under Platform in order to configure it
  • Add validations to the External struct and ability to create/update it:
  • platformName: is required and must not be empty
  • cloudControllerManger: set to an empty string (CCM disabled) if not set explicitly
  • Add feature support, OCP 4.14 and user managed networking is required to install a cluster with external platform
  • This new platform is behind an OCM capability, disabled by default

I will plug external platform/platformName=oci with the existing oci integration in a follow-up PR.

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.

@adriengentil
Copy link
Contributor Author

/cc @pawanpinjarkar

@adriengentil
Copy link
Contributor Author

adriengentil commented Nov 27, 2023

Created a SNO cluster with:

aicli -U http://10.1.155.26:8080/ create cluster ext-sno -Ppull_secret=~/pull-secret -Popenshift_version=4.14 -Puser_managed_networking=True -Pplatform='{"type":"external", "external": {"platform_name": "agdcorp" , "cloud_controller_manager": ""}}' -Psno=True

Install config is updated accordingly:

...
  "platform": {
    "external": {
      "PlatformName": "agdcorp",
      "CloudControllerManager": ""
    }
  },
...

And the infrastructure object of the cluster using the external integration without CCM is created as expected:

apiVersion: config.openshift.io/v1
kind: Infrastructure
metadata:
  creationTimestamp: "2023-11-27T15:39:13Z"
  generation: 1
  name: cluster
  resourceVersion: "527"
  uid: 391f1b27-77ea-4696-a299-e99e71a694f2
spec:
  cloudConfig:
    name: ""
  platformSpec:
    external:
      platformName: agdcorp
    type: External
status:
  apiServerInternalURI: https://api-int.ext-sno.karmalabs.corp:6443
  apiServerURL: https://api.ext-sno.karmalabs.corp:6443
  controlPlaneTopology: SingleReplica
  cpuPartitioning: None
  etcdDiscoveryDomain: ""
  infrastructureName: ext-sno-gprfr
  infrastructureTopology: SingleReplica
  platform: External
  platformStatus:
    external:
      cloudControllerManager:
        state: None
    type: External

@adriengentil
Copy link
Contributor Author

/cc @avishayt @gamli75

@adriengentil adriengentil marked this pull request as ready for review November 27, 2023 16:00
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 27, 2023
@adriengentil
Copy link
Contributor Author

/test edge-e2e-oci-assisted

@adriengentil
Copy link
Contributor Author

/retest
looks like flakes in prow

@adriengentil
Copy link
Contributor Author

/test edge-subsystem-aws edge-subsystem-kubeapi-aws

internal/bminventory/inventory.go Outdated Show resolved Hide resolved
internal/provider/common.go Outdated Show resolved Hide resolved
internal/provider/common.go Outdated Show resolved Hide resolved
@@ -2543,6 +2543,17 @@ func (b *bareMetalInventory) updatePlatformParams(params installer.V2UpdateClust
if params.ClusterUpdateParams.Platform != nil && common.PlatformTypeValue(params.ClusterUpdateParams.Platform.Type) != "" {
updates["platform_type"] = params.ClusterUpdateParams.Platform.Type
updates["platform_is_external"] = swag.BoolValue(params.ClusterUpdateParams.Platform.IsExternal)
if *params.ClusterUpdateParams.Platform.Type == models.PlatformTypeExternal {
Copy link
Contributor

Choose a reason for hiding this comment

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

sometime we use common.PlatformTypeValue(params.ClusterUpdateParams.Platform.Type) and sometimes we use *params.ClusterUpdateParams.Platform.Type - why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

common.PlatformTypeValue() returns an empty string when Platform.Type is nil. At this point of the code we know the type is not nil, so it's safe to look at the content the variable.

@@ -2543,6 +2543,17 @@ func (b *bareMetalInventory) updatePlatformParams(params installer.V2UpdateClust
if params.ClusterUpdateParams.Platform != nil && common.PlatformTypeValue(params.ClusterUpdateParams.Platform.Type) != "" {
updates["platform_type"] = params.ClusterUpdateParams.Platform.Type
updates["platform_is_external"] = swag.BoolValue(params.ClusterUpdateParams.Platform.IsExternal)
if *params.ClusterUpdateParams.Platform.Type == models.PlatformTypeExternal {
if params.ClusterUpdateParams.Platform.External != nil && params.ClusterUpdateParams.Platform.External.PlatformName != nil {
updates["platform_external_platform_name"] = params.ClusterUpdateParams.Platform.External.PlatformName
Copy link
Contributor

Choose a reason for hiding this comment

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

do we have consts for platform_external_platform_name, platform_external_cloud_controller_manager?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, those are columns names in DB, looks like we never defined any consts for them in the past 🤔

@@ -6221,6 +6225,28 @@ definitions:
- vsphere
- none
- oci
- external
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought that we are going to remove oci, @avishayt ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will come in a follow-up PR, I need to plug the oci code to the external/platformName=oci, then I will be able to remove the oci platform type

@@ -5413,6 +5414,9 @@ definitions:
properties:
type:
$ref: '#/definitions/platform_type'
external:
$ref: '#/definitions/platform_external'
x-nullable: true
is_external:
Copy link
Contributor

Choose a reason for hiding this comment

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

We should have another PR to remove is_external, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, will remove oci platform type and is_external at the same time

internal/provider/common.go Outdated Show resolved Hide resolved
@openshift-ci-robot
Copy link

openshift-ci-robot commented Nov 28, 2023

@adriengentil: This pull request references MGMT-15690 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 task to target the "4.15.0" version, but no target version was set.

In response to this:

  • Add a new platform type external and new struct External under Platform in order to configure it
  • Add validations to the External struct and ability to create/update it:
  • platformName: is required and must not be empty
  • cloudControllerManager: set to an empty string (CCM disabled) if not set explicitly
  • Add feature support, OCP 4.14 and user managed networking is required to install a cluster with external platform
  • This new platform is behind an OCM capability, disabled by default

I will plug external platform/platformName=oci with the existing oci integration in a follow-up PR.

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.

@pawanpinjarkar
Copy link
Contributor

@adriengentil I successfully tested SNO IPV4 cluster installation for the external platform with the below config in the install-config via dev-scripts.

"platform": {
        "external": {
           "platformName": "nonoci"
            }
    },

Ref installer PR openshift/installer#7585

@adriengentil
Copy link
Contributor Author

/retest
looks like flakes

@adriengentil
Copy link
Contributor Author

/retest
flakes :(

@adriengentil
Copy link
Contributor Author

@avishayt @gamli75 @rccrdpccl are we good to go with this PR?

@adriengentil
Copy link
Contributor Author

adriengentil commented Nov 29, 2023

/override ci/prow/edge-e2e-nutanix-assisted ci/prow/edge-e2e-nutanix-assisted-4-14 ci/prow/edge-e2e-vsphere-assisted
nutanix jobs are broken
vsphere job is flaky

Copy link

openshift-ci bot commented Nov 29, 2023

@adriengentil: Overrode contexts on behalf of adriengentil: ci/prow/edge-e2e-nutanix-assisted, ci/prow/edge-e2e-nutanix-assisted-4-14, ci/prow/edge-e2e-vsphere-assisted

In response to this:

/override ci/prow/edge-e2e-nutanix-assisted ci/prow/edge-e2e-nutanix-assisted-4-14 ci/prow/edge-e2e-vsphere-assisted
nutanix jobs is broken
vsphere job is flaky

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.

@rccrdpccl
Copy link
Contributor

/lgtm
/hold

Unhold whenever we're ready :)

@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 Nov 29, 2023
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 29, 2023
@adriengentil
Copy link
Contributor Author

/unhold

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 29, 2023
@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 0 against base HEAD e13da27 and 2 for PR HEAD 8317fec in total

@adriengentil
Copy link
Contributor Author

/retest

Copy link

openshift-ci bot commented Nov 29, 2023

@adriengentil: all tests passed!

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.

@openshift-merge-bot openshift-merge-bot bot merged commit 5582850 into openshift:master Nov 29, 2023
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-review Categorizes an issue or PR as actively needing an API review. approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants