Update of application are not applied

Step to reproduce

  • Create an application
  • update the number of pods
  • Number of pods remains the same on the k8s cluster

Logs

Kubernetes controller in DEBUG show this logs at the moment of an update:

2020-02-12 14:25:52,178 - [krake.controller] - [DEBUG] - Received WatchEvent(type=<WatchEventType.MODIFIED: 2>, object=<kubernetes.Application namespace='system:admin' name='echo-demo' uid='af6ee840-61c2-4e98-96f8-af0ccc9a1bfd'>)
2020-02-12 14:25:52,179 - [krake.controller.kubernetes_application.kubernetes_application] - [DEBUG] - Reject <kubernetes.Application namespace='system:admin' name='echo-demo' uid='af6ee840-61c2-4e98-96f8-af0ccc9a1bfd'>
2020-02-12 14:25:52,180 - [krake.controller] - [DEBUG] - Resource rejected: <kubernetes.Application namespace='system:admin' name='echo-demo' uid='af6ee840-61c2-4e98-96f8-af0ccc9a1bfd'>

Application details after firing the update: the status and spec are different

api: kubernetes
kind: Application
metadata:
  created: '2020-02-12T14:32:25.756140'
  deleted: null
  finalizers:
  - kubernetes_resources_deletion
  labels: {}
  modified: '2020-02-12T14:32:28.869802'
  name: echo-demo
  namespace: system:admin
  owners:
  - api: kubernetes
    kind: Cluster
    name: minikube-cluster-test322-1
    namespace: system:admin
  uid: bd8b7c71-b259-4f71-9226-cd90d81a0ea2
spec:
  constraints:
    cluster:
      custom_resources: []
      labels: []
  hooks: []
  manifest:
  - apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: echo-demo
    spec:
      replicas: 2
      selector:
        matchLabels:
          app: echo
      template:
        metadata:
          labels:
            app: echo
        spec:
          containers:
          - image: k8s.gcr.io/echoserver:1.10
            name: echo
            ports:
            - containerPort: 8080
  - apiVersion: v1
    kind: Service
    metadata:
      name: echo-demo
    spec:
      ports:
      - port: 8080
        protocol: TCP
        targetPort: 8080
      selector:
        app: echo
      type: NodePort
status:
  mangling:
  - apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: echo-demo
    spec:
      selector:
        matchLabels:
          app: echo
      template:
        metadata:
          labels:
            app: echo
        spec:
          containers:
          - image: k8s.gcr.io/echoserver:1.10
            name: echo
            ports:
            - containerPort: 8080
  - apiVersion: v1
    kind: Service
    metadata:
      name: echo-demo
    spec:
      ports:
      - port: 8080
        protocol: TCP
        targetPort: 8080
      selector:
        app: echo
      type: NodePort
  manifest:
  - apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: echo-demo
    spec:
      selector:
        matchLabels:
          app: echo
      template:
        metadata:
          labels:
            app: echo
        spec:
          containers:
          - image: k8s.gcr.io/echoserver:1.10
            name: echo
            ports:
            - containerPort: 8080
  - apiVersion: v1
    kind: Service
    metadata:
      name: echo-demo
    spec:
      ports:
      - port: 8080
        protocol: TCP
        targetPort: 8080
      selector:
        app: echo
      type: NodePort
  reason: null
  running_on:
    api: kubernetes
    kind: Cluster
    name: minikube-cluster-test322-1
    namespace: system:admin
  scheduled: '2020-02-12T14:32:26.885258'
  scheduled_to:
    api: kubernetes
    kind: Cluster
    name: minikube-cluster-test322-1
    namespace: system:admin
  services:
    echo-demo: 192.168.0.7:30528
  state: RUNNING
  token: null

Modifications to add:

  • Solve the issue
  • Create (or update) an integration test for the update action, see issue #334.
Edited by Jean Chorin