Skip to content

Scopes API

ApplicationScope Schema

scopes:
  - scopeRef:             # Scope reference
      apiVersion: string # API version
      kind: string       # Scope kind
      name: string       # Scope name
    properties:          # Scope properties
      key: value

ScopeKind Values

Kind Description
networkscope.nomad.oam.dev Network configuration
nodepool.nomad.oam.dev Node pool targeting
namespace.nomad.oam.dev Namespace isolation

NetworkScope

scopeRef:
  kind: networkscope.nomad.oam.dev
  name: string
properties:
  networkMode: string   # bridge, host, overlay
  subnet: string       # Network subnet
  dnsServers: []string # DNS servers
  serviceMesh: bool    # Enable Consul Connect
  connectSidecar: bool # Inject sidecar

NodePoolScope

scopeRef:
  kind: nodepool.nomad.oam.dev
  name: string
properties:
  poolName: string      # Node pool name
  datacenter: []string # Datacenters
  nodeClass: string   # Node class
  constraints: []Constraint # Additional constraints

Constraint

constraints:
  - attribute: string  # Node attribute
    operator: string  # =, !=, >, <, >=, <=
    value: string    # Constraint value

NamespaceScope

scopeRef:
  kind: namespace.nomad.oam.dev
  name: string
properties:
  namespace: string  # Nomad namespace
  quota: string     # Resource quota

Examples

Network Scope

scopes:
  - scopeRef:
      apiVersion: core.oam.dev/v1alpha2
      kind: networkscope.nomad.oam.dev
      name: production-network
    properties:
      networkMode: bridge
      serviceMesh: true
      connectSidecar: true

Node Pool Scope

scopes:
  - scopeRef:
      apiVersion: core.oam.dev/v1alpha2
      kind: nodepool.nomad.oam.dev
      name: compute-pool
    properties:
      poolName: production-pool
      datacenter:
        - dc1
        - dc2
      nodeClass: compute-optimized
      constraints:
        - attribute: "${meta.gpu}"
          operator: "="
          value: "true"

Namespace Scope

scopes:
  - scopeRef:
      apiVersion: core.oam.dev/v1alpha2
      kind: namespace.nomad.oam.dev
      name: production-ns
    properties:
      namespace: ecommerce-prod
      quota: large-quota

Combined Scopes

spec:
  components:
    - name: web
      type: webservice
      properties:
        image: nginx:latest

  scopes:
    - scopeRef:
        kind: networkscope.nomad.oam.dev
        name: prod-network
      properties:
        networkMode: bridge
        serviceMesh: true

    - scopeRef:
        kind: nodepool.nomad.oam.dev
        name: prod-pool
      properties:
        poolName: production-pool
        datacenter:
          - dc1

    - scopeRef:
        kind: namespace.nomad.oam.dev
        name: prod-ns
      properties:
        namespace: production