Skip to content

K8s: Fix deployment template error in video-manager #2828

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

Merged
merged 3 commits into from
May 8, 2025
Merged

Conversation

VietND96
Copy link
Member

@VietND96 VietND96 commented May 7, 2025

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

Fixes #2827

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

Bug fix, Tests


Description

  • Fix Helm template rendering for videoManager volumes

    • Correctly handle extraVolumeMounts and extraVolumes as arrays
  • Update test values to cover new videoManager configuration

  • Improve Helm template debug output in test bootstrap script

  • Quote ingress hostnames in Jaeger and file-browser templates


Changes walkthrough 📝

Relevant files
Bug fix
3 files
file-browser-deployment.yaml
Fix extraVolumeMounts/extraVolumes rendering in deployment template
+2/-2     
file-browser-ingress.yaml
Quote ingress hostnames in file-browser ingress template 
+2/-2     
jaeger-ingress.yaml
Quote ingress hostnames in Jaeger ingress template             
+2/-2     
Tests
3 files
base-recorder-values.yaml
Add videoManager extraVolumes and extraVolumeMounts test values
+11/-0   
dummy.yaml
Add videoManager extraVolumes and extraVolumeMounts test values
+11/-0   
dummy_solution.yaml
Add videoManager extraVolumes and extraVolumeMounts test values
+11/-0   
Enhancement
1 files
bootstrap.sh
Enable debug output for Helm template rendering in tests 
+2/-2     

Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Copy link

    qodo-merge-pro bot commented May 7, 2025

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    🎫 Ticket compliance analysis ✅

    2827 - Fully compliant

    Compliant requirements:

    • Fix the Helm template rendering failure for videoManager.extraVolumeMounts and videoManager.extraVolumes
    • Ensure these properties are treated as arrays rather than objects
    • Fix the error: "json: cannot unmarshal object into Go struct field Container.spec.template.spec.containers.volumeMounts of type []v1.VolumeMount"

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

    Variable Reference

    The fix changes from using "." to ".Values.videoManager.extraVolumeMounts" but the context suggests "." was already within the "if .Values.videoManager.extraVolumeMounts" block, so verify this change doesn't introduce a new issue.

      {{- tpl (toYaml .Values.videoManager.extraVolumeMounts) $ | nindent 12 }}
    {{- else }}

    Copy link

    qodo-merge-pro bot commented May 7, 2025

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Preserve default volume mounts

    The conditional structure creates a potential issue where the default volume
    mount is only applied when extraVolumeMounts is not defined. If users define
    custom volume mounts, they'll lose the default mount unless they explicitly
    include it. Consider merging default mounts with custom ones instead.

    charts/selenium-grid/templates/video-manager/file-browser-deployment.yaml [60-65]

    +{{- $defaultMounts := list (dict "name" "srv" "mountPath" "/srv" "subPath" "srv") }}
     {{- if .Values.videoManager.extraVolumeMounts }}
    -  {{- tpl (toYaml .Values.videoManager.extraVolumeMounts) $ | nindent 12 }}
    +  {{- $allMounts := concat $defaultMounts .Values.videoManager.extraVolumeMounts }}
    +  {{- tpl (toYaml $allMounts) $ | nindent 12 }}
     {{- else }}
       - name: srv
         mountPath: /srv
         subPath: srv
    +{{- end }}
    • Apply / Chat
    Suggestion importance[1-10]: 9

    __

    Why: This suggestion addresses a critical design issue where users would lose the default volume mount when defining custom mounts. The improved approach of merging default mounts with custom ones prevents potential functionality breakage and improves the chart's usability.

    High
    Preserve default volumes

    Similar to the volume mounts issue, the default volume is only applied when
    extraVolumes is not defined. This creates inconsistency where custom volumes
    would replace rather than supplement the default volume, potentially breaking
    functionality.

    charts/selenium-grid/templates/video-manager/file-browser-deployment.yaml [115-120]

    +{{- $defaultVolumes := list (dict "name" "srv" "emptyDir" (dict)) }}
     {{- if .Values.videoManager.extraVolumes }}
    -  {{- tpl (toYaml .Values.videoManager.extraVolumes) $ | nindent 8 }}
    +  {{- $allVolumes := concat $defaultVolumes .Values.videoManager.extraVolumes }}
    +  {{- tpl (toYaml $allVolumes) $ | nindent 8 }}
     {{- else }}
       - name: srv
         emptyDir: {}
     {{- end }}
    • Apply / Chat
    Suggestion importance[1-10]: 9

    __

    Why: This suggestion fixes a similar critical issue with volumes where custom volumes would completely replace the default volume instead of supplementing it. This could break core functionality and the fix ensures consistent behavior regardless of user customizations.

    High
    • More

    Copy link

    qodo-merge-pro bot commented May 7, 2025

    CI Feedback 🧐

    (Feedback updated until commit 44ac082)

    A test triggered by this PR failed. Here is an AI-generated analysis of the failure:

    Action: Rerun workflow when failure

    Failed stage: Authenticate GitHub CLI for PR [❌]

    Failure summary:

    The action failed because the GitHub CLI authentication token is missing the required 'read:org'
    scope. At line 182, the error message clearly states: "error validating token: missing required
    scope 'read:org'". This indicates that the token provided in the GH_CLI_TOKEN_PR environment
    variable doesn't have sufficient permissions to perform the required operations.

    Relevant error logs:
    1:  ##[group]Operating System
    2:  Ubuntu
    ...
    
    22:  Issues: write
    23:  Metadata: read
    24:  Models: read
    25:  Packages: write
    26:  Pages: write
    27:  PullRequests: write
    28:  RepositoryProjects: write
    29:  SecurityEvents: write
    30:  Statuses: write
    31:  ##[endgroup]
    32:  Secret source: Actions
    33:  Prepare workflow directory
    34:  Prepare all required actions
    35:  Getting action download info
    36:  Download action repository 'actions/checkout@main' (SHA:85e6279cec87321a52edac9c87bce653a07cf6c2)
    37:  Complete job name: Rerun workflow when failure
    38:  ##[group]Run actions/checkout@main
    ...
    
    42:  ssh-strict: true
    43:  ssh-user: git
    44:  persist-credentials: true
    45:  clean: true
    46:  sparse-checkout-cone-mode: true
    47:  fetch-depth: 1
    48:  fetch-tags: false
    49:  show-progress: true
    50:  lfs: false
    51:  submodules: false
    52:  set-safe-directory: true
    53:  env:
    54:  GH_CLI_TOKEN: ***
    55:  GH_CLI_TOKEN_PR: ***
    56:  RUN_ID: 14891994752
    57:  RERUN_FAILED_ONLY: true
    58:  RUN_ATTEMPT: 2
    ...
    
    113:  Or undo this operation with:
    114:  git switch -
    115:  Turn off this advice by setting config variable advice.detachedHead to false
    116:  HEAD is now at ad3134d Merge 44ac082feb90e350a9272d52bc69f550d46345be into f7bc3fb7facd980ff4ac54945c578bcc2ff14588
    117:  ##[endgroup]
    118:  [command]/usr/bin/git log -1 --format=%H
    119:  ad3134d90bd1a465f9f0c72e69730d5827979fff
    120:  ##[group]Run sudo apt update
    121:  �[36;1msudo apt update�[0m
    122:  �[36;1msudo apt install gh�[0m
    123:  shell: /usr/bin/bash -e {0}
    124:  env:
    125:  GH_CLI_TOKEN: ***
    126:  GH_CLI_TOKEN_PR: ***
    127:  RUN_ID: 14891994752
    128:  RERUN_FAILED_ONLY: true
    129:  RUN_ATTEMPT: 2
    ...
    
    164:  Reading state information...
    165:  19 packages can be upgraded. Run 'apt list --upgradable' to see them.
    166:  WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
    167:  Reading package lists...
    168:  Building dependency tree...
    169:  Reading state information...
    170:  gh is already the newest version (2.72.0).
    171:  0 upgraded, 0 newly installed, 0 to remove and 19 not upgraded.
    172:  ##[group]Run echo "$GH_CLI_TOKEN_PR" | gh auth login --with-token
    173:  �[36;1mecho "$GH_CLI_TOKEN_PR" | gh auth login --with-token�[0m
    174:  shell: /usr/bin/bash -e {0}
    175:  env:
    176:  GH_CLI_TOKEN: ***
    177:  GH_CLI_TOKEN_PR: ***
    178:  RUN_ID: 14891994752
    179:  RERUN_FAILED_ONLY: true
    180:  RUN_ATTEMPT: 2
    181:  ##[endgroup]
    182:  error validating token: missing required scope 'read:org'
    183:  ##[error]Process completed with exit code 1.
    184:  Post job cleanup.
    

    @VietND96 VietND96 merged commit 7d4d65f into trunk May 8, 2025
    48 of 55 checks passed
    @VietND96 VietND96 deleted the video-manager branch May 8, 2025 03:36
    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.

    [🐛 Bug]:extraVolumeMounts and extraVolumes cause template rendering failure in Helm chart under videomanager components
    1 participant