Skip to content

Conversation

@fabriziopandini
Copy link
Member

What this PR does / why we need it:
This PR cleanup the inventory types and set the stages for implementing:

  • clusterctl upgrade apply
  • validation of the contract version during init

I have added comments explaining the main changes

Which issue(s) this PR fixes:
rif #1729

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Feb 6, 2020
// ClusterAPIVersion indicates the cluster API supported version.
ClusterAPIVersion string `json:"clusterAPIVersion,omitempty"`
// Contract defines the API Version of Cluster API (contract) supported by the ReleaseSeries.
Contract string `json:"contract,omitempty"`
Copy link
Member Author

Choose a reason for hiding this comment

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

Renaming ClusterAPIVersion into Contract so we are consistent with the term used in #2267 / less confusing

Copy link
Contributor

Choose a reason for hiding this comment

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

Just out of my own curiosity, when you reference Cluster API (contract) are you referring to the clusterctl provider contract?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm assuming there will be some documentation explaining Cluster API (contract) in the clusterctl upgrade section of the book.

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 API Version of Cluster API (contract) is v1alpha2, v1alpha3 etc. If this is not clear enough in the doc we should iterate and make it crystal clear

// HasReleaseSeriesForVersion return true if the given version is in one of the ReleaseSeries.
func (m *Metadata) HasReleaseSeriesForVersion(version *version.Version) bool {
// GetReleaseSeriesForVersion return the release series for a given version.
func (m *Metadata) GetReleaseSeriesForVersion(version *version.Version) *ReleaseSeries {
Copy link
Member Author

Choose a reason for hiding this comment

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

Switching from Has to Get so I can reuse the same function in upgrade apply

// InstanceName return the instance name for the provider, that is composed by the provider name and the namespace
// where the provider is installed (nb. clusterctl does not support more instance of the same provider to be
// installed in the same namespace)
func (p *Provider) InstanceName() string {
Copy link
Member Author

@fabriziopandini fabriziopandini Feb 6, 2020

Choose a reason for hiding this comment

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

Adding instanceName so I can drop the usage of the name/namespace tuple in many places


// List returns the inventory items for all the provider instances installed in the cluster.
List() ([]clusterctlv1.Provider, error)
List() (*clusterctlv1.ProviderList, error)
Copy link
Member Author

Choose a reason for hiding this comment

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

Switching from []clusterctlv1.Provider to clusterctlv1.ProviderList so I can drop the double List / list function

}

// deriveManagementGroups derives the management groups from a list of providers.
func deriveManagementGroups(providerList *clusterctlv1.ProviderList) (ManagementGroupList, error) {
Copy link
Member Author

Choose a reason for hiding this comment

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

splitting deriveManagementGroups from reading providers so I can use to validate providers contracts during init

// ManagementGroup is a group of providers composed by a CoreProvider and a set of Bootstrap/ControlPlane/Infrastructure providers
// watching objects in the same namespace. For example, a management group can be used for upgrades, in order to ensure all the providers
// in a management group support the same ClusterAPI version.
type ManagementGroup struct {
Copy link
Member Author

Choose a reason for hiding this comment

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

Adding some Utils to ManagementGroup/ManagementGroupList so It will be easier to leverage on these objects during upgrade apply

@fabriziopandini
Copy link
Member Author

/area clusterctl
/assing @wfernandes

@k8s-ci-robot k8s-ci-robot added the area/clusterctl Issues or PRs related to clusterctl label Feb 6, 2020
Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/approve
/assign @wfernandes

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini, vincepri

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 6, 2020
@fabriziopandini fabriziopandini force-pushed the clusterctl-cleanup-inventory branch from 18cd6ae to 8aa5b6a Compare February 6, 2020 21:01
@fabriziopandini
Copy link
Member Author

@wfernandes comments addressed!

@wfernandes
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 6, 2020
@k8s-ci-robot k8s-ci-robot merged commit c976d8e into kubernetes-sigs:master Feb 6, 2020
@fabriziopandini fabriziopandini deleted the clusterctl-cleanup-inventory branch February 7, 2020 07:50
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. area/clusterctl Issues or PRs related to clusterctl cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants