Score:0

disable deprecated resource automatic conversion

br flag

I’m trying to purposefully create K8S resources with deprecated apiVersion for test purposes, but keep ending up with a converted resource to the non-deprecated apiVersion. I don’t understand why it’s happening and can’t find any discussion/topic on how to force K8S API to respect my resource manifest.

Does anyone know how it could be done? Or even why it’s acting like that?

Here is the resource I’m trying to create:

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: deprecated-ingress
spec:
  rules:
    - host: example.com
      http:
        paths:
          - path: /*
            pathType: ImplementationSpecific
            backend:
              serviceName: test
              servicePort: 80

I tried to create this resource on several clusters with the following versions:

  • 1.16
  • 1.21
  • 1.23

For each cluster, I was using the corresponding kubectl version. This is an indicator that the « conversion » is not happening client-side.

This is the created resource on cluster, as you can see, the apiVersion is not the same…

apiVersion: networking.k8s.io/v1                                                                                                                                                                                
kind: Ingress                                                                                                                                                                                                   
metadata:                                                                                                                                                                                                       
  annotations:                                                                                                                                                                                                  
    kubectl.kubernetes.io/last-applied-configuration: |                                                                                                                                                         
      {"apiVersion":"networking.k8s.io/v1beta1","kind":"Ingress","metadata":{"annotations":{},"name":"deprecated-ingress","namespace":"test1"},"spec":{"rules":[{"host":"example.com","http":{"paths":[{"backen
d":{"serviceName":"test","servicePort":80},"path":"/*","pathType":"ImplementationSpecific"}]}}]}}                                                                                                           
  creationTimestamp: "2022-06-02T12:06:04Z"                                                                                                                                                                     
  finalizers:                                                                                                                                                                                                   
  - networking.gke.io/ingress-finalizer-V2                                                                                                                                                                      
  generation: 1                                                                                                                                                                                                 
  managedFields:                                                                                                                                                                                                
  - apiVersion: networking.k8s.io/v1beta1                                                                                                                                                                       
    fieldsType: FieldsV1                                                                                                                                                                                        
    fieldsV1:                                                                                                                                                                                                   
      f:metadata:                                                                                                                                                                                               
        f:finalizers:                                                                                                                                                                                           
          .: {}                                                                                                                                                                                                 
          v:"networking.gke.io/ingress-finalizer-V2": {}
    manager: glbc
    operation: Update
    time: "2022-06-02T12:06:04Z"
  - apiVersion: networking.k8s.io/v1beta1
    fieldsType: FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .: {}
          f:kubectl.kubernetes.io/last-applied-configuration: {}
      f:spec:
        f:rules: {}
    manager: kubectl
    operation: Update
    time: "2022-06-02T12:06:04Z"
  name: deprecated-ingress
  namespace: test1
  resourceVersion: "489457660"
  selfLink: /apis/networking.k8s.io/v1/namespaces/test1/ingresses/deprecated-ingress
  uid: c8c80e6f-3e72-45b7-aca7-d17ab4a49f19
spec:
  rules:
  - host: example.com
    http:
      paths:
      - backend:
          service:
            name: test
            port:
              number: 80
        path: /*
        pathType: ImplementationSpecific
status:
  loadBalancer: {}

I also tried with CronJob and version batch/v1beta1 and I ended up with the batch/v1 version.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.