Skip to content

Error when using PDB with Sandbox #202

@barney-s

Description

@barney-s

Warning seen in pdb events:

Warning  CalculateExpectedPodCountFailed  19s (x6 over 15m)  controllermanager  
Failed to calculate the number of expected pods: 
Internal error occurred: the spec replicas field ".spec.replicas" does not exist

Reason:
Sandbox implements scale .spec.replicas as an int pointer.
when it is not specified, the controller defaults locally to 1.
It does not set the value 1 in the resource.

Then when PDB tries to use scale subresource Get() https://github.com/kubernetes/kubernetes/blob/2711e8cb53987ad7aca9eee21e1be3a4961fea39/pkg/controller/disruption/disruption.go#L387

Scale get reads fails at read from etcd/crd: https://github.com/kubernetes/kubernetes/blob/2711e8cb53987ad7aca9eee21e1be3a4961fea39/staging/src/k8s.io/apiextensions-apiserver/pkg/registry/customresource/etcd.go#L183

scale subresource get fails when replica is not specified.

Options to fix:

  1. make .spec.replicas an int instead of *int (how does defaulting to 1 work in this case ?)
  2. default in controller and write back to the sandbox object (breaks controller mutating spec principle)

Related PR #85

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions