redhat-cop/namespace-configuration-operator

update 0.2.0 -> 0.2.3 limits or quotas always added

ichmachnixichgucknur opened this issue · 5 comments

Hi,
I am using the operator just to configure namespaces - resourcequotas and limitranges - running on kubernetes (no Openshift).

I am running 0.2.0 and it does a great job. Now I wanted to update to 0.2.3 and a problem. Every configuration is added, but not deleted/released. So if I change somthing, the new matching configuration just added to the namespace configuration. That's the case for resourcequotas as for limitranges. But there are no error messages in the log.

Looks like this:

Status:       Active

Resource Quotas

Name:     nsconfig-default
Resource  Used  Hard
--------  ---   ---
pods      0     50


Name:     nsconfig-large
Resource  Used  Hard
--------  ---   ---
pods      0     100

Name:     nsconfig-superlarge
Resource  Used  Hard
--------  ---   ---
pods      0     250

Resource Limits
Type       Resource           Min  Max     Default Request  Default Limit  Max Limit/Request Ratio
----       --------           ---  ---     ---------------  -------------  -----------------------
Pod        cpu                -    1       -                -              -
Pod        memory             -    1Gi     -                -              -
Container  ephemeral-storage  -    1500Mi  1250Mi           1250Mi         -
Pod        cpu                -    2       -                -              -
Pod        memory             -    2Gi     -                -              -
Container  ephemeral-storage  -    2Gi     1250Mi           1250Mi         -
Pod        cpu                -    14      -                -              -
Pod        memory             -    16Gi    -                -              -
Container  ephemeral-storage  -    27Gi    1250Mi           1250Mi         -```

Any idea?

Thx

@ichmachnixichgucknur could you provide us with the NamespaceConfig here so we can try to recreate? thanks!

@cnuland, sure.
Here is an example:

apiVersion: redhatcop.redhat.io/v1alpha1
kind: NamespaceConfig
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"redhatcop.redhat.io/v1alpha1","kind":"NamespaceConfig","metadata":{"annotations":{},"name":"nsconfig-…
  creationTimestamp: "2020-09-28T09:07:13Z"
  finalizers:
  - namespace-config-operator
  generation: 2
  name: nsconfig-default
  resourceVersion: "6653557"
  selfLink: /apis/redhatcop.redhat.io/v1alpha1/namespaceconfigs/nsconfig-default
  uid: de634d34-a72e-4703-8ca1-cd28cc6ecbca
spec:
  annotationSelector: {}
  labelSelector:
    matchExpressions:
    - key: meta.example.com/nsconfig-ns-profile
      operator: NotIn
      values:
      - large
      - superlarge
    - key: meta.example.com/namespace-name
      operator: Exists
  templates:
  - excludedPaths:
    - .metadata
    - .status
    - .spec.replicas
    objectTemplate: |
      apiVersion: v1
      kind: ResourceQuota
      metadata:
        name: nsconfig-default
        namespace: {{ .Name }}
      spec:
        hard:
          pods: "50"

Quick update on this, I was able to reproduce this issue on 0.2.3, but I also see the same issue in 0.2.2 when testing in OCP, specifically when dealing with NamespaceConfig. I only had a couple hours to investigate this last week, but will budget some more time later this week to investigate further (including testing in k8s) and look into a solution. Thank you for the patience!

Found the source of this issue, tracking PR in the operator-utils project
redhat-cop/operator-utils#39

gr8!
Thank you!