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

Port 12682 support new provisioning on k8s-exporter #94

Merged
merged 11 commits into from
Feb 2, 2025

Conversation

razsamuel
Copy link
Contributor

@razsamuel razsamuel commented Jan 26, 2025

Description

What - Added support to create resources on port by default
Why - Support onboarding experience
How - Decide which logic to execute by port FF

Type of change

Please leave one option from the following and delete the rest:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Non-breaking change (fix of existing functionality that will not change current behavior)
  • Documentation (added/updated documentation)

Copy link

@shalev007 shalev007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure this configuration is also available when reading configuration from the ConfigMap

Comment on lines 28 to 47
if applicationConfig.CreatePortResourcesOrigin == port.CreatePortResourcesOriginPort {
klog.Info("Resources origin is set to be Port, verifying integration is supported")
featureFlags, err := org_details.GetOrganizationFeatureFlags(portClient)
if err != nil {
return err
}

hasProvisionedDefaultsFlag := false
for _, flag := range featureFlags {
if flag == port.OrgUseProvisionedDefaultsFeatureFlag {
hasProvisionedDefaultsFlag = true
break
}
}

if !hasProvisionedDefaultsFlag {
klog.Info("Port origin for Integration is not supported, changing resources origin to use K8S")
applicationConfig.CreatePortResourcesOrigin = port.CreatePortResourcesOriginK8S
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put that in a different function, it could be something generic like isFeatureFalgSupported

@@ -38,7 +61,8 @@ func InitIntegration(portClient *cli.PortClient, applicationConfig *port.Config)
}

klog.Warningf("Could not get integration with state key %s, error: %s", applicationConfig.StateKey, err.Error())
if err := integration.CreateIntegration(portClient, applicationConfig.StateKey, applicationConfig.EventListenerType, defaultIntegrationConfig); err != nil {
_, err := integration.CreateIntegration(portClient, applicationConfig.StateKey, applicationConfig.EventListenerType, defaultIntegrationConfig, applicationConfig.CreatePortResourcesOrigin == port.CreatePortResourcesOriginPort)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could use a helper variable here instead of evaluating twice

shouldCreateResourcesUsingPort = applicationConfig.CreatePortResourcesOrigin == port.CreatePortResourcesOriginPort

@razsamuel razsamuel force-pushed the PORT-12682_support_provisioning_on_exporter branch from 8ffeacc to a91b2de Compare January 28, 2025 08:36
@@ -47,7 +80,7 @@ func InitIntegration(portClient *cli.PortClient, applicationConfig *port.Config)
EventListener: getEventListenerConfig(applicationConfig.EventListenerType),
}

if existingIntegration.Config == nil || applicationConfig.OverwriteConfigurationOnRestart {
if (existingIntegration.Config == nil || applicationConfig.OverwriteConfigurationOnRestart) && !(applicationConfig.CreatePortResourcesOrigin == port.CreatePortResourcesOriginPort) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REF

@@ -47,7 +80,7 @@ func InitIntegration(portClient *cli.PortClient, applicationConfig *port.Config)
EventListener: getEventListenerConfig(applicationConfig.EventListenerType),
}

if existingIntegration.Config == nil || applicationConfig.OverwriteConfigurationOnRestart {
if (existingIntegration.Config == nil && !(applicationConfig.CreatePortResourcesOrigin == port.CreatePortResourcesOriginPort)) || applicationConfig.OverwriteConfigurationOnRestart {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that correct?

Copy link
Member

@erikzaadi erikzaadi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@razsamuel razsamuel merged commit 4d6fab7 into main Feb 2, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants