Skip to content

Commit

Permalink
Add changelog & comments
Browse files Browse the repository at this point in the history
Add changelog & comments
  • Loading branch information
kevinteng525 committed Dec 6, 2022
1 parent 8784d74 commit e70dc89
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ To learn more about active deprecations, we recommend checking [GitHub Discussio
- **General:** Add support to use pod identities for authentication in Azure Key Vault ([#3813](https://github.com/kedacore/keda/issues/3813)
- **General:** Support disable keep http connection alive([#3874](https://github.com/kedacore/keda/issues/3874)
- **General:** Improve the function used to normalize metric names ([#3789](https://github.com/kedacore/keda/issues/3789)
- **General:** Support Restrict Secret Access to mitigate the security risk ([#3668](https://github.com/kedacore/keda/issues/3668)
- **Apache Kafka Scaler:** SASL/OAuthbearer Implementation ([#3681](https://github.com/kedacore/keda/issues/3681))
- **Azure AD Pod Identity Authentication:** Improve error messages to emphasize problems around the integration with aad-pod-identity itself ([#3610](https://github.com/kedacore/keda/issues/3610))
- **Azure Event Hub Scaler:** Support Azure Active Direcotry Pod & Workload Identity for Storage Blobs ([#3569](https://github.com/kedacore/keda/issues/3569))
Expand Down
2 changes: 2 additions & 0 deletions adapter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ func (a *Adapter) makeProvider(ctx context.Context, globalHTTPTimeout time.Durat
logger.Error(err, "Unable to get cluster object namespace")
return nil, nil, err
}
// the namespaced kubeInformerFactory is used to restrict secret informer to only list/watch secrets in KEDA cluster object namespace,
// refer to https://github.com/kedacore/keda/issues/3668
kubeInformerFactory := kubeinformers.NewSharedInformerFactoryWithOptions(kubeClientset, 1*time.Hour, kubeinformers.WithNamespace(objectNamespace))
secretInformer := kubeInformerFactory.Core().V1().Secrets()

Expand Down
7 changes: 4 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package main

import (
"context"
"flag"
"fmt"
"os"
Expand Down Expand Up @@ -172,6 +171,8 @@ func main() {
setupLog.Error(err, "Unable to get cluster object namespace")
os.Exit(1)
}
// the namespaced kubeInformerFactory is used to restrict secret informer to only list/watch secrets in KEDA cluster object namespace,
// refer to https://github.com/kedacore/keda/issues/3668
kubeInformerFactory := kubeinformers.NewSharedInformerFactoryWithOptions(kubeClientset, 1*time.Hour, kubeinformers.WithNamespace(objectNamespace))
secretInformer := kubeInformerFactory.Core().V1().Secrets()

Expand Down Expand Up @@ -242,15 +243,15 @@ func main() {
setupLog.Info(fmt.Sprintf("Go OS/Arch: %s/%s", runtime.GOOS, runtime.GOARCH))
setupLog.Info(fmt.Sprintf("Running on Kubernetes %s", kubeVersion.PrettyVersion), "version", kubeVersion.Version)

ctx := context.Background()
ctx := ctrl.SetupSignalHandler()
kubeInformerFactory.Start(ctx.Done())

if ok := cache.WaitForCacheSync(ctx.Done(), secretInformer.Informer().HasSynced); !ok {
setupLog.Error(nil, "failed to wait Secrets cache synced")
os.Exit(1)
}

if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil {
if err := mgr.Start(ctx); err != nil {
setupLog.Error(err, "problem running manager")
os.Exit(1)
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/util/env_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func ResolveOsEnvDuration(envName string) (*time.Duration, error) {
return nil, nil
}

// GetClusterObjectNamespace retrieves the cluster object namespace of KEDA, default is the namespace of KEDA Operator & Metrics Server
func GetClusterObjectNamespace() (string, error) {
// Check if a cached value is available.
if clusterObjectNamespaceCache != nil {
Expand All @@ -79,4 +80,4 @@ func GetClusterObjectNamespace() (string, error) {
// GetRestrictSecretAccess retrieves the value of the environment variable of KEDA_RESTRICT_SECRET_ACCESS
func GetRestrictSecretAccess() string {
return os.Getenv(RestrictSecretAccessEnvVar)
}
}

0 comments on commit e70dc89

Please sign in to comment.