kubernetes-client / python

Official Python client library for kubernetes
http://kubernetes.io/
Apache License 2.0
6.69k stars 3.25k forks source link

every deployment item resource's api_version and kind are all null in the list_namespaced_deployment return data #1617

Open dashanhust opened 2 years ago

dashanhust commented 2 years ago

What happened (please include outputs or screenshots): every deployment item resource's api_version and kind are all null in the list_namespaced_deployment return data. image

What you expected to happen: every deployment item resources's api_version is extensions/v1beta1, and the kind is Deployment.

How to reproduce it (as minimally and precisely as possible):

cluster_id = request.GET.get('cluster_id')
k8s_namespace = request.GET.get('namespace')

configuration = client.Configuration()
configuration.host = f"https://api.xx.com/clusters/{cluster_id}"
configuration.verify_ssl=False
configuration.debug = False
configuration.api_key = {"authorization":"Bearer " + K8S_ACCESS_TOKEN}
client.Configuration.set_default(configuration)

v1 = client.AppsV1Api()
res = v1.list_namespaced_deployment(k8s_namespace)
res_dict = res.to_dict()
return JsonResponse({
    "result": True,
    "code": 0,
    "data": res_dict,
    "message": "success."
})

Anything else we need to know?:

Environment:

roycaihw commented 2 years ago

I think this is a server-side behavior. kube-apiserver probably wrote the kind for the entire list as DeploymentList and omitted the apiVersion and kind for each item. Could you confirm if you get the same result with kubectl get deployments -ojson? This is likely a feature request to the main Kubernetes repo, not a python client issue.

k8s-triage-robot commented 2 years ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

motey commented 2 years ago

@roycaihw

I think this is a server-side behavior. kube-apiserver probably wrote the kind for the entire list as DeploymentList and omitted the apiVersion and kind for each item. Could you confirm if you get the same result with kubectl get deployments -ojson? This is likely a feature request to the main Kubernetes repo, not a python client issue.

Nope, i dont think this is the case

import subprocess
import json
from kubernetes import config
from kubernetes.client import Configuration
from kubernetes.client.api import apps_v1_api

def get_kind_of_first_deployment_via_python_lib():
    config.load_kube_config()
    api = apps_v1_api.AppsV1Api()
    return api.list_deployment_for_all_namespaces().items[0].kind

def get_kind_of_first_deployment_via_kubectl():
    proc = subprocess.Popen(
        ["/bin/sh", "-c", "kubectl get deployments -ojson --all-namespaces"],
        stdout=subprocess.PIPE,
    )
    stdout = b""

    with proc.stdout:
        for line in iter(proc.stdout.readline, b""):
            stdout += line

    exitcode = proc.wait()
    return json.loads(stdout.decode("utf-8"))["items"][0]["kind"]

print("'kind' via python: ", get_kind_of_first_deployment_via_python_lib())
print("'kind' via kubectl: ", get_kind_of_first_deployment_via_kubectl())

Output (for me) is:

'kind' via python:  None
'kind' via kubectl:  Deployment
motey commented 2 years ago

@roycaihw Can we label this as a bug?

roycaihw commented 2 years ago

@motey You're right. Thanks for verifying the behavior!

I wonder if we can check the HTTP requests and responses to tell what caused the difference.

motey commented 2 years ago

@roycaihw Sure no problem

import subprocess
import json
import logging
from kubernetes import config, client
from kubernetes.client.api import apps_v1_api

logging.basicConfig(
    format="[%(levelname)s] %(message)s",
    handlers=[logging.StreamHandler()],
    level="DEBUG",
)
log: logging.Logger = logging.getLogger("databasebackupper")

def get_kind_of_first_deployment_via_python_lib():

    config.load_kube_config()
    c = client.Configuration.get_default_copy()

    c.debug = True
    c.verify_ssl = False
    api = apps_v1_api.AppsV1Api(api_client=client.ApiClient(configuration=c))
    return api.list_deployment_for_all_namespaces().items[0].kind

def get_kind_of_first_deployment_via_kubectl():
    proc = subprocess.Popen(
        ["/bin/sh", "-c", "kubectl -v=9 get deployments -ojson --all-namespaces"],
        stdout=subprocess.PIPE,
    )
    stdout = b""

    with proc.stdout:
        for line in iter(proc.stdout.readline, b""):
            if line:
                print(line.decode("utf-8").strip())
            stdout += line

    exitcode = proc.wait()
    return json.loads(stdout.decode("utf-8"))["items"][0]["kind"]

print("'kind' via python: ", get_kind_of_first_deployment_via_python_lib())
print("'kind' via kubectl: ", get_kind_of_first_deployment_via_kubectl())

output of get_kind_of_first_deployment_via_python_lib()

[DEBUG] Starting new HTTPS connection (1): localhost:443
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:1015: InsecureRequestWarning: Unverified HTTPS request is being made to host 'localhost'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  warnings.warn(
send: b'GET /k8s/clusters/local/apis/apps/v1/deployments HTTP/1.1\r\nHost: localhost\r\nAccept-Encoding: identity\r\nAccept: application/json\r\nUser-Agent: OpenAPI-Generator/22.6.0/python\r\nauthorization: Bearer kubeconfig-user-dxcgqj4hkp:95cgnxhj57h5xxkzrcjdhn2qrz545p98xdwm5v2vnqr8g6grd7fbj4\r\nContent-Type: application/json\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Cache-Control: no-cache, private
header: Content-Type: application/json
header: Date: Tue, 22 Mar 2022 15:28:31 GMT
header: X-Api-Cattle-Auth: true
header: X-Content-Type-Options: nosniff
header: X-Kubernetes-Pf-Flowschema-Uid: 2f5554e0-3479-4442-85d2-b4a840f7db01
header: X-Kubernetes-Pf-Prioritylevel-Uid: e45a1dcc-3369-4662-9516-1f6f4f91264d
header: Transfer-Encoding: chunked
[DEBUG] https://localhost:443 "GET /k8s/clusters/local/apis/apps/v1/deployments HTTP/1.1" 200 None
[DEBUG] response body: {"kind":"DeploymentList","apiVersion":"apps/v1","metadata":{"resourceVersion":"1125879"},"items":[{"metadata":{"name":"fleet-agent","namespace":"cattle-fleet-local-system","uid":"28768fcc-2e82-4fa4-a4bf-14a9160f1690","resourceVersion":"3190","generation":2,"creationTimestamp":"2022-03-18T09:30:49Z","labels":{"app.kubernetes.io/managed-by":"Helm","objectset.rio.cattle.io/hash":"362023f752e7f1989d8b652e029bd2c658ae7c44"},"annotations":{"deployment.kubernetes.io/revision":"2","meta.helm.sh/release-name":"fleet-agent-local","meta.helm.sh/release-namespace":"cattle-fleet-local-system","objectset.rio.cattle.io/applied":"H4sIAAAAAAAA/4RUy47jNhD8lz5LGlt+62Z4lY2RjdaYMfayMBYtqmUzQ5EK2XLGMfTvAf3QaPJwTuKjq7pZVdAZsJbfyDppNCSAde2ejkMI4FXqAhL4RLUyp4o0QwAVMRbICMkZUGvDyNJo57cm/40EO+LIShMJZFYUSfMkPUmpiDjEPWkOc2PYscU6vBaF10tlBKrQnRxTBW0ACnNSD5kP6A6QwGgaD+JROZvENCuHi/mimOfTSUyDeJEXsZhO5kgzMR57Uo0VfRwHroeuRuFvHo7kahJ+IEeKBBvr1xWyOHzpZsW6/ht/64FskWl/guTcBsBU1QqZLvCeoMLSRc6trMgxVjUkulGqL8V/0N/mwrKUWrJvA9oUtOzta0slWUvFp8ZKvX8RByoaJfV+vdemO07fSDR8ScL3O4a0oO6l6Vttybmr6d/P8Eqn+0A9Z+7KmposXoSCtYYAjqga8kBg2xDs2l0bwB8k9weGZNju/GOE0YxSk702IH28fG/OZctf05fNcpXe2X6ypvLTlZJU8Uxlt94g+3TcBY7eXW7bNugIl5/TbPvjZfV101H+Tww66OrndPXLOvuxzrbp87fllx5+4PqFn9MsfV5u11+zfkm+mMbDAYViLopwXMQULhaIoRiKwXw4G0/KfBTG0O4CkBXuPcSiFgeyTz3/k+MgGkVzuBVtGqU2RknhXVmXmeGNJfce839k35IzjRXelHPrezmyRyloKYRpNGf/hmGjvK1dBqgsSbA3x9xiRf73cUmGj2EklGmK2pqjLMhGr01OVhOT81FptI+oRCX/pOJjZNLfG1Q9xS6Z8bI+avgeQuMe0ympmzfwoWvbvwIAAP//ivSGiwUFAAA","objectset.rio.cattle.io/id":"fleet-agent-bootstrap-cattle-fleet-local-system"},"managedFields":[{"manager":"fleetcontroller","operation":"Update","apiVersion":"apps/v1","time":"2022-03-18T09:30:49Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{".":{},"f:objectset.rio.cattle.io/applied":{},"f:objectset.rio.cattle.io/id":{}},"f:labels":{".":{},"f:objectset.rio.cattle.io/hash":{}}},"f:spec":{"f:progressDeadlineSeconds":{},"f:replicas":{},"f:revisionHistoryLimit":{},"f:selector":{},"f:strategy":{"f:rollingUpdate":{".":{},"f:maxSurge":{},"f:maxUnavailable":{}},"f:type":{}},"f:template":{"f:metadata":{"f:labels":{".":{},"f:app":{}}},"f:spec":{"f:affinity":{".":{},"f:nodeAffinity":{".":{},"f:preferredDuringSchedulingIgnoredDuringExecution":{}}},"f:containers":{"k:{\"name\":\"fleet-agent\"}":{".":{},"f:env":{".":{},"k:{\"name\":\"AGENT_SCOPE\"}":{".":{},"f:name":{},"f:value":{}},"k:{\"name\":\"CHECKIN_INTERVAL\"}":{".":{},"f:name":{},"f:value":{}},"k:{\"name\":\"GENERATION\"}":{".":{},"f:name":{}},"k:{\"name\":\"NAMESPACE\"}":{".":{},"f:name":{},"f:valueFrom":{".":{},"f:fieldRef":{".":{},"f:apiVersion":{},"f:fieldPath":{}}}}},"f:image":{},"f:imagePullPolicy":{},"f:name":{},"f:resources":{},"f:terminationMessagePath":{},"f:terminationMessagePolicy":{}}},"f:dnsPolicy":{},"f:restartPolicy":{},"f:schedulerName":{},"f:securityContext":{},"f:serviceAccount":{},"f:serviceAccountName":{},"f:terminationGracePeriodSeconds":{},"f:tolerations":{}}}}}},{"manager":"fleetagent","operation":"Update","apiVersion":"apps/v1","time":"2022-03-18T09:31:00Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{"f:meta.helm.sh/release-name":{},"f:meta.helm.sh/release-namespace":{}},"f:labels":{"f:app.kubernetes.io/managed-by":{}}},"f:spec":{"f:template":{"f:spec":{"f:containers":{"k:{\"name\":\"fleet-agent\"}":{"f:env":{"k:{\"name\":\"GENERATION\"}":{"f:value":{}}}}}}}}}},{"manager":"k3s","operation":"Update","apiVersion":"apps/v1","time":"2022-03-18T09:31:02Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{"f:deployment.kubernetes.io/revision":{}}},"f:status":{"f:availableReplicas":{},"f:conditions":{".":{},"k:{\"type\":\"Available\"}":{".":{},"f:lastTransitionTime":{},"f:lastUpdateTime":{},"f:message":{},"f:reason":{},"f:status":{},"f:type":{}},"k:{\"type\":\"Progressing\"}":{".":{},"f:lastTransitionTime":{},"f:lastUpdateTime":{},"f:message":{},"f:reason":{},"f:status":{},"f:type":{}}},"f:observedGeneration":{},"f:readyReplicas":{},"f:replicas":{},"f:updatedReplicas":{}}}}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app":"fleet-agent"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app":"fleet-agent"}},"spec":{"containers":[{"name":"fleet-agent","image":"rancher/fleet-agent:v0.3.8","env":[{"name":"NAMESPACE","valueFrom":{"fieldRef":{"apiVersion":"v1","fieldPath":"metadata.namespace"}}},{"name":"AGENT_SCOPE","value":"cattle-fleet-local-system"},{"name":"CHECKIN_INTERVAL","value":"0s"},{"name":"GENERATION","value":"bundle"}],"resources":{},"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"IfNotPresent"}],"restartPolicy":"Always","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","serviceAccountName":"fleet-agent","serviceAccount":"fleet-agent","securityContext":{},"affinity":{"nodeAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":1,"preference":{"matchExpressions":[{"key":"fleet.cattle.io/agent","operator":"In","values":["true"]}]}}]}},"schedulerName":"default-scheduler","tolerations":[{"key":"node.cloudprovider.kubernetes.io/uninitialized","operator":"Equal","value":"true","effect":"NoSchedule"},{"key":"cattle.io/os","operator":"Equal","value":"linux","effect":"NoSchedule"}]}},"strategy":{"type":"RollingUpdate","rollingUpdate":{"maxUnavailable":"25%","maxSurge":"25%"}},"revisionHistoryLimit":10,"progressDeadlineSeconds":600},"status":{"observedGeneration":2,"replicas":1,"updatedReplicas":1,"readyReplicas":1,"availableReplicas":1,"conditions":[{"type":"Available","status":"True","lastUpdateTime":"2022-03-18T09:30:59Z","lastTransitionTime":"2022-03-18T09:30:59Z","reason":"MinimumReplicasAvailable","message":"Deployment has minimum availability."},{"type":"Progressing","status":"True","lastUpdateTime":"2022-03-18T09:31:02Z","lastTransitionTime":"2022-03-18T09:30:49Z","reason":"NewReplicaSetAvailable","message":"ReplicaSet \"fleet-agent-78f694664b\" has successfully progressed."}]}},{"metadata":{"name":"fleet-controller","namespace":"cattle-fleet-system","uid":"58be9f6e-ebb8-4f3d-90a5-25260c6efd73","resourceVersion":"2720","generation":1,"creationTimestamp":"2022-03-18T09:30:29Z","labels":{"app.kubernetes.io/managed-by":"Helm"},"annotations":{"deployment.kubernetes.io/revision":"1","meta.helm.sh/release-name":"fleet","meta.helm.sh/release-namespace":"cattle-fleet-system"},"managedFields":[{"manager":"helm","operation":"Update","apiVersion":"apps/v1","time":"2022-03-18T09:30:29Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{".":{},"f:meta.helm.sh/release-name":{},"f:meta.helm.sh/release-namespace":{}},"f:labels":{".":{},"f:app.kubernetes.io/managed-by":{}}},"f:spec":{"f:progressDeadlineSeconds":{},"f:replicas":{},"f:revisionHistoryLimit":{},"f:selector":{},"f:strategy":{"f:rollingUpdate":{".":{},"f:maxSurge":{},"f:maxUnavailable":{}},"f:type":{}},"f:template":{"f:metadata":{"f:labels":{".":{},"f:app":{}}},"f:spec":{"f:containers":{"k:{\"name\":\"fleet-controller\"}":{".":{},"f:command":{},"f:env":{".":{},"k:{\"name\":\"NAMESPACE\"}":{".":{},"f:name":{},"f:valueFrom":{".":{},"f:fieldRef":{".":{},"f:apiVersion":{},"f:fieldPath":{}}}}},"f:image":{},"f:imagePullPolicy":{},"f:name":{},"f:resources":{},"f:terminationMessagePath":{},"f:terminationMessagePolicy":{}}},"f:dnsPolicy":{},"f:nodeSelector":{".":{},"f:kubernetes.io/os":{}},"f:restartPolicy":{},"f:schedulerName":{},"f:securityContext":{},"f:serviceAccount":{},"f:serviceAccountName":{},"f:terminationGracePeriodSeconds":{},"f:tolerations":{}}}}}},{"manager":"k3s","operation":"Update","apiVersion":"apps/v1","time":"2022-03-18T09:30:39Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{"f:deployment.kubernetes.io/revision":{}}},"f:status":{"f:availableReplicas":{},"f:conditions":{".":{},"k:{\"type\":\"Available\"}":{".":{},"f:lastTransitionTime":{},"f:lastUpdateTime":{},"f:message":{},"f:reason":{},"f:status":{},"f:type":{}},"k:{\"type\":\"Progressing\"}":{".":{},"f:lastTransitionTime":{},"f:lastUpdateTime":{},"f:message":{},"f:reason":{},"f:status":{},"f:type":{}}},"f:observedGeneration":{},"f:readyReplicas":{},"f:replicas":{},"f:updatedReplicas":{}}}}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app":"fleet-controller"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app":"fleet-controller"}},"spec":{"containers":[{"name":"fleet-controller","image":"rancher/fleet:v0.3.8","command":["fleetcontroller"],"env":[{"name":"NAMESPACE","valueFrom":{"fieldRef":{"apiVersion":"v1","fieldPath":"metadata.namespace"}}}],"resources":{},"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"IfNotPresent"}],"restartPolicy":"Always","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","nodeSelector":{"kubernetes.io/os":"linux"},"serviceAccountName":"fleet-controller","serviceAccount":"fleet-controller","securityContext":{},"schedulerName":"default-scheduler","tolerations":[{"key":"cattle.io/os","operator":"Equal","value":"linux","effect":"NoSchedule"}]}},"strategy":{"type":"RollingUpdate","rollingUpdate":{"maxUnavailable":"25%","maxSurge":"25%"}},"revisionHistoryLimit":10,"progressDeadlineSeconds":600},"status":{"observedGeneration":1,"replicas":1,"updatedReplicas":1,"readyReplicas":1,"availableReplicas":1,"conditions":[{"type":"Available","status":"True","lastUpdateTime":"2022-03-18T09:30:39Z","lastTransitionTime":"2022-03-18T09:30:39Z","reason":"MinimumReplicasAvailable","message":"Deployment has minimum availability."},{"type":"Progressing","status":"True","lastUpdateTime":"2022-03-18T09:30:39Z","lastTransitionTime":"2022-03-18T09:30:29Z","reason":"NewReplicaSetAvailable","message":"ReplicaSet \"fleet-controller-6666887949\" has successfully progressed."}]}},{"metadata":{"name":"gitjob","namespace":"cattle-fleet-system","uid":"3621c252-e140-4636-90a9-8bcd3ea3dc64","resourceVersion":"2732","generation":1,"creationTimestamp":"2022-03-18T09:30:29Z","labels":{"app.kubernetes.io/managed-by":"Helm"},"annotations":{"deployment.kubernetes.io/revision":"1","meta.helm.sh/release-name":"fleet","meta.helm.sh/release-namespace":"cattle-fleet-system"},"managedFields":[{"manager":"helm","operation":"Update","apiVersion":"apps/v1","time":"2022-03-18T09:30:29Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{".":{},"f:meta.helm.sh/release-name":{},"f:meta.helm.sh/release-namespace":{}},"f:labels":{".":{},"f:app.kubernetes.io/managed-by":{}}},"f:spec":{"f:progressDeadlineSeconds":{},"f:replicas":{},"f:revisionHistoryLimit":{},"f:selector":{},"f:strategy":{"f:rollingUpdate":{".":{},"f:maxSurge":{},"f:maxUnavailable":{}},"f:type":{}},"f:template":{"f:metadata":{"f:labels":{".":{},"f:app":{}}},"f:spec":{"f:containers":{"k:{\"name\":\"gitjob\"}":{".":{},"f:command":{},"f:env":{".":{},"k:{\"name\":\"NAMESPACE\"}":{".":{},"f:name":{},"f:valueFrom":{".":{},"f:fieldRef":{".":{},"f:apiVersion":{},"f:fieldPath":{}}}}},"f:image":{},"f:imagePullPolicy":{},"f:name":{},"f:resources":{},"f:terminationMessagePath":{},"f:terminationMessagePolicy":{}}},"f:dnsPolicy":{},"f:nodeSelector":{".":{},"f:kubernetes.io/os":{}},"f:restartPolicy":{},"f:schedulerName":{},"f:securityContext":{},"f:serviceAccount":{},"f:serviceAccountName":{},"f:terminationGracePeriodSeconds":{},"f:tolerations":{}}}}}},{"manager":"k3s","operation":"Update","apiVersion":"apps/v1","time":"2022-03-18T09:30:40Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{"f:deployment.kubernetes.io/revision":{}}},"f:status":{"f:availableReplicas":{},"f:conditions":{".":{},"k:{\"type\":\"Available\"}":{".":{},"f:lastTransitionTime":{},"f:lastUpdateTime":{},"f:message":{},"f:reason":{},"f:status":{},"f:type":{}},"k:{\"type\":\"Progressing\"}":{".":{},"f:lastTransitionTime":{},"f:lastUpdateTime":{},"f:message":{},"f:reason":{},"f:status":{},"f:type":{}}},"f:observedGeneration":{},"f:readyReplicas":{},"f:replicas":{},"f:updatedReplicas":{}}}}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app":"gitjob"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app":"gitjob"}},"spec":{"containers":[{"name":"gitjob","image":"rancher/gitjob:v0.1.23","command":["gitjob","--tekton-image","rancher/tekton-utils:v0.1.3"],"env":[{"name":"NAMESPACE","valueFrom":{"fieldRef":{"apiVersion":"v1","fieldPath":"metadata.namespace"}}}],"resources":{},"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"IfNotPresent"}],"restartPolicy":"Always","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","nodeSelector":{"kubernetes.io/os":"linux"},"serviceAccountName":"gitjob","serviceAccount":"gitjob","securityContext":{},"schedulerName":"default-scheduler","tolerations":[{"key":"cattle.io/os","operator":"Equal","value":"linux","effect":"NoSchedule"}]}},"strategy":{"type":"RollingUpdate","rollingUpdate":{"maxUnavailable":"25%","maxSurge":"25%"}},"revisionHistoryLimit":10,"progressDeadlineSeconds":600},"status":{"observedGeneration":1,"replicas":1,"updatedReplicas":1,"readyReplicas":1,"availableReplicas":1,"conditions":[{"type":"Available","status":"True","lastUpdateTime":"2022-03-18T09:30:40Z","lastTransitionTime":"2022-03-18T09:30:40Z","reason":"MinimumReplicasAvailable","message":"Deployment has minimum availability."},{"type":"Progressing","status":"True","lastUpdateTime":"2022-03-18T09:30:40Z","lastTransitionTime":"2022-03-18T09:30:29Z","reason":"NewReplicaSetAvailable","message":"ReplicaSet \"gitjob-7b97c9c7fd\" has successfully progressed."}]}},{"metadata":{"name":"rancher-webhook","namespace":"cattle-system","uid":"11715ea9-fa5a-4ef6-8e78-cd9ec9db421e","resourceVersion":"3129","generation":1,"creationTimestamp":"2022-03-18T09:30:52Z","labels":{"app.kubernetes.io/managed-by":"Helm"},"annotations":{"deployment.kubernetes.io/revision":"1","meta.helm.sh/release-name":"rancher-webhook","meta.helm.sh/release-namespace":"cattle-system"},"managedFields":[{"manager":"helm","operation":"Update","apiVersion":"apps/v1","time":"2022-03-18T09:30:52Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{".":{},"f:meta.helm.sh/release-name":{},"f:meta.helm.sh/release-namespace":{}},"f:labels":{".":{},"f:app.kubernetes.io/managed-by":{}}},"f:spec":{"f:progressDeadlineSeconds":{},"f:replicas":{},"f:revisionHistoryLimit":{},"f:selector":{},"f:strategy":{"f:rollingUpdate":{".":{},"f:maxSurge":{},"f:maxUnavailable":{}},"f:type":{}},"f:template":{"f:metadata":{"f:labels":{".":{},"f:app":{}}},"f:spec":{"f:containers":{"k:{\"name\":\"rancher-webhook\"}":{".":{},"f:env":{".":{},"k:{\"name\":\"ENABLE_CAPI\"}":{".":{},"f:name":{},"f:value":{}},"k:{\"name\":\"ENABLE_MCM\"}":{".":{},"f:name":{},"f:value":{}},"k:{\"name\":\"NAMESPACE\"}":{".":{},"f:name":{},"f:valueFrom":{".":{},"f:fieldRef":{".":{},"f:apiVersion":{},"f:fieldPath":{}}}},"k:{\"name\":\"STAMP\"}":{".":{},"f:name":{}}},"f:image":{},"f:imagePullPolicy":{},"f:name":{},"f:ports":{".":{},"k:{\"containerPort\":8777,\"protocol\":\"TCP\"}":{".":{},"f:containerPort":{},"f:name":{},"f:protocol":{}},"k:{\"containerPort\":9443,\"protocol\":\"TCP\"}":{".":{},"f:containerPort":{},"f:name":{},"f:protocol":{}}},"f:resources":{},"f:terminationMessagePath":{},"f:terminationMessagePolicy":{},"f:volumeMounts":{".":{},"k:{\"mountPath\":\"/tmp/k8s-webhook-server/serving-certs\"}":{".":{},"f:mountPath":{},"f:name":{}}}}},"f:dnsPolicy":{},"f:restartPolicy":{},"f:schedulerName":{},"f:securityContext":{},"f:serviceAccount":{},"f:serviceAccountName":{},"f:terminationGracePeriodSeconds":{},"f:volumes":{".":{},"k:{\"name\":\"tls\"}":{".":{},"f:name":{},"f:secret":{".":{},"f:defaultMode":{},"f:secretName":{}}}}}}}}},{"manager":"k3s","operation":"Update","apiVersion":"apps/v1","time":"2022-03-18T09:31:00Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{"f:deployment.kubernetes.io/revision":{}}},"f:status":{"f:availableReplicas":{},"f:conditions":{".":{},"k:{\"type\":\"Available\"}":{".":{},"f:lastTransitionTime":{},"f:lastUpdateTime":{},"f:message":{},"f:reason":{},"f:status":{},"f:type":{}},"k:{\"type\":\"Progressing\"}":{".":{},"f:lastTransitionTime":{},"f:lastUpdateTime":{},"f:message":{},"f:reason":{},"f:status":{},"f:type":{}}},"f:observedGeneration":{},"f:readyReplicas":{},"f:replicas":{},"f:updatedReplicas":{}}}}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app":"rancher-webhook"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app":"rancher-webhook"}},"spec":{"volumes":[{"name":"tls","secret":{"secretName":"rancher-webhook-tls","defaultMode":420}}],"containers":[{"name":"rancher-webhook","image":"rancher/rancher-webhook:v0.2.2","ports":[{"name":"https","containerPort":9443,"protocol":"TCP"},{"name":"capi-https","containerPort":8777,"protocol":"TCP"}],"env":[{"name":"STAMP"},{"name":"ENABLE_CAPI","value":"true"},{"name":"ENABLE_MCM","value":"true"},{"name":"NAMESPACE","valueFrom":{"fieldRef":{"apiVersion":"v1","fieldPath":"metadata.namespace"}}}],"resources":{},"volumeMounts":[{"name":"tls","mountPath":"/tmp/k8s-webhook-server/serving-certs"}],"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"IfNotPresent"}],"restartPolicy":"Always","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","serviceAccountName":"rancher-webhook","serviceAccount":"rancher-webhook","securityContext":{},"schedulerName":"default-scheduler"}},"strategy":{"type":"RollingUpdate","rollingUpdate":{"maxUnavailable":"25%","maxSurge":"25%"}},"revisionHistoryLimit":10,"progressDeadlineSeconds":600},"status":{"observedGeneration":1,"replicas":1,"updatedReplicas":1,"readyReplicas":1,"availableReplicas":1,"conditions":[{"type":"Available","status":"True","lastUpdateTime":"2022-03-18T09:31:00Z","lastTransitionTime":"2022-03-18T09:31:00Z","reason":"MinimumReplicasAvailable","message":"Deployment has minimum availability."},{"type":"Progressing","status":"True","lastUpdateTime":"2022-03-18T09:31:00Z","lastTransitionTime":"2022-03-18T09:30:52Z","reason":"NewReplicaSetAvailable","message":"ReplicaSet \"rancher-webhook-5d4f5b7f6d\" has successfully progressed."}]}},{"metadata":{"name":"coredns","namespace":"kube-system","uid":"767f040b-b37b-43b1-b7e4-f4612714cea7","resourceVersion":"854","generation":1,"creationTimestamp":"2022-03-18T09:29:56Z","labels":{"k8s-app":"kube-dns","kubernetes.io/name":"CoreDNS","objectset.rio.cattle.io/hash":"bce283298811743a0386ab510f2f67ef74240c57"},"annotations":{"deployment.kubernetes.io/revision":"1","objectset.rio.cattle.io/applied":"H4sIAAAAAAAA/6xV32/bNhD+V4Z7ln8obhNXwB66OFuDLZ6RH30pjOJMnSzOFI8jKTdGoP99OEl2nDRNu2FPpsnvjt/38e70AOj0R/JBs4UM0Lkw2qaQwEbbHDKYkTO8q8hGSKCiiDlGhOwB0FqOGDXbIH959RepGCgOveahwhgNDTWPtCSB5Jvn/MWSH6y3G8hgMwlHJ9s0+el3bfOf3+c52++msFgRZKDYU27DD8GDQyUxm3pFg7ALkSpoEjC4ItOK2kzDAJ3bQ7q8svSWIgXJ1l97zp5m85tXri0xlJDBStHJdHLybjpN07M3ExxPpqe4epuOi5Pi9IyKszcnb8bq7ZkQ+UrSK6SDIyWUAxlSkb2sK4yq/OM1NY1ERo+R1juBeDZG2/WdyzFSl+L+zuIWtcGVIcjSJoG4c0Lg+glW9qlyZh93VCmv+tkccVdsI2pLPkD26QHQr2UBA8W2gARGFNWoN2MkhhfaECwT0BWuhZFHq0rye8yg/83S4XQ4gR63qI1ZsNFqBxlcFnOOC0+hq2+jt2QphIXnVSujQG1qT7elp1CyySGbJFDG6H6jKOcOozzqqCQ0sYQEHPsI2XQ8HScQVEntA364vV2IQdrqqNHMyODuhhTbPEB2Ok7AkdecH7ZSCa6VohCObk4TiLoiruMj8KUiEQqdgQc/Fy2rt5MDukd6jqzYQAZ3M2H4nZBBVO5p2O35i2Hv0qPAiqLXKrwQuEzAE+b6P1kukbtHx9Np+qOOf234yb/w21Pg2itqC9roSsfQFXzFXkoqPRtfaWiBf9cUulPlajkaj6t2ivbQDikNQKr2Ou7O2Ua6b2WiMfxl4fVWG1rTRVBo2mELWYEmUAIKHa600VF3VDDPpVnmF7eff7mczz7fXFx/vDy/kP7IPTs5Q2Ng2XSm/2nN7po5/qoN9VMki76mJoEtm7qiK65tX0eVLBe970dNCEfVZwu9HnSR8HhDn3MpT53bcOi7GRVYG2k5yzndHM2sFUUcPh2xHCADo219L7Y6r7n1ymAI8+76TsBAmTpE8gPlddQKDYizfqsVvVdKNMyf90pkQ37/Efv0ABsSdud9fPvhCa2OBNgJUkjCxb2Wd5XCp6IgFSGDOd+okvLaiPwujUgbeDb0TI80i2czcAYt/a+ZKxT9L6dc7h/2MBsKvb5CJ6brSNUTA/bDNdm322FHqHWgOef0gSX3AfW4Jdc9m0zNN6qlWTZN0/wTAAD//9NEnByICAAA","objectset.rio.cattle.io/id":"","objectset.rio.cattle.io/owner-gvk":"k3s.cattle.io/v1, Kind=Addon","objectset.rio.cattle.io/owner-name":"coredns","objectset.rio.cattle.io/owner-namespace":"kube-system"},"managedFields":[{"manager":"deploy@local-node","operation":"Update","apiVersion":"apps/v1","time":"2022-03-18T09:29:56Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{".":{},"f:objectset.rio.cattle.io/applied":{},"f:objectset.rio.cattle.io/id":{},"f:objectset.rio.cattle.io/owner-gvk":{},"f:objectset.rio.cattle.io/owner-name":{},"f:objectset.rio.cattle.io/owner-namespace":{}},"f:labels":{".":{},"f:k8s-app":{},"f:kubernetes.io/name":{},"f:objectset.rio.cattle.io/hash":{}}},"f:spec":{"f:progressDeadlineSeconds":{},"f:replicas":{},"f:revisionHistoryLimit":{},"f:selector":{},"f:strategy":{"f:rollingUpdate":{".":{},"f:maxSurge":{},"f:maxUnavailable":{}},"f:type":{}},"f:template":{"f:metadata":{"f:labels":{".":{},"f:k8s-app":{}}},"f:spec":{"f:containers":{"k:{\"name\":\"coredns\"}":{".":{},"f:args":{},"f:image":{},"f:imagePullPolicy":{},"f:livenessProbe":{".":{},"f:failureThreshold":{},"f:httpGet":{".":{},"f:path":{},"f:port":{},"f:scheme":{}},"f:initialDelaySeconds":{},"f:periodSeconds":{},"f:successThreshold":{},"f:timeoutSeconds":{}},"f:name":{},"f:ports":{".":{},"k:{\"containerPort\":53,\"protocol\":\"TCP\"}":{".":{},"f:containerPort":{},"f:name":{},"f:protocol":{}},"k:{\"containerPort\":53,\"protocol\":\"UDP\"}":{".":{},"f:containerPort":{},"f:name":{},"f:protocol":{}},"k:{\"containerPort\":9153,\"protocol\":\"TCP\"}":{".":{},"f:containerPort":{},"f:name":{},"f:protocol":{}}},"f:readinessProbe":{".":{},"f:failureThreshold":{},"f:httpGet":{".":{},"f:path":{},"f:port":{},"f:scheme":{}},"f:periodSeconds":{},"f:successThreshold":{},"f:timeoutSeconds":{}},"f:resources":{".":{},"f:limits":{".":{},"f:memory":{}},"f:requests":{".":{},"f:cpu":{},"f:memory":{}}},"f:securityContext":{".":{},"f:allowPrivilegeEscalation":{},"f:capabilities":{".":{},"f:add":{},"f:drop":{}},"f:readOnlyRootFilesystem":{}},"f:terminationMessagePath":{},"f:terminationMessagePolicy":{},"f:volumeMounts":{".":{},"k:{\"mountPath\":\"/etc/coredns\"}":{".":{},"f:mountPath":{},"f:name":{},"f:readOnly":{}}}}},"f:dnsPolicy":{},"f:nodeSelector":{".":{},"f:beta.kubernetes.io/os":{}},"f:priorityClassName":{},"f:restartPolicy":{},"f:schedulerName":{},"f:securityContext":{},"f:serviceAccount":{},"f:serviceAccountName":{},"f:terminationGracePeriodSeconds":{},"f:tolerations":{},"f:volumes":{".":{},"k:{\"name\":\"config-volume\"}":{".":{},"f:configMap":{".":{},"f:defaultMode":{},"f:items":{},"f:name":{}},"f:name":{}}}}}}}},{"manager":"k3s","operation":"Update","apiVersion":"apps/v1","time":"2022-03-18T09:30:10Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{"f:deployment.kubernetes.io/revision":{}}},"f:status":{"f:availableReplicas":{},"f:conditions":{".":{},"k:{\"type\":\"Available\"}":{".":{},"f:lastTransitionTime":{},"f:lastUpdateTime":{},"f:message":{},"f:reason":{},"f:status":{},"f:type":{}},"k:{\"type\":\"Progressing\"}":{".":{},"f:lastTransitionTime":{},"f:lastUpdateTime":{},"f:message":{},"f:reason":{},"f:status":{},"f:type":{}}},"f:observedGeneration":{},"f:readyReplicas":{},"f:replicas":{},"f:updatedReplicas":{}}}}]},"spec":{"replicas":1,"selector":{"matchLabels":{"k8s-app":"kube-dns"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"k8s-app":"kube-dns"}},"spec":{"volumes":[{"name":"config-volume","configMap":{"name":"coredns","items":[{"key":"Corefile","path":"Corefile"},{"key":"NodeHosts","path":"NodeHosts"}],"defaultMode":420}}],"containers":[{"name":"coredns","image":"rancher/coredns-coredns:1.8.3","args":["-conf","/etc/coredns/Corefile"],"ports":[{"name":"dns","containerPort":53,"protocol":"UDP"},{"name":"dns-tcp","containerPort":53,"protocol":"TCP"},{"name":"metrics","containerPort":9153,"protocol":"TCP"}],"resources":{"limits":{"memory":"170Mi"},"requests":{"cpu":"100m","memory":"70Mi"}},"volumeMounts":[{"name":"config-volume","readOnly":true,"mountPath":"/etc/coredns"}],"livenessProbe":{"httpGet":{"path":"/health","port":8080,"scheme":"HTTP"},"initialDelaySeconds":60,"timeoutSeconds":1,"periodSeconds":10,"successThreshold":1,"failureThreshold":3},"readinessProbe":{"httpGet":{"path":"/ready","port":8181,"scheme":"HTTP"},"timeoutSeconds":1,"periodSeconds":2,"successThreshold":1,"failureThreshold":3},"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"IfNotPresent","securityContext":{"capabilities":{"add":["NET_BIND_SERVICE"],"drop":["all"]},"readOnlyRootFilesystem":true,"allowPrivilegeEscalation":false}}],"restartPolicy":"Always","terminationGracePeriodSeconds":30,"dnsPolicy":"Default","nodeSelector":{"beta.kubernetes.io/os":"linux"},"serviceAccountName":"coredns","serviceAccount":"coredns","securityContext":{},"schedulerName":"default-scheduler","tolerations":[{"key":"CriticalAddonsOnly","operator":"Exists"},{"key":"node-role.kubernetes.io/control-plane","operator":"Exists","effect":"NoSchedule"},{"key":"node-role.kubernetes.io/master","operator":"Exists","effect":"NoSchedule"}],"priorityClassName":"system-cluster-critical"}},"strategy":{"type":"RollingUpdate","rollingUpdate":{"maxUnavailable":1,"maxSurge":"25%"}},"revisionHistoryLimit":10,"progressDeadlineSeconds":600},"status":{"observedGeneration":1,"replicas":1,"updatedReplicas":1,"readyReplicas":1,"availableReplicas":1,"conditions":[{"type":"Available","status":"True","lastUpdateTime":"2022-03-18T09:30:08Z","lastTransitionTime":"2022-03-18T09:30:08Z","reason":"MinimumReplicasAvailable","message":"Deployment has minimum availability."},{"type":"Progressing","status":"True","lastUpdateTime":"2022-03-18T09:30:10Z","lastTransitionTime":"2022-03-18T09:30:08Z","reason":"NewReplicaSetAvailable","message":"ReplicaSet \"coredns-7448499f4d\" has successfully progressed."}]}},{"metadata":{"name":"mariadb01","namespace":"my-namespace","uid":"b9bd8bca-d400-4fb4-a053-ecf0bb3cc27f","resourceVersion":"26792","generation":3,"creationTimestamp":"2022-03-18T09:55:24Z","labels":{"backup.dzd-ev.de/enabled":"true","workload.user.cattle.io/workloadselector":"apps.deployment-my-namespace-mariadb01"},"annotations":{"deployment.kubernetes.io/revision":"3"},"managedFields":[{"manager":"rancher","operation":"Update","apiVersion":"apps/v1","time":"2022-03-18T10:21:07Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:labels":{".":{},"f:backup.dzd-ev.de/enabled":{},"f:workload.user.cattle.io/workloadselector":{}}},"f:spec":{"f:progressDeadlineSeconds":{},"f:replicas":{},"f:revisionHistoryLimit":{},"f:selector":{},"f:strategy":{"f:rollingUpdate":{".":{},"f:maxSurge":{},"f:maxUnavailable":{}},"f:type":{}},"f:template":{"f:metadata":{"f:annotations":{".":{},"f:backup.dzd-ev.de/auto-create-databases":{}},"f:labels":{".":{},"f:backup.dzd-ev.de/auto-create":{},"f:backup.dzd-ev.de/password":{},"f:backup.dzd-ev.de/type":{},"f:backup.dzd-ev.de/username":{},"f:workload.user.cattle.io/workloadselector":{}}},"f:spec":{"f:affinity":{},"f:containers":{"k:{\"name\":\"container-0\"}":{".":{},"f:env":{".":{},"k:{\"name\":\"MYSQL_ROOT_PASSWORD\"}":{".":{},"f:name":{},"f:value":{}}},"f:image":{},"f:imagePullPolicy":{},"f:name":{},"f:resources":{},"f:terminationMessagePath":{},"f:terminationMessagePolicy":{}}},"f:dnsPolicy":{},"f:restartPolicy":{},"f:schedulerName":{},"f:securityContext":{},"f:terminationGracePeriodSeconds":{}}}}}},{"manager":"k3s","operation":"Update","apiVersion":"apps/v1","time":"2022-03-18T11:03:11Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{".":{},"f:deployment.kubernetes.io/revision":{}}},"f:status":{"f:availableReplicas":{},"f:conditions":{".":{},"k:{\"type\":\"Available\"}":{".":{},"f:lastTransitionTime":{},"f:lastUpdateTime":{},"f:message":{},"f:reason":{},"f:status":{},"f:type":{}},"k:{\"type\":\"Progressing\"}":{".":{},"f:lastTransitionTime":{},"f:lastUpdateTime":{},"f:message":{},"f:reason":{},"f:status":{},"f:type":{}}},"f:observedGeneration":{},"f:readyReplicas":{},"f:replicas":{},"f:updatedReplicas":{}}}}]},"spec":{"replicas":1,"selector":{"matchLabels":{"workload.user.cattle.io/workloadselector":"apps.deployment-my-namespace-mariadb01"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"backup.dzd-ev.de/auto-create":"true","backup.dzd-ev.de/password":"mysuperpw","backup.dzd-ev.de/type":"mysql","backup.dzd-ev.de/username":"root","workload.user.cattle.io/workloadselector":"apps.deployment-my-namespace-mariadb01"},"annotations":{"backup.dzd-ev.de/auto-create-databases":"[{\n          \"database\": \"coda_sql_test\",\n          \"user\": \"coda_test\",\n          \"password\": \"super_save_pw\"\n        }]"}},"spec":{"containers":[{"name":"container-0","image":"mariadb","env":[{"name":"MYSQL_ROOT_PASSWORD","value":"mysuperpw"}],"resources":{},"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"Always"}],"restartPolicy":"Always","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","securityContext":{},"affinity":{},"schedulerName":"default-scheduler"}},"strategy":{"type":"RollingUpdate","rollingUpdate":{"maxUnavailable":"25%","maxSurge":"25%"}},"revisionHistoryLimit":10,"progressDeadlineSeconds":600},"status":{"observedGeneration":3,"replicas":1,"updatedReplicas":1,"readyReplicas":1,"availableReplicas":1,"conditions":[{"type":"Available","status":"True","lastUpdateTime":"2022-03-18T09:55:41Z","lastTransitionTime":"2022-03-18T09:55:41Z","reason":"MinimumReplicasAvailable","message":"Deployment has minimum availability."},{"type":"Progressing","status":"True","lastUpdateTime":"2022-03-18T11:03:11Z","lastTransitionTime":"2022-03-18T09:55:24Z","reason":"NewReplicaSetAvailable","message":"ReplicaSet \"mariadb01-656cdf84f4\" has successfully progressed."}]}}]}

'kind' via python:  None

Output of get_kind_of_first_deployment_via_kubectl()

I0322 16:29:30.148327  218356 loader.go:372] Config loaded from file:  /home/tim/.kube/config
I0322 16:29:30.154672  218356 round_trippers.go:466] curl -v -XGET  -H "Accept: application/json" -H "User-Agent: kubectl/v1.23.5 (linux/amd64) kubernetes/c285e78" -H "Authorization: Bearer <masked>" 'https://localhost/k8s/clusters/local/apis/apps/v1/deployments?limit=500'
I0322 16:29:30.155097  218356 round_trippers.go:495] HTTP Trace: DNS Lookup for localhost resolved to [{::1 } {127.0.0.1 }]
I0322 16:29:30.155304  218356 round_trippers.go:510] HTTP Trace: Dial to tcp:[::1]:443 succeed
I0322 16:29:30.159983  218356 round_trippers.go:570] HTTP Statistics: DNSLookup 0 ms Dial 0 ms TLSHandshake 1 ms ServerProcessing 3 ms Duration 5 ms
I0322 16:29:30.159998  218356 round_trippers.go:577] Response Headers:
I0322 16:29:30.160006  218356 round_trippers.go:580]     X-Kubernetes-Pf-Prioritylevel-Uid: e45a1dcc-3369-4662-9516-1f6f4f91264d
I0322 16:29:30.160013  218356 round_trippers.go:580]     Cache-Control: no-cache, private
I0322 16:29:30.160019  218356 round_trippers.go:580]     Content-Type: application/json
I0322 16:29:30.160024  218356 round_trippers.go:580]     Date: Tue, 22 Mar 2022 15:29:30 GMT
I0322 16:29:30.160028  218356 round_trippers.go:580]     X-Api-Cattle-Auth: true
I0322 16:29:30.160031  218356 round_trippers.go:580]     X-Content-Type-Options: nosniff
I0322 16:29:30.160035  218356 round_trippers.go:580]     X-Kubernetes-Pf-Flowschema-Uid: 2f5554e0-3479-4442-85d2-b4a840f7db01
I0322 16:29:30.160214  218356 request.go:1181] Response Body: {"kind":"DeploymentList","apiVersion":"apps/v1","metadata":{"resourceVersion":"1126125"},"items":[{"metadata":{"name":"fleet-agent","namespace":"cattle-fleet-local-system","uid":"28768fcc-2e82-4fa4-a4bf-14a9160f1690","resourceVersion":"3190","generation":2,"creationTimestamp":"2022-03-18T09:30:49Z","labels":{"app.kubernetes.io/managed-by":"Helm","objectset.rio.cattle.io/hash":"362023f752e7f1989d8b652e029bd2c658ae7c44"},"annotations":{"deployment.kubernetes.io/revision":"2","meta.helm.sh/release-name":"fleet-agent-local","meta.helm.sh/release-namespace":"cattle-fleet-local-system","objectset.rio.cattle.io/applied":"H4sIAAAAAAAA/4RUy47jNhD8lz5LGlt+62Z4lY2RjdaYMfayMBYtqmUzQ5EK2XLGMfTvAf3QaPJwTuKjq7pZVdAZsJbfyDppNCSAde2ejkMI4FXqAhL4RLUyp4o0QwAVMRbICMkZUGvDyNJo57cm/40EO+LIShMJZFYUSfMkPUmpiDjEPWkOc2PYscU6vBaF10tlBKrQnRxTBW0ACnNSD5kP6A6QwGgaD+JROZvENCuHi/mimOfTSUyDeJEXsZhO5kgzMR57Uo0VfRwHroeuRuFvHo7kahJ+IEeKBBvr1xWyOHzpZsW6/ht/64FskWl/guTcBsBU1QqZLvCeoMLSRc6trMgxVjUkulGqL8V/0N/mwrKUWrJvA9oUtOzta0slWUvFp8ZKvX8RByoaJfV+vdemO07fSDR8ScL3O4a0oO6l6Vttybmr6d/P8Eqn+0A9Z+7KmposXoSCtYYAjqga8kBg2xDs2l0bwB8k9weGZNju/GOE0YxSk702IH28fG/OZctf05fNcpXe2X6ypvLTlZJU8Uxlt94g+3TcBY7eXW7bNugIl5/TbPvjZfV101H+Tww66OrndPXLOvuxzrbp87fllx5+4PqFn9MsfV5u11+zfkm+mMbDAYViLopwXMQULhaIoRiKwXw4G0/KfBTG0O4CkBXuPcSiFgeyTz3/k+MgGkVzuBVtGqU2RknhXVmXmeGNJfce839k35IzjRXelHPrezmyRyloKYRpNGf/hmGjvK1dBqgsSbA3x9xiRf73cUmGj2EklGmK2pqjLMhGr01OVhOT81FptI+oRCX/pOJjZNLfG1Q9xS6Z8bI+avgeQuMe0ympmzfwoWvbvwIAAP//ivSGiwUFAAA","objectset.rio.cattle.io/id":"fleet-agent-bootstrap-cattle-fleet-local-system"},"managedFields":[{"manager":"fleetcontroller","operation":"Update","apiVersion":"apps/v1","time":"2022-03-18T09:30:49Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{".":{},"f:objectset.rio.cattle.io/applied":{},"f:objectset.rio.cattle.io/id":{}},"f:labels":{".":{},"f:objectset.rio.cattle.io/hash":{}}},"f:spec":{"f:progressDeadlineSeconds":{},"f:replicas":{},"f:revisionHistoryLimit":{},"f:selector":{},"f:strategy":{"f:rollingUpdate":{".":{},"f:maxSurge":{},"f:maxUnavailable":{}},"f:type":{}},"f:template":{"f:metadata":{"f:labels":{".":{},"f:app":{}}},"f:spec":{"f:affinity":{".":{},"f:nodeAffinity":{".":{},"f:preferredDuringSchedulingIgnoredDuringExecution":{}}},"f:containers":{"k:{\"name\":\"fleet-agent\"}":{".":{},"f:env":{".":{},"k:{\"name\":\"AGENT_SCOPE\"}":{".":{},"f:name":{},"f:value":{}},"k:{\"name\":\"CHECKIN_INTERVAL\"}":{".":{},"f:name":{},"f:value":{}},"k:{\"name\":\"GENERATION\"}":{".":{},"f:name":{}},"k:{\"name\":\"NAMESPACE\"}":{".":{},"f:name":{},"f:valueFrom":{".":{},"f:fieldRef":{".":{},"f:apiVersion":{},"f:fieldPath":{}}}}},"f:image":{},"f:imagePullPolicy":{},"f:name":{},"f:resources":{},"f:terminationMessagePath":{},"f:terminationMessagePolicy":{}}},"f:dnsPolicy":{},"f:restartPolicy":{},"f:schedulerName":{},"f:securityContext":{},"f:serviceAccount":{},"f:serviceAccountName":{},"f:terminationGracePeriodSeconds":{},"f:tolerations":{}}}}}},{"manager":"fleetagent","operation":"Update","apiVersion":"apps/v1","time":"2022-03-18T09:31:00Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{"f:meta.helm.sh/release-name":{},"f:meta.helm.sh/release-namespace":{}},"f:labels":{"f:app.kubernetes.io/managed-by":{}}},"f:spec":{"f:template":{"f:spec":{"f:containers":{"k:{\"name\":\"fleet-agent\"}":{"f:env":{"k:{\"name\":\"GENERATION\"}":{"f:value":{}}}}}}}}}},{"manager":"k3s","operation":"Update","apiVersion":"apps/v1","time":"2022-03-18T09:31:02Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{"f:deployment.kubernetes.io/revision":{}}},"f:status":{"f:availableReplicas":{},"f:conditions":{".":{},"k:{\"type\":\"Available\"}":{".":{},"f:lastTransitionTime":{},"f:lastUpdateTime":{},"f:message":{},"f:reason":{},"f:status":{},"f:type":{}},"k:{\"type\":\"Progressing\"}":{".":{},"f:lastTransitionTime":{},"f:lastUpdateTime":{},"f:message":{},"f:reason":{},"f:status":{},"f:type":{}}},"f:observedGeneration":{},"f:readyReplicas":{},"f:replicas":{},"f:updatedReplicas":{}}}}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app":"fleet-agent"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app":"fleet-agent"}},"spec":{"containers":[{"name":"fleet-agent","image":"rancher/fleet-agent:v0.3.8","env":[{"name":"NAMESPACE","valueFrom":{"fieldRef":{"apiVersion":"v1","fieldPath":"metadata.namespace"}}},{"name":"AGENT_SCOPE","value":"cattle-fleet-local-system"},{"name":"CHECKIN_INTERVAL","value":"0s"},{"name":"GENERATION","value":"bundle"}],"resources":{},"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"IfNotPresent"}],"restartPolicy":"Always","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","serviceAccountName":"fleet-agent","serviceAccount":"fleet-agent","securityContext":{},"affinity":{"nodeAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":1,"preference":{"matchExpressions":[{"key":"fleet.cattle.io/agent","operator":"In","values":["true"]}]}}]}},"schedulerName":"default-scheduler","tolerations":[{"key":"node.cloudprovider.kubernetes.io/uninitialized","operator":"Equal","value":"true","effect":"NoSchedule"},{"key":"cattle.io/os","operator":"Equal","value":"linux","effect":"NoSchedule"}]}},"strategy":{"type":"RollingUpdate","rollingUpdate":{"maxUnavailable":"25%","maxSurge":"25%"}},"revisionHistoryLimit":10,"progressDeadlineSeconds":600},"status":{"observedGeneration":2,"replicas":1,"updatedReplicas":1,"readyReplicas":1,"availableReplicas":1,"conditions":[{"type":"Available","status":"True","lastUpdateTime":"2022-03-18T09:30:59Z","lastTransitionTime":"2022-03-18T09:30:59Z","reason":"MinimumReplicasAvailable","message":"Deployment has minimum availability."},{"type":"Progressing","status":"True","lastUpdateTime":"2022-03-18T09:31:02Z","lastTransitionTime":"2022-03-18T09:30:49Z","reason":"NewReplicaSetAvailable","message":"ReplicaSet \"fleet-agent-78f694664b\" has successfully progressed."}]}},{"metadata":{"name":"fleet-controller","namespace":"cattle-fleet-system","uid":"58be9f6e-ebb8-4f3d-90a5-25260c6efd73","resourceVersion":"2720","generation":1,"creationTimestamp":"2022-03-18T09:30:29Z","labels":{"app.kubernetes.io/managed-by":"Helm"},"annotations":{"deployment.kubernetes.io/revision":"1","meta.helm.sh/release-name":"fleet","meta.helm.sh/release-namespace":"cattle-fleet-system"},"managedFields":[{"manager":"helm","operation":"Update","apiVersion":"apps/v1","time":"2022-03-18T09:30:29Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{".":{},"f:meta.helm.sh/release-name":{},"f:meta.helm.sh/release-namespace":{}},"f:labels":{".":{},"f:app.kubernetes.io/managed-by":{}}},"f:spec":{"f:progressDeadlineSeconds":{},"f:replicas":{},"f:revisionHistoryLimit":{},"f:selector":{},"f:strategy":{"f:rollingUpdate":{".":{},"f:maxSurge":{},"f:maxUnavailable":{}},"f:type":{}},"f:template":{"f:metadata":{"f:labels":{".":{},"f:app":{}}},"f:spec":{"f:containers":{"k:{\"name\":\"fleet-controller\"}":{".":{},"f:command":{},"f:env":{".":{},"k:{\"name\":\"NAMESPACE\"}":{".":{},"f:name":{},"f:valueFrom":{".":{},"f:fieldRef":{".":{},"f:apiVersion":{},"f:fieldPath":{}}}}},"f:image":{},"f:imagePullPolicy":{},"f:name":{},"f:resources":{},"f:terminationMessagePath":{},"f:terminationMessagePolicy":{}}},"f:dnsPolicy":{},"f:nodeSelector":{".":{},"f:kubernetes.io/os":{}},"f:restartPolicy":{},"f:schedulerName":{},"f:securityContext":{},"f:serviceAccount":{},"f:serviceAccountName":{},"f:terminationGracePeriodSeconds":{},"f:tolerations":{}}}}}},{"manager":"k3s","operation":"Update","apiVersion":"apps/v1","time":"2022-03-18T09:30:39Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{"f:deployment.kubernetes.io/revision":{}}},"f:status":{"f:availableReplicas":{},"f:conditions":{".":{},"k:{\"type\":\"Available\"}":{".":{},"f:lastTransitionTime":{},"f:lastUpdateTime":{},"f:message":{},"f:reason":{},"f:status":{},"f:type":{}},"k:{\"type\":\"Progressing\"}":{".":{},"f:lastTransitionTime":{},"f:lastUpdateTime":{},"f:message":{},"f:reason":{},"f:status":{},"f:type":{}}},"f:observedGeneration":{},"f:readyReplicas":{},"f:replicas":{},"f:updatedReplicas":{}}}}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app":"fleet-controller"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app":"fleet-controller"}},"spec":{"containers":[{"name":"fleet-controller","image":"rancher/fleet:v0.3.8","command":["fleetcontroller"],"env":[{"name":"NAMESPACE","valueFrom":{"fieldRef":{"apiVersion":"v1","fieldPath":"metadata.namespace"}}}],"resources":{},"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"IfNotPresent"}],"restartPolicy":"Always","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","nodeSelector":{"kubernetes.io/os":"linux"},"serviceAccountName":"fleet-controller","serviceAccount":"fleet-controller","securityContext":{},"schedulerName":"default-scheduler","tolerations":[{"key":"cattle.io/os","operator":"Equal","value":"linux","effect":"NoSchedule"}]}},"strategy":{"type":"RollingUpdate","rollingUpdate":{"maxUnavailable":"25%","maxSurge":"25%"}},"revisionHistoryLimit":10,"progressDeadlineSeconds":600},"status":{"observedGeneration":1,"replicas":1,"updatedReplicas":1,"readyReplicas":1,"availableReplicas":1,"conditions":[{"type":"Available","status":"True","lastUpdateTime":"2022-03-18T09:30:39Z","lastTransitionTime":"2022-03-18T09:30:39Z","reason":"MinimumReplicasAvailable","message":"Deployment has minimum availability."},{"type":"Progressing","status":"True","lastUpdateTime":"2022-03-18T09:30:39Z","lastTransitionTime":"2022-03-18T09:30:29Z","reason":"NewReplicaSetAvailable","message":"ReplicaSet \"fleet-controller-6666887949\" has successfully progressed."}]}},{"metadata":{"name":"gitjob","namespace":"cattle-fleet-system","uid":"3621c252-e140-4636-90a9-8bcd3ea3dc64","resourceVersion":"2732","generation":1,"creationTimestamp":"2022-03-18T09:30:29Z","labels":{"app.kubernetes.io/managed-by":"Helm"},"annotations":{"deployment.kubernetes.io/revision":"1","meta.helm.sh/release-name":"fleet","meta.helm.sh/release-namespace":"cattle-fleet-system"},"managedFields":[{"manager":"helm","operation":"Update","apiVersion":"apps/v1 [truncated 19376 chars]
'kind' via kubectl:  Deployment

No worries about any PWs. This is just a local test deployment.

motey commented 2 years ago

i can not ready any significant differences into the request. The response body is truncated :/

motey commented 2 years ago

anything else i can do?

k8s-triage-robot commented 2 years ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 2 years ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

motey commented 2 years ago

still an existing bug

/remove-lifecycle rotten

AlexeyPetroff commented 2 years ago

After some investigation I can confirm it's a server-side behavior. Steps to reproduce:

  1. Start reverse proxy to kube api-server: kubectl proxy
  2. Send a GET request to get the list of deployments: curl -X GET 'http://127.0.0.1:8001/apis/apps/v1/namespaces/default/deployments. Note that you should change the default namespace to your own.

In the response I'm getting I see that Deployments object do not have kind property in it, however k8s API docs suggests that it should have this property.

One more interesting thing is that kubectl get deployments -o=json shows Deployment objects with kind property as it should

motey commented 2 years ago

@AlexeyPetroff very interesting. Thx for checking.

But not showing an attribute and declaring it as None are two different things. The HTTP API of Kubernetes does something quirky by not showing the kind (I think just showing it would be the preferred behavior for me) The python client does something wrong by claiming the kind is None/null. This is slightly worse i think :)

AlexeyPetroff commented 2 years ago

@motey There is no surprise that python client assigns None to kind. After the client gets the response from the kube-apiserver, it serializes it. The serializer see V1Deployment object inside the json, so tries to serialize it to V1Deployment model. If we look into implementation of this model, we'll see that None is the default value for kind. On one hand we can fix it by changing the default value in the model to Deployment, on the other, it's a workaround and we should get the correct response from the apiserver in the first place

P.S. I noticed that the models were generated via OpenApi generator, so manual changes in models are out of scope.

k8s-triage-robot commented 1 year ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

yfried commented 1 year ago

/remove-lifecycle stale Still a bug

k8s-triage-robot commented 1 year ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

motey commented 1 year ago

geez. this bot. /remove-lifecycle stale Still a bug

k8s-triage-robot commented 1 year ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

motey commented 1 year ago

/remove-lifecycle stale

xarses commented 11 months ago

I also ran into this and found it odd, it only appears to occur on the list_ calls. the read_ calls always include the expected data.

I use both client.BatchV1beta1Api(config).list_cron_job_for_all_namespaces and client.CoreV1Api(config).list_pod_for_all_namespaces and just write the values back into the objects returned so that the data is consistent with what is produced from the read_ calls

k8s-triage-robot commented 7 months ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

motey commented 7 months ago

/remove-lifecycle stale still a bug

k8s-triage-robot commented 4 months ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 3 months ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

motey commented 3 months ago

/remove-lifecycle rotten still a bug

mintbomb27 commented 1 month ago

As mentioned by @ellieayla in #1394 , kubectl adds the kind,group and version in https://github.com/kubernetes/cli-runtime/blob/bc95ff91653e956ac06fbff1a242c3d96687602d/pkg/printers/typesetter.go#L41 .

What is the expected behaviour here? Do we do something like kubectl does, or not give the kind and apiVersion at all?

motey commented 1 month ago

I see the reason why list items do not contain kind for each object; its repetitive. But in real life code one may pass around single items of a list or in other words; there is a high chance that a list object maybe used outside of the parent list context. A coder would need to add kind manually and therefor write a child class with the extra prop, transfer the data, yadayadayada.

Therefore it would be great if the objects are self contained and have the kind property. Having two different data models for the same thing based on if its contained in a list or not is just not intuitive, at least for me. The costs on wire and in memory for the single property are relatively low and code that is using the k8s-python-client will look cleaner.

hampusudd commented 1 month ago

I'd like to see these values provided for each item in the lists as well. Like @motey mentioned, the list of items may be put out of scope of the initial request and therefore would be useful. Currently I have to set them manually.