Skip to content

Commit 2e85daa

Browse files
authored
feat: add networking quota grant policies (#192)
## Summary - Add GrantCreationPolicy for all 13 NSO user-facing resources - Triggered on Project creation, allocates default quota amounts - Single default tier (personal-level) — standard org overrides deferred until org-type label propagation exists - Companion to datum-cloud/network-services-operator#129 which defines the registrations and claim policies in the NSO repo ### Default quotas per project | Resource | apiGroup | Amount | |----------|----------|--------| | Domain | `networking.datumapis.com` | 25 | | HTTPProxy | `networking.datumapis.com` | 10 | | TrafficProtectionPolicy | `networking.datumapis.com` | 0 (disabled) | | Connector | `networking.datumapis.com` | 5 | | ConnectorAdvertisement | `networking.datumapis.com` | 10 | | Gateway | `gateway.networking.k8s.io` | 10 | | HTTPRoute | `gateway.networking.k8s.io` | 25 | | BackendTLSPolicy | `gateway.networking.k8s.io` | 10 | | Backend | `gateway.envoyproxy.io` | 10 | | BackendTrafficPolicy | `gateway.envoyproxy.io` | 10 | | SecurityPolicy | `gateway.envoyproxy.io` | 10 | | HTTPRouteFilter | `gateway.envoyproxy.io` | 10 | | EndpointSlice | `discovery.k8s.io` | 25 | Note: Domains aligned with existing DNS zone quota (25). HTTPProxies and Gateways are 1-to-1 with each other (10). ## Test plan - [ ] Verify kustomize build succeeds - [ ] Deploy alongside NSO registrations/claim policies and verify grant creation on project creation Ref: datum-cloud/enhancements#664 🤖 Generated with [Claude Code](https://claude.com/claude-code)
2 parents 38df4ae + 9a31219 commit 2e85daa

5 files changed

Lines changed: 95 additions & 0 deletions

File tree

config/services/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ components:
1212
- resourcemanager.miloapis.com/
1313
- iam.miloapis.com/
1414
- dns.networking.miloapis.com/
15+
- networking.datumapis.com/
1516
- search.miloapis.com/
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: kustomize.config.k8s.io/v1alpha1
2+
kind: Component
3+
4+
sortOptions:
5+
order: fifo
6+
7+
components:
8+
- quota/
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
apiVersion: quota.miloapis.com/v1alpha1
2+
kind: GrantCreationPolicy
3+
metadata:
4+
name: default-networking-quota-policy
5+
labels:
6+
app.kubernetes.io/name: datum
7+
app.kubernetes.io/component: quota-system
8+
spec:
9+
trigger:
10+
resource:
11+
apiVersion: resourcemanager.miloapis.com/v1alpha1
12+
kind: Project
13+
target:
14+
parentContext:
15+
apiGroup: "resourcemanager.miloapis.com"
16+
kind: "Project"
17+
nameExpression: "trigger.metadata.name"
18+
resourceGrantTemplate:
19+
metadata:
20+
name: "default-networking-quota-{{ trigger.metadata.name }}"
21+
namespace: milo-system
22+
annotations:
23+
kubernetes.io/description: "Networking quota allocation for project"
24+
spec:
25+
consumerRef:
26+
apiGroup: resourcemanager.miloapis.com
27+
kind: Project
28+
name: "{{ trigger.metadata.name }}"
29+
allowances:
30+
- resourceType: networking.datumapis.com/domains
31+
buckets:
32+
- amount: 25
33+
- resourceType: networking.datumapis.com/httpproxies
34+
buckets:
35+
- amount: 10
36+
- resourceType: networking.datumapis.com/trafficprotectionpolicies
37+
buckets:
38+
- amount: 0
39+
- resourceType: networking.datumapis.com/connectors
40+
buckets:
41+
- amount: 5
42+
- resourceType: networking.datumapis.com/connectoradvertisements
43+
buckets:
44+
- amount: 10
45+
- resourceType: gateway.networking.k8s.io/gateways
46+
buckets:
47+
- amount: 10
48+
- resourceType: gateway.networking.k8s.io/httproutes
49+
buckets:
50+
- amount: 25
51+
- resourceType: gateway.networking.k8s.io/backendtlspolicies
52+
buckets:
53+
- amount: 10
54+
- resourceType: gateway.envoyproxy.io/backends
55+
buckets:
56+
- amount: 10
57+
- resourceType: gateway.envoyproxy.io/backendtrafficpolicies
58+
buckets:
59+
- amount: 10
60+
- resourceType: gateway.envoyproxy.io/securitypolicies
61+
buckets:
62+
- amount: 10
63+
- resourceType: gateway.envoyproxy.io/httproutefilters
64+
buckets:
65+
- amount: 10
66+
- resourceType: discovery.k8s.io/endpointslices
67+
buckets:
68+
- amount: 25
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: kustomize.config.k8s.io/v1alpha1
2+
kind: Component
3+
4+
sortOptions:
5+
order: fifo
6+
7+
resources:
8+
- default-project-grant-policy.yaml
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: kustomize.config.k8s.io/v1alpha1
2+
kind: Component
3+
4+
# Use explicit sorting options so we can guarantee that grant creation
5+
# policies are applied correctly.
6+
sortOptions:
7+
order: fifo
8+
9+
components:
10+
- grant-policies/

0 commit comments

Comments
 (0)