// Module included in the following assemblies:
//
// * security/compliance_operator/co-management/compliance-operator-installation.adoc

:_mod-docs-content-type: PROCEDURE
[id="installing-compliance-operator-hcp_{context}"]
= Installing the Compliance Operator on Hypershift {hcp}

[role="_abstract"]
You can install the Compliance Operator in {hcp} by using the software catalog by creating a `Subscription` file.

:FeatureName: {hcp-capital}
include::snippets/technology-preview.adoc[]

.Prerequisites

* You must have `admin` privileges.

.Procedure

. Define a `Namespace` object similar to the following:
+
.Example `namespace-object.yaml`
[source,yaml]
----
apiVersion: v1
kind: Namespace
metadata:
  labels:
    openshift.io/cluster-monitoring: "true"
    pod-security.kubernetes.io/enforce: privileged
  name: openshift-compliance
----
* In {product-title} {product-version}, the pod security label must be set to `privileged` at the namespace level.

. Create the `Namespace` object by running the following command:
+
[source,terminal]
----
$ oc create -f namespace-object.yaml
----

. Define an `OperatorGroup` object:
+
.Example `operator-group-object.yaml`
[source,yaml]
----
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
  name: compliance-operator
  namespace: openshift-compliance
spec:
  targetNamespaces:
  - openshift-compliance
----

. Create the `OperatorGroup` object by running the following command:
+
[source,terminal]
----
$ oc create -f operator-group-object.yaml
----

. Define a `Subscription` object:
+
.Example `subscription-object.yaml`
[source,yaml]
----
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: compliance-operator-sub
  namespace: openshift-compliance
spec:
  channel: "stable"
  installPlanApproval: Automatic
  name: compliance-operator
  source: redhat-operators
  sourceNamespace: openshift-marketplace
  config:
    nodeSelector:
      node-role.kubernetes.io/worker: ""
    env:
    - name: PLATFORM
      value: "HyperShift"
----

. Create the `Subscription` object by running the following command:
+
[source,terminal]
----
$ oc create -f subscription-object.yaml
----

.Verification

. Verify the installation succeeded by inspecting the CSV file by running the following command:
+
[source,terminal]
----
$ oc get csv -n openshift-compliance
----

. Verify that the Compliance Operator is up and running by running the following command:
+
[source,terminal]
----
$ oc get deploy -n openshift-compliance
----
