Skip to content

Conversation

@doy-materialize
Copy link
Contributor

Motivation

simplify our resource management (this should help ensure balancer stuff is decoupled from the environmentd rollout code)

Tips for reviewer

sorry about the size - most of this is just moving code around but it wasn't really easy to make a single pr smaller than this

Checklist

  • This PR has adequate test coverage / QA involvement has been duly considered. (trigger-ci for additional test/nightly runs)
  • This PR has an associated up-to-date design doc, is a design doc (template), or is sufficiently small to not require a design.
  • If this PR evolves an existing $T ⇔ Proto$T mapping (possibly in a backwards-incompatible way), then it is tagged with a T-proto label.
  • If this PR will require changes to cloud orchestration or tests, there is a companion cloud PR to account for those changes that is tagged with the release-blocker label (example).
  • If this PR includes major user-facing behavior changes, I have pinged the relevant PM to schedule a changelog post.

@doy-materialize doy-materialize requested a review from a team as a code owner December 4, 2025 16:06
Base automatically changed from push-wtyxknkkzltv to main December 5, 2025 20:14
Copy link
Contributor

@jubrad jubrad left a comment

Choose a reason for hiding this comment

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

I think we should add an orchestratord test for this.
test/orchestratord/mzcompose.py

Perhaps not now, but at some point we'll also want to update our automatic doc generation to include balancerd and console

#[serde(rename_all = "camelCase")]
pub struct StaticRoutingConfig {
pub environmentd_namespace: String,
pub environmentd_service_name: String,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we be able to determine this from the environment name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not in general - we have a specific naming convention in cloud, but it's not required for self-managed

Comment on lines +25 to +29
#[derive(Clone, Debug)]
pub enum Routing<'a> {
Static(&'a StaticRoutingConfig),
Frontegg(&'a FronteggRoutingConfig),
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think something like UpstreamTargetting might be more in line with the terminology used in proxies.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should i also change the field names? pub static_upstream_targetting: Option<StaticUpstreamTargettingConfig> or something like that?

Comment on lines +38 to +42
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize, JsonSchema)]
#[serde(rename_all = "camelCase")]
pub struct FronteggRoutingConfig {
// TODO
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this needed before we merge, or just before we adopt the new model in cloud?

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 think we can wait to figure this out for a future pr

Comment on lines +79 to +82
// Configuration for statically routing traffic
pub static_routing: Option<StaticRoutingConfig>,
// Configuration for routing traffic via Frontegg
pub frontegg_routing: Option<FronteggRoutingConfig>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these exclusive? If so should this be an enum?

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 was considering that but i'm not super sure how tagged union style enums work in the context of a crd (like how would it look in the resource yaml?), and we're also already deriving Default on the crd struct which would also be awkward (we could probably change that but not sure what else that would require). i imagine we're probably going to be iterating on all of these crds going forward, i'm not super worried about being able to write the migration logic or something like that if necessary in the future.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair enough. Would it be worth clarifying that this resource is in development... clearly the resource is v1alpha1 but that might be a bit undercut by the materialize CRD also being v1alpha1.

Comment on lines +150 to +164
fn create_external_certificate_object(&self, balancer: &Balancer) -> Option<Certificate> {
create_certificate(
self.config
.default_certificate_specs
.balancerd_external
.clone(),
balancer,
balancer.spec.external_certificate_spec.clone(),
balancer.external_certificate_name(),
balancer.external_certificate_secret_name(),
None,
CertificatePrivateKeyAlgorithm::Rsa,
Some(4096),
)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Not for this PR but I would love it if this was configurable so we could use ed25519 here, I think it would drastically reduce CPU usage on balancers.. I think this PR will make making that configurable way easier.

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, that would definitely be nice!

@doy-materialize
Copy link
Contributor Author

we already have tests that the balancerd pods are created correctly - is there something specific you think we should test about the crd?

@jubrad
Copy link
Contributor

jubrad commented Dec 9, 2025

we already have tests that the balancerd pods are created correctly - is there something specific you think we should test about the crd?

I was thinking a test that explicitly created the balancerd CR, but perhaps something that does some validation of the CR that gets created, or ensure delete logic cleans up assoicated CRs and sub resources.

@doy-materialize doy-materialize requested a review from a team as a code owner December 9, 2025 22:15
@doy-materialize doy-materialize force-pushed the push-zokpppwmvvrp branch 2 times, most recently from 35c28b5 to 6d2d9bb Compare December 9, 2025 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants