kubernetes-client icon indicating copy to clipboard operation
kubernetes-client copied to clipboard

api version for ingress

Open patriceckhart opened this issue 3 years ago • 4 comments

I want to use the api version networking.k8s.io/v1 for Ingress.

Tried to extend the model and define the api version. But ends in an error:

{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"the API version in the data (networking.k8s.io/v1) does not match the expected API version (networking.k8s.io/v1beta1)","reason":"BadRequest","code":400}

patriceckhart avatar Dec 01 '21 08:12 patriceckhart

had same problem, solution was: implement my own Ingresses Collections/Model/Repositories. And use them instead of original ones. all the same as orginal ones, except two key changes (at first i forgot to change in Repository, that's why i was getting this error):

Ingress.php

class Ingress extends Model
{
    protected string $apiVersion = 'networking.k8s.io/v1';
}

IngressRepository.php

class IngressRepository extends Repository
{
    protected ?string $apiVersion = 'networking.k8s.io/v1';
    ....
}

@maclof i'm not sure what is the plan for 1.20+ Kubernetes support, but i could do PR to accomodate Ingress migration to networking.k8s.io/v1

trylika avatar Feb 14 '22 11:02 trylika

to extend my idea of PR, my project unfortunatelly doesn't use anything else from what changed in Kubernetes 1.20+ so i can't test/do changes beyond Ingress. but, we use ServiceAccounts and i can add that Model if there is need for that

trylika avatar Feb 14 '22 12:02 trylika

@trylika

Doesn't work for me :-( :

IngressRepository::$apiVersion
must not be defined (as in class
Maclof\Kubernetes\Repositories\Repository) in ...

patriceckhart avatar Jun 11 '22 11:06 patriceckhart

@patriceckhart not sure about this exact error, but i'm using 0.24 and my changes work, but i can see recently there where some changes regarding Ingress and other changes related to kubernetes new versions

trylika avatar Jun 13 '22 09:06 trylika