10000 feat: Define Prometheus port in the pod spec by mtojek · Pull Request #5213 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

feat: Define Prometheus port in the pod spec #5213

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

Merged
merged 5 commits into from
Dec 1, 2022

Conversation

mtojek
Copy link
Member
@mtojek mtojek commented Dec 1, 2022

Fixes: #4666

This PR adds a port entry to the container spec.

Testing:

helm template coder helm --namespace coder --set coder.image.tag=v0.12.9 --values helm/values.yaml --debug
...
      containers:
        - name: coder
          image: "ghcr.io/coder/coder:v0.12.9"
          imagePullPolicy: IfNotPresent
          resources:
            {}
          env:
            - name: CODER_ADDRESS
              value: "0.0.0.0:8080"
            # Set the default access URL so a `helm apply` works by default.
            # See: https://github.com/coder/coder/issues/5024
            - name: CODER_ACCESS_URL
              value: "http://coder.coder.svc.cluster.local"
            # Used for inter-pod communication with high-availability.
            - name: KUBE_POD_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
            - name: CODER_DERP_SERVER_RELAY_URL
              value: "http://$(KUBE_POD_IP):8080"

            - name: CODER_PG_CONNECTION_URL
              valueFrom:
                secretKeyRef:
                  key: url
                  name: coder-db-url
            - name: CODER_PROMETHEUS_ADDRESS
              value: 0.0.0.0:2112
            - name: CODER_PROMETHEUS_ENABLE
              value: "true"
          ports:
            - name: "http"
              containerPort: 8080
              protocol: TCP
            - name: "prometheus-http"
              containerPort: 2112
              protocol: TCP
          readinessProbe:
            httpGet:
              path: /api/v2/buildinfo
              port: "http"
              scheme: "HTTP"
          livenessProbe:
            httpGet:
              path: /api/v2/buildinfo
              port: "http"
              scheme: "HTTP"

          volumeMounts: []
...

and

  Containers:
   coder:
    Image:       ghcr.io/coder/coder:v0.12.9
    Ports:       8080/TCP, 2112/TCP
    Host Ports:  0/TCP, 0/TCP
    Liveness:    http-get http://:http/api/v2/buildinfo delay=0s timeout=1s period=10s #success=1 #failure=3
    Readiness:   http-get http://:http/api/v2/buildinfo delay=0s timeout=1s period=10s #success=1 #failure=3
    Environment:
      CODER_ADDRESS:                0.0.0.0:8080
      CODER_ACCESS_URL:             http://coder.coder.svc.cluster.local
      KUBE_POD_IP:                   (v1:status.podIP)
      CODER_DERP_SERVER_RELAY_URL:  http://$(KUBE_POD_IP):8080
      CODER_PG_CONNECTION_URL:      <set to the key 'url' in secret 'coder-db-url'>  Optional: false
      CODER_PROMETHEUS_ADDRESS:     0.0.0.0:2112
      CODER_PROMETHEUS_ENABLE:      true
    Mounts:                         <none>
  Volumes:                          <none>

@mtojek mtojek self-assigned this Dec 1, 2022
@mtojek mtojek requested a review from a team December 1, 2022 12:01
@mtojek mtojek marked this pull request as ready for review December 1, 2022 12:01
helm/values.yaml Outdated

# - CODER_PROMETHEUS_ENABLE: set if CODER_PROMETHEUS_ADDRESS is not empty.
env:
- name: CODER_PG_CONNECTION_URL
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this left over by mistake?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch! I admit that I was experimenting with something. It isn't mandatory here.

@mtojek mtojek enabled auto-merge (squash) December 1, 2022 15:39
@mtojek mtojek merged commit 916ed28 into coder:main Dec 1, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Dec 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

helm: support prometheus port
2 participants
0