Conversation
Resolve conflict in values.yaml: keep subagent configuration and new openopsEnvSecrets section. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: Role | ||
| metadata: | ||
| name: {{ include "openops.fullname" . }}-subagent-manager | ||
| namespace: {{ .Values.subagents.namespace | default .Release.Namespace }} | ||
| labels: | ||
| {{- include "openops.componentLabels" (dict "root" . "component" "app") | nindent 4 }} | ||
| {{- with .Values.global.commonLabels }} | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| {{- with .Values.global.commonAnnotations }} | ||
| annotations: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| rules: | ||
| - apiGroups: [""] | ||
| resources: ["pods"] | ||
| verbs: ["create", "get", "list", "delete"] | ||
| - apiGroups: [""] | ||
| resources: ["pods/log"] | ||
| verbs: ["get"] |
There was a problem hiding this comment.
The Role and RoleBinding for subagents are always created, even when subagents are disabled (OPS_SUBAGENTS_ENABLED: "false"). Other optional features in this chart (e.g., externalSecrets, serviceMonitor, limitRange, networkPolicy) are wrapped in a conditional guard like {{- if .Values.<feature>.enabled }}. These templates should be similarly guarded — for example, wrap the entire file content with {{- if eq (index .Values.openopsEnv "OPS_SUBAGENTS_ENABLED") "true" }} ... {{- end }}, or better yet, add an enabled field to the subagents section in values.yaml and use it here. Without this, every installation gets RBAC resources for a feature they may not use.
| # Subagent configuration | ||
| OPS_SUBAGENTS_ENABLED: "false" | ||
| OPS_SUBAGENT_EXECUTOR_TYPE: "k8s" | ||
| OPS_SUBAGENT_K8S_NAMESPACE: "{{ .Release.Namespace }}" |
There was a problem hiding this comment.
OPS_SUBAGENT_K8S_NAMESPACE is hardcoded to {{ .Release.Namespace }}, but the RBAC resources (Role/RoleBinding) in role-app-subagents.yaml and rolebinding-app-subagents.yaml use {{ .Values.subagents.namespace | default .Release.Namespace }}. If a user sets subagents.namespace to a different namespace, the app will still try to create pods in .Release.Namespace (per this env var), but the RBAC permissions will be granted in the custom namespace — a mismatch that will cause permission errors. This should use the same logic, e.g., '{{ .Values.subagents.namespace | default .Release.Namespace }}' to stay consistent with the RBAC templates.
| OPS_SUBAGENT_K8S_NAMESPACE: "{{ .Release.Namespace }}" | |
| OPS_SUBAGENT_K8S_NAMESPACE: '{{ .Values.subagents.namespace | default .Release.Namespace }}' |
| OPS_SUBAGENT_S3_BUCKET: "" | ||
| OPS_SUBAGENT_S3_REGION: "" | ||
| OPS_SUBAGENT_S3_ENDPOINT: "" | ||
| OPS_SUBAGENT_RUNNER_IMAGE: "535002847982.dkr.ecr.us-east-2.amazonaws.com/openops/subagent-runner:main" |
There was a problem hiding this comment.
Two issues with this default image reference:
-
Private ECR registry: The image URL
535002847982.dkr.ecr.us-east-2.amazonaws.comis a private AWS ECR registry. Other images in this chart use the configurableimage.repository(defaulting topublic.ecr.aws/openops) or component-levelrepositoryoverrides. External users won't be able to pull this image without ECR credentials. Consider following the chart's image repository convention or using the public registry as default. -
Mutable
:maintag: All other component images in this chart use pinned, immutable version tags (e.g.,"0.2.17","0.14.6","18.1", orglobal.version). The chart's schema describes its purpose as ensuring "deterministic upgrades." Using:mainmeans the image can change between deployments without any chart version change, leading to non-reproducible behavior. Consider pinning to a specific version tag.
| OPS_SUBAGENT_RUNNER_IMAGE: "535002847982.dkr.ecr.us-east-2.amazonaws.com/openops/subagent-runner:main" | |
| OPS_SUBAGENT_RUNNER_IMAGE: "public.ecr.aws/openops/subagent-runner:0.0.1-dev" |
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: RoleBinding | ||
| metadata: | ||
| name: {{ include "openops.fullname" . }}-subagent-manager | ||
| namespace: {{ .Values.subagents.namespace | default .Release.Namespace }} | ||
| labels: | ||
| {{- include "openops.componentLabels" (dict "root" . "component" "app") | nindent 4 }} | ||
| {{- with .Values.global.commonLabels }} | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| {{- with .Values.global.commonAnnotations }} | ||
| annotations: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: Role | ||
| name: {{ include "openops.fullname" . }}-subagent-manager | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: {{ include "openops.serviceAccountName" (dict "root" . "component" "app") }} | ||
| namespace: {{ .Release.Namespace }} |
There was a problem hiding this comment.
Same as the Role template: this RoleBinding is always created regardless of whether subagents are enabled. It should be wrapped in a conditional guard (e.g., {{- if eq (index .Values.openopsEnv "OPS_SUBAGENTS_ENABLED") "true" }}) consistent with how other optional features in this chart gate their resources.
| # Namespace where subagent pods run (defaults to same namespace as app) | ||
| namespace: "" |
There was a problem hiding this comment.
There are now two separate configuration points for the subagent namespace: subagents.namespace (used by RBAC templates) and OPS_SUBAGENT_K8S_NAMESPACE (used as an env var by the application). Having two independent settings for the same concept is error-prone — users could set one and forget the other, leading to mismatched RBAC permissions and application behavior. Consider deriving OPS_SUBAGENT_K8S_NAMESPACE from subagents.namespace (e.g., '{{ .Values.subagents.namespace | default .Release.Namespace }}') to have a single source of truth.
| # Namespace where subagent pods run (defaults to same namespace as app) | |
| namespace: "" | |
| # Namespace where subagent pods run (defaults to the Helm release namespace) | |
| namespace: "{{ .Release.Namespace }}" |
Part of OPS-3823