feat: support multiple configurations via configmaps #230
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Currently the operator supports only one definition of configuration YAML in the
InstanaAgent
custom resource. This PR adds support for defining multiple configurations and merging them.Problem
Consider the the problem of deploying the operator to monitor multiple DB2 instances in a cluster. To configure the DB2 plugin, the following configuration is needed:
Note that this supports a list of configurations, one for each DB2 instance. This configuration may not be known at deployment time for the operator. Automation for deploying each DB2 instance must update this configuration by inserting its own details into the list, however, this will result in consistency problems if multiple automation instances try to update their details at the same time.
Solution
ConfigMap
with the special labelinstana.io/agent-config=true
. The operator uses the Kubernetes API to find all such resources in the cluster, and merges their configuration into theconfiguration_yaml
field read fromInstanaAgent
custom resource.configuration_yaml
data is as follows:Example
InstanaAgent
custom resource with the following YAML in theconfiguration_yaml
field:ConfigMap
with the following YAML in itsconfiguration_yaml
field underdata
:ConfigMap
with the following YAML in itsconfiguration_yaml
field underdata
: