8000 initial ClusterTrustBundle v1alpha1 support by dgn · Pull Request #55592 · istio/istio · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

initial ClusterTrustBundle v1alpha1 support #55592

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

Merged
merged 11 commits into from
Apr 15, 2025

Conversation

dgn
Copy link
Contributor
@dgn dgn commented Mar 19, 2025

This adds a feature flag to enable basic ClusterTrustBundle API support. If enabled, it replaces the old Namespace controller with a simpler ClusterTrustBundle controller.

Fixes #43986

@dgn dgn requested review from a team as code owners March 19, 2025 16:49
@istio-testing istio-testing added do-not-merge/work-in-progress Block merging of a PR because it isn't ready yet. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 19, 2025
@dgn dgn force-pushed the clustertrustbundles branch 3 times, most recently from 0811538 to 7951ec4 Compare March 19, 2025 17:21
Copy link
Member
@howardjohn howardjohn left a comment

Choose a reason for hiding this comment

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

Very nice! Excited to see this making progress (here and upstream)

- apiGroups: ["certificates.k8s.io"]
resources:
- "clustertrustbundles"
verbs: ["update", "create", "delete"]
Copy link
Member

Choose a reason for hiding this comment

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

can we scope to a single name (istio-ca-root-cert)? I think it should work but the per-name permissions are a little wonky in k8s so not certain

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will try it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

turns out just using resourceName does not work, but it works in conjunction with signerName. I am using that now

projected:
sources:
- clusterTrustBundle:
name: istio-ca-root-cert
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure the answer to this: are there plausible use cases where a user may deploy a cert + a trust bundle, and Istio just consumes that and doesn't create it?

Seems like 'maybe' and we can add that later without issue.

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 agree with 'maybe' being the answer here. For now, this only covers the simplest use cases where a) the internal CA is used with a self-signed cert generated by istiod or b) with a cert passed into istiod through the cacerts secret. In both cases, istiod will manage the ClusterTrustBundle. We might want to keep it that way to keep things simple - ie if you use an external CA to manage the cert/key, that only has to update the cacerts secret and not bother with ClusterTrustBundle

@@ -183,8 +183,16 @@ spec:
expirationSeconds: 43200
audience: istio-ca
- name: istiod-ca-cert
{{- if (.Values.env).ENABLE_CLUSTER_TRUST_BUNDLE_API }}
Copy link
Member

Choose a reason for hiding this comment

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

nit: the API here is a bit awkward since we enable it by setting an env var on the Ztunnel daemon, but ztunnel doesn't actually read the env var at all.

Given its for experimental enablement its not too bad, we are effectively making up for the fact we don't have a first class "feature flag" concept

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, I didn't want to add a global helm value for this as it's really not something we want to keep around anyway. honestly I would really appreciate first class feature flags, this stuff is always a bit hacky. As soon as a Pilot experimental flag needs to be known about by e.g. the gateways things become weird. Maybe we can pick up that discussion again

},
}

existing, err := c.client.Kube().CertificatesV1alpha1().ClusterTrustBundles().Get(context.Background(), istioClusterTrustBundleName, metav1.GetOptions{})
Copy link
Member

Choose a reason for hiding this comment

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

Typically we would read from the informer cache here. Given this is so low-traffic this isn't too important here, but given we do that in every other part of Istio its probably best for consistency (technically this approach is slightly less race-conditiony, but both are, so we need to be eventually consistent anyways)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

switched to informer cache

existing, err := c.client.Kube().CertificatesV1alpha1().ClusterTrustBundles().Get(context.Background(), istioClusterTrustBundleName, metav1.GetOptions{})
if err == nil {
// Update existing bundle
existing.Spec.TrustBundle = string(rootCert)
Copy link
Member

Choose a reason for hiding this comment

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

very nit: we could skip if its the same. For example, a new istiod on startup

Copy link
Contributor Author

Choose a reason for hiding this comment

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

comparing and skipping if equal now

@istio-testing istio-testing added the needs-rebase Indicates a PR needs to be rebased before being merged label Mar 22, 2025
@dgn dgn changed the title WIP: initial ClusterTrustBundle v1alpha1 support initial ClusterTrustBundle v1alpha1 support Mar 27, 2025
@istio-testing istio-testing removed the do-not-merge/work-in-progress Block merging of a PR because it isn't ready yet. label Mar 27, 2025
@dgn dgn force-pushed the clustertrustbundles branch from 4cbb525 to 47bd4fb Compare March 27, 2025 12:22
@istio-testing istio-testing removed the needs-rebase Indicates a PR needs to be rebased before being merged label Mar 27, 2025
Copy link
Member
@dhawton dhawton left a comment

Choose a reason for hiding this comment

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

nits to rn

- 43986
releaseNotes:
- |
**Added** experimental support for the v1alpha1 ClusterTrustBundle API. This can be enabled by setting `values.pilot.env.ENABLE_CLUSTER_TRUST_BUNDLE_API=true`. Note that you will have to make sure to also enable the respective feature gates in your cluster, see KEP-3257 (https://github.com/kubernetes/enhancements/tree/master/keps/sig-auth/3257-cluster-trust-bundles) for details.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
**Added** experimental support for the v1alpha1 ClusterTrustBundle API. This can be enabled by setting `values.pilot.env.ENABLE_CLUSTER_TRUST_BUNDLE_API=true`. Note that you will have to make sure to also enable the respective feature gates in your cluster, see KEP-3257 (https://github.com/kubernetes/enhancements/tree/master/keps/sig-auth/3257-cluster-trust-bundles) for details.
**Added** experimental support for the v1alpha1 `ClusterTrustBundle` API. This can be enabled by setting `values.pilot.env.ENABLE_CLUSTER_TRUST_BUNDLE_API=true`. Note that you will have to make sure to also enable the respective feature gates in your cluster, see [KEP-3257](https://github.com/kubernetes/enhancements/tree/master/keps/sig-auth/3257-cluster-trust-bundles) for details.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks! fixed

@istio-testing istio-testing added the needs-rebase Indicates a PR needs to be rebased before being merged label Apr 14, 2025
@dgn dgn force-pushed the clustertrustbundles branch from 3559b9d to fd134cf Compare April 15, 2025 07:36
@istio-testing istio-testing removed the needs-rebase Indicates a PR needs to be rebased before being merged label Apr 15, 2025
@dgn
Copy link
Contributor Author
dgn commented Apr 15, 2025

@howardjohn @dhawton, all comments have been addressed, PTAL

@dgn dgn force-pushed the clustertrustbundles branch from fd134cf to aee438a Compare April 15, 2025 19:29
Copy link
Member
@howardjohn howardjohn left a comment

Choose a reason for hiding this comment

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

Awesome work

@istio-testing istio-testing merged commit a10f865 into istio:master Apr 15, 2025
29 checks passed
@howardjohn
Copy link
Member

@dgn this broke postsubmit since ClusterTrustBundle is not a valid feature on old versions. We will need to modifythe prow config to only apply it for new versions.

In the past we have done this via different configs in prow/config and selecting in test-infra which is kind of a pain to maintain... maybe we want to make more support in the prow runner to conditionally enable a feature flag based on version

@dgn dgn deleted the clustertrustbundles branch April 16, 2025 07:14
@dgn
Copy link
Contributor Author
dgn commented Apr 16, 2025

@dgn this broke postsubmit since ClusterTrustBundle is not a valid feature on old versions. We will need to modifythe prow config to only apply it for new versions.

In the past we have done this via different configs in prow/config and selecting in test-infra which is kind of a pain to maintain... maybe we want to make more support in the prow runner to conditionally enable a feature flag based on version

I'll look into it. For now, I can just remove the additional kind config, as there is no integration test for ClusterTrustBundles anyway.

dgn added a commit to dgn/istio that referenced this pull request Apr 16, 2025
In istio#55592, the default prow config was changed to include support for
ClusterTrustBundles by default, which breaks on k8s<v1.27. This moves
the ClusterTrustBundle enablement into a separate config, as it's only
used in manual tests anyway. We can use the separate config when we
write an integration test.
istio-testing pushed a commit that referenced this pull request Apr 16, 2025
In #55592, the default prow config was changed to include support for
ClusterTrustBundles by default, which breaks on k8s<v1.27. This moves
the ClusterTrustBundle enablement into a separate config, as it's only
used in manual tests anyway. We can use the separate config when we
write an integration test.
arka-pramanik-hpe added a commit to Cray-HPE/cray-istio that referenced this pull request May 19, 2025
arka-pramanik-hpe added a commit to Cray-HPE/cray-istio that referenced this pull request May 30, 2025
* Revamped Chart Structure since Istio Operator is deprecated now
* Renamed cray-istio chart to cray-istio-ingress
* Removed charts cray-istio-deploy and cray-istio-operator
* Added charts cray-istio-base and cray-istio-pilot
* Updated version tags and images
* Updated LICENSES
* Support setting namespaces on gateway charts (istio/istio#32675)
* More consistent helm charts labels (istio/istio#52463)
* By default, exclude gateways from ambient mesh enrollment (istio/istio#54825)
* Upgrade docker-kubectl version
* Modify rbac and change jwtPolicy
* initial ClusterTrustBundle v1alpha1 support (istio/istio#55592)
* Update Image and App version to 1.26.0
* Add a check before accessing the Values
* Update chart values to comply with upstream
@zirain
Copy link
Member
zirain commented Jun 18, 2025

@dgn this required more work on rbac?

2025-06-18T02:41:41.419752Z	error	watch error in cluster Kubernetes: failed to list *v1alpha1.ClusterTrustBundle: clustertrustbundles.certificates.k8s.io "istio.io:istiod-ca:root-cert" is forbidden: User "system:serviceaccount:istio-system:istiod" cannot list resource "clustertrustbundles" in API group "
94B9
certificates.k8s.io" at the cluster scope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Initial ClusterTrustBundle v1alpha1 support
5 participants
0