Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

K8s: Autoscaling using KEDA core 2.16.1 #2531

Merged
merged 2 commits into from
Dec 25, 2024
Merged

K8s: Autoscaling using KEDA core 2.16.1 #2531

merged 2 commits into from
Dec 25, 2024

Conversation

VietND96
Copy link
Member

@VietND96 VietND96 commented Dec 25, 2024

User description

Thanks for contributing to the Docker-Selenium project!
A PR well described will help maintainers to quickly review and merge it

Before submitting your PR, please check our contributing guidelines, applied for this repository.
Avoid large PRs, help reviewers by making them as simple and short as possible.

Description

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

PR Type

Enhancement


Description

  • Updated KEDA core version to 2.16.1 and related configurations:

    • Added KEDA_CORE_VERSION variable
    • Updated chart dependencies and tag versions
    • Removed hardcoded KEDA image configurations
  • Enhanced CI/CD workflows:

    • Added skip test conditions based on commit messages
    • Improved commit message formats with [ci] prefix
    • Added [skip test] and [skip ci] flags
  • Improved Helm chart configurations:

    • Changed platformName from "linux" to "Linux" for browser nodes
    • Updated changelog generation logic for KEDA versioning
    • Added TEST_PATCHED_KEDA variable management

Changes walkthrough 📝

Relevant files
Enhancement
generate_chart_changelog.sh
Update changelog generation for KEDA versioning                   

generate_chart_changelog.sh

  • Added KEDA_CORE_VERSION and IS_PATCHED_VERSION variables
  • Modified changelog generation logic to handle patched versions
  • +10/-4   
    *.yml
    Improve CI workflow skip conditions and commit messages   

    .github/workflows/*.yml

  • Added skip test conditions based on commit messages
  • Updated commit message formats to include [ci] prefix
  • Added [skip test] and [skip ci] flags
  • Configuration changes
    Makefile
    Update KEDA version configuration and variables                   

    Makefile

  • Added KEDA_CORE_VERSION variable set to 2.16.1
  • Updated KEDA tag versions to 2.16.1
  • Added TEST_PATCHED_KEDA variable with default true
  • +8/-6     
    *
    Update Helm chart configurations for KEDA 2.16.1                 

    charts/selenium-grid/*

  • Updated KEDA chart version to 2.16.1
  • Changed platformName from "linux" to "Linux" for browser nodes
  • Removed hardcoded KEDA image configuration

  • 💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    * Update Helm release keda to v2.16.1
    
    * Update chart configuration table
    
    ---------
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    Co-authored-by: Selenium CI Bot <[email protected]>
    Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 PR contains tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Configuration Change

    Removal of hardcoded KEDA image configurations could impact existing deployments that rely on specific image versions. Verify that using KEDA core 2.16.1 images directly works as expected.

    #  image:
    #    keda:
    #      registry: selenium
    #      repository: keda
    #      tag: "2.16.0-selenium-grid-20241204"
    #    metricsApiServer:
    #      registry: selenium
    #      repository: keda-metrics-apiserver
    #      tag: "2.16.0-selenium-grid-20241204"
    #    webhooks:
    #      registry: selenium
    #      repository: keda-admission-webhooks
    #      tag: "2.16.0-selenium-grid-20241204"
    Platform Change

    Platform name changed from "linux" to "Linux" for all browser nodes. Verify this change doesn't break existing deployments or configurations.

    | chromeNode.hpa.platformName | string | `"Linux"` | platformName from the capability |
    | chromeNode.hpa.unsafeSsl | string | `"{{ template \"seleniumGrid.graphqlURL.unsafeSsl\" . }}"` | Skip check SSL when connecting to the Graphql endpoint |
    | chromeNode.initContainers | list | `[]` | It is used to add initContainers in the same pod of the browser node. It should be set using the --set-json option |
    | chromeNode.sidecars | list | `[]` | It is used to add sidecars proxy in the same pod of the browser node. It means it will add a new container to the deployment itself. It should be set using the --set-json option |
    | chromeNode.videoRecorder | object | `{}` | Override specific video recording settings for chrome node |
    | firefoxNode.enabled | bool | `true` | Enable firefox nodes |
    | firefoxNode.deploymentEnabled | bool | `true` | NOTE: Only used when autoscaling.enabled is false Enable creation of Deployment true (default) - if you want long living pods false - for provisioning your own custom type such as Jobs |
    | firefoxNode.updateStrategy | object | `{"type":"RollingUpdate"}` | Global update strategy will be overwritten by individual component |
    | firefoxNode.replicas | int | `1` | Number of firefox nodes |
    | firefoxNode.imageRegistry | string | `nil` | Registry to pull the image (this overwrites global.seleniumGrid.imageRegistry parameter) |
    | firefoxNode.imageName | string | `"node-firefox"` | Image of firefox nodes |
    | firefoxNode.imageTag | string | `nil` | Image of firefox nodes (this overwrites global.seleniumGrid.nodesImageTag) |
    | firefoxNode.imagePullPolicy | string | `"IfNotPresent"` | Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images) |
    | firefoxNode.imagePullSecret | string | `""` | Image pull secret (see https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) |
    | firefoxNode.ports | list | `[]` | Extra ports list to enable on the node container (e.g. SSH, VNC, NoVNC, etc.) |
    | firefoxNode.port | int | `5555` | Node component port |
    | firefoxNode.nodePort | string | `nil` | Node component expose NodePort |
    | firefoxNode.affinity | object | `{}` | Specify affinity for firefox-node pods, this overwrites global.seleniumGrid.affinity parameter |
    | firefoxNode.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for firefox-node pods, this overwrites global.seleniumGrid.topologySpreadConstraints parameter |
    | firefoxNode.annotations | object | `{}` | Annotations for firefox-node pods |
    | firefoxNode.labels | object | `{}` | Labels for firefox-node pods |
    | firefoxNode.tolerations | list | `[]` | Tolerations for firefox-node pods |
    | firefoxNode.nodeSelector | object | `{}` | Node selector for firefox-node pods |
    | firefoxNode.shareProcessNamespace | bool | `true` | Shared process namespace for firefox-node pods |
    | firefoxNode.resources.requests | object | `{"cpu":"1","memory":"1Gi"}` | Request resources for firefox-node pods |
    | firefoxNode.resources.limits | object | `{"cpu":"1","memory":"2Gi"}` | Limit resources for firefox-node pods |
    | firefoxNode.securityContext | object | `{}` | SecurityContext for firefox-node container |
    | firefoxNode.hostAliases | string | `nil` | Custom host aliases for firefox nodes |
    | firefoxNode.extraEnvironmentVariables | string | `nil` | Custom environment variables for firefox nodes |
    | firefoxNode.extraEnvFrom | string | `nil` | Custom environment variables by sourcing entire configMap, Secret, etc. for firefox nodes |
    | firefoxNode.service.enabled | bool | `false` | Create a service for node |
    | firefoxNode.service.type | string | `"ClusterIP"` | Service type |
    | firefoxNode.service.loadBalancerIP | string | `""` | Set specific loadBalancerIP when serviceType is LoadBalancer (see https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer) |
    | firefoxNode.service.ports | string | `nil` | Extra ports exposed in node service |
    | firefoxNode.service.annotations | object | `{}` | Custom annotations for service |
    | firefoxNode.dshmVolumeSizeLimit | string | `"2Gi"` | Size limit for DSH volume mounted in container (if not set, default is disabled, e.g "1Gi") |
    | firefoxNode.priorityClassName | string | `""` | Priority class name for firefox-node pods |
    | firefoxNode.startupProbe | object | `{"enabled":true,"failureThreshold":12,"initialDelaySeconds":0,"path":"/status","periodSeconds":5,"successThreshold":1,"timeoutSeconds":60}` | Startup probe settings |
    | firefoxNode.readinessProbe | object | `{"enabled":false,"failureThreshold":10,"initialDelaySeconds":10,"path":"/status","periodSeconds":10,"successThreshold":1,"timeoutSeconds":10}` | Readiness probe settings |
    | firefoxNode.livenessProbe | object | `{"enabled":false,"failureThreshold":6,"initialDelaySeconds":30,"path":"/status","periodSeconds":10,"successThreshold":1,"timeoutSeconds":60}` | Liveness probe settings |
    | firefoxNode.terminationGracePeriodSeconds | int | `30` | Time to wait for pod termination |
    | firefoxNode.deregisterLifecycle | string | `nil` | Define preStop command to shuts down the chrome node gracefully. This overwrites autoscaling.deregisterLifecycle |
    | firefoxNode.lifecycle | object | `{}` | Define postStart and preStop events. This overwrites the defined preStop in deregisterLifecycle if any |
    | firefoxNode.extraVolumeMounts | list | `[]` | Extra volume mounts for firefox-node container |
    | firefoxNode.extraVolumes | list | `[]` | Extra volumes for firefox-node pod |
    | firefoxNode.nodeMaxSessions | string | `nil` | Override the number of max sessions per node |
    | firefoxNode.scaledOptions | string | `nil` | Override the scaled options for firefox nodes |
    | firefoxNode.scaledJobOptions | string | `nil` | Override the scaledJobOptions for firefox nodes |
    | firefoxNode.scaledObjectOptions | string | `nil` | Override the scaledObjectOptions for firefox nodes |
    | firefoxNode.hpa.browserName | string | `"firefox"` | browserName from the capability |
    | firefoxNode.hpa.sessionBrowserName | string | `"firefox"` | sessionBrowserName if the browserName is different from the sessionBrowserName |
    | firefoxNode.hpa.browserVersion | string | `""` | browserVersion from the capability |
    | firefoxNode.hpa.platformName | string | `"Linux"` | platformName from the capability |
    | firefoxNode.hpa.unsafeSsl | string | `"{{ template \"seleniumGrid.graphqlURL.unsafeSsl\" . }}"` | Skip check SSL when connecting to the Graphql endpoint |
    | firefoxNode.initContainers | list | `[]` | It is used to add initContainers in the same pod of the browser node. It should be set using the --set-json option |
    | firefoxNode.sidecars | list | `[]` | It is used to add sidecars proxy in the same pod of the browser node. It means it will add a new container to the deployment itself. It should be set using the --set-json option |
    | firefoxNode.videoRecorder | object | `{}` | Override specific video recording settings for firefox node |
    | edgeNode.enabled | bool | `true` | Enable edge nodes |
    | edgeNode.deploymentEnabled | bool | `true` | NOTE: Only used when autoscaling.enabled is false Enable creation of Deployment true (default) - if you want long living pods false - for provisioning your own custom type such as Jobs |
    | edgeNode.updateStrategy | object | `{"type":"RollingUpdate"}` | Global update strategy will be overwritten by individual component |
    | edgeNode.replicas | int | `1` | Number of edge nodes |
    | edgeNode.imageRegistry | string | `nil` | Registry to pull the image (this overwrites global.seleniumGrid.imageRegistry parameter) |
    | edgeNode.imageName | string | `"node-edge"` | Image of edge nodes |
    | edgeNode.imageTag | string | `nil` | Image of edge nodes (this overwrites global.seleniumGrid.nodesImageTag) |
    | edgeNode.imagePullPolicy | string | `"IfNotPresent"` | Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images) |
    | edgeNode.imagePullSecret | string | `""` | Image pull secret (see https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) |
    | edgeNode.ports | list | `[]` | Extra ports list to enable on the node container (e.g. SSH, VNC, NoVNC, etc.) |
    | edgeNode.port | int | `5555` | Node component port |
    | edgeNode.nodePort | string | `nil` | Node component expose NodePort |
    | edgeNode.affinity | object | `{}` | Specify affinity for edge-node pods, this overwrites global.seleniumGrid.affinity parameter |
    | edgeNode.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for edge-node pods, this overwrites global.seleniumGrid.topologySpreadConstraints parameter |
    | edgeNode.annotations | object | `{}` | Annotations for edge-node pods |
    | edgeNode.labels | object | `{}` | Labels for edge-node pods |
    | edgeNode.tolerations | list | `[]` | Tolerations for edge-node pods |
    | edgeNode.nodeSelector | object | `{}` | Node selector for edge-node pods |
    | edgeNode.shareProcessNamespace | bool | `true` | Shared process namespace for edge-node pods |
    | edgeNode.resources.requests | object | `{"cpu":"1","memory":"1Gi"}` | Request resources for edge-node pods |
    | edgeNode.resources.limits | object | `{"cpu":"1","memory":"2Gi"}` | Limit resources for edge-node pods |
    | edgeNode.securityContext | object | `{}` | SecurityContext for edge-node container |
    | edgeNode.hostAliases | string | `nil` | Custom host aliases for edge nodes |
    | edgeNode.extraEnvironmentVariables | string | `nil` | Custom environment variables for edge nodes |
    | edgeNode.extraEnvFrom | string | `nil` | Custom environment variables by sourcing entire configMap, Secret, etc. for edge nodes |
    | edgeNode.service.enabled | bool | `false` | Create a service for node |
    | edgeNode.service.type | string | `"ClusterIP"` | Service type |
    | edgeNode.service.loadBalancerIP | string | `""` | Set specific loadBalancerIP when serviceType is LoadBalancer (see https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer) |
    | edgeNode.service.ports | string | `nil` | Extra ports exposed in node service |
    | edgeNode.service.annotations | object | `{}` | Custom annotations for service |
    | edgeNode.dshmVolumeSizeLimit | string | `""` | Size limit for DSH volume mounted in container (if not set, default is disabled, e.g "1Gi") |
    | edgeNode.priorityClassName | string | `""` | Priority class name for edge-node pods |
    | edgeNode.startupProbe | object | `{"enabled":true,"failureThreshold":12,"initialDelaySeconds":0,"path":"/status","periodSeconds":5,"successThreshold":1,"timeoutSeconds":60}` | Startup probe settings |
    | edgeNode.readinessProbe | object | `{"enabled":false,"failureThreshold":10,"initialDelaySeconds":10,"path":"/status","periodSeconds":10,"successThreshold":1,"timeoutSeconds":10}` | Readiness probe settings |
    | edgeNode.livenessProbe | object | `{"enabled":false,"failureThreshold":6,"initialDelaySeconds":30,"path":"/status","periodSeconds":10,"successThreshold":1,"timeoutSeconds":60}` | Liveness probe settings |
    | edgeNode.terminationGracePeriodSeconds | int | `30` | Time to wait for pod termination |
    | edgeNode.deregisterLifecycle | string | `nil` | Define preStop command to shuts down the chrome node gracefully. This overwrites autoscaling.deregisterLifecycle |
    | edgeNode.lifecycle | object | `{}` | Define postStart and preStop events. This overwrites the defined preStop in deregisterLifecycle if any |
    | edgeNode.extraVolumeMounts | list | `[]` | Extra volume mounts for edge-node container |
    | edgeNode.extraVolumes | list | `[]` | Extra volumes for edge-node pod |
    | edgeNode.nodeMaxSessions | string | `nil` | Override the number of max sessions per node |
    | edgeNode.scaledOptions | string | `nil` | Override the scaled options for edge nodes |
    | edgeNode.scaledJobOptions | string | `nil` | Override the scaledJobOptions for edge nodes |
    | edgeNode.scaledObjectOptions | string | `nil` | Override the scaledObjectOptions for edge nodes |
    | edgeNode.hpa.browserName | string | `"MicrosoftEdge"` | browserName from the capability |
    | edgeNode.hpa.sessionBrowserName | string | `"msedge"` | sessionBrowserName if the browserName is different from the sessionBrowserName |
    | edgeNode.hpa.browserVersion | string | `""` | browserVersion from the capability |
    | edgeNode.hpa.platformName | string | `"Linux"` | platformName from the capability |

    Copy link

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Uncomment and update the KEDA image configuration to ensure proper container image usage

    The KEDA image configuration should not be commented out as it's needed for proper
    functionality. Remove the comment symbols (#) from the image configuration block to
    ensure KEDA components use the correct container images.

    charts/selenium-grid/values.yaml [1829-1838]

    -#  image:
    -#    keda:
    -#      registry: selenium
    -#      repository: keda
    -#      tag: "2.16.0-selenium-grid-20241204"
    -#    metricsApiServer:
    -#      registry: selenium
    -#      repository: keda-metrics-apiserver
    -#      tag: "2.16.0-selenium-grid-20241204"
    +image:
    +  keda:
    +    registry: selenium
    +    repository: keda
    +    tag: "2.16.1-selenium-grid-20241224"
    +  metricsApiServer:
    +    registry: selenium
    +    repository: keda-metrics-apiserver
    +    tag: "2.16.1-selenium-grid-20241224"
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    Why: The suggestion correctly identifies that commenting out the KEDA image configuration could cause issues, and properly updates the version numbers to match the new 2.16.1 version being used throughout the PR. This is critical for ensuring KEDA components work correctly.

    8

    @VietND96 VietND96 force-pushed the keda-2.16.1 branch 2 times, most recently from 4b2f662 to 4fe4217 Compare December 25, 2024 00:25
    Copy link

    qodo-merge-pro bot commented Dec 25, 2024

    CI Failure Feedback 🧐

    (Checks updated until commit 0272f30)

    Action: Rerun workflow when failure

    Failed stage: Authenticate GitHub CLI for PR [❌]

    Failure summary:

    The action failed because the GitHub authentication token lacks the required 'read:org' permission
    scope. The error occurred during the gh auth login command, which requires proper authorization to
    access organizational data.

    Relevant error logs:
    1:  ##[group]Operating System
    2:  Ubuntu
    ...
    
    28:  SecurityEvents: write
    29:  Statuses: write
    30:  ##[endgroup]
    31:  Secret source: Actions
    32:  Prepare workflow directory
    33:  Prepare all required actions
    34:  Getting action download info
    35:  Download action repository 'actions/checkout@main' (SHA:cbb722410c2e876e24abbe8de2cc27693e501dcb)
    36:  Complete job name: Rerun workflow when failure
    ...
    
    48:  show-progress: true
    49:  lfs: false
    50:  submodules: false
    51:  set-safe-directory: true
    52:  env:
    53:  GH_CLI_TOKEN: ***
    54:  GH_CLI_TOKEN_PR: ***
    55:  RUN_ID: 12487632026
    56:  RERUN_FAILED_ONLY: true
    ...
    
    119:  ##[group]Run sudo apt update
    120:  �[36;1msudo apt update�[0m
    121:  �[36;1msudo apt install gh�[0m
    122:  shell: /usr/bin/bash -e {0}
    123:  env:
    124:  GH_CLI_TOKEN: ***
    125:  GH_CLI_TOKEN_PR: ***
    126:  RUN_ID: 12487632026
    127:  RERUN_FAILED_ONLY: true
    ...
    
    164:  0 upgraded, 0 newly installed, 0 to remove and 48 not upgraded.
    165:  ##[group]Run echo "$GH_CLI_TOKEN_PR" | gh auth login --with-token
    166:  �[36;1mecho "$GH_CLI_TOKEN_PR" | gh auth login --with-token�[0m
    167:  shell: /usr/bin/bash -e {0}
    168:  env:
    169:  GH_CLI_TOKEN: ***
    170:  GH_CLI_TOKEN_PR: ***
    171:  RUN_ID: 12487632026
    172:  RERUN_FAILED_ONLY: true
    173:  RUN_ATTEMPT: 1
    174:  ##[endgroup]
    175:  error validating token: missing required scope 'read:org'
    176:  ##[error]Process completed with exit code 1.
    

    ✨ CI feedback usage guide:

    The CI feedback tool (/checks) automatically triggers when a PR has a failed check.
    The tool analyzes the failed checks and provides several feedbacks:

    • Failed stage
    • Failed test name
    • Failure summary
    • Relevant error logs

    In addition to being automatically triggered, the tool can also be invoked manually by commenting on a PR:

    /checks "https://github.com/{repo_name}/actions/runs/{run_number}/job/{job_number}"
    

    where {repo_name} is the name of the repository, {run_number} is the run number of the failed check, and {job_number} is the job number of the failed check.

    Configuration options

    • enable_auto_checks_feedback - if set to true, the tool will automatically provide feedback when a check is failed. Default is true.
    • excluded_checks_list - a list of checks to exclude from the feedback, for example: ["check1", "check2"]. Default is an empty list.
    • enable_help_text - if set to true, the tool will provide a help message with the feedback. Default is true.
    • persistent_comment - if set to true, the tool will overwrite a previous checks comment with the new feedback. Default is true.
    • final_update_message - if persistent_comment is true and updating a previous checks message, the tool will also create a new message: "Persistent checks updated to latest commit". Default is true.

    See more information about the checks tool in the docs.

    @VietND96 VietND96 merged commit d86d252 into trunk Dec 25, 2024
    30 of 36 checks passed
    @VietND96 VietND96 deleted the keda-2.16.1 branch December 25, 2024 01:51
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant