Exemplo n.º 1
0
    def get_init_containers(
        self,
        polyaxon_init: V1PolyaxonInitContainer,
        contexts: PluginsContextsSpec,
        artifacts_store: V1ConnectionType,
        init_connections: List[V1Init],
        init_containers: List[k8s_schemas.V1Container],
        connection_by_names: Dict[str, V1ConnectionType],
    ) -> List[k8s_schemas.V1Container]:
        init_containers = [
            ensure_container_name(container=c, prefix=INIT_PREFIX)
            for c in to_list(init_containers, check_none=True)
        ]
        init_connections = to_list(init_connections, check_none=True)
        containers = []

        # Add auth context
        if contexts and contexts.auth:
            containers.append(
                get_auth_context_container(
                    polyaxon_init=polyaxon_init,
                    env=self.get_auth_service_env_vars(
                        external_host=contexts.external_host),
                ))

        # Add outputs
        if contexts and contexts.collect_artifacts:
            containers += to_list(
                get_artifacts_path_container(
                    polyaxon_init=polyaxon_init,
                    artifacts_store=artifacts_store,
                    run_path=self.run_path,
                    auto_resume=contexts.auto_resume,
                ),
                check_none=True,
            )

        containers += self.handle_init_connections(
            polyaxon_init=polyaxon_init,
            artifacts_store=artifacts_store,
            init_connections=init_connections,
            connection_by_names=connection_by_names,
            contexts=contexts,
        )
        init_containers = containers + init_containers
        return [sanitize_container(c) for c in init_containers]
Exemplo n.º 2
0
 def get_sidecar_containers(
     self,
     polyaxon_sidecar: V1PolyaxonSidecarContainer,
     contexts: PluginsContextsSpec,
     artifacts_store: V1ConnectionType,
     sidecar_containers: List[k8s_schemas.V1Container],
 ) -> List[k8s_schemas.V1Container]:
     sidecar_containers = [
         ensure_container_name(container=c, prefix=SIDECAR_PREFIX)
         for c in to_list(sidecar_containers, check_none=True)
     ]
     polyaxon_sidecar_container = get_sidecar_container(
         container_id=self.MAIN_CONTAINER_ID,
         polyaxon_sidecar=polyaxon_sidecar,
         env=self.get_polyaxon_sidecar_service_env_vars(),
         artifacts_store=artifacts_store,
         contexts=contexts,
         run_path=self.run_path,
     )
     containers = to_list(polyaxon_sidecar_container, check_none=True)
     containers += sidecar_containers
     return [sanitize_container_command_args(c) for c in containers]