Coder Social home page Coder Social logo

isabella232 / newrelic-k8s-metrics-adapter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from newrelic/newrelic-k8s-metrics-adapter

0.0 0.0 0.0 386 KB

This repository hosts the NewRelic Kubernetes metrics adapter

License: Apache License 2.0

Shell 2.67% Python 1.40% Go 79.16% Makefile 6.77% Dockerfile 1.21% Starlark 7.23% Mustache 1.57%

newrelic-k8s-metrics-adapter's Introduction

Community Project header

newrelic-k8s-metrics-adapter

The newrelic-k8s-metrics-adapter implements the external.metrics.k8s.io API to support the use of external metrics based New Relic NRQL queries.

During installation, a set of metrics can be configured to be available for Horizontal Pod Autoscalers to be used. Once deployed, the metrics values are fetched from the configured New Relic account using the NerdGraph API and the configured NRQL query.

The adapter uses the Custom Metrics Adapter Server Boilerplate as a base code to implement the external metric api server.

Installation

This project has the newrelic-k8s-metrics-adapter Helm Chart in charts/newrelic-k8s-metrics-adapter and can also be installed through the nri-bundle chart in newrelic helm charts repo.

For further information regarding the installation refer to the official docs and to the README.md and the values.yaml of the chart.

Getting Started

In order to start using the adapter, please start by installing and configuring the adapter using the provided Helm Chart. After this, metrics will be available for consumption by Horizontal Pod Autoscaler using the configured metric names. For further information regarding the usage of the adapter refer to the official docs.

Develop, Test and Run Locally

For the development process kind and tilt tools are used.

Building

To build the image:

GOOS=linux make image

To build the binary:

GOOS=linux make build

Configure Tilt

If you want to use a kind cluster for testing, configure Tilt using the command below:

cat <<EOF > tilt_option.json
{
  "default_registry": "localhost:5000"
}
EOF

If you want to use existing Kubernetes cluster, create tilt_option.json file with content similar to below:

{
  "default_registry": "quay.io/<your username>",
  "allowed_contexts": "<kubeconfig context to use>"
}

Creating kind cluster

If you want to use a local kind cluster for testing, create it with command below:

make kind-up

Run

If you use a kind cluster, simply run:

make tilt-up

If you deploy on external cluster, run the command below, pointing TILT_KUBECONFIG to your kubeconfig file:

TILT_KUBECONFIG=~/.kube/config make tilt-down

Now, when you make changes to the code, the metrics adapter binary will be built locally, copied to the Pod, and then executed.

Testing

In order to run unit tests run:

make test

In order to run integration and e2e tests run:

make test-integration
make test-e2e

Notice that in order to run both integration tests and e2e is required to configure access to a New Relic account. This can be done either via environment variable directly or by putting required environment variables into .env file, which will be read by Makefile and they will be used for other commands.

.env example content looks like following:

NEWRELIC_API_KEY=NRAK-XXX
NEWRELIC_ACCOUNT_ID=1
#NEWRELIC_REGION=EU
NEWRELIC_CLUSTER_NAME=my-cluster

Also in order to run e2e tests, you will need a working environment available with the newrelic-k8s-metrics-adapter running. Both installing the newrelic-k8s-metrics-adapter chart or spinning up the environment with make tilt-up are possible options.

It is also possible to run such tests against any cluster you have access to by setting the environment variable TEST_KUBECONFIG=/your/kube/config/path.

Support

Contribute

We encourage your contributions to improve newrelic-k8s-metrics-adapter! Keep in mind that when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project.

If you have any questions, or to execute our corporate CLA (which is required if your contribution is on behalf of a company), drop us an email at [email protected].

A note about vulnerabilities

As noted in our security policy, New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.

If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through HackerOne.

If you would like to contribute to this project, review these guidelines.

To all contributors, we thank you! Without your contribution, this project would not be what it is today.

License

The newrelic-k8s-metrics-adapter is licensed under the Apache 2.0 License.

The newrelic-k8s-metrics-adapter also uses source code from third-party libraries. You can find full details on which libraries are used, and the terms under which they are licensed in the third-party notices document.

newrelic-k8s-metrics-adapter's People

Contributors

alvarocabanas avatar gsanchezgavier avatar invidian avatar jbeveland27 avatar kang-makes avatar marcsanmi avatar paologallinaharbur avatar renovate[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.