kubernetes-client
kubernetes-client copied to clipboard
api version for ingress
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}
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
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
Doesn't work for me :-( :
IngressRepository::$apiVersion
must not be defined (as in class
Maclof\Kubernetes\Repositories\Repository) in ...
@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