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

Add method to set K8S custom environments akin to custom DSNs #96

Open
peterfarrell opened this issue Aug 16, 2024 · 0 comments
Open

Add method to set K8S custom environments akin to custom DSNs #96

peterfarrell opened this issue Aug 16, 2024 · 0 comments

Comments

@peterfarrell
Copy link

Currently, an error is reported to the correct DNS in Sentry, however it uses the environment set in SENTRY_ENVIRONMENT. This is very inflexible and limits you to a single environment.

We'd like the ability override the default environment and enable custom environment overrides akin to the SENTRY_K8S_CUSTOM_DSNS setting by adding a newSENTRY_K8S_CUSTOM_ENVIRONMENTS variable.

New Configuration Variable

  • SENTRY_K8S_CUSTOM_ENVIRONMENTS - if set to 1, enables custom environments to be specified in the annotations with key k8s.sentry.io/environment which would take precedence over SENTRY_ENVIRONMENT. Disabled by default.

Example resource using SENTRY_K8S_CUSTOM_DSNS and SENTRY_K8S_CUSTOM_ENVIRONMENTS via annotations:

apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: null
  labels:
    run: pod-crashloop
    type: test-pod
  name: pod-crashloop
  annotations:
    k8s.sentry.io/dsn: "https://xxxx@xxxx.ingest.us.sentry.io/xxxx"
    k8s.sentry.io/environment: "staging"
spec:
  containers:
    - image: alpine:3
      name: pod-crashloop
      command:
        - sh
        - "-c"
        - |
          sleep 1
          invalid_command
  dnsPolicy: ClusterFirst
  restartPolicy: Always
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

No branches or pull requests

1 participant