Skip to content

feat: add connectors.iroh config block and validation#146

Merged
zachsmith1 merged 2 commits intomainfrom
feat/iroh-connector-config
Apr 30, 2026
Merged

feat: add connectors.iroh config block and validation#146
zachsmith1 merged 2 commits intomainfrom
feat/iroh-connector-config

Conversation

@zachsmith1
Copy link
Copy Markdown
Contributor

@zachsmith1 zachsmith1 commented Apr 30, 2026

Summary

  • Introduces connector.iroh configuration in NetworkServicesOperator. When dnsEnabled is true the (upcoming) iroh DNS discovery controller will publish <recordPrefix>.<z32-endpoint-id>.<baseDomain> TXT records into a downstream DNSZone for every Connector whose ConnectorClass is routed to iroh.
  • Block fields:
    • dnsEnabled (default false)
    • downstreamKubeconfigPath — path to a kubeconfig file pointing at the cluster where DNSRecordSets are written. Empty falls back to the operator's own in-cluster config (matches existing DiscoveryKubeconfigPath / ProjectKubeconfigPath pattern).
    • dnsZoneRef (namespace, name)
    • recordPrefix (default "_iroh")
    • baseDomain (required when dnsEnabled is true)
    • ttlSeconds (default 30)
  • IrohConnectorConfig.DownstreamRestConfig() helper builds the rest.Config for the downstream cluster, mirroring DiscoveryConfig.DiscoveryRestConfig.
  • Adds a Validate() entrypoint on NetworkServicesOperator and wires it into cmd/main.go where the previous TODO(jreese) validate the config lived. Only Connector.Iroh is checked today; future rules can extend the same dispatch. Validation only fires when dnsEnabled is true, so existing deployments are unaffected.
  • Regenerated zz_generated.deepcopy.go and zz_generated.defaults.go via make generate.

Test plan

  • go test ./internal/config/... — passes (defaulting + every required-field-missing case + aggregated-error case + iroh-disabled no-op + path-optional fallback).
  • go build ./... — clean.
  • go vet ./... — clean.
  • gofmt -l — no diff.
  • Reviewer: confirm config field names align with connectors.<type>.* pattern we agreed on for future siblings.

Adds a new IrohConnectorConfig under connector.iroh that gates the
upcoming iroh DNS discovery controller. When dnsEnabled is true the
controller will publish "<recordPrefix>.<z32-endpoint-id>.<baseDomain>"
TXT records into a downstream DNSZone for every Connector backed by an
iroh-routed ConnectorClass.

The block carries:
- DNSEnabled (default false)
- DownstreamCluster.KubeconfigSecretRef pointing at the cluster where
  DNSRecordSets are written
- DNSZoneRef identifying the zone that owns the names
- RecordPrefix (default "_iroh") and BaseDomain
- TTLSeconds (default 30)

Also introduces a Validate() entrypoint on NetworkServicesOperator and
wires it into cmd/main.go where the previous "TODO(jreese) validate the
config" lived. Today only Connector.Iroh is checked; future cross-field
rules can extend the same dispatch. Validation only fires when
DNSEnabled is true, so existing deployments are unaffected.

No controller behavior is registered yet — that lands in a follow-up.
Replace the IrohDownstreamClusterConfig / IrohKubeconfigSecretRef
nesting with a single DownstreamKubeconfigPath field on
IrohConnectorConfig, matching the existing DiscoveryConfig pattern
(DiscoveryKubeconfigPath / ProjectKubeconfigPath). Empty path falls
back to the operator's own in-cluster config — supports single-cluster
deployments with no extra knobs.

Adds a DownstreamRestConfig() helper that builds the rest.Config the
upcoming controller will use, mirroring DiscoveryConfig.DiscoveryRestConfig.

Validation no longer flags missing kubeconfig fields since the empty
fallback is intentional.

Regenerated zz_generated.{deepcopy,defaults}.go via make generate.
@zachsmith1 zachsmith1 requested a review from scotwells April 30, 2026 22:24
Copy link
Copy Markdown
Contributor

@scotwells scotwells left a comment

Choose a reason for hiding this comment

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

Think it would make more sense to invert the dependency here? Probably cleaner to have a component that's Iroh specific that understands how to discover iroh connectors and publish DNS information instead of the network services operator knowing those details.

@zachsmith1
Copy link
Copy Markdown
Contributor Author

@scotwells mind elaborating more on what you mean here?

@scotwells
Copy link
Copy Markdown
Contributor

I just mean that this doesn't seem like it should be network operators concern long term since it's specific to iroh

@zachsmith1
Copy link
Copy Markdown
Contributor Author

hmmm. its connector implementation specifically for iroh but def worth thinking about how this grows when other providers are there in the future.

@zachsmith1 zachsmith1 merged commit 27e1446 into main Apr 30, 2026
11 checks passed
@zachsmith1 zachsmith1 deleted the feat/iroh-connector-config branch April 30, 2026 23:01
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.

2 participants