-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16305 from deads2k/route-02-field-selector
Automatic merge from submit-queue (batch tested with PRs 16089, 16305, 16219, 15934, 16366) fix the route field selectors This makes the field selectors for routes work correctly and makes a slightly different pattern which works with the upstream defaulting and fieldkey methods so that we won't slip on object meta updates in the future. It also uses the actual scheme registration to determine if the field key conversion methods work.
- Loading branch information
Showing
11 changed files
with
181 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
package route | ||
|
||
import "k8s.io/apimachinery/pkg/fields" | ||
import ( | ||
"fmt" | ||
|
||
// RouteToSelectableFields returns a label set that represents the object | ||
func RouteToSelectableFields(route *Route) fields.Set { | ||
return fields.Set{ | ||
"metadata.name": route.Name, | ||
"metadata.namespace": route.Namespace, | ||
"spec.path": route.Spec.Path, | ||
"spec.host": route.Spec.Host, | ||
"spec.to.name": route.Spec.To.Name, | ||
"k8s.io/apimachinery/pkg/fields" | ||
runtime "k8s.io/apimachinery/pkg/runtime" | ||
) | ||
|
||
func RouteFieldSelector(obj runtime.Object, fieldSet fields.Set) error { | ||
route, ok := obj.(*Route) | ||
if !ok { | ||
return fmt.Errorf("%T not a Route", obj) | ||
} | ||
fieldSet["spec.path"] = route.Spec.Path | ||
fieldSet["spec.host"] = route.Spec.Host | ||
fieldSet["spec.to.name"] = route.Spec.To.Name | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.