Coder Social home page Coder Social logo

Comments (4)

janisz avatar janisz commented on August 17, 2024

@gerodriguez-fan Thank you for reporting this. Could you please add an example yaml (you can use our test yaml`s as a base) just to make sure we are talking about same thing.

From the description the problem could be the replicas we are using. So we are comparing replicas not minReplicas in PDB.

replicas, _ := extract.Replicas(dl)
if isPercent {
// Calulate the actual value of the MinAvailable with respect to the Replica count if a percentage is set
pdbMinAvailable = int(math.Ceil(float64(replicas) * (float64(value) / float64(100))))
}
if replicas <= int32(pdbMinAvailable) {
results = append(results, diagnostic.Diagnostic{
Message: fmt.Sprintf("The current number of replicas for deployment %s is equal to or lower than the minimum number of replicas specified by its PDB.", dl.GetName()),

@gerodriguez-fan Would you like to work on this issue?

from kube-linter.

jpedrobf avatar jpedrobf commented on August 17, 2024

I'm having a similar issue even when I use a percentage value on minAvailable. My deployment spec doesn't have .spec.replicas declared as I use the HPA min/max parameters and any value I put on the pdb ends up with an error.

my pdb spec:

spec:
  minAvailable: 75%
  selector:
    matchLabels:
      app: example

my deployment spec (to show it doesn't have replicas):

spec:
  revisionHistoryLimit: 3
  progressDeadlineSeconds: 600
  strategy:
    rollingUpdate:
      maxSurge: 10%
      maxUnavailable: 0
    type: RollingUpdate
  selector:
    matchLabels:
      app: example
  template: [...]

What I've noticed:

  • This started to happen when I updated the pdb apiVersion from policy/v1beta1 to policy/v1.
  • If I force a .spec.replicas on my deployment, the minAvailable percentage needs to result in at least 1 available disruption (which makes sense). In this example, the minimal replicas to avoid the error is 4 (75% results in 3 disruptions, leaving 1 available disruption); The thing is, my hpa minReplicas is 60.

I'm using KubeLinter 0.6.4 both on Mac (local) and Linux (pipeline)

from kube-linter.

gerodriguez-fan avatar gerodriguez-fan commented on August 17, 2024

@gerodriguez-fan Thank you for reporting this. Could you please add an example yaml (you can use our test yaml`s as a base) just to make sure we are talking about same thing.

From the description the problem could be the replicas we are using. So we are comparing replicas not minReplicas in PDB.

replicas, _ := extract.Replicas(dl)
if isPercent {
// Calulate the actual value of the MinAvailable with respect to the Replica count if a percentage is set
pdbMinAvailable = int(math.Ceil(float64(replicas) * (float64(value) / float64(100))))
}
if replicas <= int32(pdbMinAvailable) {
results = append(results, diagnostic.Diagnostic{
Message: fmt.Sprintf("The current number of replicas for deployment %s is equal to or lower than the minimum number of replicas specified by its PDB.", dl.GetName()),

@gerodriguez-fan Would you like to work on this issue?

I can give it a try,

from kube-linter.

janisz avatar janisz commented on August 17, 2024

Closed with #688

from kube-linter.

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.