outposts: fix kubernetes ApiClient not being used

This commit is contained in:
Jens Langhammer 2020-11-09 10:39:00 +01:00
parent 07da6ffa69
commit e99f6e289b
7 changed files with 7 additions and 30 deletions

View file

@ -36,7 +36,7 @@ class DeploymentReconciler(KubernetesObjectReconciler[V1Deployment]):
def __init__(self, controller: "KubernetesController") -> None:
super().__init__(controller)
self.api = AppsV1Api()
self.api = AppsV1Api(controller.client)
self.outpost = self.controller.outpost
@property

View file

@ -23,7 +23,7 @@ class SecretReconciler(KubernetesObjectReconciler[V1Secret]):
def __init__(self, controller: "KubernetesController") -> None:
super().__init__(controller)
self.api = CoreV1Api()
self.api = CoreV1Api(controller.client)
@property
def name(self) -> str:

View file

@ -18,7 +18,7 @@ class ServiceReconciler(KubernetesObjectReconciler[V1Service]):
def __init__(self, controller: "KubernetesController") -> None:
super().__init__(controller)
self.api = CoreV1Api()
self.api = CoreV1Api(controller.client)
@property
def name(self) -> str:

View file

@ -21,7 +21,7 @@ class KubernetesController(BaseController):
reconcilers: Dict[str, Type[KubernetesObjectReconciler]]
reconcile_order: List[str]
config: ApiClient
client: ApiClient
connection: KubernetesServiceConnection
def __init__(

View file

@ -5,7 +5,6 @@ from typing import Dict, Iterable, List, Optional, Type, Union
from uuid import uuid4
from dacite import from_dict
from django.conf import settings
from django.core.cache import cache
from django.db import models, transaction
from django.db.models.base import Model
@ -22,7 +21,7 @@ from kubernetes.client.configuration import Configuration
from kubernetes.client.exceptions import OpenApiException
from kubernetes.config.config_exception import ConfigException
from kubernetes.config.incluster_config import load_incluster_config
from kubernetes.config.kube_config import load_kube_config, load_kube_config_from_dict
from kubernetes.config.kube_config import load_kube_config_from_dict
from model_utils.managers import InheritanceManager
from packaging.version import LegacyVersion, Version, parse
from urllib3.exceptions import HTTPError
@ -223,10 +222,7 @@ class KubernetesServiceConnection(OutpostServiceConnection):
load_kube_config_from_dict(self.kubeconfig, client_configuration=config)
return ApiClient(config)
except ConfigException as exc:
if not settings.DEBUG:
raise ServiceConnectionInvalid from exc
load_kube_config(client_configuration=config)
return config
class Meta:

View file

@ -30,7 +30,7 @@ class IngressReconciler(KubernetesObjectReconciler[NetworkingV1beta1Ingress]):
def __init__(self, controller: "KubernetesController") -> None:
super().__init__(controller)
self.api = NetworkingV1beta1Api()
self.api = NetworkingV1beta1Api(controller.client)
@property
def name(self) -> str:

View file

@ -1100,25 +1100,6 @@ paths:
required: true
type: string
format: uuid
/flows/instances/{flow_uuid}/cache_count/:
get:
operationId: flows_instances_cache_count
description: Get count of cached flows
parameters: []
responses:
'200':
description: ''
schema:
$ref: '#/definitions/Flow'
tags:
- flows
parameters:
- name: flow_uuid
in: path
description: A UUID string identifying this Flow.
required: true
type: string
format: uuid
/outposts/outposts/:
get:
operationId: outposts_outposts_list