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 Dec 19, 2018
1 parent 8241b16 commit f578b4a
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 7 deletions.
46 changes: 41 additions & 5 deletions config/v1/types_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,56 @@ 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 NetworkStatus `json:"status"`
}

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

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

// NetworkType is the plugin that is to be deployed (e.g. OpenShiftSDN).
// This should match a value that the cluster-network-operator understands,
// or else no networking will be installed.
// Currently supported values are:
// - OpenShiftSDN
NetworkType string `json:"networkType"`
}

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

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

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

// ClusterNetworkMTU is the MTU for inter-pod networking.
ClusterNetworkMTU int `json:"clusterNetworkMTU"`
}

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

// The size (prefix) of block to allocate to each node.
HostPrefix uint32 `json:"hostPrefix"`
}

// +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 f578b4a

Please sign in to comment.