Skip to content
This repository was archived by the owner on Jul 28, 2026. It is now read-only.

Reconcile when asset references change - #830

Merged
rfratto merged 8 commits into
grafana-cold-storage:mainfrom
rfratto:watch-asset-refs
Aug 20, 2021
Merged

Reconcile when asset references change#830
rfratto merged 8 commits into
grafana-cold-storage:mainfrom
rfratto:watch-asset-refs

Conversation

@rfratto

@rfratto rfratto commented Aug 16, 2021

Copy link
Copy Markdown
Contributor

PR Description

Configures the event handlers to trigger a reconcile when any referenced ConfigMap or Secret changes.

A few changes are made to facilitate doing this nicely:

  1. The event handlers will now operate on a set of interfaces that can implement custom logic for matching objects
  2. Reflection is used when discovering CRDs to reduce code deduplication

On top of this change, a potential fix for #793 is included: we will default to Kubernetes' (and Prometheus Operator's) behavior w/r/t label selectors: select nothing when the selector is nil, and select everything when the selector is {}. The exception for this continues to be namespace selectors, which will match the namespace of the parent object in the hierarchy when the namespace selector is nil.

Which issue(s) this PR fixes

Fixes #655
Fixes #793 (maybe?)

Notes to the Reviewer

In draft for now. Opening for early discussion, but I need to test this beyond the unit level and consider doing a little more cleanup with the deployment builder.

PR Checklist

  • CHANGELOG updated
  • Documentation added
  • Tests updated

resources:
- secrets
- services
- configmaps

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The operator's ClusterRole should've always been configured to watch for configmaps but wasn't. cc @hjet for the helm charts.

@rfratto

rfratto commented Aug 17, 2021

Copy link
Copy Markdown
Contributor Author

Testing this is blocked by #748 because the operator CRDs do not currently work against main.

@rfratto rfratto mentioned this pull request Aug 17, 2021
6 tasks
@rfratto
rfratto force-pushed the watch-asset-refs branch 2 times, most recently from 722fc9a to 1fd10ac Compare August 19, 2021 18:54
@rfratto

rfratto commented Aug 20, 2021

Copy link
Copy Markdown
Contributor Author

I tested this in two scenarios:

  1. Operator running outside of Kubernetes
  2. Operator running inside of Kubernetes

This revealed a few final bugs in our guide, which have now been fixed. This is ready for review.

@rfratto
rfratto marked this pull request as ready for review August 20, 2021 19:07
@rfratto
rfratto requested a review from mattdurham August 20, 2021 19:07
app: grafana-agent-example
spec:
image: grafana/agent:v0.18.2
image: grafana/agent:latest

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I needed to temporarily make this change since v0.18.2 doesn't have any of the logs changes needed for the operator to work & pull logs. Maybe we should leave it like this?

@mattdurham mattdurham left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mattdurham
mattdurham self-requested a review August 20, 2021 20:26

@mattdurham mattdurham left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double LGTM

@rfratto
rfratto merged commit 5c88b1c into grafana-cold-storage:main Aug 20, 2021
@rfratto
rfratto deleted the watch-asset-refs branch August 20, 2021 20:32
mattdurham pushed a commit that referenced this pull request Nov 11, 2021
* reconcile when used asset references change

* actually use the filtered set of resources, oops

* refactor deployment builder

* make crds

* changelog

* lint error

* structwalk: fix bug that caused crash

* fix permissions issues
@github-actions github-actions Bot added the frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed. label Apr 9, 2024
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed.

Projects

None yet

2 participants