Skip to content

Conversation

@andrewstucki
Copy link
Contributor

@andrewstucki andrewstucki commented Oct 27, 2025

This moves around CEL-based validations for various ClusterSource fields so that SourceCluster for ShadowLinks is partially mutable, mainly in order to allow for a shadow link's authentication block to its source cluster to be modified. On ShadowCluster and any other CRDs where we're creating a resource in the cluster, the ClusterSource is still fully immutable, additionally, TLS-settings and bootstrap servers of SourceCluster are immutable per the core implementation.

@andrewstucki
Copy link
Contributor Author

Looks like last week the fields we're intentionally considering immutable were made mutable: redpanda-data/redpanda#27986 -- looks like I'll need to update this.

Copy link
Contributor

@chrisseto chrisseto left a comment

Choose a reason for hiding this comment

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

Blocking on the validation rules (Pretty sure I've had enough coffee this morning...)

var ErrUnsupportedSASLMechanism = errors.New("unsupported SASL mechanism")

// KafkaAPISpec configures client configuration settings for connecting to Redpanda brokers.
// +kubebuilder:validation:XValidation:rule="has(self.tls) == has(oldSelf.tls)",message="kafka tls settings are immutable"
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't the reasoning for making authentication mutable also apply to TLS settings? e.g. what if I rotate my certs or fat finger a certificate name?

On the whole, I'm wonder if we should allow cluster source (Or at least the static configuration part) to be fully mutable for shadow links as shadowlinks themselves will perform the appropriate checks to make sure the underlying cluster hasn't changed.

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, so previously TLS and bootstrap servers were explicitly immutable in core. Now they aren't, so this should change.

That said, we still need to keep the target ShadowCluster immutable for the same reasons that we keep the other CRD ClusterSources immutable, we can only guarantee cleanup and consistency if we ensure you're referencing the same cluster between reconciliations.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense! Just to summarize: StaticConfig can generally be mutable (No strong opinion on brokers list) but cluster references should be immutable.

Any opinion on applying that to Topics/Schemas/Etc?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no real opinions initially, I kept them as immutable for now, because:

  1. that's how it's been
  2. this allows us to still clean things up properly in targeted clusters

The reason that the SourceCluster is fine being mutable in ShadowLinks is that basically the parameters are just used to initialize a connection in the ShadowCluster, there's basically nothing in the SourceCluster that actually knows about the ShadowCluster and it's treated as a read-only source. All of the configuration writes actually happen inside of the ShadowCluster so we can still clean that properly if we treat that as immutable.

@github-actions
Copy link

github-actions bot commented Nov 3, 2025

This PR is stale because it has been open 5 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the stale label Nov 3, 2025
@chrisseto chrisseto removed the stale label Nov 3, 2025
@andrewstucki andrewstucki merged commit 414bf9c into main Nov 3, 2025
10 checks passed
@andrewstucki andrewstucki deleted the as/modify-mutability-of-cluster-sources branch November 3, 2025 21:06
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.

3 participants