Conversation
| > [!NOTE] | ||
| > If you do not see the changes in the plugin UI, try clearing your browser cache. | ||
|
|
There was a problem hiding this comment.
I spent 20 minutes banging my head against this 😅
| * One or more watchers, which consume events for particular kinds | ||
| In our case, the boilerplate code uses the `simple.Operator` operator type, which handles dealing with tying together informers and watchers (or reconcilers) in an `InformerController` for us in `cmd/operator/main.go`: | ||
|
|
||
| In our case, the boilerplate code uses the opinionated `simple.App` App type, which handles dealing with tying together informers and watchers (or reconcilers) as Managed Kinds for us in `pkg/app/app.go`: |
There was a problem hiding this comment.
This bit has not been updated since the refactor away from directly using simple.App. It could do with a redraft by someone more familiar IMO
| return nil, fmt.Errorf("unable to create IssueWatcher: %w", err) | ||
| } | ||
|
|
||
| prometheus.MustRegister(issueWatcher.PrometheusCollectors()...) |
There was a problem hiding this comment.
This is a bodge that worked for me, i suspect there's a better way to register this collector, but I couldn't see anything useful in simple.App
| to this: | ||
| ```go | ||
| issueWatcher, err := watchers.NewIssueWatcher(runner.ClientGenerator()) | ||
| issueWatcher, err := watchers.NewIssueWatcher(k8s.NewClientRegistry(cfg.KubeConfig, k8s.ClientConfig{})) |
There was a problem hiding this comment.
Another bodge from me to highlight a change required. This worked, but I imagine its not the way it "should" work after the refactor.
| Basically, it consumes an admission request and produces a validation error if validation fails, or returns nil on success. | ||
| The `simple` package has a ready-to-go implementation for this: `simple.Validator`, which calls `ValidateFunc` when `Validate` is called. | ||
| That's what we're using here, but you can always define your own type to implement `KindValidator`, too. | ||
| We use the `simple.Validator` struct here to validate, but you can use any type that implements `simple.KindValidator`. |
There was a problem hiding this comment.
I couldn't get these changes to apply for me, even after a teardown & clean. But its near the end of the day, I can try again tomorrow!
I've worked through the tutorial with very little context on the project, these are some amendments and comments i have as feedback