Skip to content

Commit

Permalink
Merge pull request #68 from port-labs/PORT-8394_enable_updateEntityOn…
Browse files Browse the repository at this point in the history
…lyOnDiff_by_default

PORT-8394 Enable updateEntityOnlyOnDiff by default
  • Loading branch information
razsamuel authored Jun 19, 2024
2 parents ef7be1d + e8fcd10 commit 8b8bb64
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func main() {

portClient, err := cli.New(config.ApplicationConfig.PortBaseURL,
cli.WithClientID(config.ApplicationConfig.PortClientId), cli.WithClientSecret(config.ApplicationConfig.PortClientSecret),
cli.WithHeader("User-Agent", fmt.Sprintf("port-k8s-exporter/0.1 (statekey/%s)", applicationConfig.StateKey)),
cli.WithHeader("User-Agent", fmt.Sprintf("port-k8s-exporter/^0.3.4 (statekey/%s)", applicationConfig.StateKey)),
)

if err != nil {
Expand Down
1 change: 0 additions & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ func Init() {
NewString(&ApplicationConfig.PortClientSecret, "port-client-secret", "", "Port client secret. Required.")
NewBool(&ApplicationConfig.CreateDefaultResources, "create-default-resources", true, "Create default resources on installation. Optional.")
NewBool(&ApplicationConfig.OverwriteConfigurationOnRestart, "overwrite-configuration-on-restart", false, "Overwrite the configuration in port on restarting the exporter. Optional.")
NewBool(&ApplicationConfig.UpdateEntityOnlyOnDiff, "update-entity-only-on-diff", false, "Optimization to reduce requests to port. Optional.")

// Deprecated
NewBool(&ApplicationConfig.DeleteDependents, "delete-dependents", false, "Delete dependents. Optional.")
Expand Down
2 changes: 1 addition & 1 deletion pkg/k8s/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func NewController(resource port.AggregatedResource, portClient *cli.PortClient,
item.Key, err = cache.MetaNamespaceKeyFunc(new)
if err == nil {

if controller.shouldSendUpdateEvent(old, new, integrationConfig.UpdateEntityOnlyOnDiff) {
if controller.shouldSendUpdateEvent(old, new, integrationConfig.UpdateEntityOnlyOnDiff == nil || *(integrationConfig.UpdateEntityOnlyOnDiff)) {
controller.workqueue.Add(item)
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/port/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ type IntegrationAppConfig struct {
Resources []Resource `json:"resources,omitempty" yaml:"resources,omitempty"`
CRDSToDiscover string `json:"crdsToDiscover,omitempty"`
OverwriteCRDsActions bool `json:"overwriteCrdsActions,omitempty"`
UpdateEntityOnlyOnDiff bool `json:"updateEntityOnlyOnDiff,omitempty"`
UpdateEntityOnlyOnDiff *bool `json:"updateEntityOnlyOnDiff,omitempty"`
}

type Config struct {
Expand Down

0 comments on commit 8b8bb64

Please sign in to comment.