Update Go version and package dependencies

This commit is contained in:
Eddy Filip
2023-03-24 17:58:25 +01:00
parent fe930fef05
commit 63dcaac407
960 changed files with 74779 additions and 35525 deletions

View File

@@ -84,8 +84,10 @@ type CRDInstallOptions struct {
WebhookOptions WebhookInstallOptions
}
const defaultPollInterval = 100 * time.Millisecond
const defaultMaxWait = 10 * time.Second
const (
defaultPollInterval = 100 * time.Millisecond
defaultMaxWait = 10 * time.Second
)
// InstallCRDs installs a collection of CRDs into a cluster by reading the crd yaml files from a directory.
func InstallCRDs(config *rest.Config, options CRDInstallOptions) ([]*apiextensionsv1.CustomResourceDefinition, error) {
@@ -142,7 +144,7 @@ func defaultCRDOptions(o *CRDInstallOptions) {
// WaitForCRDs waits for the CRDs to appear in discovery.
func WaitForCRDs(config *rest.Config, crds []*apiextensionsv1.CustomResourceDefinition, options CRDInstallOptions) error {
// Add each CRD to a map of GroupVersion to Resource
waitingFor := map[schema.GroupVersion]*sets.String{}
waitingFor := map[schema.GroupVersion]*sets.Set[string]{}
for _, crd := range crds {
gvs := []schema.GroupVersion{}
for _, version := range crd.Spec.Versions {
@@ -155,7 +157,7 @@ func WaitForCRDs(config *rest.Config, crds []*apiextensionsv1.CustomResourceDefi
log.V(1).Info("adding API in waitlist", "GV", gv)
if _, found := waitingFor[gv]; !found {
// Initialize the set
waitingFor[gv] = &sets.String{}
waitingFor[gv] = &sets.Set[string]{}
}
// Add the Resource
waitingFor[gv].Insert(crd.Spec.Names.Plural)
@@ -173,7 +175,7 @@ type poller struct {
config *rest.Config
// waitingFor is the map of resources keyed by group version that have not yet been found in discovery
waitingFor map[schema.GroupVersion]*sets.String
waitingFor map[schema.GroupVersion]*sets.Set[string]
}
// poll checks if all the resources have been found in discovery, and returns false if not.
@@ -362,7 +364,7 @@ func modifyConversionWebhooks(crds []*apiextensionsv1.CustomResourceDefinition,
if err != nil {
return err
}
url := pointer.StringPtr(fmt.Sprintf("https://%s/convert", hostPort))
url := pointer.String(fmt.Sprintf("https://%s/convert", hostPort))
for i := range crds {
// Continue if we're preserving unknown fields.

View File

@@ -173,7 +173,7 @@ func WaitForWebhooks(config *rest.Config,
mutatingWebhooks []*admissionv1.MutatingWebhookConfiguration,
validatingWebhooks []*admissionv1.ValidatingWebhookConfiguration,
options WebhookInstallOptions) error {
waitingFor := map[schema.GroupVersionKind]*sets.String{}
waitingFor := map[schema.GroupVersionKind]*sets.Set[string]{}
for _, hook := range mutatingWebhooks {
h := hook
@@ -183,7 +183,7 @@ func WaitForWebhooks(config *rest.Config,
}
if _, ok := waitingFor[gvk]; !ok {
waitingFor[gvk] = &sets.String{}
waitingFor[gvk] = &sets.Set[string]{}
}
waitingFor[gvk].Insert(h.GetName())
}
@@ -196,7 +196,7 @@ func WaitForWebhooks(config *rest.Config,
}
if _, ok := waitingFor[gvk]; !ok {
waitingFor[gvk] = &sets.String{}
waitingFor[gvk] = &sets.Set[string]{}
}
waitingFor[gvk].Insert(hook.GetName())
}
@@ -212,7 +212,7 @@ type webhookPoller struct {
config *rest.Config
// waitingFor is the map of resources keyed by group version that have not yet been found in discovery
waitingFor map[schema.GroupVersionKind]*sets.String
waitingFor map[schema.GroupVersionKind]*sets.Set[string]
}
// poll checks if all the resources have been found in discovery, and returns false if not.
@@ -229,7 +229,7 @@ func (p *webhookPoller) poll() (done bool, err error) {
delete(p.waitingFor, gvk)
continue
}
for _, name := range names.List() {
for _, name := range names.UnsortedList() {
var obj = &unstructured.Unstructured{}
obj.SetGroupVersionKind(gvk)
err := c.Get(context.Background(), client.ObjectKey{