Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDN docs and stuff #10143

Merged
merged 4 commits into from
Aug 24, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions api/swagger-spec/oapi-v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -22115,7 +22115,7 @@
},
"v1.ClusterNetwork": {
"id": "v1.ClusterNetwork",
"description": "ClusterNetwork describes a cluster network",
"description": "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.",
"required": [
"network",
"hostsubnetlength",
Expand All @@ -22136,19 +22136,19 @@
},
"network": {
"type": "string",
"description": "Network is a CIDR string to specify the global overlay network's L3 space"
"description": "Network is a CIDR string specifying the global overlay network's L3 space"
},
"hostsubnetlength": {
"type": "integer",
"description": "HostSubnetLength is the number of bits to allocate to each host's subnet e.g. 8 would mean a /24 network on the host"
"description": "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"
},
"serviceNetwork": {
"type": "string",
"description": "ServiceNetwork is the CIDR string to specify the service network"
"description": "ServiceNetwork is the CIDR range that Service IP addresses are allocated from"
},
"pluginName": {
"type": "string",
"description": "PluginName is the name of the network plugin"
"description": "PluginName is the name of the network plugin being used"
}
}
},
Expand Down Expand Up @@ -24468,7 +24468,7 @@
},
"v1.HostSubnet": {
"id": "v1.HostSubnet",
"description": "HostSubnet encapsulates the inputs needed to define the container subnet network on a node",
"description": "HostSubnet describes the container subnet network on a node. The HostSubnet object must have the same name as the Node object it corresponds to.",
"required": [
"host",
"hostIP",
Expand All @@ -24489,15 +24489,15 @@
},
"host": {
"type": "string",
"description": "Host is the name of the host that is registered at the master. May just be an IP address, resolvable hostname or a complete DNS. A lease will be sought after this name."
"description": "Host is the name of the node. (This is redundant with the object's name, and this field is not actually used any more.)"
},
"hostIP": {
"type": "string",
"description": "HostIP is the IP address to be used as vtep by other hosts in the overlay network"
"description": "HostIP is the IP address to be used as a VTEP by other nodes in the overlay network"
},
"subnet": {
"type": "string",
"description": "Subnet is the actual subnet CIDR lease assigned to the host"
"description": "Subnet is the CIDR range of the overlay network assigned to the node for its pods"
}
}
},
Expand Down Expand Up @@ -25557,7 +25557,7 @@
},
"v1.NetNamespace": {
"id": "v1.NetNamespace",
"description": "NetNamespace encapsulates the inputs needed to define a unique network namespace on the cluster",
"description": "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.)",
"required": [
"netname",
"netid"
Expand All @@ -25577,11 +25577,11 @@
},
"netname": {
"type": "string",
"description": "NetName is the name of the network namespace"
"description": "NetName is the name of the network namespace. (This is the same as the object's name, but both fields must be set.)"
},
"netid": {
"type": "integer",
"description": "NetID is the network identifier of the network namespace assigned to each overlay network packet"
"description": "NetID is the network identifier of the network namespace assigned to each overlay network packet. This can be manipulated with the \"oadm pod-network\" commands."
}
}
},
Expand Down
3 changes: 3 additions & 0 deletions contrib/completions/bash/oc
Original file line number Diff line number Diff line change
Expand Up @@ -7421,6 +7421,7 @@ _oc_describe()
must_have_one_noun+=("appliedclusterresourcequota")
must_have_one_noun+=("build")
must_have_one_noun+=("buildconfig")
must_have_one_noun+=("clusternetwork")
must_have_one_noun+=("clusterpolicy")
must_have_one_noun+=("clusterpolicybinding")
must_have_one_noun+=("clusterresourcequota")
Expand All @@ -7435,6 +7436,7 @@ _oc_describe()
must_have_one_noun+=("group")
must_have_one_noun+=("horizontalpodautoscaler")
must_have_one_noun+=("horizontalpodautoscaler")
must_have_one_noun+=("hostsubnet")
must_have_one_noun+=("identity")
must_have_one_noun+=("image")
must_have_one_noun+=("imagestream")
Expand All @@ -7445,6 +7447,7 @@ _oc_describe()
must_have_one_noun+=("job")
must_have_one_noun+=("limitrange")
must_have_one_noun+=("namespace")
must_have_one_noun+=("netnamespace")
must_have_one_noun+=("networkpolicy")
must_have_one_noun+=("node")
must_have_one_noun+=("oauthaccesstoken")
Expand Down
3 changes: 3 additions & 0 deletions contrib/completions/bash/openshift
Original file line number Diff line number Diff line change
Expand Up @@ -11737,6 +11737,7 @@ _openshift_cli_describe()
must_have_one_noun+=("appliedclusterresourcequota")
must_have_one_noun+=("build")
must_have_one_noun+=("buildconfig")
must_have_one_noun+=("clusternetwork")
must_have_one_noun+=("clusterpolicy")
must_have_one_noun+=("clusterpolicybinding")
must_have_one_noun+=("clusterresourcequota")
Expand All @@ -11751,6 +11752,7 @@ _openshift_cli_describe()
must_have_one_noun+=("group")
must_have_one_noun+=("horizontalpodautoscaler")
must_have_one_noun+=("horizontalpodautoscaler")
must_have_one_noun+=("hostsubnet")
must_have_one_noun+=("identity")
must_have_one_noun+=("image")
must_have_one_noun+=("imagestream")
Expand All @@ -11761,6 +11763,7 @@ _openshift_cli_describe()
must_have_one_noun+=("job")
must_have_one_noun+=("limitrange")
must_have_one_noun+=("namespace")
must_have_one_noun+=("netnamespace")
must_have_one_noun+=("networkpolicy")
must_have_one_noun+=("node")
must_have_one_noun+=("oauthaccesstoken")
Expand Down
3 changes: 3 additions & 0 deletions contrib/completions/zsh/oc
Original file line number Diff line number Diff line change
Expand Up @@ -7582,6 +7582,7 @@ _oc_describe()
must_have_one_noun+=("appliedclusterresourcequota")
must_have_one_noun+=("build")
must_have_one_noun+=("buildconfig")
must_have_one_noun+=("clusternetwork")
must_have_one_noun+=("clusterpolicy")
must_have_one_noun+=("clusterpolicybinding")
must_have_one_noun+=("clusterresourcequota")
Expand All @@ -7596,6 +7597,7 @@ _oc_describe()
must_have_one_noun+=("group")
must_have_one_noun+=("horizontalpodautoscaler")
must_have_one_noun+=("horizontalpodautoscaler")
must_have_one_noun+=("hostsubnet")
must_have_one_noun+=("identity")
must_have_one_noun+=("image")
must_have_one_noun+=("imagestream")
Expand All @@ -7606,6 +7608,7 @@ _oc_describe()
must_have_one_noun+=("job")
must_have_one_noun+=("limitrange")
must_have_one_noun+=("namespace")
must_have_one_noun+=("netnamespace")
must_have_one_noun+=("networkpolicy")
must_have_one_noun+=("node")
must_have_one_noun+=("oauthaccesstoken")
Expand Down
3 changes: 3 additions & 0 deletions contrib/completions/zsh/openshift
Original file line number Diff line number Diff line change
Expand Up @@ -11898,6 +11898,7 @@ _openshift_cli_describe()
must_have_one_noun+=("appliedclusterresourcequota")
must_have_one_noun+=("build")
must_have_one_noun+=("buildconfig")
must_have_one_noun+=("clusternetwork")
must_have_one_noun+=("clusterpolicy")
must_have_one_noun+=("clusterpolicybinding")
must_have_one_noun+=("clusterresourcequota")
Expand All @@ -11912,6 +11913,7 @@ _openshift_cli_describe()
must_have_one_noun+=("group")
must_have_one_noun+=("horizontalpodautoscaler")
must_have_one_noun+=("horizontalpodautoscaler")
must_have_one_noun+=("hostsubnet")
must_have_one_noun+=("identity")
must_have_one_noun+=("image")
must_have_one_noun+=("imagestream")
Expand All @@ -11922,6 +11924,7 @@ _openshift_cli_describe()
must_have_one_noun+=("job")
must_have_one_noun+=("limitrange")
must_have_one_noun+=("namespace")
must_have_one_noun+=("netnamespace")
must_have_one_noun+=("networkpolicy")
must_have_one_noun+=("node")
must_have_one_noun+=("oauthaccesstoken")
Expand Down
60 changes: 60 additions & 0 deletions pkg/cmd/cli/describe/describer.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ func describerMap(c *client.Client, kclient kclient.Interface, host string) map[
userapi.Kind("UserIdentityMapping"): &UserIdentityMappingDescriber{c},
quotaapi.Kind("ClusterResourceQuota"): &ClusterQuotaDescriber{c},
quotaapi.Kind("AppliedClusterResourceQuota"): &AppliedClusterQuotaDescriber{c},
sdnapi.Kind("ClusterNetwork"): &ClusterNetworkDescriber{c},
sdnapi.Kind("HostSubnet"): &HostSubnetDescriber{c},
sdnapi.Kind("NetNamespace"): &NetNamespaceDescriber{c},
sdnapi.Kind("EgressNetworkPolicy"): &EgressNetworkPolicyDescriber{c},
}
return m
Expand Down Expand Up @@ -1489,6 +1492,63 @@ func (d *AppliedClusterQuotaDescriber) Describe(namespace, name string, settings
return DescribeClusterQuota(quotaapi.ConvertAppliedClusterResourceQuotaToClusterResourceQuota(quota))
}

type ClusterNetworkDescriber struct {
client.Interface
}

// Describe returns the description of a ClusterNetwork
func (d *ClusterNetworkDescriber) Describe(namespace, name string, settings kctl.DescriberSettings) (string, error) {
cn, err := d.ClusterNetwork().Get(name)
if err != nil {
return "", err
}
return tabbedString(func(out *tabwriter.Writer) error {
formatMeta(out, cn.ObjectMeta)
formatString(out, "Cluster Network", cn.Network)
formatString(out, "Host Subnet Length", cn.HostSubnetLength)
formatString(out, "Service Network", cn.ServiceNetwork)
formatString(out, "Plugin Name", cn.PluginName)
return nil
})
}

type HostSubnetDescriber struct {
client.Interface
}

// Describe returns the description of a HostSubnet
func (d *HostSubnetDescriber) Describe(namespace, name string, settings kctl.DescriberSettings) (string, error) {
hs, err := d.HostSubnets().Get(name)
if err != nil {
return "", err
}
return tabbedString(func(out *tabwriter.Writer) error {
formatMeta(out, hs.ObjectMeta)
formatString(out, "Node", hs.Host)
formatString(out, "Node IP", hs.HostIP)
formatString(out, "Pod Subnet", hs.Subnet)
return nil
})
}

type NetNamespaceDescriber struct {
client.Interface
}

// Describe returns the description of a NetNamespace
func (d *NetNamespaceDescriber) Describe(namespace, name string, settings kctl.DescriberSettings) (string, error) {
netns, err := d.NetNamespaces().Get(name)
if err != nil {
return "", err
}
return tabbedString(func(out *tabwriter.Writer) error {
formatMeta(out, netns.ObjectMeta)
formatString(out, "Name", netns.NetName)
formatString(out, "ID", netns.NetID)
return nil
})
}

type EgressNetworkPolicyDescriber struct {
osClient client.Interface
}
Expand Down
4 changes: 0 additions & 4 deletions pkg/cmd/cli/describe/describer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
imageapi "github.com/openshift/origin/pkg/image/api"
oauthapi "github.com/openshift/origin/pkg/oauth/api"
projectapi "github.com/openshift/origin/pkg/project/api"
sdnapi "github.com/openshift/origin/pkg/sdn/api"
securityapi "github.com/openshift/origin/pkg/security/api"

// install all APIs
Expand Down Expand Up @@ -81,9 +80,6 @@ var DescriberCoverageExceptions = []reflect.Type{
var MissingDescriberCoverageExceptions = []reflect.Type{
reflect.TypeOf(&imageapi.ImageStreamMapping{}),
reflect.TypeOf(&oauthapi.OAuthClient{}),
reflect.TypeOf(&sdnapi.ClusterNetwork{}),
reflect.TypeOf(&sdnapi.HostSubnet{}),
reflect.TypeOf(&sdnapi.NetNamespace{}),
}

func TestDescriberCoverage(t *testing.T) {
Expand Down
24 changes: 12 additions & 12 deletions pkg/sdn/api/v1/swagger_doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ package v1
// ==== DO NOT EDIT THIS FILE MANUALLY ====

var map_ClusterNetwork = map[string]string{
"": "ClusterNetwork describes a cluster network",
"": "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.",
"metadata": "Standard object's metadata.",
"network": "Network is a CIDR string to specify the global overlay network's L3 space",
"hostsubnetlength": "HostSubnetLength is the number of bits to allocate to each host's subnet e.g. 8 would mean a /24 network on the host",
"serviceNetwork": "ServiceNetwork is the CIDR string to specify the service network",
"pluginName": "PluginName is the name of the network plugin",
"network": "Network is a CIDR string specifying the global overlay network's L3 space",
"hostsubnetlength": "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",
"serviceNetwork": "ServiceNetwork is the CIDR range that Service IP addresses are allocated from",
"pluginName": "PluginName is the name of the network plugin being used",
}

func (ClusterNetwork) SwaggerDoc() map[string]string {
Expand Down Expand Up @@ -77,11 +77,11 @@ func (EgressNetworkPolicySpec) SwaggerDoc() map[string]string {
}

var map_HostSubnet = map[string]string{
"": "HostSubnet encapsulates the inputs needed to define the container subnet network on a node",
"": "HostSubnet describes the container subnet network on a node. The HostSubnet object must have the same name as the Node object it corresponds to.",
"metadata": "Standard object's metadata.",
"host": "Host is the name of the host that is registered at the master. May just be an IP address, resolvable hostname or a complete DNS. A lease will be sought after this name.",
"hostIP": "HostIP is the IP address to be used as vtep by other hosts in the overlay network",
"subnet": "Subnet is the actual subnet CIDR lease assigned to the host",
"host": "Host is the name of the node. (This is redundant with the object's name, and this field is not actually used any more.)",
"hostIP": "HostIP is the IP address to be used as a VTEP by other nodes in the overlay network",
"subnet": "Subnet is the CIDR range of the overlay network assigned to the node for its pods",
}

func (HostSubnet) SwaggerDoc() map[string]string {
Expand All @@ -99,10 +99,10 @@ func (HostSubnetList) SwaggerDoc() map[string]string {
}

var map_NetNamespace = map[string]string{
"": "NetNamespace encapsulates the inputs needed to define a unique network namespace on the cluster",
"": "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.)",
"metadata": "Standard object's metadata.",
"netname": "NetName is the name of the network namespace",
"netid": "NetID is the network identifier of the network namespace assigned to each overlay network packet",
"netname": "NetName is the name of the network namespace. (This is the same as the object's name, but both fields must be set.)",
"netid": "NetID is the network identifier of the network namespace assigned to each overlay network packet. This can be manipulated with the \"oadm pod-network\" commands.",
}

func (NetNamespace) SwaggerDoc() map[string]string {
Expand Down
31 changes: 18 additions & 13 deletions pkg/sdn/api/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,21 @@ const (

// +genclient=true

// ClusterNetwork describes a cluster network
// 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.
type ClusterNetwork struct {
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
kapi.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`

// Network is a CIDR string to specify the global overlay network's L3 space
// Network is a CIDR string specifying the global overlay network's L3 space
Network string `json:"network" protobuf:"bytes,2,opt,name=network"`
// HostSubnetLength is the number of bits to allocate to each host's subnet e.g. 8 would mean a /24 network on the host
// 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
HostSubnetLength uint32 `json:"hostsubnetlength" protobuf:"varint,3,opt,name=hostsubnetlength"`
// ServiceNetwork is the CIDR string to specify the service network
// ServiceNetwork is the CIDR range that Service IP addresses are allocated from
ServiceNetwork string `json:"serviceNetwork" protobuf:"bytes,4,opt,name=serviceNetwork"`
// PluginName is the name of the network plugin
// PluginName is the name of the network plugin being used
PluginName string `json:"pluginName,omitempty" protobuf:"bytes,5,opt,name=pluginName"`
}

Expand All @@ -36,18 +38,19 @@ type ClusterNetworkList struct {
Items []ClusterNetwork `json:"items" protobuf:"bytes,2,rep,name=items"`
}

// HostSubnet encapsulates the inputs needed to define the container subnet network on a node
// HostSubnet describes the container subnet network on a node. The HostSubnet object must have the
// same name as the Node object it corresponds to.
type HostSubnet struct {
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
kapi.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`

// Host is the name of the host that is registered at the master. May just be an IP address, resolvable hostname or a complete DNS.
// A lease will be sought after this name.
// Host is the name of the node. (This is redundant with the object's name, and this
// field is not actually used any more.)
Host string `json:"host" protobuf:"bytes,2,opt,name=host"`
// HostIP is the IP address to be used as vtep by other hosts in the overlay network
// HostIP is the IP address to be used as a VTEP by other nodes in the overlay network
HostIP string `json:"hostIP" protobuf:"bytes,3,opt,name=hostIP"`
// Subnet is the actual subnet CIDR lease assigned to the host
// Subnet is the CIDR range of the overlay network assigned to the node for its pods
Subnet string `json:"subnet" protobuf:"bytes,4,opt,name=subnet"`
}

Expand All @@ -60,15 +63,17 @@ type HostSubnetList struct {
Items []HostSubnet `json:"items" protobuf:"bytes,2,rep,name=items"`
}

// NetNamespace encapsulates the inputs needed to define a unique network namespace on the cluster
// 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.)
type NetNamespace struct {
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
kapi.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`

// NetName is the name of the network namespace
// NetName is the name of the network namespace. (This is the same as the object's name, but both fields must be set.)
NetName string `json:"netname" protobuf:"bytes,2,opt,name=netname"`
// NetID is the network identifier of the network namespace assigned to each overlay network packet
// NetID is the network identifier of the network namespace assigned to each overlay network packet. This can be manipulated with the "oadm pod-network" commands.
NetID uint32 `json:"netid" protobuf:"varint,3,opt,name=netid"`
}

Expand Down