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

Avoid importing upstream k8s packages #11

Merged

Conversation

Karthik-K-N
Copy link
Contributor

This PR removes the dependency of upstream k8s. Because

We are planning to use this package across multiple repositories including cluster-api-provider-ibmcloud, if this repo has k8s dependency which makes the importer to be on the same k8s version.
This cannot be satisfied all the time as updating in this repo may cause issue in various repo's as well.

One of the reference to the error kubernetes-sigs/cluster-api-provider-ibmcloud#1608 (comment)

The removed function can be constructed again in the caller like

package main

import (
	"fmt"
	powerUtil "github.com/ppc64le-cloud/powervs-utils"
	"k8s.io/apimachinery/pkg/util/sets"
)

func main() {
	fmt.Println(AllKnownSysTypes())

}

// AllKnownSysTypes returns aggregated known system types from all regions.
func AllKnownSysTypes() sets.Set[string] {
	sysTypes := sets.New[string]()
	for _, region := range powerUtil.Regions {
		sysTypes.Insert(region.SysTypes...)
	}
	return sysTypes
}

@ppc64le-cloud-bot ppc64le-cloud-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 22, 2024
@Karthik-K-N
Copy link
Contributor Author

/cc @mkumatag @dharaneeshvrd @hamzy

@ppc64le-cloud-bot
Copy link
Contributor

@Karthik-K-N: GitHub didn't allow me to request PR reviews from the following users: hamzy.

Note that only ppc64le-cloud members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @mkumatag @dharaneeshvrd @hamzy

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.

@dharaneeshvrd
Copy link
Contributor

/lgtm
/approve

@ppc64le-cloud-bot ppc64le-cloud-bot added the lgtm Indicates that a PR is ready to be merged. label May 23, 2024
@dharaneeshvrd
Copy link
Contributor

@mkumatag Please approve this PR when you get a chance, need this dependancy for hypershift as well.

@@ -254,12 +252,3 @@ func AvailableSysTypes(region string) ([]string, error) {
}
return knownRegion.SysTypes, nil
}

// AllKnownSysTypes returns aggregated known system types from all regions.
func AllKnownSysTypes() sets.Set[string] {
Copy link
Member

Choose a reason for hiding this comment

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

but the question is - is this consumed anywhere right now?

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 dont think its used any where @hamzy can confirm.

Copy link
Contributor

Choose a reason for hiding this comment

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

I seemed to be the only person interested in having one place where all this code would be. There was no action done on my working solution.

Copy link
Member

Choose a reason for hiding this comment

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

yes, that's the reason we are removing the k8s.io deps so that we can import this code everywhere with no conflict with k8s deps

Copy link
Member

Choose a reason for hiding this comment

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

@hamzy if this function is not consumed anywhere, will merge this code and find some other way of implementing this function withought k8s sets package

@Karthik-K-N
Copy link
Contributor Author

@mkumatag can this be merged?

Copy link
Member

@mkumatag mkumatag left a comment

Choose a reason for hiding this comment

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

/lgtm

@ppc64le-cloud-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dharaneeshvrd, Karthik-K-N, mkumatag

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

@ppc64le-cloud-bot ppc64le-cloud-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 4, 2024
@ppc64le-cloud-bot ppc64le-cloud-bot merged commit 5884530 into ppc64le-cloud:main Jun 4, 2024
2 checks passed
@Karthik-K-N Karthik-K-N deleted the remove-upstream-k8 branch June 4, 2024 06:02
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. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants