Esempio n. 1
0
    def Run(self, args):
        _EnsureComponentsInstalled(args)

        settings = local.Settings.FromArgs(args)
        local_file_generator = local_files.LocalRuntimeFiles(settings)

        kubernetes_config = six.ensure_text(
            local_file_generator.KubernetesConfig())

        _EnsureDockerRunning()
        with cross_platform_temp_file.NamedTempFile(
                kubernetes_config) as kubernetes_file:
            skaffold_config = six.ensure_text(
                local_file_generator.SkaffoldConfig(kubernetes_file.name))
            skaffold_event_port = (args.skaffold_events_port
                                   or portpicker.pick_unused_port())
            with cross_platform_temp_file.NamedTempFile(skaffold_config) as skaffold_file, \
                 self._GetKubernetesEngine(args) as kube_context, \
                 self._WithKubeNamespace(args.namespace, kube_context.context_name), \
                 _SetImagePush(skaffold_file, kube_context.shared_docker) as patched_skaffold_file, \
                 skaffold.Skaffold(patched_skaffold_file.name, kube_context.context_name,
                                   args.namespace, kube_context.env_vars, _IsDebug(),
                                   skaffold_event_port) as running_process, \
                 skaffold.PrintUrlThreadContext(settings.service_name, skaffold_event_port):
                running_process.wait()
    def Run(self, args):
        _EnsureComponentsInstalled(args)
        if _IsDebug():
            _PrintDependencyVersions(args)

        settings = local.AssembleSettings(args, self.ReleaseTrack())

        local_file_generator = local_files.LocalRuntimeFiles(settings)

        kubernetes_config = six.ensure_text(
            local_file_generator.KubernetesConfig())
        namespace = getattr(args, 'namespace', None)

        _EnsureDockerRunning()
        with _DeployTempFile(kubernetes_config) as kubernetes_file:
            skaffold_config = six.ensure_text(
                local_file_generator.SkaffoldConfig(kubernetes_file.name))
            skaffold_event_port = (args.skaffold_events_port
                                   or portpicker.pick_unused_port())
            with _SkaffoldTempFile(skaffold_config) as skaffold_file, \
                 self._GetKubernetesEngine(args) as kube_context, \
                 self._WithKubeNamespace(namespace, kube_context.context_name), \
                 _SetImagePush(skaffold_file,
                               kube_context.shared_docker) as patched_skaffold_file, \
                 self._SkaffoldProcess(patched_skaffold_file, kube_context, namespace,
                                       skaffold_event_port) as running_process, \
                 skaffold.PrintUrlThreadContext(settings.service_name,
                                                skaffold_event_port):
                running_process.wait()
  def Run(self, args):
    settings = local.Settings.FromArgs(args)
    local_file_generator = local_files.LocalRuntimeFiles(settings)

    with files.FileWriter(args.kubernetes_file) as output:
      output.write(six.u(local_file_generator.KubernetesConfig()))

    if not args.no_skaffold_file:
      with files.FileWriter(args.skaffold_file) as output:
        output.write(
            six.u(local_file_generator.SkaffoldConfig(args.kubernetes_file)))
Esempio n. 4
0
  def Run(self, args):
    settings = local.Settings.FromArgs(args)
    local_file_generator = local_files.LocalRuntimeFiles(settings)

    kubernetes_config = six.ensure_text(local_file_generator.KubernetesConfig())

    with _NamedTempFile(kubernetes_config) as kubernetes_file:
      skaffold_config = six.ensure_text(
          local_file_generator.SkaffoldConfig(kubernetes_file.name))
      with _NamedTempFile(skaffold_config) as skaffold_file, \
           self._GetKubernetesEngine(args) as kube_context, \
           self._WithKubeNamespace(args.namespace, kube_context.context_name), \
           _SetImagePush(skaffold_file, kube_context.shared_docker) as patched_skaffold_file, \
           Skaffold(patched_skaffold_file.name, kube_context.context_name,
                    args.namespace, kube_context.env_vars,
                    args.additional_skaffold_flags) as skaffold:
        skaffold.wait()
Esempio n. 5
0
    def Run(self, args):
        settings = local.Settings.FromArgs(args)
        local_file_generator = local_files.LocalRuntimeFiles(settings)

        with tempfile.NamedTemporaryFile(mode='w+t') as kubernetes_config:
            with tempfile.NamedTemporaryFile(mode='w+t') as skaffold_config:
                kubernetes_config.write(
                    six.u(local_file_generator.KubernetesConfig()))
                kubernetes_config.flush()
                skaffold_config.write(
                    six.u(
                        local_file_generator.SkaffoldConfig(
                            kubernetes_config.name)))
                skaffold_config.flush()

                with self._GetKubernetesEngine(args) as context:
                    with Skaffold(skaffold_config.name,
                                  context.context_name) as skaffold:
                        skaffold.wait()