Insights Operator Gathering Conditions Service
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
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:
- clone the Insights Behavioral Spec repository
- go into the cloned subdirectory
insights-behavioral-spec
- 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:
CONTAINER_RUNTIME
usually docker
or podman
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.