Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions cmd/galactic-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ type options struct {
edgeMaxSkew time.Duration
edgeIngressIDs []string
edgeIngressPrefix string
edgeVIPPrefixes []string
}

func main() {
Expand Down Expand Up @@ -118,9 +119,10 @@ func newRootCommand() *cobra.Command {
f.StringVar(&o.platformProject, "platform-project", "", "Fabric role: platform project for IPAM")
f.StringVar(&o.ipamKubeconfig, "ipam-kubeconfig", "", "Fabric role: IPAM cluster kubeconfig")
f.StringVar(&o.hubKubeconfig, "hub-kubeconfig", "", "Fabric role: federation hub kubeconfig")
f.BoolVar(&o.edge, "edge", false, "Cell role: admit, allocate and drain Galactic Edge attachments, and "+
"accept and revoke their route claims (requires the edge CRDs and config/galactic-edge applied first; "+
"a deleted attachment is held until galactic-edge on its node reports it released, or the node is removed)")
f.BoolVar(&o.edge, "edge", false, "Cell role: admit, allocate and drain Galactic Edge attachments, "+
"accept and revoke their route claims, and serve public listeners (requires the edge CRDs and "+
"config/galactic-edge applied first; a deleted attachment is held until galactic-edge on its node "+
"reports it released, or the node is removed)")
f.DurationVar(&o.edgeMaxSkew, "edge-max-skew", 2*time.Second,
"Cell role: maximum wall-clock error of any node; an EdgeService stops admitting this long before its "+
"validUntil. It must equal galactic-edge's --max-skew")
Expand All @@ -130,6 +132,9 @@ func newRootCommand() *cobra.Command {
f.StringVar(&o.edgeIngressPrefix, "edge-ingress-prefix", "",
"Cell role with --edge: IPv6 unique local prefix, /64 or shorter, from which each ingress gVPC takes a /64; "+
"required with --edge-ingress-identity")
f.StringSliceVar(&o.edgeVIPPrefixes, "edge-listener-vip-prefixes", nil,
"Cell role with --edge: comma-separated IPv6 and IPv4 prefixes of the cell's gateway VIPs; an EdgeListener "+
"address outside them is refused with AddressOutsidePool, as is every address when none are given")
logOpts.BindFlags(cmd.PersistentFlags())
return cmd
}
Expand Down Expand Up @@ -233,9 +238,13 @@ func setupListeners(mgr ctrl.Manager, o *options) error {
if len(identities) > 0 && !prefix.IsValid() {
return errors.New("--edge-ingress-prefix is required with --edge-ingress-identity")
}
vips, err := edgelistener.ParseVIPPrefixes(o.edgeVIPPrefixes)
if err != nil {
return fmt.Errorf("--edge-listener-vip-prefixes: %w", err)
}
if err := edgelistener.Setup(mgr, edgelistener.Config{
Namespace: galactic.SystemNamespace, Identities: identities, IngressPrefix: prefix,
Events: mgr.GetEventRecorder("galactic-controller"),
Namespace: galactic.SystemNamespace, Identities: identities, IngressPrefix: prefix, VIPPrefixes: vips,
MaxSkew: o.edgeMaxSkew, LeaseDuration: timing.Params.Duration, Events: mgr.GetEventRecorder("galactic-controller"),
}); err != nil {
return fmt.Errorf("set up edge listeners: %w", err)
}
Expand Down
21 changes: 15 additions & 6 deletions config/galactic-edge/controller-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ rules:
- apiGroups: [galactic.datumapis.com]
resources: [bgpvrfinstances]
verbs: [get, list, watch]
# Listener admission reads every EdgeListener; its writes are in the
# galactic-controller-edge-listener Role.
- apiGroups: [galactic.datumapis.com]
resources: [edgelisteners]
verbs: [get, list, watch]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand Down Expand Up @@ -151,12 +156,13 @@ subjects:
name: galactic-controller
namespace: galactic-system
---
# Public listeners: one ingress gVPC per provider holding PublicListener,
# created in the gateway namespace with its fabric identifier in status,
# and deleted once its provider may no longer hold a listener and no
# EdgeService references it. Kubernetes RBAC cannot scope a create by name,
# so the Role covers every VPC in the gateway namespace, though core writes
# only those labelled galactic.datumapis.com/edge-ingress.
# Public listeners, all in the gateway namespace: one ingress gVPC per
# provider holding PublicListener, created with its fabric identifier in
# status and deleted once its provider may no longer hold a listener and no
# EdgeService references it, and each EdgeListener's status. Kubernetes RBAC
# cannot scope a create by name, so the Role covers every VPC in the
# namespace, though core writes only those labelled
# galactic.datumapis.com/edge-ingress.
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
Expand All @@ -169,6 +175,9 @@ rules:
- apiGroups: [galactic.datumapis.com]
resources: [vpcs/status]
verbs: [get, update, patch]
- apiGroups: [galactic.datumapis.com]
resources: [edgelisteners/status]
verbs: [patch]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
Expand Down
23 changes: 12 additions & 11 deletions docs/controller/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| NSO cell manager | VPC, subnet-status and attachment reconciliation, attachment identifiers and NetworkAttachmentDefinitions when Galactic integration is enabled |
| `galactic-controller --role=cell` | TrafficPolicy admission, default policies and binding resolution; pod-interface injection; projection of BGP programming status to attachments and NSO interfaces/claims; [running instances' attachment state](../observability/vpc-attachments.md) |
| `galactic-controller --role=cell --edge` | The cell role plus admission, allocation and draining of Edge attachments and acceptance/revocation of Edge route claims |
| `galactic-controller --role=cell --edge` | The cell role plus admission, allocation and draining of Edge attachments, acceptance/revocation of Edge route claims, and public listeners: ingress gVPCs, `EdgeListener` admission and status |
| `galactic-controller --role=fabric` | Central NetworkFabricIdentity allocation using the federation hub and platform IPAM |
| `galactic-router` | Node BGP and traffic-policy programming and node-owned status |
| `galactic-edge` | Node-side Edge attachment programming, fencing and release |
Expand All @@ -31,15 +31,16 @@ Logging takes `--log-level` (`LOG_LEVEL`) and the standard `--zap-*` flags; see

## Cell flags

| Flag | Default | Meaning |
| ------------------------- | ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--webhook-port` | `9443` | Admission webhook listener |
| `--webhook-cert-dir` | `/tmp/k8s-webhook-server/serving-certs` | Directory containing `tls.crt` and `tls.key` |
| `--controller-username` | `system:serviceaccount:<namespace>:galactic-controller` | Identity allowed to write the reserved default policy |
| `--edge` | `false` | Enable Edge attachment and route controllers after their CRDs and admission prerequisites are installed |
| `--edge-max-skew` | `2s` | Maximum assumed clock error; must match `galactic-edge --max-skew` |
| `--edge-ingress-identity` | none | With `--edge`: `<provider>=<identity>`, the decimal fabric VPC identity of a provider's ingress gVPC. Repeat it or separate entries with commas. A provider that holds `PublicListener` without one gets no ingress gVPC, and an Event on the `EdgeProvider` says so. An identity another VPC already holds is not recorded: the ingress gVPC reports `Ready` False with reason `IdentityInUse` |
| `--edge-ingress-prefix` | none | With `--edge`: IPv6 unique local prefix, `/64` or shorter, from which each ingress gVPC takes a `/64`. Required with `--edge-ingress-identity` |
| Flag | Default | Meaning |
| ------------------------------ | ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--webhook-port` | `9443` | Admission webhook listener |
| `--webhook-cert-dir` | `/tmp/k8s-webhook-server/serving-certs` | Directory containing `tls.crt` and `tls.key` |
| `--controller-username` | `system:serviceaccount:<namespace>:galactic-controller` | Identity allowed to write the reserved default policy |
| `--edge` | `false` | Enable Edge attachment, route and public listener controllers after their CRDs and admission prerequisites are installed |
| `--edge-max-skew` | `2s` | Maximum assumed clock error; must match `galactic-edge --max-skew` |
| `--edge-ingress-identity` | none | With `--edge`: `<provider>=<identity>`, the decimal fabric VPC identity of a provider's ingress gVPC. Repeat it or separate entries with commas. A provider that holds `PublicListener` without one gets no ingress gVPC, and an Event on the `EdgeProvider` says so. An identity another VPC already holds is not recorded: the ingress gVPC reports `Ready` False with reason `IdentityInUse` |
| `--edge-ingress-prefix` | none | With `--edge`: IPv6 unique local prefix, `/64` or shorter, from which each ingress gVPC takes a `/64`. Required with `--edge-ingress-identity` |
| `--edge-listener-vip-prefixes` | none | With `--edge`: comma-separated IPv6 and IPv4 prefixes of the cell's gateway VIPs. An `EdgeListener` address outside them is refused with `AddressOutsidePool`, as is every address when none are given |

### Installing the cell role

Expand All @@ -51,7 +52,7 @@ Logging takes `--log-level` (`LOG_LEVEL`) and the standard `--zap-*` flags; see

Admission fails closed. Deploy the webhook with its serving Deployment, and keep its certificates and Service reachable. Neither the controller nor its CRDs are installed by the root `config/` kustomization.

For `--edge`, first install the Edge prerequisites in `config/galactic-edge/` and its node agent on eligible nodes. A deleting attachment is held until the node reports `Released` or the node is removed. See [Edge troubleshooting](../edge/troubleshooting.md) and the [provider contract](../edge/provider-contract.md) for ownership and timing requirements.
For `--edge`, first install the Edge prerequisites in `config/galactic-edge/` and its node agent on eligible nodes. Apply the bundle's CRDs (`config/crd/`) and `config/galactic-edge/`, with its RBAC, before rolling out a controller image that serves public listeners: without the `EdgeListener` CRD the controller logs that it does not start the listener controllers and runs the rest, and without the RBAC its caches cannot sync. A deleting attachment is held until the node reports `Released` or the node is removed. See [Edge troubleshooting](../edge/troubleshooting.md) and the [provider contract](../edge/provider-contract.md) for ownership and timing requirements.

### Pod-interface injection

Expand Down
Loading
Loading