diff --git a/assets/defaults/scorecards.json b/assets/defaults/scorecards.json index f5bc2da..083b8cc 100644 --- a/assets/defaults/scorecards.json +++ b/assets/defaults/scorecards.json @@ -89,7 +89,7 @@ "rules": [ { "identifier": "highAvalabilityB", - "title": "Highly Available", + "title": "\"Wanted Replicas\" >= 1", "level": "Bronze", "query": { "combinator": "and", @@ -104,7 +104,7 @@ }, { "identifier": "highAvalabilityS", - "title": "Highly Available", + "title": "\"Wanted Replicas\" >= 2", "level": "Silver", "query": { "combinator": "and", @@ -119,7 +119,7 @@ }, { "identifier": "highAvalabilityG", - "title": "Highly Available", + "title": "\"Wanted Replicas\" >= 3", "level": "Gold", "query": { "combinator": "and", diff --git a/pkg/config/config.go b/pkg/config/config.go index aa753be..da6e369 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -7,6 +7,7 @@ import ( "fmt" "github.com/joho/godotenv" "github.com/port-labs/port-k8s-exporter/pkg/port" + "k8s.io/klog/v2" "strings" ) @@ -57,8 +58,10 @@ func NewConfiguration() (*port.Config, error) { c, err := GetConfigFile(ApplicationConfig.ConfigFilePath) var fileNotFoundError *FileNotFoundError if errors.As(err, &fileNotFoundError) { + klog.Infof("Config file not found, using defaults") return overrides, nil } + klog.Infof("Config file found") v, err := json.Marshal(overrides) if err != nil { return nil, fmt.Errorf("failed loading configuration: %w", err) diff --git a/pkg/defaults/init.go b/pkg/defaults/init.go index 2a04953..8d7e685 100644 --- a/pkg/defaults/init.go +++ b/pkg/defaults/init.go @@ -17,6 +17,7 @@ func getEventListenerConfig(eventListenerType string) *port.EventListenerSetting } func InitIntegration(portClient *cli.PortClient, applicationConfig *port.Config) error { + klog.Infof("Initializing Port integration") existingIntegration, err := integration.GetIntegration(portClient, applicationConfig.StateKey) defaultIntegrationConfig := &port.IntegrationAppConfig{ Resources: applicationConfig.Resources, @@ -25,21 +26,27 @@ func InitIntegration(portClient *cli.PortClient, applicationConfig *port.Config) } if err != nil { + klog.Infof("Integration does not exist, creating a new one") // The exporter supports a deprecated case where resources are provided in config file and integration does not // exist. If this is not the case, we support the new way of creating the integration with the default resources. // Only one of the two cases can be true. if defaultIntegrationConfig.Resources == nil && applicationConfig.CreateDefaultResources { + klog.Infof("Creating default resources") if err := initializeDefaults(portClient, applicationConfig); err != nil { klog.Warningf("Error initializing defaults: %s", err.Error()) klog.Warningf("The integration will start without default integration mapping and other default resources. Please create them manually in Port. ") } else { + klog.Infof("Default resources created successfully") return nil } } + klog.Infof("Could not create default resources, creating integration with no resources") + klog.Infof("Creating integration with config: %v", defaultIntegrationConfig) // Handle a deprecated case where resources are provided in config file return integration.CreateIntegration(portClient, applicationConfig.StateKey, applicationConfig.EventListenerType, defaultIntegrationConfig) } else { + klog.Infof("Integration exists, patching it") integrationPatch := &port.Integration{ EventListener: getEventListenerConfig(applicationConfig.EventListenerType), } @@ -47,6 +54,7 @@ func InitIntegration(portClient *cli.PortClient, applicationConfig *port.Config) // Handle a deprecated case where resources are provided in config file and integration exists from previous //versions without a config if existingIntegration.Config == nil { + klog.Infof("Integration exists without a config, patching it with default config: %v", defaultIntegrationConfig) integrationPatch.Config = defaultIntegrationConfig }