Skip to content

feat(adapter-service): single and multi deployment modes on role network (#55, #66) - #87

Open
kelvinprabhu wants to merge 10 commits into
developmentfrom
feat/55-run-a-single-adapter-through-the-helm-charts
Open

kelvinprabhu wants to merge 10 commits into
developmentfrom
feat/55-run-a-single-adapter-through-the-helm-charts

Conversation

@kelvinprabhu

@kelvinprabhu kelvinprabhu commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #55 · Refs #66, OpenAgriNet/network-adapter#55 · Parent: OpenAgriNet/engineering-tracker#171

Objective

Run the network adapter as one release by default, without a new role or namespace.

Solution

  • networkAdapterDeploymentMode (single default | multi), read only by role network.
  • Single: one release runs the consumer, network and provider tiers as modules; tier hops stay inside the pod.
  • Multi: the existing three releases; pass --set networkAdapterDeploymentMode=multi.
  • Tier keys via networkTierKeys, defaulting to the openbao-secrets Secret names.

Split from #75: docker compose in #88, docs and setup guide in #89 (merge with or after this PR).

…ork (#55, #66)

Role network now reads networkAdapterDeploymentMode (single | multi,
default single). In single it runs the consumer, network and provider
tiers as four modules of one adapter (/<action>, /publish,
/_internal/network/, /_internal/provider/) on port 9201; in multi it is
the network tier alone and provider and consumer run one release each.
provider and consumer ignore the value; any other value fails the render.

- No new role and no new namespace: both modes release network-adapter
  into namespace network-adapter, so switching modes upgrades it in place.
- Single mode: config/network-adapter-config.yaml, routing generated at
  render time from config/routing-*.yaml with tier hops on
  localhost:<targetPort>/_internal/<tier>, one identity per tier from
  networkAdapterLayer.keys, and render guards (private keys, http.port vs
  targetPort, ingress path shape).
- startupProbe, renamed liveness/readiness probe keys, PDB, topology
  spread and graceful shutdown settings; unused helpers removed.
- examples/network-adapter.yaml (single) and examples/network.yaml (multi);
  CI values for both.
- openbao-secrets: consumer-adapter-keys, provider-adapter-keys and
  provider-upstream also mirror into network-adapter for single mode.
- docs/adr: ADR-0001 records the decision; ADR template and index.

BREAKING: a role network release without
networkAdapterDeploymentMode: multi becomes single on upgrade (the render
fails until networkAdapterLayer.keys are set). The probes.* values keys
are renamed. See charts/adapter-service/CHANGELOG.md (0.6.0).
…s to two lines (#55, #66)

README, CHANGELOGs and docs/adr move to docs/55-network-adapter-deployment-modes.
Comments added for the single/multi modes are cut to two lines; the reasoning
is in ADR-0001's implementation notes. No rendered output changes.
Comment thread charts/adapter-service/values.yaml Outdated
Comment thread charts/adapter-service/Chart.yaml Outdated
Comment thread charts/adapter-service/templates/NOTES.txt Outdated
Comment thread charts/adapter-service/templates/NOTES.txt Outdated
Comment thread charts/adapter-service/templates/deployment.yaml
Comment thread charts/adapter-service/templates/_helpers.tpl
Comment thread charts/adapter-service/examples/network.yaml Outdated
Comment thread charts/adapter-service/ci/lint-values.yaml Outdated
…templates (#55, #66)

- networkAdapterDeploymentMode is set only in values.yaml; examples and CI
  values no longer set it (multi installs pass --set ...=multi).
  ci/lint-values.yaml renders role provider.
- Drop topologySpreadConstraints, terminationGracePeriodSeconds,
  preStopSleepSeconds and goMemLimit, and the scaling/PDB extras in the
  single-mode example and CI values.
- Rename isNetworkAdapterLayer to singleMode; each template computes it once.
- Chart description is one line; NOTES single-mode text cut down.
- Restore the helpers removed earlier in _helpers.tpl.
…ults (#55, #66)

- adapter-service.deploymentMode is the only mode helper: the configured mode
  for role network, multi for provider and consumer. singleMode is removed.
- networkAdapterLayer becomes networkTierKeys, defaulting to the Secret names
  openbao-secrets creates; the example and CI values no longer list them.
- Helpers renamed without "layer": tierSecret, checkTierKeys, singleRouting.
- ci/lint-values.yaml restored as on development; it renders single mode.
Comment thread charts/adapter-service/ci/lint-values.yaml
Comment thread charts/adapter-service/templates/_network-adapter.tpl
Comment thread charts/adapter-service/templates/_network-adapter.tpl Outdated

@kelvinprabhu kelvinprabhu left a comment •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Self - Verified @manjudr

, #66)

tierSecret, checkTierKeys and singleRouting become networkTierSecret, networkCheckTierKeys and networkSingleRouting.
kelvinprabhu added a commit that referenced this pull request Oct 22, 2026
- charts/adapter-service/SETUP.md: guidelines, then single and multi steps
  (Secrets, install, check), the openbao-secrets changes multi needs,
  switching, and a symptom table. Steps verified on k3d.
- charts/adapter-service/README.md rewritten short: roles, modes, the three
  values the render really requires, the identity Secret, key rotation;
  install steps live in SETUP.md.
- quick-start/README.md: "Two modes" rewritten as guidelines; single-mode log
  checks; publish example on 9201 (multi: 9200).
- CHANGELOG and ADR-0001 follow #87 and #88: networkTierKeys with default
  Secret names, lint-values back to role network, the single template is an
  exact copy of the tier modules.
…es (#55, #66)

In single mode the chart adds networkTierKeys.upstreamSecret (default
provider-upstream) to envFrom itself, so examples/network.yaml serves both
modes and switching is only:

  --set networkAdapterDeploymentMode=single|multi

- templates/deployment.yaml: append the upstream Secret to envFrom in single mode.
- values.yaml: networkTierKeys.upstreamSecret.
- examples/network-adapter.yaml removed; its single render is identical to
  examples/network.yaml with the default mode.

Refs: #55, #66, OpenAgriNet/network-adapter#55, OpenAgriNet/engineering-tracker#171
@kelvinprabhu

Copy link
Copy Markdown
Collaborator Author

@manjudr a naming mismatch on development that this PR runs into. Your call on how to fix it.

What: the provider's upstream credentials Secret has two names.

  • charts/openbao-secrets/values.yaml creates provider-upstream (in provider-adapter).
  • charts/adapter-service/examples/provider.yaml reads provider-adapter-upstream (envFromSecrets), which nothing creates.

So a standalone provider release from the example waits on a Secret that never appears (pod stuck in ContainerCreating).

Why: history, not design.

  1. f4fcf23 (2026-09-08, chart generalised to three roles) wrote the example with provider-adapter-upstream, before any secrets chart created it.
  2. 2c54009 (2026-09-18, config from a file per role) added the Secret to the secrets chart as provider-upstream, but did not update examples/provider.yaml.
  3. b41f9f8 / cba17bf (#166) carried provider-upstream over to openbao-secrets.

In this PR: single mode loads provider-upstream (networkTierKeys.upstreamSecret), the name openbao-secrets creates. examples/provider.yaml is unchanged, and SETUP.md (#89) notes the mismatch.

Options:

  1. Change examples/provider.yaml to provider-upstream, a one-line fix, here or in a separate PR.
  2. Rename the openbao-secrets entry to provider-adapter-upstream, which also changes manage-secrets.py and the OpenBao entry.
  3. Leave it and keep the note.

Which do you prefer?

Comment thread charts/adapter-service/values.yaml Outdated

# Single mode only: one key Secret per tier (six keys each, as under keys.existingSecret),
# named as openbao-secrets creates them. routing.config and handler.* are unused.
networkTierKeys:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

rename
networkTierKeys: to adaptorKeys

Comment thread charts/adapter-service/values.yaml Outdated
# Single mode only: one key Secret per tier (six keys each, as under keys.existingSecret),
# named as openbao-secrets creates them. routing.config and handler.* are unused.
networkTierKeys:
consumer: consumer-adapter-keys

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

consumer to consumer-adaptor consistent naming across .. even for network and provider

@@ -1,11 +1,13 @@
# ===========================================================================
# network role -- the network layer of the Beckn network.
# network role. networkAdapterDeploymentMode decides: single (default) runs all
# three tiers; multi runs the network tier alone.
#

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

can we make the role as network-adaptor consistence across all | check any breakage and tell how many files that may need to change

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

its not only here have change for consumer and provider as well

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

mode switch change as suggested across all

Comment thread charts/adapter-service/values.yaml Outdated
Comment on lines +40 to +41
# A multi network release must set multi. provider and consumer ignore it.
networkAdapterDeploymentMode: single

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

make it as only DeploymentMode:
and change the mode naming single to single-adaptor || multi-adaptor

modules:
# consumer: unsigned app calls at / (the catch-all mount, on purpose: see ADR-0001);
# discover to /_internal/network, transactions to /_internal/provider.
- name: consumer

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

make as consumer adaptor

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

make a two sub folders named /multi-adaptor and single adaptor and keep the code there

…folders (#55, #66)

Addresses review 5627183696:
- Roles are consumer-adapter, network-adapter and provider-adapter. The old
  names consumer, network and provider are still accepted and render the same.
- networkAdapterDeploymentMode becomes deploymentMode: single-adapter
  (default) | multi-adapter.
- networkTierKeys becomes adapterKeys, keyed consumer-adapter, network-adapter,
  provider-adapter (plus upstreamSecret, extraSubstitutions).
- Single config modules: consumer-adapter, network-adapter, oanProvider,
  oanProviderPublish (the names the multi configs already use).
- Configs move to config/single-adapter/ and config/multi-adapter/.
- Examples and CI values use the new role names.

Multi, standalone consumer/provider and otel CI renders are unchanged; single
differs only in module names and comment text.

Refs: #55, #66, OpenAgriNet/network-adapter#55, OpenAgriNet/engineering-tracker#171
kelvinprabhu added a commit that referenced this pull request Oct 23, 2026
…#55, #66)

Follows the #87 and #88 review fixes:
- Roles consumer-adapter / network-adapter / provider-adapter (old names still
  work), deploymentMode single-adapter | multi-adapter, adapterKeys.
- Chart configs under config/single-adapter/ and config/multi-adapter/;
  quick-start templates under config/adapters/single-adapter/ and multi-adapter/.
- Module names consumer-adapter, network-adapter, oanProvider, oanProviderPublish.
- quick-start: make up / make up-core, MODE=multi for multi.

Refs: #55, #66, OpenAgriNet/network-adapter#55, OpenAgriNet/engineering-tracker#171
…66)

The previous commit (edf15db) pushed only the moves into config/single-adapter/
and config/multi-adapter/. This adds the template, values, example and CI
changes it describes, so the chart renders again.

Refs: #55, #66, OpenAgriNet/network-adapter#55, OpenAgriNet/engineering-tracker#171
@kelvinprabhu

Copy link
Copy Markdown
Collaborator Author

Review 5627183696 addressed in edf15db + cacb5c9 (docs in #89, 2a82193).

  • Roles: consumer-adapter, network-adapter, provider-adapter. The old names consumer, network, provider still render identically, so existing values files (including infra-automation) don't break. The rename touched 13 chart files.
  • Mode: deploymentMode: single-adapter (default) | multi-adapter, replacing networkAdapterDeploymentMode.
  • Keys: adapterKeys.{consumer-adapter, network-adapter, provider-adapter}, replacing networkTierKeys.
  • Modules (single config): consumer-adapter, network-adapter, oanProvider, oanProviderPublish, the names the multi configs already use.
  • Folders: config/single-adapter/ and config/multi-adapter/.
  • Examples and CI: consumer, network and provider all use the new names.

Checks:

  • Multi, standalone consumer/provider and the otel CI render are unchanged. Single differs only in module names and comment text.
  • Lint passes.
  • k3d demo: single → multi → single, publish/discover/select 200, unsigned /_internal 401.

Refs #55 #66 · OpenAgriNet/network-adapter#55 · OpenAgriNet/engineering-tracker#171

Comment thread charts/adapter-service/examples/consumer-adapter.yaml
…#66)

Addresses review 5627785485: examples/consumer.yaml, network.yaml and
provider.yaml become consumer-adapter.yaml, network-adapter.yaml and
provider-adapter.yaml, matching the role names. Example headers and
values.yaml comments follow.

Refs: #55, #66, OpenAgriNet/network-adapter#55, OpenAgriNet/engineering-tracker#171
kelvinprabhu added a commit that referenced this pull request Oct 23, 2026
#66)

- SETUP.md, README and the 0.6.0 CHANGELOG use examples/consumer-adapter.yaml,
  network-adapter.yaml and provider-adapter.yaml (#87).
- quick-start README: routing files live in config/adapters/multi-adapter/ and
  single-adapter/ (#88).

Refs: #55, #66, OpenAgriNet/network-adapter#55, OpenAgriNet/engineering-tracker#171

@kelvinprabhu kelvinprabhu left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@manjudr made changes as per the demo review comments and verified

…nt fixes (#55, #66)

From the code review:
- Single-adapter ingress refuses any snippet, rewrite or regex annotation
  (e.g. configuration-snippet, server-snippet, another controller's
  rewrite-target), not only nginx use-regex and rewrite-target; any of them
  can route a request onto /_internal or /publish.
- network-adapter-config.yaml: the Vistaar token URL comment names
  adapterKeys.extraSubstitutions (was the old networkAdapterLayer key).
- values.yaml: otel.serviceName comment says only the uncalled
  otelServiceName helper reads it.

Refs: #55, #66, OpenAgriNet/network-adapter#55, OpenAgriNet/engineering-tracker#171

@kelvinprabhu kelvinprabhu left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done

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.

1 participant