insights-operator-gathering-conditions-service

command module
v0.0.0-...-5c36ebe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

README

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:

./insights-operator-gathering-conditions-service

or:

make run

Then you can test it:

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

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                Build binary containing service executable
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
function_list        List all functions in generated binary file
container-build      Build the container image
container-run        Run the container image

BDD tests

Behaviour tests for this service are included in Insights Behavioral Spec repository. In order to run these tests, the following steps need to be made:

  1. clone the Insights Behavioral Spec repository
  2. go into the cloned subdirectory insights-behavioral-spec
  3. run the aggregator_tests.sh from this subdirectory

List of all test scenarios prepared for this service is available at https://redhatinsights.github.io/insights-behavioral-spec/feature_list.html#insights-operator-gathering-conditions-service

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

Definition of Done for new features and fixes

Please look at DoD.md document for definition of done for new features and fixes.

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.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
cli
Implementation of REST API tests that checks all REST API endpoints of Insights aggregator service.
Implementation of REST API tests that checks all REST API endpoints of Insights aggregator service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL