Skip to content
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

Enables relevant ActiveGate service ports based on capability requirements #622

Merged
merged 3 commits into from
Mar 9, 2022

Conversation

toszr
Copy link
Contributor

@toszr toszr commented Mar 8, 2022

Description

This changeset solves the problem deploying ActiveGate with capabilities which require a ClusterIP service (routing, dynatrace-api) but without metrics-ingest.

Before that, defining routiung and/or dynatrace-api without metrics-ingest caused deployment failure due to AG service not exposing HTTP(S) ports, with stack trace similar to:

{"error":"Service \"***-activegate\" is invalid: spec.ports: Required value","level":"error","logger":"main.controller.dynakube","msg":"Reconciler error","name":"***","namespace":"dynatrace","reconciler group":"dynatrace.com","reconciler kind":"DynaKube","stacktrace":"Service \"***-activegate\" is invalid: spec.ports: Required value                                                                    
github.com/Dynatrace/dynatrace-operator/src/controllers/activegate/reconciler/capability.(*Reconciler).createServiceIfNotExists                                                                                               
        /app/src/controllers/activegate/reconciler/capability/reconciler.go:173                                                                                                                                               
github.com/Dynatrace/dynatrace-operator/src/controllers/activegate/reconciler/capability.(*Reconciler).Reconcile                                                                                                              
        /app/src/controllers/activegate/reconciler/capability/reconciler.go:140                                                                                                                                               
github.com/Dynatrace/dynatrace-operator/src/controllers/dynakube.(*DynakubeController).reconcileActiveGateCapabilities                                                                                                        
        /app/src/controllers/dynakube/dynakube_controller.go:320                                                                                                                                                              
github.com/Dynatrace/dynatrace-operator/src/controllers/dynakube.(*DynakubeController).reconcileActiveGate                                                                                                                    
        /app/src/controllers/dynakube/dynakube_controller.go:292                                                                                                                                                              
github.com/Dynatrace/dynatrace-operator/src/controllers/dynakube.(*DynakubeController).reconcileDynaKube                                                                                                                      
        /app/src/controllers/dynakube/dynakube_controller.go:212                                                                                                                                                              
github.com/Dynatrace/dynatrace-operator/src/controllers/dynakube.(*DynakubeController).Reconcile                                                                                                                              
        /app/src/controllers/dynakube/dynakube_controller.go:123                                                                                                                                                              
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile                                                                                                                                                
        /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.0/pkg/internal/controller/controller.go:114                                                                                                                          
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler                                                                                                                                         
        /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.0/pkg/internal/controller/controller.go:311                                                                                                                          
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem                                                                                                                                      
        /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.0/pkg/internal/controller/controller.go:266                                                                                                                          
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2                                                                                                                                            
        /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.0/pkg/internal/controller/controller.go:227                                                                                                                          
runtime.goexit                                                                                                                                                                                                                
        /usr/local/go/src/runtime/asm_amd64.s:1581    

How can this be tested?

Automatic

Run or inspect kuttl test scenario tests/activegate/routing.

Manual

To test the fix, experiment with ActiveGate capabilities making sure that the expected service ports are exposed (and the AG pod is ready):

  • if routing, dynatrace-api and/or metrics-ingest capabilities are defined, ports http and https are exposed in dynakube-activegate
  • if (and only if) statsd-ingest is enabled, port statsd is exposed in dynakube-activegate
  • if statsd-ingest and at least one of routing, dynatrace-api and/or metrics-ingest are enabled, all the three ports are exposed (http, https, statsd)
  • if ActiveGate is deployed with kubernetes-monitoring only, the AG service is not created at all dynakube-activegate (or is removed)

Checklist

  • Unit tests have been updated/added
  • PR is labeled accordingly

@toszr toszr added bug Something isn't working activegate Changes related to Activegate labels Mar 8, 2022
@toszr toszr requested review from mjgrzybek, aorcholski and a team March 8, 2022 19:35
@toszr toszr self-assigned this Mar 8, 2022
@toszr toszr requested a review from mjgrzybek March 9, 2022 06:59
@toszr toszr enabled auto-merge (squash) March 9, 2022 07:07
@toszr toszr force-pushed the bugfix/pure-routing-activegate-fails-to-reconcile branch from 58ddeae to 995cf30 Compare March 9, 2022 07:58
@toszr toszr requested a review from mjgrzybek March 9, 2022 07:58
@toszr toszr merged commit 970eaed into master Mar 9, 2022
@toszr toszr deleted the bugfix/pure-routing-activegate-fails-to-reconcile branch March 9, 2022 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
activegate Changes related to Activegate bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants