Пример #1
0
 def __init__(self, invoc):
     if 'KUBERNETES_SERVICE_HOST' in os.environ:
         config.load_incluster_config()
     else:
         config.load_kube_config()
     logging.getLogger().setLevel(agent_config.settings.loglevel)
     self._configuration = client.Configuration()
     self._api_instance = client.BatchV1Api(
         client.ApiClient(self._configuration))
     self._api_instance_core = client.CoreV1Api(
         client.ApiClient(self._configuration))
     configuration = stackl_client.Configuration()
     configuration.host = agent_config.settings.stackl_host
     api_client = stackl_client.ApiClient(configuration=configuration)
     self._stack_instance_api = stackl_client.StackInstancesApi(
         api_client=api_client)
     self._stack_fr_api = stackl_client.FunctionalRequirementsApi(
         api_client=api_client)
     self._invoc = invoc
     self._service = self._invoc.service
     self.hosts = self._invoc.hosts
     self._functional_requirement = self._invoc.functional_requirement
     self._functional_requirement_obj = self._stack_fr_api.get_functional_requirement_by_name(
         self._functional_requirement)
     self._stack_instance = self._stack_instance_api.get_stack_instance(
         self._invoc.stack_instance)
     self._output = None
     self._env_from = {}
     self._env_list = {}
     self._volumes = []
     self._init_containers = []
     self.stackl_namespace = agent_config.settings.stackl_namespace
     self.service_account = agent_config.settings.service_account
     self._secret_handler = None
Пример #2
0
 def __init__(self):
     try:
         with open(get_config_path(), 'r+') as stackl_config:
             host = stackl_config.read()
             configuration = stackl_client.Configuration()
             configuration.host = host
             self.api_client = stackl_client.ApiClient(
                 configuration=configuration)
             self.infrastructure_base_api = stackl_client.InfrastructureBaseApi(
                 api_client=self.api_client)
             self.functional_requirements_api = stackl_client.FunctionalRequirementsApi(
                 api_client=self.api_client)
             self.services_api = stackl_client.ServicesApi(
                 api_client=self.api_client)
             self.sat_api = stackl_client.StackApplicationTemplatesApi(
                 api_client=self.api_client)
             self.sit_api = stackl_client.StackInfrastructureTemplatesApi(
                 api_client=self.api_client)
             self.stack_instances_api = stackl_client.StackInstancesApi(
                 api_client=self.api_client)
             self.policy_templates_api = stackl_client.PolicyTemplatesApi(
                 api_client=self.api_client)
             self.snapshot_api = stackl_client.SnapshotsApi(
                 api_client=self.api_client)
             self.outputs_api = stackl_client.OutputsApi(
                 api_client=self.api_client)
     except FileNotFoundError:
         click.echo("Config file not found, run `stackl connect` first")
         exit(1)