Skip to content

Commit

Permalink
Merge branch 'main' into cycle-delay
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es>
  • Loading branch information
JorTurFer authored Jun 16, 2023
2 parents 1eaee4b + bce3375 commit d94c6cc
Show file tree
Hide file tree
Showing 900 changed files with 18,487 additions and 17,684 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/fossa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- run: go version
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v6
uses: tj-actions/branch-names@v7
- uses: fossas/fossa-action@main
name: Scanning with FOSSA
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-e2e-checker.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: e2e-tests
name: E2E Test Checker
on:
pull_request_target:
types:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-e2e-creator.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: e2e-tests
name: E2E Test Creator
on:
pull_request_target:
types:
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/pr-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ jobs:
**Update:** You can check the progress [here](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})
reactions: rocket

- name: Add label to skip e2e test
if: ${{ startsWith(github.event.comment.body,'/skip-e2e') && steps.checkUserMember.outputs.isTeamMember == 'true' }}
uses: actions/github-script@v6
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["skip-e2e"]
})
- name: Parse git info
if: ${{ startsWith(github.event.comment.body,'/run-e2e') && steps.checkUserMember.outputs.isTeamMember == 'true' }}
id: parser
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,12 @@ jobs:
- name: Go modules sync
run: go mod tidy -compat=1.20

- name: Verify Generated clientset is up to date
- name: Verify generated Clientset is up to date
run: make clientset-verify

- name: Verify generated Manifests are up to date
run: make verify-manifests

- name: Build
run: make build

Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/pr-welcome.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: PR Welcome Bot

on:
pull_request_target:
types: [opened]
branches:
- 'main'

permissions:
issues: write
pull-requests: write

jobs:
pr_bot:
name: PR Bot
runs-on: ubuntu-latest
steps:
- name: 'Comment on PR'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ${{ github.event.number }},
body: 'Thank you for your contribution! 🙏 We will review your PR as soon as possible.\n\n\nWhile you are waiting, make sure to:\n\n\n- Add an entry in [our changelog](https://github.com/kedacore/keda/blob/main/CHANGELOG.md) in alphabetical order and link related issue\n- Update the [documentation](https://github.com/kedacore/keda-docs), if needed\n- Add unit & [e2e](https://github.com/kedacore/keda/blob/main/tests/README.md) tests for your changes\n- GitHub checks are passing\n- Is the DCO check failing? Here is [how you can fix DCO issues](https://github.com/kedacore/keda/blob/main/CONTRIBUTING.md#i-didnt-sign-my-commit-now-what)\n\n\nLearn more about:\n- Our [contribution guide](https://github.com/kedacore/keda/blob/main/CONTRIBUTING.md)'
});
2 changes: 1 addition & 1 deletion .github/workflows/template-smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
fetch-depth: 1

- name: Create k8s ${{ inputs.kubernetesVersion }} Kind Cluster
uses: helm/kind-action@v1.4.0
uses: helm/kind-action@v1.7.0
with:
node_image: ${{ inputs.kindImage }}
cluster_name: smoke-tests-cluster-${{ inputs.kubernetesVersion }}
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ repos:
hooks:
- id: trailing-whitespace
- id: detect-private-key
exclude: pkg/scalers/prometheus_scaler_test.go
- id: end-of-file-fixer
- id: check-merge-conflict
- id: mixed-line-ending
Expand Down
20 changes: 14 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,23 @@ To learn more about active deprecations, we recommend checking [GitHub Discussio

- **CPU/Memory scaler**: Add support for scale to zero if there are multiple triggers([#4269](https://github.com/kedacore/keda/issues/4269))
- **Redis Scalers**: Allow scaling using redis stream length ([#4277](https://github.com/kedacore/keda/issues/4277))
- **General:** Introduce new Solr Scaler ([#4234](https://github.com/kedacore/keda/issues/4234))
- **General**: Introduce new Solr Scaler ([#4234](https://github.com/kedacore/keda/issues/4234))

### Improvements

- **General**: Metrics Adapter: remove deprecated Prometheus Metrics and non-gRPC code ([#3930](https://github.com/kedacore/keda/issues/3930))
- **General**: Add a Promethean metric for measuring the processing loop lag ([#4702](https://github.com/kedacore/keda/issues/4702))
- **Azure Data Exporer Scaler**: Use azidentity SDK ([#4489](https://github.com/kedacore/keda/issues/4489))
- **General**: Add a Prometheus metric for measuring the processing loop lag ([#4702](https://github.com/kedacore/keda/issues/4702))
- **AWS DynamoDB**: Add support for `indexName` ([#4680](https://github.com/kedacore/keda/issues/4680))
- **Azure Data Explorer Scaler**: Use azidentity SDK ([#4489](https://github.com/kedacore/keda/issues/4489))
- **External Scaler**: Add tls options in TriggerAuth metadata. ([#3565](https://github.com/kedacore/keda/issues/3565))
- **GCP PubSub Scaler**: Make it more flexible for metrics ([#4243](https://github.com/kedacore/keda/issues/4243))
- **Kafka Scaler:** Add support for OAuth extensions ([#4544](https://github.com/kedacore/keda/issues/4544))
- **Kafka Scaler**: Add support for OAuth extensions ([#4544](https://github.com/kedacore/keda/issues/4544))
- **NATS JetStream Scaler**: Add support for pulling AccountID from TriggerAuthentication ([#4586]https://github.com/kedacore/keda/issues/4586)
- **Pulsar Scaler**: Improve error messages for unsuccessful connections ([#4563](https://github.com/kedacore/keda/issues/4563))
- **Security:** Enable secret scanning in GitHub repo
- **Security**: Enable secret scanning in GitHub repo
- **RabbitMQ Scaler**: Add support for `unsafeSsl` in trigger metadata ([#4448](https://github.com/kedacore/keda/issues/4448))
- **Prometheus Metrics**: Add new metric with KEDA build info ([#4647](https://github.com/kedacore/keda/issues/4647))
- **Prometheus Scaler**: Add support for Google Managed Prometheus ([#4675](https://github.com/kedacore/keda/pull/4675))

### Fixes

Expand All @@ -71,6 +76,8 @@ To learn more about active deprecations, we recommend checking [GitHub Discussio
- **NATS Jetstream Scaler**: Fix compatibility if node is not advertised ([#4524](https://github.com/kedacore/keda/issues/4524))
- **Prometheus Metrics**: Create e2e tests for all exposed Prometheus metrics ([#4127](https://github.com/kedacore/keda/issues/4127))
- **Grafana Dashboard**: Fix HPA metrics panel to use range instead of instant ([#4513](https://github.com/kedacore/keda/pull/4513))
- **Grafana Dashboard**: Fix HPA metrics panel by replacing $namepsace to $exported_namespace due to label conflict ([#4539](https://github.com/kedacore/keda/pull/4539))
- **Kafka Scaler**: Add back `strings.TrimSpace()` function for saslAuthType ([#4689](https://github.com/kedacore/keda/issues/4689))

### Deprecations

Expand All @@ -80,19 +87,20 @@ New deprecation(s):

- **Azure Data Explorer**: Deprecate `metadata.clientSecret` ([#4514](https://github.com/kedacore/keda/issues/4514))


### Breaking Changes

- TODO ([#XXX](https://github.com/kedacore/keda/issue/XXX))

### Other

- **General**: Add e2e test for external push scaler ([#2698](https://github.com/kedacore/keda/pull/2698))
- **General**: Bump Golang to 1.20 ([#4517](https://github.com/kedacore/keda/issues/4517))
- **General**: Drop a transitive dependency on bou.ke/monkey ([#4364](https://github.com/kedacore/keda/issues/4364))
- **General**: Fix odd number of arguments passed as key-value pairs for logging ([#4368](https://github.com/kedacore/keda/issues/4368))
- **General**: Automatically scale test clusters in/out to reduce environmental footprint & improve cost-efficiency ([#4456](https://github.com/kedacore/keda/pull/4456))
- **General**: Use default metrics provider from sigs.k8s.io/custom-metrics-apiserver ([#4473](https://github.com/kedacore/keda/pull/4473))
- **General**: Refactor several functions for Status & Conditions handling into pkg util functions ([#2906](https://github.com/kedacore/keda/pull/2906))
- **General**: Bump `kubernetes-sigs/controller-runtime` to v0.15.0 and code alignment ([#4582](https://github.com/kedacore/keda/pull/4582))

## v2.10.1

Expand Down
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ vet: ## Run go vet against code.
golangci: ## Run golangci against code.
golangci-lint run

verify-manifests: ## Verify manifests are up to date.
./hack/verify-manifests.sh

clientset-verify: ## Verify that generated client-go clientset, listers and informers are up to date.
./hack/verify-codegen.sh

Expand Down Expand Up @@ -248,13 +251,13 @@ set-version:

##@ Deployment

install: kustomize manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | kubectl apply -f -
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | kubectl apply --server-side -f -

uninstall: kustomize manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | kubectl delete -f -

deploy: kustomize manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
deploy: install ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager && \
$(KUSTOMIZE) edit set image ghcr.io/kedacore/keda=${IMAGE_CONTROLLER} && \
if [ "$(AZURE_RUN_AAD_POD_IDENTITY_TESTS)" = true ]; then \
Expand Down Expand Up @@ -293,6 +296,7 @@ deploy: kustomize manifests kustomize ## Deploy controller to the K8s cluster sp

undeploy: kustomize e2e-test-clean-crds ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/e2e | kubectl delete -f -
make uninstall

## Location to install dependencies to
LOCALBIN ?= $(shell pwd)/bin
Expand Down
11 changes: 7 additions & 4 deletions cmd/adapter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
"k8s.io/klog/v2"
"k8s.io/klog/v2/klogr"
ctrl "sigs.k8s.io/controller-runtime"
ctrlcache "sigs.k8s.io/controller-runtime/pkg/cache"
basecmd "sigs.k8s.io/custom-metrics-apiserver/pkg/cmd"
"sigs.k8s.io/custom-metrics-apiserver/pkg/provider"

Expand Down Expand Up @@ -111,10 +112,12 @@ func (a *Adapter) makeProvider(ctx context.Context, globalHTTPTimeout time.Durat
mgr, err := ctrl.NewManager(cfg, ctrl.Options{
MetricsBindAddress: metricsBindAddress,
Scheme: scheme,
Namespace: namespace,
LeaseDuration: leaseDuration,
RenewDeadline: renewDeadline,
RetryPeriod: retryPeriod,
Cache: ctrlcache.Options{
Namespaces: []string{namespace},
},
LeaseDuration: leaseDuration,
RenewDeadline: renewDeadline,
RetryPeriod: retryPeriod,
})
if err != nil {
logger.Error(err, "failed to setup manager")
Expand Down
25 changes: 14 additions & 11 deletions cmd/operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ import (
_ "k8s.io/client-go/plugin/pkg/client/auth"
"k8s.io/client-go/tools/cache"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/config"
ctrlcache "sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/controller"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/webhook"

kedav1alpha1 "github.com/kedacore/keda/v2/apis/keda/v1alpha1"
kedacontrollers "github.com/kedacore/keda/v2/controllers/keda"
Expand Down Expand Up @@ -136,16 +137,20 @@ func main() {
cfg.DisableCompression = disableCompression

mgr, err := ctrl.NewManager(cfg, ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Port: 9443,
Scheme: scheme,
MetricsBindAddress: metricsAddr,
WebhookServer: webhook.NewServer(webhook.Options{
Port: 9443,
}),
Cache: ctrlcache.Options{
Namespaces: []string{namespace},
},
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "operator.keda.sh",
LeaseDuration: leaseDuration,
RenewDeadline: renewDeadline,
RetryPeriod: retryPeriod,
Namespace: namespace,
})
if err != nil {
setupLog.Error(err, "unable to start manager")
Expand Down Expand Up @@ -204,9 +209,8 @@ func main() {
ScaleClient: scaleClient,
ScaleHandler: scaledHandler,
}).SetupWithManager(mgr, controller.Options{
Controller: config.Controller{
MaxConcurrentReconciles: scaledObjectMaxReconciles,
}}); err != nil {
MaxConcurrentReconciles: scaledObjectMaxReconciles,
}); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "ScaledObject")
os.Exit(1)
}
Expand All @@ -218,9 +222,8 @@ func main() {
SecretsLister: secretInformer.Lister(),
SecretsSynced: secretInformer.Informer().HasSynced,
}).SetupWithManager(mgr, controller.Options{
Controller: config.Controller{
MaxConcurrentReconciles: scaledJobMaxReconciles,
}}); err != nil {
MaxConcurrentReconciles: scaledJobMaxReconciles,
}); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "ScaledJob")
os.Exit(1)
}
Expand Down
30 changes: 17 additions & 13 deletions cmd/webhooks/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package main

import (
"crypto/tls"
"flag"
"os"

Expand All @@ -29,6 +30,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/controller-runtime/pkg/webhook"

kedav1alpha1 "github.com/kedacore/keda/v2/apis/keda/v1alpha1"
"github.com/kedacore/keda/v2/pkg/k8s"
Expand All @@ -54,13 +56,12 @@ func main() {
var webhooksClientRequestQPS float32
var webhooksClientRequestBurst int
var certDir string
var tlsMinVersion string

pflag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
pflag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
pflag.Float32Var(&webhooksClientRequestQPS, "kube-api-qps", 20.0, "Set the QPS rate for throttling requests sent to the apiserver")
pflag.IntVar(&webhooksClientRequestBurst, "kube-api-burst", 30, "Set the burst for throttling requests sent to the apiserver")
pflag.StringVar(&certDir, "cert-dir", "/certs", "Webhook certificates dir to use. Defaults to /certs")
pflag.StringVar(&tlsMinVersion, "tls-min-version", "1.3", "Minimum TLS version")

opts := zap.Options{}
opts.BindFlags(flag.CommandLine)
Expand All @@ -76,12 +77,19 @@ func main() {
cfg.Burst = webhooksClientRequestBurst

mgr, err := ctrl.NewManager(cfg, ctrl.Options{
Scheme: scheme,
LeaderElection: false,
MetricsBindAddress: metricsAddr,
Port: 9443,
Scheme: scheme,
LeaderElection: false,
MetricsBindAddress: metricsAddr,
WebhookServer: webhook.NewServer(webhook.Options{
Port: 9443,
CertDir: certDir,
TLSOpts: []func(tlsConfig *tls.Config){
func(tlsConfig *tls.Config) {
tlsConfig.MinVersion = kedautil.GetMinTLSVersion()
},
},
}),
HealthProbeBindAddress: probeAddr,
CertDir: certDir,
})
if err != nil {
setupLog.Error(err, "unable to start admission webhooks")
Expand All @@ -98,7 +106,7 @@ func main() {

kedautil.PrintWelcome(setupLog, kubeVersion, "admission webhooks")

setupWebhook(mgr, tlsMinVersion)
setupWebhook(mgr)

if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
setupLog.Error(err, "unable to set up health check")
Expand All @@ -115,14 +123,10 @@ func main() {
}
}

func setupWebhook(mgr manager.Manager, tlsMinVersion string) {
func setupWebhook(mgr manager.Manager) {
// setup webhooks
if err := (&kedav1alpha1.ScaledObject{}).SetupWebhookWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create webhook", "webhook", "ScaledObject")
os.Exit(1)
}

setupLog.V(1).Info("setting up webhook server")
hookServer := mgr.GetWebhookServer()
hookServer.TLSMinVersion = tlsMinVersion
}
3 changes: 1 addition & 2 deletions config/crd/bases/keda.sh_clustertriggerauthentications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.12.0
name: clustertriggerauthentications.keda.sh
spec:
group: keda.sh
Expand Down
Loading

0 comments on commit d94c6cc

Please sign in to comment.