consolidation / site-process

A thin wrapper around the Symfony Process Component that allows applications to use the Site Alias library to specify the target for a remote call.
Other
50 stars 19 forks source link

Implement a new kubectl transport #60

Closed rudolfbyker closed 2 years ago

rudolfbyker commented 2 years ago

Overview

This pull request:

Q A
Bug fix? no
New feature? yes
Has tests? yes
BC breaks? no
Deprecations? no

Summary

Implement a new kubectl transport for accessing Drupal instances running in Kubernetes.

Description

If you have this alias:

foo:
  paths:
    drush-script: /vv/vendor/bin/drush
  root: /vv/web
  uri: drupal.example.com
  kubectl:
    tty: false
    interactive: false
    namespace: vv
    resource: deploy/drupal-deployment
    container: drupal

... you can do this:

drush @foo status

... or any other drush command, and it will run via kubectl, like this:

kubectl --namespace=vv exec --tty=false --stdin=false deploy/drupal-deployment --container=drupal -- /vv/vendor/bin/drush status --uri=drupal.example.com --root=/vv/web
rudolfbyker commented 2 years ago

@greg-1-anderson Do you have any comments on how the yaml structure under kubectl in the site alias should be designed? It's currently super simple:

foo:
  paths:
    drush-script: /vv/vendor/bin/drush
  root: /vv/web
  uri: drupal.example.com
  kubectl:
    tty: false
    interactive: false
    namespace: vv
    resource: deploy/drupal-deployment
    container: drupal

I'm wondering whether we would ever put anything other than transport info under kubectl. But I doubt it.

rudolfbyker commented 2 years ago

Did you see my comment above? Ready to merge?

greg-1-anderson commented 2 years ago

Sure, let's go ahead and put this in. Thanks.

rudolfbyker commented 2 years ago

Thanks for the merge. I see this is working well for SSH, but not for rsync commands. Any idea why/why not? Do rsync commands use a different mechanism? I don't find anything related to rsync in this repo, other than strings in the tests.

I'm trying to achieve something like this transparently: https://serverfault.com/a/887402/301389

weitzman commented 2 years ago

Ideally we document this in README