Skip to content

Commit

Permalink
Replace super.users with const var
Browse files Browse the repository at this point in the history
  • Loading branch information
panyuenlau committed Feb 16, 2023
1 parent 1bd582c commit f5c63c8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions pkg/resources/envoy/envoy.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,22 @@ func (r *Reconciler) Reconcile(log logr.Logger) error {
if err != nil {
return err
}
var externalListernerResources []resources.ResourceWithLogAndExternalListenerSpecificInfos
externalListernerResources = append(externalListernerResources,
var externalListenerResources []resources.ResourceWithLogAndExternalListenerSpecificInfos
externalListenerResources = append(externalListenerResources,
r.service,
r.configMap,
r.deployment,
)

if r.KafkaCluster.Spec.EnvoyConfig.GetDistruptionBudget().DisruptionBudget.Create {
externalListernerResources = append(externalListernerResources, r.podDisruptionBudget)
externalListenerResources = append(externalListenerResources, r.podDisruptionBudget)
}
for name, ingressConfig := range ingressConfigs {
if !util.IsIngressConfigInUse(name, defaultControllerName, r.KafkaCluster, log) {
continue
}

for _, res := range externalListernerResources {
for _, res := range externalListenerResources {
o := res(log, eListener, ingressConfig, name, defaultControllerName)
err := k8sutil.Reconcile(log, r.Client, o, r.KafkaCluster)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions pkg/resources/kafka/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,11 @@ func generateListenerSSLConfig(config *properties.Properties, name string, sslCl
// mergeSuperUsersPropertyValue merges the target and source super.users property value, and returns it as string.
// It returns empty string when there were no updates or any of the super.users property value was empty.
func mergeSuperUsersPropertyValue(source *properties.Properties, target *properties.Properties) string {
sourceVal, foundSource := source.Get("super.users")
sourceVal, foundSource := source.Get(kafkautils.KafkaConfigSuperUsers)
if !foundSource || sourceVal.IsEmpty() {
return ""
}
targetVal, foundTarget := target.Get("super.users")
targetVal, foundTarget := target.Get(kafkautils.KafkaConfigSuperUsers)
if !foundTarget || targetVal.IsEmpty() {
return ""
}
Expand Down Expand Up @@ -397,7 +397,7 @@ func (r Reconciler) generateBrokerConfig(id int32, brokerConfig *v1beta1.BrokerC
if suMerged := mergeSuperUsersPropertyValue(finalBrokerConfig, opGenConf); suMerged != "" {
// Setting string value for a property is not going to run into error, also we don't return error in this function
//nolint:errcheck
opGenConf.Set("super.users", suMerged)
opGenConf.Set(kafkautils.KafkaConfigSuperUsers, suMerged)
}
finalBrokerConfig.Merge(opGenConf)
}
Expand Down

0 comments on commit f5c63c8

Please sign in to comment.