IPPolicy Custom Resource
apiVersion: ingress.k8s.ngrok.com/v1alpha1
kind: IPPolicy
IP Policies define rules that allow or deny traffic based on the source IP of connections to your ngrok endpoints.
These policies can be attached to endpoints via traffic policy configurations to control access based on IP addresses and CIDR ranges.
IP Policies consist of one or more rules, where each rule specifies:
- An action (
allowordeny) - A CIDR range to match against
- An optional description
IPPolicy Structure and Types
The following outlines the high level structure and typings of anIPPolicy
IPPolicy Fields
The following sections outline each field of theIPPolicy custom resource, whether they are required, what their default values are (if applicable), and a description of their purpose/constraints.
spec
spec defines the desired state of the IPPolicy
Type: Object
Required: yes
Default: none
Fields:
| Field Name | Type | Required | Default | Description |
|---|---|---|---|---|
spec.description | string | no | "" | Human-readable description for this IPPolicy to help identify/describe it |
spec.metadata | string | no | "{"owned-by":"kubernetes-ingress-controller"}" | String of arbitrary data associated with the object in the ngrok API/Dashboard |
spec.rules | []Object | yes | none | List of rules that define which IPs/CIDR ranges to allow or deny |
spec.description
Human-readable description of this IP Policy that can be used to help identify/describe it.
Type: string
Required: no
Default: ""
spec.metadata
String of arbitrary data associated with the object in the ngrok API/Dashboard.
Type: string
Required: no
Default: "{"owned-by":"kubernetes-ingress-controller"}"
spec.rules
List of rules that define which IP addresses or CIDR ranges should be allowed or denied access.
Each rule is evaluated independently, and the most specific matching rule applies.
Type: []Object
Required: yes
Default: none
Fields:
| Field Name | Type | Required | Default | Description |
|---|---|---|---|---|
spec.rules[].action | string (enum) | yes | none | Whether to allow or deny traffic from the specified CIDR range |
spec.rules[].cidr | string | yes | none | IP address or CIDR range to match against |
spec.rules[].description | string | no | "" | Human-readable description for this rule |
spec.rules[].metadata | string | no | none | String of arbitrary data associated with the rule in the ngrok API/Dashboard |
spec.rules[].action
Specifies whether to allow or deny traffic from the IP addresses matching this rule’s CIDR range.
Type: string (enum)
Required: yes
Default: none
Allowed Values: "allow", "deny"
spec.rules[].cidr
IP address or CIDR range to match against the source IP of incoming connections.
This must be a valid IPv4 or IPv6 CIDR notation.
Type: string
Required: yes
Default: none
Examples:
- Single IP:
192.168.1.1/32 - Subnet:
10.0.0.0/24 - IPv6:
2001:db8::/32
spec.rules[].description
Human-readable description of this rule that can be used to help identify/describe it.
Type: string
Required: no
Default: ""
spec.rules[].metadata
String of arbitrary data associated with this rule in the ngrok API/Dashboard.
Type: string
Required: no
Default: none
Status Fields
TheIPPolicy resource includes status information that reflects the current state of the policy in the ngrok system.
status.id
The ngrok API ID for this IP Policy resource.
Type: string
Example: ipp_34iZT0muBP3kpcAXxGjM4uFlgDK
status.rules
Array of rules with their ngrok API IDs. Each rule status includes the rule ID, CIDR, and action that was configured.
Type: []Object
Example:
status.conditions
Standard Kubernetes conditions that indicate the state of the IP Policy.
Type: []Condition
Each condition includes:
type- The condition typestatus-True,False, orUnknownreason- A programmatic identifier for the condition statemessage- A human-readable descriptionlastTransitionTime- When the condition last changedobservedGeneration- The resource generation this condition applies to
Condition Types
Ready
Indicates whether the IP Policy is fully operational and ready to use.
Status Values:
True- IP Policy is active and readyFalse- IP Policy is not ready (see reason for details)
| Reason | Status | Meaning |
|---|---|---|
IPPolicyActive | True | IP Policy is successfully created and active |
IPPolicyRulesConfigurationError | False | One or more rules failed to configure |
IPPolicyCreationFailed | False | Failed to create the IP Policy in ngrok |
IPPolicyInvalidCIDR | False | One or more rules have invalid CIDR notation |
IPPolicyCreated
Indicates whether the IP Policy was successfully created in the ngrok API.
Status Values:
True- IP Policy was successfully createdFalse- Failed to create IP Policy
| Reason | Status | Meaning |
|---|---|---|
IPPolicyCreated | True | IP Policy successfully created |
IPPolicyCreationFailed | False | API call to create IP Policy failed |
RulesConfigured
Indicates whether all rules have been successfully configured for the IP Policy.
Status Values:
True- All rules are configuredFalse- One or more rules failed to configure
| Reason | Status | Meaning |
|---|---|---|
IPPolicyRulesConfigured | True | All rules successfully configured |
IPPolicyRulesConfigurationError | False | One or more rules failed validation or creation |
IPPolicyInvalidCIDR | False | One or more rules have invalid CIDR notation |
Status Examples
Successfully Created IP Policy
IP Policy with Invalid CIDR
Checking IP Policy Status
You can check the status of an IP Policy using kubectl:Example IPPolicies
Allow specific IP address
The followingIPPolicy allows traffic only from a specific IP address:
Allow subnet with multiple rules
The followingIPPolicy allows traffic from a corporate network subnet:
Deny specific IP addresses
The followingIPPolicy denies traffic from specific IP addresses: