// Module included in the following assemblies:
//
// assembly-installing-openshift.adoc
// assembly-iot-guide.adoc
// assembly-IoT.adoc

[id='installing-using-bundle-{context}']
= Installing {ProductName} using a YAML bundle

The simplest way to install {ProductName} is to use the predefined YAML bundles. 

.Procedure

ifeval::["{cmdcli}" == "oc"]
. Log in as a user with `cluster-admin` privileges:
+
[options="nowrap",subs="attributes"]
----
{cmdcli} login -u system:admin
----

. (Optional) If you want to deploy to a namespace other than `{ProductNamespace}` you must run the following command and substitute `{ProductNamespace}` in subsequent steps:
+
[options="nowrap",subs="+quotes,attributes"]
----
sed -i 's/{ProductNamespace}/_my-namespace_/' install/bundles/{ProductBundleName}/*.yaml
----

. Create the project where you want to deploy {ProductName}:
+
[options="nowrap",subs="+quotes,attributes"]
----
{cmdcli} new-project _{ProductNamespace}_
----
endif::[]
ifeval::["{cmdcli}" == "kubectl"]
. Create the namespace where you want to deploy {ProductName}:
+
[options="nowrap",subs="+quotes,attributes"]
----
{cmdcli} create namespace _{ProductNamespace}_
{cmdcli} config set-context $(kubectl config current-context) --namespace=_{ProductNamespace}_
----

. Create a certificate to use with the API server. For testing purposes, you can create a self-signed certificate:
+
[options="nowrap",subs="+quotes,attributes"]
----
mkdir -p api-server-cert/
openssl req -new -x509 -batch -nodes -days 11000 -subj "/O=io.enmasse/CN=api-server._{ProductNamespace}_.svc.cluster.local" -out api-server-cert/tls.crt -keyout api-server-cert/tls.key
----

. Create a secret containing the API server certificate:
+
[options="nowrap",subs="attributes"]
----
{cmdcli} create secret tls api-server-cert --cert=api-server-cert/tls.crt --key=api-server-cert/tls.key
----
endif::[]

. Change the directory to the location of the downloaded release files.

. Deploy using the `{ProductBundleName}` bundle:
+
[options="nowrap",subs="attributes"]
----
{cmdcli} apply -f install/bundles/{ProductBundleName}
----

. (Optional) Install the example plans and infrastructure configuration:
+
[options="nowrap",subs="attributes"]
----
{cmdcli} apply -f install/components/example-plans
----

. (Optional) Install the example roles:
+
[options="nowrap",subs="attributes"]
----
{cmdcli} apply -f install/components/example-roles
----

. (Optional) Install the `standard` authentication service:
+
[options="nowrap",subs="attributes"]
----
{cmdcli} apply -f install/components/example-authservices/standard-authservice.yaml
----

