-
Notifications
You must be signed in to change notification settings - Fork 450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support openshift routes #1206
Support openshift routes #1206
Conversation
a9c5522
to
5c29ef0
Compare
69617ea
to
7285b8e
Compare
actually iam a bit unhappy with the current solution. Any thoughts how to solve this a bit more elegant @pavolloffay ? func (r *OpenTelemetryCollectorReconciler) registerOnChangeTask() {
// NOTE: At the time the reconciler gets created, the platform type is still unknown.
// TODO: does it actually work? since config is just a copy?
r.config.OnChange = func() error {
r.muTasks.Lock()
defer r.muTasks.Unlock()
var (
routesPos = -1
otelPos = -1
)
for i, t := range r.tasks {
// search for route reconciler
switch t.Name {
case "opentelemetry":
otelPos = i
case "routes":
routesPos = i
}
}
if otelPos == -1 {
return fmt.Errorf("missing reconciler task: opentelemetry")
}
plt := r.config.Platform()
// if exists and platform is openshift
if routesPos == -1 && plt == platform.OpenShift {
end := r.tasks[otelPos:]
r.tasks = append([]Task{}, r.tasks[:otelPos]...)
r.tasks = append(r.tasks, Task{reconcile.Routes, "routes", true})
r.tasks = append(r.tasks, end...)
}
// if exists and platform is not openshift
if routesPos != -1 && plt != platform.OpenShift {
r.tasks = append(r.tasks[:routesPos], r.tasks[routesPos+1:]...)
}
return r.config.OnChange()
}
} |
ok, it seems the Since we need to register some kind of onChange method to add and remove routes from the reconciliation.. I thought about different ways:
var onChange func() error
cfg := config.New(
...
config.WithOnChange(func() error { return onChange() }),
...
)
...
onChange := otelReonciler.OnChange
Personally, I would prefer solution 3. |
8b3bf8a
to
b1ed67f
Compare
@pavolloffay as discussed in person, an extra structure is introduced to define the route termination. |
b1ed67f
to
2b6b9ee
Compare
2b6b9ee
to
aeadd9e
Compare
ba6bb56
to
3aa2834
Compare
Signed-off-by: Benedikt Bongartz <[email protected]>
Signed-off-by: Benedikt Bongartz <[email protected]>
- determine platform - grant otel controller permission to route api Signed-off-by: Benedikt Bongartz <[email protected]>
Signed-off-by: Benedikt Bongartz <[email protected]>
Signed-off-by: Benedikt Bongartz <[email protected]>
7ec075b
to
365e9ca
Compare
Signed-off-by: Benedikt Bongartz <[email protected]>
Signed-off-by: Benedikt Bongartz <[email protected]>
Signed-off-by: Benedikt Bongartz <[email protected]>
365e9ca
to
807a7ab
Compare
807a7ab
to
e2d554a
Compare
@open-telemetry/operator-ta-maintainers thats what i touched there: 5e800c8 |
bb91937
to
4392692
Compare
@pavolloffay could you have a look? :) |
Signed-off-by: Benedikt Bongartz <[email protected]>
``` main.go:238:16: shadow: declaration of "err" shadows declaration at line 230 (govet) configBytes, err := yaml.Marshal(configs) ^ ``` Signed-off-by: Benedikt Bongartz <[email protected]>
Signed-off-by: Benedikt Bongartz <[email protected]>
Signed-off-by: Benedikt Bongartz <[email protected]>
4392692
to
0a860e8
Compare
* split service port from config calculation into its own function Signed-off-by: Benedikt Bongartz <[email protected]> * register openshift route v1 as valid ingress enum Signed-off-by: Benedikt Bongartz <[email protected]> * add routes to reconcile loop - determine platform - grant otel controller permission to route api Signed-off-by: Benedikt Bongartz <[email protected]> * add openshift api to go mod Signed-off-by: Benedikt Bongartz <[email protected]> * add naming method for openshift routes Signed-off-by: Benedikt Bongartz <[email protected]> * add route reconcile routine Signed-off-by: Benedikt Bongartz <[email protected]> * add route reconciler if platform changes to openshift Signed-off-by: Benedikt Bongartz <[email protected]> * move route cr definition into testdata package Signed-off-by: Benedikt Bongartz <[email protected]> * controllers: verify that route is created Signed-off-by: Benedikt Bongartz <[email protected]> * crd: move route tls termination settings into extra section Signed-off-by: Benedikt Bongartz <[email protected]> * fix: share platform state across copied config objects Signed-off-by: Benedikt Bongartz <[email protected]> * controller: split opentelemetry collector callback Signed-off-by: Benedikt Bongartz <[email protected]> * tests: add route e2e tests Signed-off-by: Benedikt Bongartz <[email protected]> * fix govet linting ``` main.go:238:16: shadow: declaration of "err" shadows declaration at line 230 (govet) configBytes, err := yaml.Marshal(configs) ^ ``` Signed-off-by: Benedikt Bongartz <[email protected]> * add ingress workaround description Signed-off-by: Benedikt Bongartz <[email protected]> * regenerate Signed-off-by: Benedikt Bongartz <[email protected]> Signed-off-by: Benedikt Bongartz <[email protected]>
Closes #902