Skip to content

Commit

Permalink
added resource deletion commands
Browse files Browse the repository at this point in the history
Signed-off-by: RishabhKodes <rishabhbhandari6@gmail.com>
  • Loading branch information
RishabhKodes committed Aug 28, 2024
1 parent 51909f1 commit 60aba81
Show file tree
Hide file tree
Showing 2 changed files with 192 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bicep.makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,13 @@ oc-login: ## Login with oc to existing ARO cluster
oc login "$(shell az aro show --name ${ARO_CLUSTER_NAME} --resource-group ${ARO_RESOURCE_GROUP} --query "apiserverProfile.url" -o tsv)" \
-u "$(shell az aro list-credentials --name ${ARO_CLUSTER_NAME} --resource-group ${ARO_RESOURCE_GROUP} --query 'kubeadminUsername' -o tsv)" \
-p "$(shell az aro list-credentials --name ${ARO_CLUSTER_NAME} --resource-group ${ARO_RESOURCE_GROUP} --query 'kubeadminPassword' -o tsv)"

.PHONY: resource-group-delete
resource-group-delete: ## Delete the Azure resource group
$(call required-environment-variables,ARO_RESOURCE_GROUP)
az group delete --name ${ARO_RESOURCE_GROUP} --yes --no-wait

.PHONY: aro-delete
aro-delete: ## Delete the ARO cluster
$(call required-environment-variables,ARO_RESOURCE_GROUP ARO_CLUSTER_NAME)
az aro delete --name ${ARO_CLUSTER_NAME} --resource-group ${ARO_RESOURCE_GROUP} --yes --no-wait
182 changes: 182 additions & 0 deletions edge-integration-cell/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
<!--
SPDX-FileCopyrightText: 2024 SAP edge team
SPDX-FileContributor: Kirill Satarin (@kksat)
SPDX-FileContributor: Manjun Jiao (@mjiao)
SPDX-License-Identifier: Apache-2.0
-->

# OCP External Services for SAP EIC Test Validation

This repository provides scripts and procedures for setting up test validation external services for SAP EIC on OpenShift Container Platform (OCP). The services covered include PostgreSQL and Redis. This guide will help you install and configure these services, as well as perform cleanup after validation.

## Prerequisites

- Access to an OpenShift Container Platform cluster using an account with `cluster-admin` permissions.
- Installed `oc`, `jq`, and `git` command line tools on your local system.

## Shared Storage

When ODF (OpenShift Data Foundation) is installed, set the shared file system parameters as follows:

| Property | Settings |
|------------------------------|---------------------------------|
| Enable Shared File System | yes |
| Shared File System Storage Class | ocs-storagecluster-cephfs |

Additionally, set the ODF `ocs-storagecluster-ceph-rbd` storage class as default for RWO/RWX Block volumes to meet most block storage requirements for various services running on OpenShift.

## PostgreSQL

The following steps will install the Crunchy Postgres Operator and use its features to manage the lifecycle of the external PostgreSQL DB service.

1. Clone the repository:
```bash
git clone https://github.com/redhat-sap/sap-edge.git
```
2. Create a new project:
```bash
oc new-project sap-eic-external-postgres
```
3. Apply the OperatorGroup configuration:
```bash
oc apply -f sap-edge/edge-integration-cell/external-postgres/operatorgroup.yaml
```
4. Apply the Subscription configuration:
```bash
oc apply -f sap-edge/edge-integration-cell/external-postgres/subscription.yaml
```
5. Wait for the Postgres operator to be ready:
```bash
bash sap-edge/edge-integration-cell/external-postgres/wait_for_postgres_operator_ready.sh
```
6. Create a PostgresCluster:
```bash
oc apply -f sap-edge/edge-integration-cell/external-postgres/postgrescluster-v15.yaml
```
- For other versions, replace `v14` with `v15` or `v16`.
7. Wait for Crunchy Postgres to be ready:
```bash
bash sap-edge/edge-integration-cell/external-postgres/wait_for_postgres_ready.sh
```
8. Get access details of Crunchy Postgres:
```bash
bash sap-edge/edge-integration-cell/external-postgres/get_external_postgres_access.sh
```

After running the above script, you will get the access details of Crunchy Postgres like the following:
- External DB Hostname: `hippo-primary.sap-eic-external-postgres.svc`
- External DB Port: `5432`
- External DB Name: `eic`
- External DB Username: `eic`
- External DB Password: `xklaieniej12#`
- External DB TLS Root Certificate saved to `external_postgres_db_tls_root_cert.crt`

Please use the provided information to set up the EIC external DB accordingly.

### Cleanup PostgreSQL

To clean up the PostgresCluster:

```bash
oc delete postgrescluster eic -n sap-eic-external-postgres
bash sap-edge/edge-integration-cell/external-postgres/wait_for_deletion_of_postgrescluster.sh
oc delete subscription crunchy-postgres-operator -n sap-eic-external-postgres
oc get csv -n sap-eic-external-postgres --no-headers | grep 'postgresoperator' | awk '{print $1}' | xargs -I{} oc delete csv {} -n sap-eic-external-postgres
oc delete namespace sap-eic-external-postgres
```

# Redis Setup for SAP EIC on OCP

This guide provides instructions for setting up and validating the Redis service for SAP EIC on OpenShift Container Platform (OCP). The steps include installing the Redis Enterprise Operator, creating a RedisEnterpriseCluster and RedisEnterpriseDatabase, and cleaning up after validation.

## Prerequisites

- Access to an OpenShift Container Platform cluster using an account with `cluster-admin` permissions.
- Installed `oc`, `jq`, and `git` command line tools on your local system.

## Redis Setup

The following steps will install the Redis Enterprise Operator and use its features to manage the lifecycle of the external Redis datastore service.

1. Clone the repository:
```bash
git clone https://github.com/redhat-sap/sap-edge.git
```
2. Create a new project:
```bash
oc new-project sap-eic-external-redis
```
3. Apply the OperatorGroup configuration:
```bash
oc apply -f sap-edge/edge-integration-cell/external-redis/operatorgroup.yaml
```
4. Apply the Subscription configuration:
```bash
oc apply -f sap-edge/edge-integration-cell/external-redis/subscription.yaml
```
5. Apply the Security Context Constraint (SCC):
- For OpenShift versions earlier than 4.16, use:
```bash
oc apply -f sap-edge/edge-integration-cell/external-redis/security_context_constraint_v2.yaml
```
- For OpenShift versions 4.16 and later, use
```bash
oc apply -f sap-edge/edge-integration-cell/external-redis/security_context_constraint.yaml
```
6. Wait for the Redis operator to be ready:
```bash
bash sap-edge/edge-integration-cell/external-redis/wait_for_redis_operator_ready.sh
```
7. Create a RedisEnterpriseCluster:
```bash
oc apply -f sap-edge/edge-integration-cell/external-redis/redis_enterprise_cluster.yaml
```
8. Wait for the RedisEnterpriseCluster to be ready:
```bash
bash sap-edge/edge-integration-cell/external-redis/wait_for_rec_running_state.sh
```
9. Create a RedisEnterpriseDatabase:
```bash
oc apply -f sap-edge/edge-integration-cell/external-redis/redis_enterprise_database.yaml
```
- Note: You might need to run the above command several times until it works because the previously created RedisEnterpriseCluster needs some time to enable the admission webhook successfully.
10. Wait for the RedisEnterpriseDatabase to be ready:
```bash
bash sap-edge/edge-integration-cell/external-redis/wait_for_redb_active_status.sh
```
11. Get access details of Redis:
```bash
bash sap-edge/edge-integration-cell/external-redis/get_redis_access.sh
```

After running the above script, you will get the access details of Redis like the following:
- External Redis Addresses: `redb-headless.sap-eic-external-redis.svc:12117`
- External Redis Mode: `standalone`
- External Redis Username: `[leave me blank]`
- External Redis Password: `XpglWqoR`
- External Redis Sentinel Username: `[leave me blank]`
- External Redis Sentinel Password: `[leave me blank]`
- External Redis TLS Certificate content saved to `external_redis_tls_certificate.pem`
- External Redis Server Name: `[leave me blank]`

## Cleanup Redis

To clean up the Redis instance:

```bash
oc delete redisenterprisedatabase redb -n sap-eic-external-redis
oc delete redisenterprisecluster rec -n sap-eic-external-redis
bash sap-edge/edge-integration-cell/external-redis/wait_for_deletion_of_rec.sh
oc delete subscription redis-enterprise-operator-cert -n sap-eic-external-redis
oc get csv -n sap-eic-external-redis --no-headers | grep 'redis-enterprise-operator' | awk '{print $1}' | xargs -I{} oc delete csv {} -n sap-eic-external-redis
# For OpenShift versions earlier than 4.16
oc delete scc redis-enterprise-scc-v2
# For OpenShift versions 4.16 and later
oc delete scc redis-enterprise-scc
oc delete namespace sap-eic-external-redis
````
# License
This project is licensed under the Apache License 2.0. See the [LICENSE](https://www.apache.org/licenses/LICENSE-2.0) for details.

0 comments on commit 60aba81

Please sign in to comment.