Skip to content

Commit

Permalink
config: add Network type
Browse files Browse the repository at this point in the history
Adds the basic network configuration that downstream components may wish
to configure.
  • Loading branch information
squeed committed Nov 27, 2018
1 parent 6a375c5 commit 48e3c78
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 8 deletions.
42 changes: 36 additions & 6 deletions config/v1/types_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,50 @@ type Network struct {
// Standard object's metadata.
metav1.ObjectMeta `json:"metadata,omitempty"`

// spec holds user settable values for configuration
// Spec holds user settable values for configuration.
Spec NetworkSpec `json:"spec"`
// status holds observed values from the cluster. They may not be overridden.
// Status holds observed values from the cluster. They may not be overridden.
Status NetworkStatus `json:"status"`
}

// NetworkSpec is the desired network configuration.
// As a general rule, this SHOULD NOT be used directly. Instead, you should
// consume the NetworkStatus, as it indicates the currently deployed configuration.
type NetworkSpec struct {
// serviceCIDR
// servicePortRange
// vxlanPort
// ClusterNetworks []ClusterNetworkEntry `json:"clusterNetworks"`
// IP address pool to use for pod IPs.
ClusterNetworks []ClusterNetwork `json:"clusterNetworks"`

// IP address pool for services.
// Currently, we only support a single entry here.
ServiceNetworks []string `json:"serviceNetworks"`

// NetworkType is the plugin that is to be deployed (e.g. OpenShiftSDN).
// N.B. changing this is currently not supported.
NetworkType string `json:"networkType"`
}

// NetworkStatus is the current network configuration.
type NetworkStatus struct {
// IP address pool to use for pod IPs.
ClusterNetworks []ClusterNetwork `json:"clusterNetworks"`

// IP address pool for services.
// Currently, we only support a single entry here.
ServiceNetworks []string `json:"serviceNetworks"`

// NetworkType is the plugin that is deployed (e.g. OpenShiftSDN).
NetworkType string `json:"networkType"`
}

// ClusterNetwork is a contiguous block of IP addresses from which pod IPs are
// allocated.
type ClusterNetwork struct {
// The complete block for pod IPs.
CIDR string `json:"cidr"`

// The size of subnet (in bits) to allocate to each node for pod allocations.
// For example, 8 indicates a /24 will be given to each node.
HostSubnetLength uint32 `json:"hostSubnetLength"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
40 changes: 38 additions & 2 deletions config/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 48e3c78

Please sign in to comment.