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

fix: correct selector in PodMonitor #340

Merged
merged 2 commits into from
May 6, 2024
Merged

fix: correct selector in PodMonitor #340

merged 2 commits into from
May 6, 2024

Conversation

mikhail5555
Copy link
Contributor

@mikhail5555 mikhail5555 commented May 3, 2024

Update matchLabels from #324

Description

Corrects the match label to use new k8s labels introduced in #324

Checklist

  • I have read the contributing documentation.
  • I signed and signed-off the commits (git commit -S -s ...). See this documentation on signing commits.
  • I have correctly attributed the author(s) of the code.
  • I have tested the changes locally.
  • I have followed the project's style guidelines.
  • I have updated the documentation, if necessary.
  • I have added tests, if applicable.

Screenshots (if applicable) or Testing Completed

Generated yaml:

---
# Source: retina/templates/podmonitor.yaml
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
  name: retina-svc
  namespace: kube-system
  labels:
    k8s-app: retina
    helm.sh/chart: retina-0.0.1
    app.kubernetes.io/name: retina
    app.kubernetes.io/instance: release-name
    app.kubernetes.io/version: "0.0.1"
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/part-of: retina
    app.kubernetes.io/component: metrics
spec:
  podMetricsEndpoints:
    - port: retina
      path: /metrics
      interval: 30s
      scrapeTimeout: 30s
      scheme: http
  namespaceSelector:
    matchNames:
      - kube-system
  selector:
    matchLabels:
      app.kubernetes.io/name: retina
      app.kubernetes.io/instance: release-name
      app.kubernetes.io/component: workload

Which matches the selector labels that the DaemonSet uses

---
# Source: retina/templates/daemonset.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
  labels:
    helm.sh/chart: retina-0.0.1
    app.kubernetes.io/name: retina
    app.kubernetes.io/instance: release-name
    app.kubernetes.io/version: "0.0.1"
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/part-of: retina
    app.kubernetes.io/component: workload
    k8s-app: retina
  name: retina-agent-win
  namespace: kube-system
  annotations:
    prometheus.io/port: "10093"
    prometheus.io/scrape: "true"
    checksum/config: faf69acaa3a534c0ea0c8e2caac72fcd7abf27c8a231d51a432c1db918cd20f0
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: retina
      app.kubernetes.io/instance: release-name
      app.kubernetes.io/component: workload
  template:
    metadata:
      labels:
        helm.sh/chart: retina-0.0.1
        app.kubernetes.io/name: retina
        app.kubernetes.io/instance: release-name
        app.kubernetes.io/version: "0.0.1"
        app.kubernetes.io/managed-by: Helm
        app.kubernetes.io/part-of: retina
        app.kubernetes.io/component: workload
        k8s-app: retina
      name: retina
      namespace: kube-system
    spec:
      serviceAccountName: retina-agent
      securityContext:
        windowsOptions:
          hostProcess: true
          runAsUserName: NT AUTHORITY\SYSTEM
        runAsNonRoot: false
      hostNetwork: true
      containers:
        - name: retinawin
          image: ghcr.io/microsoft/retina/retina-agent:v0.0.2
          ports:
            - name: retina
              containerPort: 10093
          command:
            - powershell.exe
            - -command
            - .\setkubeconfigpath.ps1; ./controller.exe --config ./retina/config.yaml --kubeconfig ./kubeconfig
          env:
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: metadata.name
            - name: NODE_NAME
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: spec.nodeName
            - name: NODE_IP
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: status.hostIP
          securityContext:
            capabilities:
              add:
                - SYS_ADMIN
                - SYS_RESOURCE
                - NET_ADMIN
                - IPC_LOCK
            privileged: false
          volumeMounts:
            - name: retina-config-win
              mountPath: retina
      nodeSelector:
        kubernetes.io/os: windows
      volumes:
        - name: retina-config-win
          configMap:
            name: retina-config-win

Additional Notes

Add any additional notes or context about the pull request here.


Please refer to the CONTRIBUTING.md file for more information on how to contribute to this project.

Update matchLabels from #324

Signed-off-by: Mikhail Epifanov <[email protected]>
@mikhail5555 mikhail5555 requested a review from a team as a code owner May 3, 2024 10:21
@mikhail5555 mikhail5555 changed the title Correct selector in PodMonitor fix: correct selector in PodMonitor May 3, 2024
@rbtr rbtr self-assigned this May 3, 2024
@rbtr rbtr added type/fix Fixes something area/infra Test, Release, or CI Infrastructure priority/0 P0 scope/S Change is Small labels May 3, 2024
@rbtr rbtr enabled auto-merge May 3, 2024 16:36
@rbtr rbtr added this pull request to the merge queue May 3, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 3, 2024
@rbtr rbtr added this pull request to the merge queue May 3, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 3, 2024
@nddq nddq added this pull request to the merge queue May 3, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 3, 2024
@rbtr rbtr added this pull request to the merge queue May 3, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 3, 2024
@rbtr rbtr added this pull request to the merge queue May 6, 2024
Merged via the queue into microsoft:main with commit 363613d May 6, 2024
21 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/infra Test, Release, or CI Infrastructure priority/0 P0 scope/S Change is Small type/fix Fixes something
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants