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

Helm related fixes #338

Merged
merged 3 commits into from
Dec 10, 2024
Merged

Helm related fixes #338

merged 3 commits into from
Dec 10, 2024

Conversation

tulsiojha
Copy link
Contributor

@tulsiojha tulsiojha commented Dec 10, 2024

  • fixed helm fetch on manual url entry
  • added managed by helm tag in secrets
  • updated intercept port variables

Summary by Sourcery

Fix Helm fetch for manual URL entries, add 'managed by Helm' tag to secrets, and update intercept port variables for improved functionality and resource management.

Bug Fixes:

  • Fix Helm fetch functionality to correctly handle manual URL entries.

Enhancements:

  • Add a 'managed by Helm' tag to secrets to improve resource tracking and management.
  • Update intercept port variables to ensure correct port mapping and handling.

Copy link

sourcery-ai bot commented Dec 10, 2024

Reviewer's Guide by Sourcery

This PR implements several Helm-related improvements and fixes, focusing on helm chart management, service interception, and secret handling. The changes include fixing helm fetch functionality for manual URL entries, adding Helm management tags to secrets, and updating port variables for service interception.

ER diagram for Secret management changes

erDiagram
    SECRET {
        string displayName
        boolean createdByHelm
    }

    SECRET ||--o{ RESOURCE_EXTRA_ACTION : "managed by"
    RESOURCE_EXTRA_ACTION {
        boolean disabled
    }
Loading

Class diagram for Helm-related changes

classDiagram
    class HelmChartLayout {
        - selectedRepo: string
        + packageId: string
        - activeTab: string = 'defaults'
        + activeTab: string = 'values'
    }
    class SecretResourceV2 {
        + createdByHelm: boolean
    }
    class InterceptPortView {
        - containerPort
        + devicePort
    }
    class ServiceBindingQueries {
        - containerPort
        + devicePort
    }
    class AppQueries {
        + protocol: string
    }
    class SecretQueries {
        + createdByHelm: boolean
    }
    class ExposedPortList {
        + protocol: string = 'TCP'
    }

    HelmChartLayout --> SecretResourceV2 : uses
    InterceptPortView --> ServiceBindingQueries : uses
    AppQueries --> SecretQueries : uses
    ExposedPortList --> InterceptPortView : uses
Loading

File-Level Changes

Change Details Files
Enhanced Helm chart management and UI interactions
  • Fixed helm fetch functionality when manually entering URLs
  • Updated helm chart version filtering logic
  • Modified helm chart value handling for better defaults
src/apps/console/routes/_main+/$account+/new-managed-service/managed-service-layout-v2.tsx
src/apps/console/routes/_main+/$account+/env+/$environment+/workloads+/helm-chart+/$helmchart+/settings+/values/route.tsx
Improved service interception and port mapping
  • Updated port mapping structure to use devicePort instead of containerPort
  • Added protocol field to port mappings
  • Refactored service interception UI components
src/apps/console/routes/_main+/$account+/env+/$environment+/services/services-resource-v2.tsx
src/apps/console/routes/_main+/$account+/env+/$environment+/services/handle-intercept-service.tsx
src/apps/console/routes/_main+/$account+/env+/$environment+/services/exposed-service.tsx
Enhanced secret management with Helm integration
  • Added createdByHelm flag to secrets
  • Implemented UI controls to prevent modification of Helm-managed secrets
  • Updated secret resource queries to include Helm management information
src/apps/console/page-components/secret-resource-v2.tsx
src/apps/console/server/gql/queries/secret-queries.ts
src/apps/console/routes/_main+/$account+/env+/$environment+/secret.$secret/route.tsx

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

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @tulsiojha - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 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.

@@ -396,8 +397,9 @@ const RenderField = ({
if (field.type === 'int-range') {
Copy link

Choose a reason for hiding this comment

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

issue (complexity): Consider extracting shared number range input logic into a reusable component to reduce code duplication

The int-range and Resource field types contain significant duplication and unnecessary nesting. Consider:

  1. Extract shared number range logic into a reusable component:
const NumberRangeInput = ({ 
  field, 
  value, 
  onChange, 
  errors,
  fieldKey 
}) => {
  const formatValue = (val, unit, multiplier = 1) => 
    `${parseFloat(val) * multiplier}${unit}`;

  return (
    <div className="flex flex-row gap-xl items-end flex-1">
      <NumberInput
        size="lg"
        error={!!errors[`${fieldKey}.min`]}
        message={errors[`${fieldKey}.min`]} 
        placeholder={`${field.label} min`}
        value={parseFloat(value.min) / (field.multiplier || 1)}
        onChange={({target}) => {
          onChange(`${field.input}.min`)(
            formatValue(target.value, field.unit, field.multiplier)
          );
        }}
        suffix={field.displayUnit}
      />
      <NumberInput 
        // Similar props for max input
      />
    </div>
  );
};
  1. Simplify the field type handling:
if (field.type === 'int-range' || field.type === 'Resource') {
  return (
    <div className="flex flex-col gap-md">
      <Label required={field.required}>{field.label}</Label>
      <div className="flex flex-row gap-xl items-center">
        <NumberRangeInput
          field={field}
          value={value}
          onChange={onChange}
          errors={errors}
          fieldKey={fieldKey}
        />
        {field.type === 'Resource' && (
          <QosSwitch 
            checked={qos}
            onChange={handleQosChange}
          />
        )}
      </div>
    </div>
  );
}

This reduces nesting, eliminates the dummyEvent wrapper, and makes the code more maintainable while preserving all functionality.

@tulsiojha tulsiojha merged commit be645db into release-v1.1.1 Dec 10, 2024
5 checks passed
@tulsiojha tulsiojha deleted the helm/issue branch December 10, 2024 08:29
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.

1 participant