
// This file was autogenerated by go-to-protobuf. Do not edit it manually!

syntax = "proto2";

package github.com.openshift.api.network.v1;

import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";

// Package-wide variables from generator "generated".
option go_package = "github.com/openshift/api/network/v1";

// ClusterNetwork describes the cluster network. There is normally only one object of this type,
// named "default", which is created by the SDN network plugin based on the master configuration
// when the cluster is brought up for the first time.
//
// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
// +kubebuilder:resource:scope="Cluster"
// +kubebuilder:printcolumn:name="Cluster Network",type=string,JSONPath=`.network`,description="The primary cluster network CIDR"
// +kubebuilder:printcolumn:name="Service Network",type=string,JSONPath=`.serviceNetwork`,description="The service network CIDR"
// +kubebuilder:printcolumn:name="Plugin Name",type=string,JSONPath=`.pluginName`,description="The Openshift SDN network plug-in in use"
// +openshift:compatibility-gen:level=1
message ClusterNetwork {
  optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;

  // Network is a CIDR string specifying the global overlay network's L3 space
  // +kubebuilder:validation:Pattern=`^(([0-9]|[0-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[0-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/([0-9]|[12][0-9]|3[0-2])$`
  optional string network = 2;

  // HostSubnetLength is the number of bits of network to allocate to each node. eg, 8 would mean that each node would have a /24 slice of the overlay network for its pods
  // +kubebuilder:validation:Minimum=2
  // +kubebuilder:validation:Maximum=30
  optional uint32 hostsubnetlength = 3;

  // ServiceNetwork is the CIDR range that Service IP addresses are allocated from
  // +kubebuilder:validation:Pattern=`^(([0-9]|[0-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[0-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/([0-9]|[12][0-9]|3[0-2])$`
  optional string serviceNetwork = 4;

  // PluginName is the name of the network plugin being used
  optional string pluginName = 5;

  // ClusterNetworks is a list of ClusterNetwork objects that defines the global overlay network's L3 space by specifying a set of CIDR and netmasks that the SDN can allocate addresses from.
  repeated ClusterNetworkEntry clusterNetworks = 6;

  // VXLANPort sets the VXLAN destination port used by the cluster.
  // It is set by the master configuration file on startup and cannot be edited manually.
  // Valid values for VXLANPort are integers 1-65535 inclusive and if unset defaults to 4789.
  // Changing VXLANPort allows users to resolve issues between openshift SDN and other software trying to use the same VXLAN destination port.
  // +kubebuilder:validation:Minimum=1
  // +kubebuilder:validation:Maximum=65535
  // +kubebuilder:validation:Optional
  // +optional
  optional uint32 vxlanPort = 7;

  // MTU is the MTU for the overlay network. This should be 50 less than the MTU of the network connecting the nodes. It is normally autodetected by the cluster network operator.
  // +kubebuilder:validation:Minimum=576
  // +kubebuilder:validation:Maximum=65536
  // +kubebuilder:validation:Optional
  // +optional
  optional uint32 mtu = 8;
}

// ClusterNetworkEntry defines an individual cluster network. The CIDRs cannot overlap with other cluster network CIDRs, CIDRs reserved for external ips, CIDRs reserved for service networks, and CIDRs reserved for ingress ips.
message ClusterNetworkEntry {
  // CIDR defines the total range of a cluster networks address space.
  // +kubebuilder:validation:Pattern=`^(([0-9]|[0-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[0-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/([0-9]|[12][0-9]|3[0-2])$`
  optional string cidr = 1;

  // HostSubnetLength is the number of bits of the accompanying CIDR address to allocate to each node. eg, 8 would mean that each node would have a /24 slice of the overlay network for its pods.
  // +kubebuilder:validation:Minimum=2
  // +kubebuilder:validation:Maximum=30
  optional uint32 hostSubnetLength = 2;
}

// ClusterNetworkList is a collection of ClusterNetworks
//
// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
// +openshift:compatibility-gen:level=1
message ClusterNetworkList {
  optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;

  // Items is the list of cluster networks
  repeated ClusterNetwork items = 2;
}

// EgressNetworkPolicy describes the current egress network policy for a Namespace. When using
// the 'redhat/openshift-ovs-multitenant' network plugin, traffic from a pod to an IP address
// outside the cluster will be checked against each EgressNetworkPolicyRule in the pod's
// namespace's EgressNetworkPolicy, in order. If no rule matches (or no EgressNetworkPolicy
// is present) then the traffic will be allowed by default.
//
// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
// +openshift:compatibility-gen:level=1
message EgressNetworkPolicy {
  optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;

  // spec is the specification of the current egress network policy
  optional EgressNetworkPolicySpec spec = 2;
}

// EgressNetworkPolicyList is a collection of EgressNetworkPolicy
//
// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
// +openshift:compatibility-gen:level=1
message EgressNetworkPolicyList {
  optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;

  // items is the list of policies
  repeated EgressNetworkPolicy items = 2;
}

// EgressNetworkPolicyPeer specifies a target to apply egress network policy to
message EgressNetworkPolicyPeer {
  // CIDRSelector is the CIDR range to allow/deny traffic to. If this is set, dnsName must be unset
  // Ideally we would have liked to use the cidr openapi format for this property.
  // But openshift-sdn only supports v4 while specifying the cidr format allows both v4 and v6 cidrs
  // We are therefore using a regex pattern to validate instead.
  // +kubebuilder:validation:Pattern=`^(([0-9]|[0-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[0-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/([0-9]|[12][0-9]|3[0-2])$`
  optional string cidrSelector = 1;

  // DNSName is the domain name to allow/deny traffic to. If this is set, cidrSelector must be unset
  // +kubebuilder:validation:Pattern=`^([A-Za-z0-9-]+\.)*[A-Za-z0-9-]+\.?$`
  optional string dnsName = 2;
}

// EgressNetworkPolicyRule contains a single egress network policy rule
message EgressNetworkPolicyRule {
  // type marks this as an "Allow" or "Deny" rule
  optional string type = 1;

  // to is the target that traffic is allowed/denied to
  optional EgressNetworkPolicyPeer to = 2;
}

// EgressNetworkPolicySpec provides a list of policies on outgoing network traffic
message EgressNetworkPolicySpec {
  // egress contains the list of egress policy rules
  repeated EgressNetworkPolicyRule egress = 1;
}

// HostSubnet describes the container subnet network on a node. The HostSubnet object must have the
// same name as the Node object it corresponds to.
//
// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
// +kubebuilder:printcolumn:name="Host",type=string,JSONPath=`.host`,description="The name of the node"
// +kubebuilder:printcolumn:name="Host IP",type=string,JSONPath=`.hostIP`,description="The IP address to be used as a VTEP by other nodes in the overlay network"
// +kubebuilder:printcolumn:name="Subnet",type=string,JSONPath=`.subnet`,description="The CIDR range of the overlay network assigned to the node for its pods"
// +kubebuilder:printcolumn:name="Egress CIDRs",type=string,JSONPath=`.egressCIDRs`,description="The network egress CIDRs"
// +kubebuilder:printcolumn:name="Egress IPs",type=string,JSONPath=`.egressIPs`,description="The network egress IP addresses"
// +openshift:compatibility-gen:level=1
message HostSubnet {
  optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;

  // Host is the name of the node. (This is the same as the object's name, but both fields must be set.)
  // +kubebuilder:validation:Pattern=`^[a-z0-9.-]+$`
  optional string host = 2;

  // HostIP is the IP address to be used as a VTEP by other nodes in the overlay network
  // +kubebuilder:validation:Pattern=`^(([0-9]|[0-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[0-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$`
  optional string hostIP = 3;

  // Subnet is the CIDR range of the overlay network assigned to the node for its pods
  // +kubebuilder:validation:Pattern=`^(([0-9]|[0-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[0-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/([0-9]|[12][0-9]|3[0-2])$`
  optional string subnet = 4;

  // EgressIPs is the list of automatic egress IP addresses currently hosted by this node.
  // If EgressCIDRs is empty, this can be set by hand; if EgressCIDRs is set then the
  // master will overwrite the value here with its own allocation of egress IPs.
  // +optional
  repeated string egressIPs = 5;

  // EgressCIDRs is the list of CIDR ranges available for automatically assigning
  // egress IPs to this node from. If this field is set then EgressIPs should be
  // treated as read-only.
  // +optional
  repeated string egressCIDRs = 6;
}

// HostSubnetList is a collection of HostSubnets
//
// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
// +openshift:compatibility-gen:level=1
message HostSubnetList {
  optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;

  // Items is the list of host subnets
  repeated HostSubnet items = 2;
}

// NetNamespace describes a single isolated network. When using the redhat/openshift-ovs-multitenant
// plugin, every Namespace will have a corresponding NetNamespace object with the same name.
// (When using redhat/openshift-ovs-subnet, NetNamespaces are not used.)
//
// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
// +kubebuilder:printcolumn:name="NetID",type=integer,JSONPath=`.netid`,description="The network identifier of the network namespace"
// +kubebuilder:printcolumn:name="Egress IPs",type=string,JSONPath=`.egressIPs`,description="The network egress IP addresses"
// +openshift:compatibility-gen:level=1
message NetNamespace {
  optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;

  // NetName is the name of the network namespace. (This is the same as the object's name, but both fields must be set.)
  // +kubebuilder:validation:Pattern=`^[a-z0-9.-]+$`
  optional string netname = 2;

  // NetID is the network identifier of the network namespace assigned to each overlay network packet. This can be manipulated with the "oc adm pod-network" commands.
  // +kubebuilder:validation:Minimum=0
  // +kubebuilder:validation:Maximum=16777215
  optional uint32 netid = 3;

  // EgressIPs is a list of reserved IPs that will be used as the source for external traffic coming from pods in this namespace.
  // (If empty, external traffic will be masqueraded to Node IPs.)
  // +optional
  repeated string egressIPs = 4;
}

// NetNamespaceList is a collection of NetNamespaces
//
// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
// +openshift:compatibility-gen:level=1
message NetNamespaceList {
  optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;

  // Items is the list of net namespaces
  repeated NetNamespace items = 2;
}

