Skip to content

helm changes - #22

Merged
trispera merged 1 commit into
devfrom
helm_modifications_3
Jan 13, 2025
Merged

trispera merged 1 commit into
devfrom
helm_modifications_3

Conversation

@lvarin

@lvarin lvarin commented Jan 13, 2025 •

Copy link
Copy Markdown
Collaborator

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • 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 not work as expected)
  • Documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have not reduced the existing code coverage
  • I have added docstrings following the Python style guidelines of this project to all new modules, classes, methods and functions are documented with docstrings following; I have updated any previously existing docstrings, if applicable
  • I have updated any sections of the app's documentation that are affected by the proposed changes, if applicable

Summary by Sourcery

Update Helm chart for pubgrade.

Build:

  • Refactor Helm chart values for pubgrade webserver, mongodb and build complete updater components.
  • Configure secrets for Github access token, cosign password, private key and intermediate registry token.
  • Update persistent volume claims for webserver and mongodb components.
  • Update ingress, service and deployment configurations for webserver component.
  • Update deployment configuration for build complete updater and mongodb components.

Deployment:

  • Update service account and role binding for pubgrade webserver.

@sourcery-ai

sourcery-ai Bot commented Jan 13, 2025 •

Copy link
Copy Markdown

Reviewer's Guide by Sourcery

This pull request introduces several changes to the Helm charts, notably restructuring the values file and enhancing security measures within the deployment configurations.

Class diagram showing the updated Helm chart structure

classDiagram
    class Values {
        +String appName
        +String pubgrade_url
    }

    class PubgradeWebserver {
        +String serviceAccountName
        +int replicaCount
        +String imagePullPolicy
        +String image
        +int port
        +String portType
        +Volume volume
        +Ingress ingress
        +SecurityContext securityContext
    }

    class MongoDB {
        +String image
        +String name
        +int replicaCount
        +int port
        +String portType
        +Volume volume
        +SecurityContext securityContext
    }

    class BuildCompleteUpdater {
        +int replicaCount
        +String image
        +String imagePullPolicy
    }

    Values -- PubgradeWebserver
    Values -- MongoDB
    Values -- BuildCompleteUpdater
Loading

File-Level Changes

Change Details Files
Restructured values file to use hierarchical organization for Pubgrade components.
  • Values related to Pubgrade are now organized under dedicated component names (e.g., pubgrade_webserver, pubgrade_mongodb).
  • Added sections for build-complete-updater and mongodb configurations.
helm/values.yaml
Added security contexts to the webserver and mongodb deployments.
  • Set runAsUser to 1004510000 for both containers.
  • Added securityContext with seccompProfile and capabilities settings to the webserver container.
helm/templates/pubgrade-webserver/deployment.yaml
helm/templates/pubgrade-mongodb/deployment.yaml
Updated deployment configurations for the webserver.
  • Used templated values for serviceAccountName, imagePullPolicy, and image.
  • Added environment variables for secrets like GH_ACCESS_TOKEN, COSIGN_PASSWORD, COSIGN_PRIVATE_KEY, and INTERMEDIATE_REGISTRY_TOKEN.
helm/templates/pubgrade-webserver/deployment.yaml
Added secrets configuration.
  • Created a new secret named pubgrade-secret containing encrypted values for GitHub access token, Cosign password and private key, and intermediate registry token.
helm/templates/pubgrade-webserver/secrets.yaml
Updated ingress configuration.
  • Used templated values for ingress URL and HTTPS settings.
helm/templates/pubgrade-webserver/ingress.yaml
Updated persistent volume claim configurations.
  • Used templated values for storage class, size, and access modes.
  • Simplified PVC definitions by removing the embedded List.
helm/templates/pubgrade-webserver/pvc.yaml
helm/templates/pubgrade-mongodb/pvc.yaml
Updated service configurations.
  • Used templated values for service type and port.
helm/templates/pubgrade-webserver/services.yaml
helm/templates/pubgrade-mongodb/service.yaml
Updated service account and role binding configurations.
  • Used templated values for service account name.
helm/templates/pubgrade-webserver/service-account.yaml
helm/templates/pubgrade-webserver/role-binding.yaml
Updated build-complete-updater deployment.
  • Used templated values for replicaCount, image, and imagePullPolicy.
  • Renamed the container name to pubgrade-build-complete-updater.
helm/templates/pubgrade-build-complete-updater/deployment.yaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @lvarin - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider making the nodePort configurable through values.yaml instead of hardcoding it to 30008 in the service template
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟡 Security: 1 issue found
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

containers:
- name: mongodb
image: mongo:3.6
image: {{ .Values.pubgrade_mongodb.image }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 issue (security): MongoDB 3.6 is quite outdated and may have security vulnerabilities

Consider upgrading to a more recent version of MongoDB (e.g., 4.4 or later) to ensure better security and performance.

targetPort: 8080
- port: {{ .Values.pubgrade_webserver.port }}
targetPort: {{ .Values.pubgrade_webserver.port }}
nodePort: 30008

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Consider templating the nodePort value

Other port configurations are templated, but nodePort is hardcoded. Consider making this configurable through values.yaml for consistency and flexibility.

Suggested implementation:

      nodePort: {{ .Values.pubgrade_webserver.nodePort }}

You'll need to add the nodePort configuration to your values.yaml file. Add this under the pubgrade_webserver section:

pubgrade_webserver:
  # ... existing values ...
  nodePort: 30008  # Default value matching the previous hardcoded value

This allows users to override the nodePort value while maintaining the same default behavior.

@trispera
trispera merged commit e5066b2 into dev Jan 13, 2025
@trispera
trispera deleted the helm_modifications_3 branch January 13, 2025 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants