insights-cli

module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 License: Apache-2.0

README

Insights-cli

FairwindsOps Apache 2.0 license

A command line tool for interacting with Fairwinds Insights.

Want to learn more? Reach out on the Slack channel (request invite), send an email to opensource@fairwinds.com, or join us for office hours on Zoom

Contributing

PRs welcome! Check out the Contributing Guidelines and Code of Conduct for more information.

Installation

Binary

Install the binary from our releases page.

Go Get
go get -u github.com/fairwindsops/insights-cli/cmd/insights

Usage

The Insights CLI requires a configuration file which by default is named fairwinds-insights.yaml in your current directory. You can overwrite this with the --config flag. You will also need the admin token from your organization in Fairwinds Insights stored in the FAIRWINDS_TOKEN environment variable.

At a minimum the fairwinds-insights.yaml file must contain the following. Any additional values will be ignored.

options:
  organization: <org Name>
Global flags

insights --config <filename> will let you point to a different location for the configuration file other than ./fairwinds-insights.yaml.

insights --log-level warn will omit any info level log messages.

Policy

These are functions related to the Rules Engine or OPA polices.

Sync

Synchronize OPA policies to Fairwinds Insights.

The sync functionality expects a directory structure like the following.

.
+-- policy1
|   +-- policy.yaml
|   +-- instance1.yaml
+-- policy2
|   +-- policy.rego
|   +-- instance1.yaml

Running insights policy sync -d ./examples will create two policies, one called policy1 the other called policy2 which each have an instance named instance1. The rego for these policies will be pulled from the policy.x file inside that folder. See the examples folder for more examples.

Running insights policy sync -d ./examples --dry-run will print out a message telling you that it would create/update/delete policies but it won't actually save any changes. This can be very useful for checking a repository for changes.

Running insights policy sync -d ./examples --fullsync will delete any policies not present in the examples folder. Without --fullsync policies could still be deleted if the policy.rego file or the rego field of the policy.yaml are empty.

List

Lists OPA policies currently applied to a Fairwinds Insights Organization.

The list function will show the names of all OPA policies currently applied and any instances applied to that policy.

Running the command insights policy list would display output like the following:

.
└── opa
    └── no-name
        └── deployments

Directories

Path Synopsis
cmd
pkg
opa

Jump to

Keyboard shortcuts

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