Skip to content

Commit

Permalink
refactor: adjust codestyle to remove '+' in string concat
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiangaiser committed May 25, 2024
1 parent 208020f commit dcb563d
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,22 @@ import (
)

var (
globalName = "ca-controller-for-strimzi"
scheme = runtime.NewScheme()
log = ctrlRuntime.Log.WithName(globalName)
reconcileAnnotationKey = "sebastian.gaiser.bayern/tls-strimzi-ca"
reconcileAnnotationValue = "reconcile"
managedByLabelKey = "sebastian.gaiser.bayern/managed-by"
hashLabelKey = "sebastian.gaiser.bayern/hash"
managedByLabelValue = "ca-controller-for-strimzi"
targetClusterNameKey = "sebastian.gaiser.bayern/target-cluster-name"
targetClusterNameValue = ""
targetSecretAnnotationNameKey = "sebastian.gaiser.bayern/target-secret-name"
targetSecretAnnotationKeyNameKey = "sebastian.gaiser.bayern/target-secret-key-name"
strimziClusterLabel = "strimzi.io/cluster"
strimziKindLabel = "strimzi.io/kind"
strimziKindValue = "Kafka"
strimziCaCertGeneration = "strimzi.io/ca-cert-generation"
strimziCaKeyGeneration = "strimzi.io/ca-key-generation"
globalName = "ca-controller-for-strimzi"
scheme = runtime.NewScheme()
log = ctrlRuntime.Log.WithName(globalName)
reconcileAnnotationKey = "sebastian.gaiser.bayern/tls-strimzi-ca"
reconcileAnnotationValue = "reconcile"
managedByLabelKey = "sebastian.gaiser.bayern/managed-by"
hashLabelKey = "sebastian.gaiser.bayern/hash"
managedByLabelValue = "ca-controller-for-strimzi"
targetClusterNameKey = "sebastian.gaiser.bayern/target-cluster-name"
targetSecretAnnotationNameKey = "sebastian.gaiser.bayern/target-secret-name"
targetSecretAnnotationKeyNameKey = "sebastian.gaiser.bayern/target-secret-key-name"
strimziClusterLabel = "strimzi.io/cluster"
strimziKindLabel = "strimzi.io/kind"
strimziKindValue = "Kafka"
strimziCaCertGeneration = "strimzi.io/ca-cert-generation"
strimziCaKeyGeneration = "strimzi.io/ca-key-generation"
)

func init() {
Expand Down Expand Up @@ -168,23 +167,23 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrlRuntime.Request) (ct
return ctrlRuntime.Result{}, nil
} else {
if value == "" {
ctrlRuntime.Log.Info("Secret with name: " + tlsSecret.Name + " should be reconciled but the target secret name annotation value is empty...")
ctrlRuntime.Log.Info(fmt.Sprintf("Secret with name: %s should be reconciled but the target secret name annotation value is empty...", tlsSecret.Name))
return ctrlRuntime.Result{}, nil
} else {
ctrlRuntime.Log.Info("Secret with name: " + tlsSecret.Name + " will get reconciled with target secret name: " + tlsSecretAnnotations[targetSecretAnnotationNameKey])
ctrlRuntime.Log.Info(fmt.Sprintf("Secret with name: %s will get reconciled with target secret name: %s", tlsSecret.Name, tlsSecretAnnotations[targetSecretAnnotationNameKey]))
}
}

// verify targetSecretAnnotationKeyNameKey is set
if value, exists := tlsSecretAnnotations[targetSecretAnnotationKeyNameKey]; !exists {
ctrlRuntime.Log.Info("Secret with name: " + tlsSecret.Name + " should be reconciled but is missing annotation: " + targetSecretAnnotationKeyNameKey)
ctrlRuntime.Log.Info(fmt.Sprintf("Secret with name: %s should be reconciled but is missing annotation: %s", tlsSecret.Name, targetSecretAnnotationKeyNameKey))
return ctrlRuntime.Result{}, nil
} else {
if value == "" {
ctrlRuntime.Log.Info("Secret with name: " + tlsSecret.Name + " should be reconciled but the target secret name key annotation value is empty...")
ctrlRuntime.Log.Info(fmt.Sprintf("Secret with name: %s should be reconciled but the target secret name key annotation value is empty...", tlsSecret.Name))
return ctrlRuntime.Result{}, nil
} else {
ctrlRuntime.Log.Info("Secret with name: " + tlsSecret.Name + " will get reconciled with target secret name: " + tlsSecretAnnotations[targetSecretAnnotationKeyNameKey])
ctrlRuntime.Log.Info(fmt.Sprintf("Secret with name: %s will get reconciled with target secret name: %s", tlsSecret.Name, tlsSecretAnnotations[targetSecretAnnotationKeyNameKey]))
}
}

Expand Down

0 comments on commit dcb563d

Please sign in to comment.