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

Multiple selectors #217

Merged
merged 6 commits into from Jul 23, 2018
Merged

Multiple selectors #217

merged 6 commits into from Jul 23, 2018

Conversation

timfallmk
Copy link
Collaborator

@timfallmk timfallmk commented Jul 20, 2018

Closes #216

The only problem is that this changes the config file format, which cases Viper to barf on validation if it detects the old format. Should we add some sort of conversion here? @grampelberg

Updating Old Config Files:
This update introduces a slight change to the config file schema that allows use of multiple selectors (tags) when specifying a spec. Specs created prior to this version are not compatible and must be updated.

There are two options for updating configs:

  1. Delete and recreate the specs
  2. Update the selectors field

For option 2, you'll need to do the following:

The old config format specified a single key-value pair for configs, like so:

spec:
- name: intent-lacewing
  containername: ""
  pod: ""
  selector: app=test
  namespace: default

The new config format changes the selector value to a map, allowing more than one selector to be specified:

spec:
- name: intent-lacewing
  containername: ""
  pod: ""
  selector: 
  - app=test
  - tier=backend
  namespace: default

Change this field to a map with the appropriate values and it should validate correctly. You will need to reload kysnc watch to validate the new config.

When (re)creating specs, selectors can be passed in as comma-separated values --selector=app=test,tier=backend or as multiple flags -l app=test -l tier=backend.

Tim added 2 commits July 19, 2018 15:55
The slice of selectors is concatenated before passing to `metav1.ListOptions`
@grampelberg
Copy link
Collaborator

@timfallmk how about throwing a friendly error in and bumping the major version?

Tim added 3 commits July 23, 2018 12:23
This currently doesn't check the nested map structure properly. Leaving
it in the git log for future possible use.

This reverts commit 2d47de6.
@timfallmk
Copy link
Collaborator Author

@grampelberg I'll add the config "update" steps to the PR and Release Notes. This is ready for merging.

@timfallmk timfallmk merged commit d2c6365 into master Jul 23, 2018
@timfallmk timfallmk deleted the multiple-selectors branch July 23, 2018 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants