Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugins Phase 1 #1469

Merged
merged 13 commits into from
Apr 28, 2020
Merged

Commits on Apr 14, 2020

  1. Plugin implementation: Phase 1

    These changes are the implementation of concepts outlined in
    designs/extensible-cli-and-scaffolding-plugins-phase-1.md
    
    * cmd/: remove all but 'edit' and 'update' subcommands in favor
    of plugins that implement removed commands
    
    * internal/cmdutil: RunOptions configure Run() to execute a command
    in a generic manner
    
    * pkg/cli: CLI interface and cobra CLI constructors. Most commands
    from cmd/ were move here and modified to initialize plugins
    
    * pkg/plugin: Plugin and PluginGetter interfaces for v1 and v2
    scaffolds. These are kubebuilider's base Go plugins consumed by
    pkg/cli.CLI
    estroz committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    1bba4fb View commit details
    Browse the repository at this point in the history
  2. pkg/cli: validate cli struct's fields

    pkg/plugin: validation for plugin version strings
    
    pkg/internal/validation: project-wide validation logic; move
    pkg/model/resource/validation.go functions here
    estroz committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    883e8c6 View commit details
    Browse the repository at this point in the history
  3. pkg/scaffold: pass pkg/model/config.Config to scaffolds, not the

    internal type
    
    pkg/plugin: InjectConfig passes a Config object to a plugin that
    the plugin can modify instead of having the plugin load/save the
    plugin itself
    
    pkg/cli: manage initialization, loading, and saving of a Config
    object, and inject the Config object into plugins
    
    internal/cmdutil: remove LoadConfig and Config object parameters
    from RunOptions interface
    
    cmd: rewrite edit/update to respect new command runner interface
    estroz committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    e1d2f11 View commit details
    Browse the repository at this point in the history
  4. pkg/cli: use --plugins to determine which plugin.Base's kubebuilder

    should run for a subcommand. This option is global. Refactoring of
    getBaseFlags -> parseBaseFlags allows multiple global flags to be
    parsed for a cli struct. plugin filtering considers short names,
    ex. --plugins="go" rather than --plugins="go.kubebuilder.io/v2.0.0".
    WithDefaultPlugins sets the default plugins a CLi should use in case
    --plugins or the config 'layout' are not set
    
    pkg/model/config: Config support the 'layout' key which indicates the
    plugin that scaffolded a project, by plugin key
    
    pkg/plugin: SplitKey, KeyFor, Key, GetShortName are utility functions
    for plugin keys
    
    * pkg/{cli,plugin}: add plugin name validation
    
    * pkg/plugin/{v1,v2}: set layout key in config
    
     Please enter the commit message for your changes. Lines starting
    estroz committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    d331eaa View commit details
    Browse the repository at this point in the history
  5. pkg/mode/config: add arbitrary extra fields to Config under the

    'plugins' key, with each plugin's config keyed by its plugin key,
    and an encoder and decoder for plugin configuration objects. Add
    marshal/unmarshal functions for a Config
    
    internal/config: use Config marshalling/unmarshalling to read/write
    a config, and add tests
    estroz committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    478c233 View commit details
    Browse the repository at this point in the history
  6. 1 Configuration menu
    Copy the full SHA
    e4b8d15 View commit details
    Browse the repository at this point in the history
  7. Any changes that break 'PROJECT' file backwards-compatibility require…

    … a version
    
    bump. This new version will be '3-alpha', which will eventually be bumped to
    '3' once the below config changes have stabilized.
    
    *: add tests and checks for v3 where appropriate
    estroz committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    5d5e7d2 View commit details
    Browse the repository at this point in the history
  8. test/e2e: add v3 tests

    testdata: add v3 test data
    estroz committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    706019b View commit details
    Browse the repository at this point in the history
  9. pkg/plugin: inject command name from Context so help messages contain

    the correct command name
    
    pkg/cli: use layout or cliPluginKeys in error messages if no plugin
    for a command is found
    estroz committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    cd2d948 View commit details
    Browse the repository at this point in the history

Commits on Apr 18, 2020

  1. pkg/cli: move --plugins to init, since phase 1 only allows one plugin

    to be used for scaffolding at a time, and a config's 'layout' value
    should be used for other commands. Also change the implementation of
    resolvePluginsByKey to only match one key, and add tests
    estroz committed Apr 18, 2020
    Configuration menu
    Copy the full SHA
    3596e21 View commit details
    Browse the repository at this point in the history

Commits on Apr 28, 2020

  1. *: fix validation of default values, update license years, and make

    all encode/decode operations on a Config methods
    estroz committed Apr 28, 2020
    Configuration menu
    Copy the full SHA
    1ee71ec View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a639be0 View commit details
    Browse the repository at this point in the history
  3. pkg/model/config: use Version3Alpha variable name for project version…

    … "3-alpha",
    
    and update all references
    
    pkg/cli: generalize layout key check for future v3 project version types
    estroz committed Apr 28, 2020
    Configuration menu
    Copy the full SHA
    8093011 View commit details
    Browse the repository at this point in the history