Skip to content

Option to assign field selector or label selector for filtering pods #192

@samiulsaki

Description

@samiulsaki

Hello, we are looking for an option to not maintain the list of namespaces, every time we setup a coder namespace in the kubernetes cluster. Instead we would like to use the set field-selector and/or label-selector to filter out coder workspaces.

Is this possible to simply update your chart to add these properties in the values.yaml

# fieldSelector -- Kubernetes field selector for filtering pods.
# Use this filter instead of .values.namespaces
fieldSelector: ""

# labelSelector -- Kubernetes label selector for filtering pods
# Use this filter instead of .values.namespaces
labelSelector: ""

And add them environment variables for the deployment?

apiVersion: apps/v1
kind: Deployment
metadata:
  name: coder-logstream-kube
spec:
  # This must remain at 1 otherwise duplicate logs can occur!
  replicas: 1
  -------
  template:
    ------
    spec:
      ------
      containers:
          ------
          env:
            {{- if .Values.fieldSelector }}
            - name: CODER_FIELD_SELECTOR
              value: {{ .Values.fieldSelector | quote }}
            {{- end }}
            {{- if .Values.labelSelector }}
            - name: CODER_LABEL_SELECTOR
              value: {{ .Values.labelSelector | quote }}
            {{- end }}

I can create a PR if you think this approach will actually work for the app.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions