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

[Operator] Integration Deployment and DaemonSet use the same selectors #6857

Open
lindeskar opened this issue Apr 12, 2024 · 1 comment
Open
Labels
bug Something isn't working needs-attention An issue or PR has been sitting around and needs attention. variant/operator Related to Grafana Agent Static Operator.

Comments

@lindeskar
Copy link

What's wrong?

The Deployment and DaemonSet for integrations use the same selectors and labels in their templates.

Example:

apiVersion: apps/v1
kind: DaemonSet
metadata:
  # truncated
  name: my-agent-integrations-ds
  namespace: grafana-agent
  # truncated
spec:
  # truncated
  selector:
    matchLabels:
      app.kubernetes.io/instance: my-agent
      app.kubernetes.io/managed-by: grafana-agent-operator
      app.kubernetes.io/name: grafana-agent
      grafana-agent: my-agent
      operator.agent.grafana.com/name: my-agent
      operator.agent.grafana.com/shard: "0"
      operator.agent.grafana.com/type: integrations
  template:
    metadata:
      # truncated
      labels:
        app.kubernetes.io/instance: my-agent
        app.kubernetes.io/managed-by: grafana-agent-operator
        app.kubernetes.io/name: grafana-agent
        app.kubernetes.io/version: v0-40-2
        grafana-agent: my-agent
        operator.agent.grafana.com/name: my-agent
        operator.agent.grafana.com/shard: "0"
        operator.agent.grafana.com/type: integrations
apiVersion: apps/v1
kind: Deployment
metadata:
  # truncated
  name: my-agent-integrations-deploy
  namespace: grafana-agent
  # truncated
spec:
  # truncated
  selector:
    matchLabels:
      app.kubernetes.io/instance: my-agent
      app.kubernetes.io/managed-by: grafana-agent-operator
      app.kubernetes.io/name: grafana-agent
      grafana-agent: my-agent
      operator.agent.grafana.com/name: my-agent
      operator.agent.grafana.com/shard: "0"
      operator.agent.grafana.com/type: integrations
  # truncated
  template:
    metadata:
      # truncated
      labels:
        app.kubernetes.io/instance: my-agent
        app.kubernetes.io/managed-by: grafana-agent-operator
        app.kubernetes.io/name: grafana-agent
        app.kubernetes.io/version: v0-40-2
        grafana-agent: my-agent
        operator.agent.grafana.com/name: my-agent
        operator.agent.grafana.com/shard: "0"
        operator.agent.grafana.com/type: integrations

Steps to reproduce

  1. Create GrafanaAgent and Integration resources (see config below)
  2. Let the Grafana Agent Operator create the Deploymentset and Daemonset resources

System information

Kubernetes v1.27.8

Software version

docker.io/grafana/agent-operator:v0.40.3

Configuration

---
apiVersion: monitoring.grafana.com/v1alpha1
kind: GrafanaAgent
metadata:
  name: my-agent
spec:
  disableReporting: false
  disableSupportBundle: false
  enableConfigReadAPI: false
  integrations:
    selector:
      matchLabels:
        grafana-agent: my-agent
---
apiVersion: monitoring.grafana.com/v1alpha1
kind: Integration
metadata:
  name: agent-eventhandler
  labels:
    grafana-agent: my-agent
spec:
  name: eventhandler
  type:
    unique: true
  config:
    cache_path: /etc/eventhandler/eventhandler.cache
    logs_instance: grafana-agent/my-agent-logs
  volumeMounts:
    - mountPath: /etc/eventhandler
      name: agent-eventhandler
  volumes:
    - name: agent-eventhandler
      persistentVolumeClaim:
        claimName: agent-eventhandler
---
apiVersion: monitoring.grafana.com/v1alpha1
kind: Integration
metadata:
  name: node-exporter
  labels:
    grafana-agent: my-agent
spec:
  name: node_exporter
  type:
    allNodes: true
    unique: true
  config:
    autoscrape:
      enable: true
      metrics_instance: grafana-agent/my-agent-metrics
    procfs_path: host/proc
    rootfs_path: /host/root
    sysfs_path: /host/sys
  volumeMounts:
    - mountPath: /host/root
      name: rootfs
    - mountPath: /host/sys
      name: sysfs
    - mountPath: /host/proc
      name: procfs
  volumes:
    - hostPath:
        path: /
      name: rootfs
    - hostPath:
        path: /sys
      name: sysfs
    - hostPath:
        path: /proc
      name: procfs

Logs

level=info ts=2024-04-12T14:28:42.017622454Z controller=grafanaagent controllerGroup=monitoring.grafana.com controllerKind=GrafanaAgent GrafanaAgent=grafana-agent/my-agent namespace=grafana-agent name=my-agent reconcileID=19932562-6488-4c48-aecd-7b93efee69ba msg="reconciling integrations Deployment" deploy=grafana-agent/my-agent-integrations-deploy
level=info ts=2024-04-12T14:28:42.031503823Z controller=grafanaagent controllerGroup=monitoring.grafana.com controllerKind=GrafanaAgent GrafanaAgent=grafana-agent/my-agent namespace=grafana-agent name=my-agent reconcileID=19932562-6488-4c48-aecd-7b93efee69ba msg="reconciling integrations DaemonSet" ds=grafana-agent/my-agent-integrations-ds
@lindeskar lindeskar added the bug Something isn't working label Apr 12, 2024
@rfratto rfratto added the variant/operator Related to Grafana Agent Static Operator. label Apr 12, 2024
Copy link
Contributor

This issue has not had any activity in the past 30 days, so the needs-attention label has been added to it.
If the opened issue is a bug, check to see if a newer release fixed your issue. If it is no longer relevant, please feel free to close this issue.
The needs-attention label signals to maintainers that something has fallen through the cracks. No action is needed by you; your issue will be kept open and you do not have to respond to this comment. The label will be removed the next time this job runs if there is new activity.
Thank you for your contributions!

@github-actions github-actions bot added the needs-attention An issue or PR has been sitting around and needs attention. label May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-attention An issue or PR has been sitting around and needs attention. variant/operator Related to Grafana Agent Static Operator.
Projects
None yet
Development

No branches or pull requests

2 participants