The App Metrics Operator for Kubernetes provides an easy way to install and manage AeroGear App Metrics Service on Kubernetes.
ℹ️
|
This operator currently only works on OpenShift. This is because it provisions `Route`s and `ImageStream`s. In future we aim to make it work on vanilla Kubernetes also. |
As a user with admin permissions, you can install the app-metrics-operator and a sample CR in your OpenShift cluster as follows:
make cluster/prepare make install
The operator uses 2 image streams and what image streams to use are configurable with environment variables.
App Metrics image stream is created within the same namespace by the operator.
However, for Postgres the image stream in openshift
namespace is used.
The following table shows the available environment variable names, along with their default values:
Name | Default | Purpose |
---|---|---|
|
|
Name of the App Metrics image stream that will be created by the operator. |
|
|
Tag of the App Metrics image stream that will be created by the operator. |
|
|
Initial image for the App Metrics image stream that will be created by the operator. |
|
|
Namespace to look for the Postgres image stream. |
|
|
Name of the Postgres image stream to look for. |
|
|
Tag of the Postgres image stream. |
🔥
|
Re-deploying this operator with customized images will cause all instances owned by the operator to be updated. |
If you would like to modify the container names, you can use the following environment variables.
Name | Default |
---|---|
|
|
|
|
This is the main installation resource kind. Creation of a valid AppMetricsService CR will result in a functional App Metrics Service deployed to your namespace.
AppMetricsService
has no fields that are configurable.
An example AppMetricsService resource is available at
./deploy/crds/metrics_v1alpha1_appmetricsservice_cr.yaml
:
apiVersion: metrics.aerogear.org/v1alpha1
kind: AppMetricsService
metadata:
name: example-appmetricsservice
To create this, you can run:
kubectl apply -n app-metrics -f ./deploy/crds/metrics_v1alpha1_appmetricsservice_cr.yaml
To see the created instance then, you can run:
kubectl get appmetricsservice example-appmetricsservice -n app-metrics -o yaml
This is the service consumption resource kind. Creation of a valid AppMetricsConfig CR will write the client config to a config map in the CR namespace.
AppMetricsConfig
has no fields that are configurable.
An example AppMetricsConfig resource is available at
./deploy/crds/metrics_v1alpha1_appmetricsconfig_cr.yaml
:
apiVersion: metrics.aerogear.org/v1alpha1
kind: AppMetricsConfig
metadata:
name: example-app
To create this, you can run:
kubectl apply -n app-metrics -f ./deploy/crds/metrics_v1alpha1_appmetricsconfig_cr.yaml
To see the created instance then, you can run:
kubectl get appmetricsconfig example-app -n app-metrics -o yaml
The config map created will have the name pattern <cr-app-name>-metrics
. For the example above,
you can run the following command to get the config map.
kubectl get configmap example-app-metrics -n app-metrics -o yaml
It will have content similar to this:
apiVersion: v1 data: SDKConfig: >- {"url": "https://example-appmetricsservice-appmetrics-app-metrics.openshift.cluster.hostname"} kind: ConfigMap ...
All AeroGear projects use the same communication channels.
Issue tracker
Our main issue tracker is AeroGear on JBoss Jira. Issues may also be created here on GitHub for individual projects.
Chat
For synchronous real-time chat, we use Matrix/IRC. These are bridged together, so you can choose which is more convenient for you: #aerogear:matrix.org on Matrix or #aerogear on FreeNode IRC.
Discussion list
For important conversations, we discuss asynchronously on this Google Groups Mailing List. This is great for discussions that should involve many people in different time zones, and allows us to easily link back to conversations in future.
-
Access to an OpenShift cluster with admin privileges to be able to create Roles. Minishift is suggested.
-
Go, Make, dep, operator-sdk, kubectl (kubectl can just be a symlink to oc)
-
Prepare the operator project:
make cluster/prepare
-
Run the operator (locally, not in OpenShift):
make code/run
-
Create an App Metrics Service instance (in another terminal):
make install
-
Watch the status of your App Metrics Service instance provisioning (optional):
watch -n1 "kubectl get po -n app-metrics && echo '' && kubectl get appmetricsservice -o yaml -n app-metrics"
-
If you want to be able to work with resources that require the local instance of your operator to be able to talk to the App Metrics instance in the cluster, then you’ll need to make a corresponding domain name available locally. Something like the following should work, by adding an entry to /etc/hosts for the example Service that’s created, then forwarding the port from the relevant Pod in the cluster to the local machine. Run this in a separate terminal, and ctrl+c to clean it up when finished:
-
Create an App Metrics Config instance:
… make example-app/apply …
-
Watch the status of your App Metrics Config (optional):
watch -n1 "kubectl get po -n app-metrics && echo '' && kubectl get appmetricsconfig -o yaml -n app-metrics"
-
Check the config map created:
… kubectl get configmap -n app-metrics example-app-metrics -o yaml …
-
When finished, clean up:
make cluster/clean
If you’ve found a security issue that you’d like to disclose confidentially please contact the Red Hat Product Security team.
The App Metrics Operator is licensed under the Apache License, Version 2.0 License, and is subject to the AeroGear Export Policy.