This repository was archived by the owner on Jul 28, 2026. It is now read-only.
[dev.operator-integrations] Add Integration into operator resource hierarchy - #1417
Merged
rfratto merged 6 commits intoMar 2, 2022
Conversation
…1alpha1 This allows us to easily generate the DeepCopy implementation for the struct instead of manually creating it. This commit also makes gragent the consistent name to refer to pkg/operator/apis/monitoring/v1alpha1, which is short and understandable.
rfratto
commented
Feb 23, 2022
| @@ -0,0 +1 @@ | |||
| pkg/operator/crds/*.yaml linguist-generated=true | |||
Contributor
Author
There was a problem hiding this comment.
I think this will impact future PRs, but not this one 🤔
rfratto
commented
Feb 23, 2022
Comment on lines
+12
to
+21
| // Label selector to find Integration resources to run. When nil, no | ||
| // integration resources will be defined. | ||
| Selector *metav1.LabelSelector `json:"selector,omitempty"` | ||
|
|
||
| // Label selector for namespaces to search when discovering integration | ||
| // resources. If nil, integration resources are only discovered in the | ||
| // namespace of the GrafanaAgent resource. | ||
| // | ||
| // Set to `{}` to search all namespaces. | ||
| NamespaceSelector *metav1.LabelSelector `json:"namespaceSelector,omitempty"` |
Contributor
Author
There was a problem hiding this comment.
These are called instanceSelector and instanceNamespaceSelector for metrics and logs, so this is inconsistent with that.
OTOH, those refer to selecting MetricsInstances and LogsInstances, so it might make sense to drop the prefix here.
tpaschalis
reviewed
Feb 24, 2022
captncraig
approved these changes
Mar 1, 2022
Contributor
There was a problem hiding this comment.
LGTM - My biggest concern is usability with the config and volumes and things being pretty free form fields.
It will probably be hard for users to know how to use this without pre-built snippets for each particular integration in the docs.
But no major design objections from me.
rlankfo
reviewed
Mar 1, 2022
rfratto
enabled auto-merge (squash)
March 2, 2022 15:03
rfratto
added a commit
to rfratto/agent
that referenced
this pull request
Apr 12, 2022
…erarchy (grafana-cold-storage#1417) * add CRDs for integrations * move pkg/operator/config.Deployment to pkg/operator/apis/monitoring/v1alpha1 This allows us to easily generate the DeepCopy implementation for the struct instead of manually creating it. This commit also makes gragent the consistent name to refer to pkg/operator/apis/monitoring/v1alpha1, which is short and understandable. * Mark CRDs as generated to hide their diffs from GitHub PR reviews * test Integrations in resource hierarchy * go mod tidy * fix doc error for ConfigMaps
3 tasks
rfratto
added a commit
that referenced
this pull request
Apr 12, 2022
* [dev.operator-integrations] Add Integration into operator resource hierarchy (#1417) * add CRDs for integrations * move pkg/operator/config.Deployment to pkg/operator/apis/monitoring/v1alpha1 This allows us to easily generate the DeepCopy implementation for the struct instead of manually creating it. This commit also makes gragent the consistent name to refer to pkg/operator/apis/monitoring/v1alpha1, which is short and understandable. * Mark CRDs as generated to hide their diffs from GitHub PR reviews * test Integrations in resource hierarchy * go mod tidy * fix doc error for ConfigMaps * [dev.operator-integrations] pkg/operator/config: Generate config for integrations (#1503) * pkg/operator/config: Support integration-specific configs * document why we want to skip adding a __replica__ label for integration metrics * [dev.operator-integrations] Reconcile operator integrations (#1556) * pkg/operator: refactor pod template generation into its own function Extract the generation of pod templates out into its own function: the implementation of generating the DaemonSetSpec (for logs) and StatefulSetSpec (for metrics) was incredibly similar, and this will be doubly true for integrations. A shared function for generating the template will help remove duplication and avoid bugs where template generation becomes out of sync for the various generated resources. * pkg/operator: move more common logic to generatePodTemplate * pkg/operator: make generating pod templates its own function * pkg/operator: share generated ObjectMeta between pod controllers * pkg/operator: reconcile integrations * pkg/operator: resolve lint errors * pkg/operator: e2e test deployment of integrations * docs: update docs for RBAC additions * pkg/operator: fix lint errors * pkg/operator/apis: fix "order resources" typo (other resources) * pkg/operator: elaborate why deleteManagedResource gets called * update changelog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
PR Description
This PR is a reimplementation of #1288 given the recent changes to the operator integrations RFC (#1224).
It introduces one new CRD, Integration, which defines an integration to run. The new CRD is injected into the resource hierarchy and discovered during reconcile, which is verified by a test.
Additional changes:
pkg/operator/config.Deploymenthas been moved topkg/operator/apis/monitoring/v1alpha1.Deployment. This allows us to take advantage of the DeepCopy function generation, which was previously manually maintained..gitattributeshas been modified to mark CRDs as generated so they don't inflate the size of diffs during PR review, though I think this will only change future PRs and not this one.pkg/operator/apis/monitoring/v1alpha1are now always aliases togragentfor consistency.gragentwas picked for its brevity and should be mostly grokkable by readers.Which issue(s) this PR fixes
Related to #1414.
Notes to the Reviewer
While the new resources are discovered during reconcile, nothing is done with them at the moment. Incorporating into the reconcile and deploying the integrations will be done over a few follow up PRs.
PR Checklist