Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: small refactor, docs improvements #1

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.swp
secrets/
87 changes: 56 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Cluster IQ

Cluster IQ is a tool for making stock of the Openshift Clusters and its
resources running on the most common cloud providers and collects relevant
information about the compute resources, access routes and billing.
Expand All @@ -7,8 +8,8 @@ Metrics and monitoring is not part of the scope of this project, the main
purpose is to maintain and updated inventory of the clusters and offer a easier
way to identify, manage, and estimate costs.


## Supported cloud providers

The scope of the project is to cover make stock on the most common public cloud
providers, but as the component dedicated to scrape data is decoupled, more
providers could be included in the future.
Expand All @@ -23,33 +24,38 @@ available for every cloud provider:
| GCP | No | No | No |

## Architecture

The following graph shows the architecture of this project:
![CLUSTER_IQ_ARCH](./doc/arch.png)

## Getting started

### Scanners
As each cloud provider has a different API and because of this, a specific
scanner adapted to the provider is required.
### Credentials file

To build every available scanner, use the following makefile rules:
```sh
make build-scanners
```
The file containing the access credentials to the cloud provider accounts
should look like this:

By default, every build rule will be performed using the Dockerfile for each
specific scanner
```text
[appeng]
provider = aws/gcp/azure
user = XXXXXXX
key = YYYYYYY
```

The credentials file must be located on the path `secrets/credentials` to work with `docker-compose`.

#### AWS Scanner
The scanner should run periodically to keep the inventory up to date.
To manage this on Openshift, a secret containing this information is needed.
Once you prepared your credentials file, run the following command to create the
secret:

```shell
# Building
make build-aws-scanner
oc create secret generic credentials \
-n <NAMESPACE> \
--from-file=credentials=<CREDENTIALS_FILE>
```


### Configuration

Available configuration via Env Vars:
| Key | Value | Description |
|----------------------|-------------------------------|-------------------------------------------|
Expand All @@ -62,26 +68,45 @@ Available configuration via Env Vars:
| CIQ_CREDS_FILE | string (Default: "") | Cloud providers accounts credentials file |

These variables are defined in `./<PROJECT_FOLDER>/.env` to be used on Makefile
and on `./<PROJECT_FOLDER>/manifests/config.yaml` to deploy it on Openshift.
and on `./<PROJECT_FOLDER>/deploy/openshift/config.yaml` to deploy it on Openshift.

### Credentials file
The file containing the access credentials to the cloud provider accounts
should look like this:
### Run local development environment

```text
[appeng]
provider = aws/gcp/azure
user = XXXXXXX
key = YYYYYYY
```shell
make start-dev
```

To manage this on Openshift, a secret containing this information is needed.
Once you prepared your credentials file, run the following command to create the
secret:
```sh
oc create secret generic credentials \
-n <NAMESPACE> \
--from-file=credentials=<CREDENTIALS_FILE>
The local environment is started via `docker-compose`.

The following services are available:

| Service | URL |
|----------------|-----------------------|
| UI | <http://localhost:8080> |
| API | <http://localhost:9000/clusters> |
| Redis | 0.0.0.0:6379 |

### Scanners

As each cloud provider has a different API and because of this, a specific
scanner adapted to the provider is required.

To build every available scanner, use the following makefile rules:

```shell
make build-scanners
```

By default, every build rule will be performed using the Dockerfile for each
specific scanner

#### AWS Scanner

The scanner should run periodically to keep the inventory up to date.

```shell
# Building
make build-aws-scanner
```

## API Server
Expand Down
4 changes: 2 additions & 2 deletions deploy/docker-compose/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.7'
version: "3.7"
services:
console:
image: quay.io/ecosystem-appeng/cluster-iq-console:latest
Expand Down Expand Up @@ -35,7 +35,7 @@ services:
CIQ_DB_PASS: ""
CIQ_CREDS_FILE: "/credentials"
volumes:
- ../secrets/credentials:/credentials:ro
- ../../secrets/credentials:/credentials:ro

redis:
image: registry.redhat.io/rhel8/redis-6@sha256:39c7fb6fa745e5e56bc2fb315917f83fe2f338f526e61e3c959495818c79ffa9
Expand Down
2 changes: 1 addition & 1 deletion src/aws_scanner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o aws_scanner ./src/aws_scan

## Run
####################
FROM scratch
FROM registry.access.redhat.com/ubi8/ubi-micro:8.8-5

# Arguments
ARG VERSION="0.1-alpha"
Expand Down