Skip to content

Commit d24d1d4

Browse files
committed
feat(kubernetes): run service ingress as a dedicated controller deployment
Move the service-ingress reconciler out of the gateway process into its own pod, as requested in review. The gateway now publishes its exposed-service hostname set into a feed ConfigMap (skipping the publication on persistence errors so a transient outage can never look like an empty set), and the chart deploys a one-replica controller running the gateway image's new service-ingress subcommand against the same configuration file. The controller reads the feed each pass: a missing or unreadable feed skips the pass, while an existing feed with an empty list is authoritative and deletes everything. - service_ingress: ExposedServiceSource now returns Option so feed absence never triggers deletions; add ServiceIngressFeedPublisher (create-or-update, unchanged-content skip, 409 retry convergence) and ConfigMapFeedSource (format-versioned, strict malformed-data refusal) - config: publish_config_map_name and publish_interval_secs fields with validation - cli: service-ingress subcommand behind the new openshell-server/service-ingress-controller feature, enabled by the gateway's compute-driver-kubernetes feature; shares the gateway TOML - helm: service-ingress Deployment (replicas value, shared config ConfigMap), dedicated controller ServiceAccount, controller Role (feed reads + all ingress kinds), and a publisher Role for the gateway ServiceAccount pinned to the feed object — the gateway SA no longer holds any ingress-object permissions - hostnames() is now fallible so the publisher distinguishes store outages from empty sets Also resolves the clippy -D warnings fallout across the touched files (doc backticks, merged bounds, is_some_and). Signed-off-by: Jesse Jaggars <jjaggars@redhat.com>
1 parent e6f91c0 commit d24d1d4

21 files changed

Lines changed: 959 additions & 181 deletions

‎Cargo.lock‎

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎crates/openshell-driver-kubernetes/src/config.rs‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ pub enum ServiceIngressKind {
453453
#[default]
454454
Route,
455455
/// Gateway API `HTTPRoute` attached to the configured parent `Gateway`.
456-
/// The canonical wire value is `http_route` (snake_case, matching every
456+
/// The canonical wire value is `http_route` (`snake_case`, matching every
457457
/// other config key); the Helm chart surfaces `httproute` (matching the
458458
/// Kubernetes kind) and passes it through verbatim, so that spelling is
459459
/// accepted as an alias.
@@ -469,7 +469,7 @@ pub enum ServiceIngressKind {
469469
/// When enabled, the gateway periodically lists its exposed service
470470
/// hostnames and ensures one ingress object of the configured kind exists
471471
/// per hostname, targeting the gateway's own Service. Objects are labeled as
472-
/// OpenShell-managed and orphaned entries are removed.
472+
/// `OpenShell`-managed and orphaned entries are removed.
473473
#[derive(Debug, Clone, Serialize, Deserialize)]
474474
#[serde(default, deny_unknown_fields)]
475475
pub struct ServiceIngressConfig {
@@ -495,6 +495,12 @@ pub struct ServiceIngressConfig {
495495
/// `target_service_namespace`.
496496
#[serde(skip_serializing_if = "Option::is_none")]
497497
pub http_route_parent_namespace: Option<String>,
498+
/// Name of the `ConfigMap` the gateway publishes the exposed-hostname
499+
/// feed into. The dedicated service-ingress controller watches the same
500+
/// object. Required when enabled.
501+
pub publish_config_map_name: String,
502+
/// Seconds between gateway feed publications.
503+
pub publish_interval_secs: u64,
498504
/// Seconds between reconciliation passes.
499505
pub poll_interval_secs: u64,
500506
}
@@ -510,6 +516,8 @@ impl Default for ServiceIngressConfig {
510516
ingress_class: None,
511517
http_route_parent_gateway: None,
512518
http_route_parent_namespace: None,
519+
publish_config_map_name: String::new(),
520+
publish_interval_secs: 5,
513521
poll_interval_secs: 15,
514522
}
515523
}
@@ -635,6 +643,12 @@ impl KubernetesComputeConfig {
635643
if ingress.poll_interval_secs == 0 {
636644
return Err("service_ingress requires a non-zero poll_interval_secs".into());
637645
}
646+
if ingress.publish_config_map_name.is_empty() {
647+
return Err("service_ingress requires publish_config_map_name".into());
648+
}
649+
if ingress.publish_interval_secs == 0 {
650+
return Err("service_ingress requires a non-zero publish_interval_secs".into());
651+
}
638652
Ok(())
639653
}
640654

0 commit comments

Comments
 (0)