CRD API Reference

API Reference

networkenforcer.kubewarden.io/v1alpha1

Package v1alpha1 contains API Schema definitions for the security v1alpha1 API group.

AcknowledgedViolationRecord

AcknowledgedViolationRecord wraps a ViolationRecord together with the acknowledgement reason and timestamp.

Field Description Default Validation

violation ViolationRecord

Violation is the violation record that was acknowledged.

reason string

Reason is an optional field to indicate why this violation was
acknowledged.

acknowledgedAt Time

AcknowledgedAt is the time when the violation was acknowledged.

IstioAuthorizationPolicyRule

Field Description Default Validation

from IstioFrom array

From defines source identities for the rule.

to IstioTo array

To defines destination operations for the rule.

IstioAuthorizationPolicySpec

Field Description Default Validation

selector LabelSelector

Selector selects the destination workloads where the policy is enforced.

Rules is the ruleset.

IstioFrom

Field Description Default Validation

source IstioSource

Source defines the source identities for the rule.

IstioOperation

Appears In:
Field Description Default Validation

ports string array

Ports is the list of destination ports.

IstioSource

Appears In:
Field Description Default Validation

principals string array

Principals are the source SPIFFE identities.

IstioTo

Field Description Default Validation

operation IstioOperation

Operation defines the destination operations for the rule.

PolicyBackend

Underlying type: string

PolicyBackend selects which data-plane policy model is used.

Validation:
  • Enum: [kubernetes istio]

PolicyBackendSpec

PolicyBackendSpec contains the backend-specific policy payload.

Field Description Default Validation

backend PolicyBackend

Backend selects which backend policy model this object carries.

Enum: [kubernetes istio]
Required: \{}

kubernetes NetworkPolicySpec

Kubernetes contains the policy expressed as a standard Kubernetes
NetworkPolicySpec.

Istio contains a constrained L4 policy model rendered as an Istio
AuthorizationPolicy by the reconciler.

ViolationInfo

ViolationInfo holds the details of a single network policy violation without the controller-assigned ID. Backend scrapers produce observations in this shape (see violation.Observation); the controller assigns the ID when it persists the record into wnp.Status.Violations.

Appears In:
Field Description Default Validation

timestamp Time

Timestamp is when the violation last occurred.

source WorkloadRef

Source is the workload that initiated the traffic.

Dest is the workload that received the traffic.

protocol Protocol

Protocol is the L4 protocol (TCP, UDP).

dstPort integer

DstPort is the destination port. 0 when unavailable.

Maximum: 65535
Minimum: 0

Action is the enforcement action taken (monitor or protect).

Enum: [monitor protect]

denyingPolicyNamespace string

DenyingPolicyNamespace is the namespace of the WorkloadNetworkPolicy this
violation belongs to. For a DENY it is the policy that denied the flow; for
an ALLOW-miss (which carries no denying policy on the wire) the scraper
resolves the owning WorkloadNetworkPolicy by matching the destination pod’s
labels against WNP selectors and records it here (see istio.Enricher).

denyingPolicyName string

DenyingPolicyName is the name of the WorkloadNetworkPolicy this violation
belongs to. For a DENY it is the policy that denied the flow; for an
ALLOW-miss it is the owning WorkloadNetworkPolicy resolved by selector match
(see DenyingPolicyNamespace). The controller keys the violation to its WNP
by this name for both cases; Action (monitor vs protect) distinguishes them.

ViolationRecord

ViolationRecord holds the details of a single network policy violation. It embeds ViolationInfo (the violation without the ID) so that the two types cannot drift apart: every violation field is defined once, in ViolationInfo.

Field Description Default Validation

timestamp Time

Timestamp is when the violation last occurred.

source WorkloadRef

Source is the workload that initiated the traffic.

Dest is the workload that received the traffic.

protocol Protocol

Protocol is the L4 protocol (TCP, UDP).

dstPort integer

DstPort is the destination port. 0 when unavailable.

Maximum: 65535
Minimum: 0

Action is the enforcement action taken (monitor or protect).

Enum: [monitor protect]

denyingPolicyNamespace string

DenyingPolicyNamespace is the namespace of the WorkloadNetworkPolicy this
violation belongs to. For a DENY it is the policy that denied the flow; for
an ALLOW-miss (which carries no denying policy on the wire) the scraper
resolves the owning WorkloadNetworkPolicy by matching the destination pod’s
labels against WNP selectors and records it here (see istio.Enricher).

denyingPolicyName string

DenyingPolicyName is the name of the WorkloadNetworkPolicy this violation
belongs to. For a DENY it is the policy that denied the flow; for an
ALLOW-miss it is the owning WorkloadNetworkPolicy resolved by selector match
(see DenyingPolicyNamespace). The controller keys the violation to its WNP
by this name for both cases; Action (monitor vs protect) distinguishes them.

id integer

ID is a per-policy unique identifier allocated by the controller
when the record is first observed. It is stable across re-scrapes
of the same logical violation, so consumers can refer to a single
record by ID (for example when correlating with external events).

Stored as int64 (not uint64) for compatibility with the Kubernetes
field-management machinery used by controller-runtime’s test
fixtures; the counter is monotonically increasing and never goes
negative, so the sign bit is never set in practice.

WorkloadKind

Underlying type: string

WorkloadKind identifies the Kubernetes owner resource kind for a workload.

Appears In:

WorkloadNetworkPolicy

WorkloadNetworkPolicy is the schema for the runtime network policy API. Spec carries a backend-specific policy payload (Kubernetes or Istio) and a mode (monitor or protect). The resource is intentionally namespaced and uses the networkenforcer.kubewarden.io group to avoid colliding with the upstream networking.k8s.io/NetworkPolicy kind.

Field Description Default Validation

apiVersion string

networkenforcer.kubewarden.io/v1alpha1

kind string

WorkloadNetworkPolicy

metadata ObjectMeta

Refer to Kubernetes API documentation for fields of metadata.

WorkloadNetworkPolicyList

WorkloadNetworkPolicyList is a list of WorkloadNetworkPolicy.

Field Description Default Validation

apiVersion string

networkenforcer.kubewarden.io/v1alpha1

kind string

WorkloadNetworkPolicyList

metadata ListMeta

Refer to Kubernetes API documentation for fields of metadata.

items WorkloadNetworkPolicy array

WorkloadNetworkPolicyMode

Underlying type: string

WorkloadNetworkPolicyMode selects how a WorkloadNetworkPolicy is interpreted at runtime.

Validation:
  • Enum: [monitor protect]

WorkloadNetworkPolicyProposal

Field Description Default Validation

apiVersion string

networkenforcer.kubewarden.io/v1alpha1

kind string

WorkloadNetworkPolicyProposal

metadata ObjectMeta

Refer to Kubernetes API documentation for fields of metadata.

WorkloadNetworkPolicyProposalList

Field Description Default Validation

apiVersion string

networkenforcer.kubewarden.io/v1alpha1

kind string

WorkloadNetworkPolicyProposalList

metadata ListMeta

Refer to Kubernetes API documentation for fields of metadata.

WorkloadNetworkPolicyProposalSpec

Field Description Default Validation

backend PolicyBackend

Backend selects which backend policy model this object carries.

Enum: [kubernetes istio]
Required: \{}

kubernetes NetworkPolicySpec

Kubernetes contains the policy expressed as a standard Kubernetes
NetworkPolicySpec.

Istio contains a constrained L4 policy model rendered as an Istio
AuthorizationPolicy by the reconciler.

WorkloadNetworkPolicyProposalStatus

Field Description Default Validation

conditions Condition array

conditions represent the current state of the proposal.

WorkloadNetworkPolicySpec

WorkloadNetworkPolicySpec defines the desired state of a WorkloadNetworkPolicy.

Appears In:
Field Description Default Validation

backend PolicyBackend

Backend selects which backend policy model this object carries.

Enum: [kubernetes istio]
Required: \{}

kubernetes NetworkPolicySpec

Kubernetes contains the policy expressed as a standard Kubernetes
NetworkPolicySpec.

Istio contains a constrained L4 policy model rendered as an Istio
AuthorizationPolicy by the reconciler.

Mode controls whether the policy is observed (monitor) or actively
enforced (protect). Defaults to monitor.

monitor

Enum: [monitor protect]

WorkloadNetworkPolicyStatus

WorkloadNetworkPolicyStatus defines the observed state of a WorkloadNetworkPolicy.

Appears In:
Field Description Default Validation

observedGeneration integer

ObservedGeneration is the most recent generation observed for this
WorkloadNetworkPolicy. It corresponds to the resource’s
metadata.generation, which is updated by the API server when the
spec changes.

violationCount integer

ViolationCount is the total number of violation records ever
observed for this policy, including those that have already been
trimmed out of Violations or cleared because the flow is now
permitted by the policy template. It is not guaranteed to be strongly
consistent and may be temporarily outdated.

0

activeViolationCount integer

ActiveViolationCount is the number of currently active (non-cleared)
violation records. It is always equal to len(Violations) and is
updated in the same status write.

0

violations ViolationRecord array

Violations is the list of the most recent violation records
(max maxViolationRecords). Oldest entries are dropped when the
limit is reached.

acknowledgedViolations AcknowledgedViolationRecord array

AcknowledgedViolations is the list of the most recent violation
records that have been acknowledged by users (max maxViolationRecords).
Oldest entries are dropped when the limit is reached.

WorkloadRef

WorkloadRef identifies a Kubernetes workload.

Field Description Default Validation

namespace string

Namespace is the Kubernetes namespace of the workload.

ownerKind WorkloadKind

OwnerKind is the kind of the owner resource.

ownerName string

OwnerName is the name of the owner resource.

identity string

Identity is the istio-specific workload identity.
This field is not populated for other providers.

selector LabelSelector

Selector is the label selector for the workload.