Skip to content

fix: Stop data sources from generating kubeconfig tokens on every plan - #2287

Merged
JonCrowther merged 1 commit into
release/v15from
backport-2269-release-v15
Jun 4, 2026
Merged

fix: Stop data sources from generating kubeconfig tokens on every plan#2287
JonCrowther merged 1 commit into
release/v15from
backport-2269-release-v15

Conversation

@github-actions

@github-actions github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown

This pull request cherry-picks the changes from #2269 into release/v15

Addresses #2272 for #2271

WARNING!: to avoid having to resolve merge conflicts this PR is generated with 'git cherry-pick -X theirs'.

Please make sure to carefully inspect this PR so that you don't accidentally revert anything!

Copied from main PR:

Addresses #1229

Description

Cluster data sources called the Rancher generateKubeconfig API on every plan and apply, creating a new API token each time. Over time this leads to accumulation of large numbers of orphaned tokens.

Data sources now skip kubeconfig generation by default, which is a breaking change. Users who need the kubeconfig output can opt in by setting generate_kube_config = true on the data source.

The alternative is to make it opt-out in which case the side-effect remains the default behavior.

Testing

This is a breaking change.

kube_config on cluster data sources (rancher2_cluster, rancher2_cluster_v2) is now empty by default.
Previously, every plan/apply generated a new API token. Users who need kube_config from a data source must set generate_kube_config = true.

#2269)

* fix: Stop data sources from generating kubeconfig tokens on every plan
Cluster data sources called the Rancher generateKubeconfig API on
every plan and apply, creating a new API token each time. Over time this
leads to accumulation of large numbers of orphaned tokens.

* fix: Default generate_kube_config to true to avoid breaking change
Kubeconfig generation on cluster data sources now defaults to enabled,
preserving existing behavior. A deprecation warning is logged when
generation is active, noting that the default will change to false in
a future version.

(cherry picked from commit 0d37ae2)
@github-actions github-actions Bot added internal/pr-backport This PR is back porting code to a release branch. release/v15 Targets release v15.x correlating to Rancher's v2.15.x labels Jun 4, 2026
@JonCrowther
JonCrowther merged commit 8f0c51c into release/v15 Jun 4, 2026
@JonCrowther
JonCrowther deleted the backport-2269-release-v15 branch June 4, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal/pr-backport This PR is back porting code to a release branch. release/v15 Targets release v15.x correlating to Rancher's v2.15.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants