Insights Operator Gathering Conditions Service

GitHub Pages Go Report Card Build Status GitHub go.mod Go version codecov License

Gathering Conditions Services to Insights Operator.

Description

Simple service that provides conditional gathering-related rules. Such rules are read from JSON structures and made available via REST API.

REST API

REST API is described by OpenAPI specification.

Usage

Build

To build the service, install Go 1.14 or above and run:

make build

Configure

Configuration is done by toml config, taking the config/config.toml in the working directory if no configuration is provided. This can be overriden by INSIGHTS_OPERATOR_CONDITIONAL_SERVICE_CONFIG_FILE environment variable.

Conditions

First you need to clone the conditions repository and build it

git clone https://github.com/RedHatInsights/insights-operator-gathering-conditions
cd insights-operator-gathering-conditions
./build.sh
cp -r ./build ../conditions

It will build the gathering conditions image.

Run

To execute the service, run:

bin/insights-conditions-service

There are some flags for different purposes:

  • bin/insights-conditions-service -show-configuration: used to print the configuration in stdout.
  • bin/insights-conditions-service -show-authors: used to print the authors of the repository.
  • bin/insights-conditions-service -show-version: used to print the binary version including commit, branch and build time.

Makefile

There are many options inside the Makefile that may be useful for debugging/deploying the service:

❯ make help
Usage: make <OPTIONS> ... <TARGETS>

Available targets are:

clean                Run go clean
build                Keep this rule for compatibility
fmt                  Run go fmt -w for all sources
lint                 Run golint
vet                  Run go vet. Report likely mistakes in source code
cyclo                Run gocyclo
ineffassign          Run ineffassign checker
shellcheck           Run shellcheck
errcheck             Run errcheck
goconst              Run goconst checker
gosec                Run gosec checker
abcgo                Run ABC metrics checker
style                Run all the formatting related commands (fmt, vet, lint, cyclo) + check shell scripts
run                  Build the project and executes the binary
test                 Run the unit tests
integration_tests    Run all integration tests
before_commit        Checks done before commit
help                 Show this help screen
container-build      Build the container image
container-run        Run the container image

Container

To build the container you need to set up two environment variables:

  1. CONTAINER_RUNTIME usually docker or podman
  2. CONTAINER_IMAGE_NAME the image name

then use the command:

make container-build

Once build you can run it using:

make container-run

Then you can test it:

curl -s http://localhost:8081/api/gathering/gathering_rules | jq

License

This project is licensed by the Apache License 2.0. For more information check the LICENSE file.

Package manifest

Package manifest is available at docs/manifest.txt.