Skip to content

Prevent double registration of Kubernetes GVK for older Kube clusters#33253

Merged
tigrato merged 2 commits intomasterfrom
tigrato/fix-register-duplicated-objects
Oct 12, 2023
Merged

Prevent double registration of Kubernetes GVK for older Kube clusters#33253
tigrato merged 2 commits intomasterfrom
tigrato/fix-register-duplicated-objects

Conversation

@tigrato
Copy link
Copy Markdown
Contributor

@tigrato tigrato commented Oct 10, 2023

Older Kubernetes clusters might have types that live outside of default Kubernetes types but are registered using different APIs. When Teleport starts, it tries to pull the resources from the cluster and panics because a certain type is already registered.

This PR adds a check that prevents double registration.

Older Kubernetes clusters might have types that live outside of default
Kubernetes types but are registered using different APIs. When Teleport
starts, it tries to pull the resources from the cluster and panics
because a certain type is already registered.

This PR adds a check that prevents double registration.

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
@@ -0,0 +1,57 @@
/*
Copyright 2022 Gravitational, Inc.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
Copyright 2022 Gravitational, Inc.
Copyright 2023 Gravitational, Inc.

arrayToPointerArray(o.Items), d.allowedResources, d.deniedResources, d.log),
)
return len(o.Items) > 0, true, nil
case *extensionsv1beta1.Ingress:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we maybe just join cases and enumerate types there? (separate for list ones and non-list ones)

@public-teleport-github-review-bot public-teleport-github-review-bot Bot removed the request for review from rudream October 12, 2023 07:58
@tigrato tigrato added this pull request to the merge queue Oct 12, 2023
Merged via the queue into master with commit 4e6a760 Oct 12, 2023
@tigrato tigrato deleted the tigrato/fix-register-duplicated-objects branch October 12, 2023 17:59
@public-teleport-github-review-bot
Copy link
Copy Markdown

@tigrato See the table below for backport results.

Branch Result
branch/v14 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants