Code Monkey home page Code Monkey logo

Comments (2)

yacinebbt avatar yacinebbt commented on June 23, 2024

Hello,

I have the same isssue i've created: cloudnative-pg/charts#287, here is the details of the ticket:

Hello,

When creating a cluster and specifying the access mode type, the type is appended to a hardcoded value which is the ReadWriteOnce:

apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: yacine-rwm
  namespace: source
spec:
  instances: 1
  storage:
    pvcTemplate:
      accessModes:
        - ReadWriteMany
      resources:
        requests:
          storage: 1Gi
      storageClassName: sc-cus
      volumeMode: Filesystem
  walStorage:
    pvcTemplate:
      accessModes:
        - ReadWriteMany
      resources:
        requests:
          storage: 1Gi
      storageClassName: sc-cus
      volumeMode: Filesystem

The auto created pvcs have the following specs:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: yacine-rwm-1
  namespace: source
spec:
  accessModes:
    - ReadWriteMany
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  storageClassName: sc-cus
  volumeMode: Filesystem
  volumeName: pvc-xx-xxxx-xxxxxx-xxxxxxxxxx-xxxxxxxxx-x

and

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: yacine-rwm-1-wal
  namespace: source
spec:
  accessModes:
    - ReadWriteOnce
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  volumeName: pvc-xx-xxxx-xxxxxx-xxxxxxxxxx-xxxxxxxxx-x
  storageClassName: sc-cus
  volumeMode: Filesystem

The same thing happen if we create a cluster with ReadWriteOnce access mode:

apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: yacine-rwo
  namespace: source
spec:
  instances: 1
  storage:
    pvcTemplate:
      accessModes:
        - ReadWriteOnce
      resources:
        requests:
          storage: 1Gi
      storageClassName: sc-cus
      volumeMode: Filesystem
  walStorage:
    pvcTemplate:
      accessModes:
        - ReadWriteOnce
      resources:
        requests:
          storage: 1Gi
      storageClassName: sc-cus
      volumeMode: Filesystem

The pvcs created have ReadWriteOnce access mode duplicated:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: yacine-rwo-1
  namespace: source
spec:
  accessModes:
    - ReadWriteOnce
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  volumeName: pvc-xx-xxxx-xxxxxx-xxxxxxxxxx-xxxxxxxxx-x
  storageClassName: sc-cus
  volumeMode: Filesystem

and:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: yacine-rwo-1
  namespace: source
spec:
  accessModes:
    - ReadWriteOnce
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  volumeName: pvc-xx-xxxx-xxxxxx-xxxxxxxxxx-xxxxxxxxx-x
  storageClassName: sc-cus
  volumeMode: Filesystem

The same result if we mix the types, meaning that if we use RWO for storage data and RWX for wals or vice-versa, the pvcs will always have the ReadWriteOnce value + the one we configure in our cluster definition.
we can find the definition of the funtion that generate the pvc here:

func (cmd *fioCommand) generatePVCObject() (*corev1.PersistentVolumeClaim, error) {

I think what should be done, is to check if the user don't define a value for AccessMode we keep the ReadWriteOnce as a default value, otherwise, use the defined value by the user. (https://github.com/cloudnative-pg/cloudnative-pg/blob/267e7cc1416241453c3e0a1d5ec257e806b184fd/internal/cmd/plugin/fio/fio.go#L103C4-L103C74)

Thank you for fixing this issue :).
Regards,

from cloudnative-pg.

albundy83 avatar albundy83 commented on June 23, 2024

Hello,

if you can confirm that it's a trending that you observe also please.
Just to clarify the issue, it is also a problem with prometheus and alert PrometheusDuplicateTimestamps.
Due to the fact that you fill twice with the same value, it creates from kube-state-metrics the same metrics twice.

We have prometheus log filled with:

ts=2024-05-22T11:52:17.520Z caller=scrape.go:1738 level=warn component="scrape manager" scrape_pool=serviceMonitor/monitoring/kube-prometheus-stack-kube-state-metrics/0 target=http://10.42.xx.yy:8080/metrics msg="Error on ingesting samples with different value but same timestamp" num_dropped=12

and with debug enabled:

ts=2024-05-22T11:52:17.486Z caller=scrape.go:1777 level=debug component="scrape manager" scrape_pool=serviceMonitor/monitoring/kube-prometheus-stack-kube-state-metrics/0 target=http://10.42.xx.yy:8080/metrics msg="Duplicate sample for timestamp" series="kube_persistentvolumeclaim_access_mode{namespace=\"precious-dev\",persistentvolumeclaim=\"precious-1-wal\",access_mode=\"ReadWriteOnce\"}"
ts=2024-05-22T11:52:17.487Z caller=scrape.go:1777 level=debug component="scrape manager" scrape_pool=serviceMonitor/monitoring/kube-prometheus-stack-kube-state-metrics/0 target=http://10.42.xx.yy:8080/metrics msg="Duplicate sample for timestamp" series="kube_persistentvolumeclaim_access_mode{namespace=\"precious-prod\",persistentvolumeclaim=\"precious-1-wal\",access_mode=\"ReadWriteOnce\"}"
ts=2024-05-22T11:52:17.487Z caller=scrape.go:1777 level=debug component="scrape manager" scrape_pool=serviceMonitor/monitoring/kube-prometheus-stack-kube-state-metrics/0 target=http://10.42.xx.yy:8080/metrics msg="Duplicate sample for timestamp" series="kube_persistentvolumeclaim_access_mode{namespace=\"precious-pprod\",persistentvolumeclaim=\"precious-1\",access_mode=\"ReadWriteOnce\"}"
ts=2024-05-22T11:52:17.487Z caller=scrape.go:1777 level=debug component="scrape manager" scrape_pool=serviceMonitor/monitoring/kube-prometheus-stack-kube-state-metrics/0 target=http://10.42.xx.yy:8080/metrics msg="Duplicate sample for timestamp" series="kube_persistentvolumeclaim_access_mode{namespace=\"precious-rct\",persistentvolumeclaim=\"precious-1\",access_mode=\"ReadWriteOnce\"}"
ts=2024-05-22T11:52:17.487Z caller=scrape.go:1777 level=debug component="scrape manager" scrape_pool=serviceMonitor/monitoring/kube-prometheus-stack-kube-state-metrics/0 target=http://10.42.xx.yy:8080/metrics msg="Duplicate sample for timestamp" series="kube_persistentvolumeclaim_access_mode{namespace=\"precious-rcti\",persistentvolumeclaim=\"precious-1\",access_mode=\"ReadWriteOnce\"}"
ts=2024-05-22T11:52:17.487Z caller=scrape.go:1777 level=debug component="scrape manager" scrape_pool=serviceMonitor/monitoring/kube-prometheus-stack-kube-state-metrics/0 target=http://10.42.xx.yy:8080/metrics msg="Duplicate sample for timestamp" series="kube_persistentvolumeclaim_access_mode{namespace=\"precious-dev\",persistentvolumeclaim=\"precious-1\",access_mode=\"ReadWriteOnce\"}"
ts=2024-05-22T11:52:17.487Z caller=scrape.go:1777 level=debug component="scrape manager" scrape_pool=serviceMonitor/monitoring/kube-prometheus-stack-kube-state-metrics/0 target=http://10.42.xx.yy:8080/metrics msg="Duplicate sample for timestamp" series="kube_persistentvolumeclaim_access_mode{namespace=\"precious-pprod\",persistentvolumeclaim=\"precious-1-wal\",access_mode=\"ReadWriteOnce\"}"
ts=2024-05-22T11:52:17.487Z caller=scrape.go:1777 level=debug component="scrape manager" scrape_pool=serviceMonitor/monitoring/kube-prometheus-stack-kube-state-metrics/0 target=http://10.42.xx.yy:8080/metrics msg="Duplicate sample for timestamp" series="kube_persistentvolumeclaim_access_mode{namespace=\"precious-prod\",persistentvolumeclaim=\"precious-3-wal\",access_mode=\"ReadWriteOnce\"}"
ts=2024-05-22T11:52:17.487Z caller=scrape.go:1777 level=debug component="scrape manager" scrape_pool=serviceMonitor/monitoring/kube-prometheus-stack-kube-state-metrics/0 target=http://10.42.xx.yy:8080/metrics msg="Duplicate sample for timestamp" series="kube_persistentvolumeclaim_access_mode{namespace=\"precious-rcti\",persistentvolumeclaim=\"precious-1-wal\",access_mode=\"ReadWriteOnce\"}"
ts=2024-05-22T11:52:17.487Z caller=scrape.go:1777 level=debug component="scrape manager" scrape_pool=serviceMonitor/monitoring/kube-prometheus-stack-kube-state-metrics/0 target=http://10.42.xx.yy:8080/metrics msg="Duplicate sample for timestamp" series="kube_persistentvolumeclaim_access_mode{namespace=\"precious-rct\",persistentvolumeclaim=\"precious-1-wal\",access_mode=\"ReadWriteOnce\"}"
ts=2024-05-22T11:52:17.487Z caller=scrape.go:1777 level=debug component="scrape manager" scrape_pool=serviceMonitor/monitoring/kube-prometheus-stack-kube-state-metrics/0 target=http://10.42.xx.yy:8080/metrics msg="Duplicate sample for timestamp" series="kube_persistentvolumeclaim_access_mode{namespace=\"precious-prod\",persistentvolumeclaim=\"precious-1\",access_mode=\"ReadWriteOnce\"}"
ts=2024-05-22T11:52:17.487Z caller=scrape.go:1777 level=debug component="scrape manager" scrape_pool=serviceMonitor/monitoring/kube-prometheus-stack-kube-state-metrics/0 target=http://10.42.xx.yy:8080/metrics msg="Duplicate sample for timestamp" series="kube_persistentvolumeclaim_access_mode{namespace=\"precious-prod\",persistentvolumeclaim=\"precious-3\",access_mode=\"ReadWriteOnce\"}"

Problem is referenced here and here for example.

from cloudnative-pg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.