Skip to content

feat(gateway): make resource-config ConfigMap optional and configurable - #226

Open
naresh4dev wants to merge 1 commit into
mainfrom
feat/configurable-resource-config
Open

naresh4dev wants to merge 1 commit into
mainfrom
feat/configurable-resource-config

Conversation

@naresh4dev

Copy link
Copy Markdown
Member

Summary

Add resourceConfig.create toggle to allow suppressing the resource-config ConfigMap when it is already managed by another Helm release in the same namespace. This resolves ArgoCD ownership conflicts when multiple applications deploy from the same chart into the same namespace.

Problem

When two ArgoCD applications (e.g., gw-helm-nplive and mcpgw-helm-nplive) deploy from the portkey-gateway chart into the same namespace, ArgoCD reports:

ConfigMap/resource-config is part of applications argocd/fi-ea-portkeyai-gw-helm-nplive and fi-ea-portkeyai-mcpgw-helm-nplive

The ConfigMap was unconditionally rendered with no option to disable it, forcing ignoreDifferences workarounds in every ArgoCD ApplicationSet.

Changes

File Change
values.yaml Added resourceConfig section with create, nameOverride, and data fields
templates/resources-config.yaml Wrapped in conditional, added dynamic name + standard labels
README.md Updated PEM docs, added multi-release guidance

New Values

resourceConfig:
  create: true          # set to false to suppress the ConfigMap
  nameOverride: ""      # override the default name ("resource-config")
  data:                 # ConfigMap data entries
    document_db.pem: |
      -----BEGIN CERTIFICATE-----
      ____
      -----END CERTIFICATE-----

Backward Compatibility

  • Default behavior is unchanged: resourceConfig.create defaults to true, ConfigMap name remains resource-config.
  • No breaking changes for existing deployments.

Testing

Verified with helm template:

  • ✅ Default (create: true) — ConfigMap renders with proper labels
  • create: false — ConfigMap completely suppressed
  • nameOverride: custom-name — ConfigMap name overridden correctly

Add resourceConfig.create toggle (default: true) to allow suppressing
the resource-config ConfigMap when it is already managed by another
Helm release in the same namespace. This resolves ArgoCD ownership
conflicts when multiple applications deploy from the same chart.

Also adds:
- resourceConfig.nameOverride to customize the ConfigMap name
- resourceConfig.data to configure contents via values instead of
  editing the template directly
- Proper labels on the ConfigMap for consistency with other resources

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Template compatibility and Kubernetes validation issues can prevent successful rendering or deployment.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds configurable lifecycle, naming, and data for the gateway’s shared resource ConfigMap.

Changes:

  • Adds resourceConfig values.
  • Conditionally renders the ConfigMap with labels.
  • Documents PEM and multi-release configuration.
File summaries
File Description
values.yaml Defines resource ConfigMap settings.
templates/resources-config.yaml Renders the configurable ConfigMap.
README.md Documents configuration and shared ownership.
Review details

Suppressed comments (2)

charts/portkey-gateway/templates/resources-config.yaml:5

  • Quote this value before emitting it. A valid string override such as "123" is currently rendered as name: 123, which YAML decodes as a number and Kubernetes rejects because metadata.name must be a string.
  name: {{ .Values.resourceConfig.nameOverride | default "resource-config" }}

charts/portkey-gateway/templates/resources-config.yaml:9

  • ConfigMap.data requires string values, but toYaml preserves YAML booleans, numbers, and nulls, causing Kubernetes API validation failures for otherwise natural values such as data: { retries: 3 }. Serialize each entry with toString | quote, matching templates/gateway/config.yaml:21-22.
data:
  {{- toYaml .Values.resourceConfig.data | nindent 2 }}
  • Files reviewed: 3/3 changed files
  • Comments generated: 3
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@@ -1,9 +1,10 @@
{{- if .Values.resourceConfig.create }}
- name: shared-folder
configMap:
name: resource-config
name: resource-config # matches resourceConfig.nameOverride or default
# - name: shared-folder
# configMap:
# name: resource-config
# name: resource-config # matches resourceConfig.nameOverride or default name

@Greg215 Greg215 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.

LGTM

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