/
module_integration.go
37 lines (30 loc) · 1.75 KB
/
module_integration.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (c) 2023, Oracle and/or its affiliates.
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
package nodeexporter
import (
"github.com/verrazzano/verrazzano-modules/pkg/controller/spi/controllerspi"
"github.com/verrazzano/verrazzano/pkg/vzcr"
"github.com/verrazzano/verrazzano/platform-operator/apis/verrazzano/v1alpha1"
"github.com/verrazzano/verrazzano/platform-operator/controllers/verrazzano/component/common/watch"
"github.com/verrazzano/verrazzano/platform-operator/controllers/verrazzano/component/fluentoperator"
promoperator "github.com/verrazzano/verrazzano/platform-operator/controllers/verrazzano/component/prometheus/operator"
"github.com/verrazzano/verrazzano/platform-operator/controllers/verrazzano/component/spi"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
)
type valuesConfig struct {
PrometheusOperatorEnabled bool `json:"prometheusOperatorEnabled"`
}
// GetModuleConfigAsHelmValues returns an unstructured JSON snippet representing the portion of the Verrazzano CR that corresponds to the module
func (c prometheusNodeExporterComponent) GetModuleConfigAsHelmValues(effectiveCR *v1alpha1.Verrazzano) (*apiextensionsv1.JSON, error) {
if effectiveCR == nil {
return nil, nil
}
configSnippet := valuesConfig{
PrometheusOperatorEnabled: vzcr.IsPrometheusOperatorEnabled(effectiveCR),
}
return spi.NewModuleConfigHelmValuesWrapper(configSnippet)
}
// GetWatchDescriptors returns the list of WatchDescriptors for objects being watched by the component
func (c prometheusNodeExporterComponent) GetWatchDescriptors() []controllerspi.WatchDescriptor {
return watch.GetModuleInstalledWatches([]string{promoperator.ComponentName, fluentoperator.ComponentName})
}