// Module included in the following assemblies:
//
// master.adoc

[id='managing-address-spaces-{context}']
= Managing address spaces on {KubePlatform}

{ProductName} is configured to support managing address spaces using the
ifdef::Kubernetes[Kubernetes and]
OpenShift command-line tools.

== Minimal example

The minimal example shows the smallest set of options needed to create an `AddressSpace`.

[source,yaml,options="nowrap"]
.link:resources/address-space-example1.yaml[address-space-example1.yaml]
----
include::../common/address-space-example1.yaml[]
----
<1> The address space type can be either `brokered` or `standard`.
<2> The address space plan depends on the address space type and what has been configured by the {ProductName} admin.

== Advanced example

The advanced example show how you can configure the authentication service and endpoints of an `AddressSpace`.

[source,yaml,options="nowrap"]
.link:resources/address-space-example2.yaml[address-space-example2.yaml]
----
include::../common/address-space-example2.yaml[]
----
<1> The address space type can be either `brokered` or `standard`.
<2> The address space plan depends on the address space type and what has been configured by the {ProductName} admin.
<3> The authentication service type can be `none`, `standard` or `external`. External requires an additional field, `details`, including `host` and `port` information.
<4> The endpoints that must be configured for the `AddressSpace`.  Endpoints can specity either `messaging`, `console` or `mqtt` services. However, the `mqtt` service is supported for the `standard` address space type only.
<5> Expose the configuration of an endpoint. Endpoints can be kept internal to the cluster, or exposed using an OpenShift route or a load-balancer service.
<6> The certificate configuration can be used to specify how the endpoint certificate is provided.  The provider can be `selfsigned` (default), `wildcard` (requires it to be enabled by the {ProductName} admin), `openshift` (signed by the OpenShift cluster CA), or `certBundle` (base64-encoded PEM key and certificate).

== Example address space status output

The `AddressSpace` resource contains a `status` field that can be used to retrieve information about
its state and endpoints. The following output is an example of the output you can get from running
`oc get addressspace myspace -o yaml`:

[source,yaml,options="nowrap"]
.link:resources/address-space-output-example1.yaml[address-space-output-example1.yaml]
----
include::../common/address-space-output-example1.yaml[]
----
<1> The `status.isReady` field can be either `true` or `false`.
<2> The `status.endpointStatuses` field provides information about available endpoints for this address space.
<3> The `cert` field contains the base64-encoded certificate for a given endpoint.
<4> The `serviceHost` field contains the cluster-internal host name for a given endpoint.
<5> The `servicePorts` field contains the available ports for the cluster-internal host.
<6> The `externalHost` field contains the external host name for a given endpoint.
<7> The `externalPorts` field contains the available ports for the external host.

include::../modules/proc-create-address-space-cli.adoc[leveloffset=+1]

include::../modules/con-retrieving-address-space-information.adoc[leveloffset=+1]

