// Module included in the following assemblies:
//
// assembly-installing-openshift.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. 

.Prerequisites

.Procedure 

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

. (Optional) Replace namespace if you want to deploy to something other than `{ProductNamespace}` (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 `standard` authentication service. For testing purposes, you can create a self-signed certificate:
+
[options="nowrap",subs="+quotes,attributes"]
----
mkdir -p standard-authservice-cert
openssl req -new -x509 -batch -nodes -days 11000 -subj "/O=io.enmasse/CN=standard-authservice._{ProductNamespace}_.svc.cluster.local" -out standard-authservice-cert/tls.crt -keyout standard-authservice-cert/tls.key
----

. Create a secret with the `standard` authentication service certificate:
+
[options="nowrap",subs="attributes"]
----
{cmdcli} create secret tls standard-authservice-cert --cert=standard-authservice-cert/tls.crt --key=standard-authservice-cert/tls.key
----

. 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::[]

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