Skip to content

Commit

Permalink
Change the labelSelector field to just selector
Browse files Browse the repository at this point in the history
  • Loading branch information
jgustie committed Mar 25, 2021
1 parent ebb71ea commit 0bc0388
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion internal/readers/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func NewKubernetesReader(k *konjurev1beta2.Kubernetes) kio.Reader {
cmd.Args = append(cmd.Args, "get")
cmd.Args = append(cmd.Args, "--ignore-not-found")
cmd.Args = append(cmd.Args, "--output", "yaml")
cmd.Args = append(cmd.Args, "--selector", k.LabelSelector)
cmd.Args = append(cmd.Args, "--selector", k.Selector)
if len(k.Types) > 0 {
cmd.Args = append(cmd.Args, strings.Join(k.Types, ","))
} else {
Expand Down
2 changes: 1 addition & 1 deletion internal/spec/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ func (p *Parser) parseKubernetesSpec(spec string) (interface{}, error) {
}

k8s := &konjurev1beta2.Kubernetes{}
k8s.LabelSelector = u.Query().Get("labelSelector")
k8s.Selector = u.Query().Get("labelSelector")
if parts[0] != "" {
k8s.Namespaces = []string{parts[0]}
}
Expand Down
6 changes: 3 additions & 3 deletions internal/spec/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ func TestParser_Decode(t *testing.T) {
desc: "kubernetes default deployments of application 'test'",
spec: "k8s:default/deployments?labelSelector=app.kubernetes.io/name%3Dtest",
expected: &konjurev1beta2.Kubernetes{
Namespaces: []string{"default"},
Types: []string{"deployments"},
LabelSelector: "app.kubernetes.io/name=test",
Namespaces: []string{"default"},
Types: []string{"deployments"},
Selector: "app.kubernetes.io/name=test",
},
},
{
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/core/v1beta2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ type Kubernetes struct {
// The list of resource types to include. Defaults to "deployments,statefulsets,configmaps".
Types []string `json:"types,omitempty" yaml:"types,omitempty"`
// A label selector to limit which resources are included. Defaults to "" (match everything).
LabelSelector string `json:"labelSelector,omitempty" yaml:"labelSelector,omitempty"`
Selector string `json:"selector,omitempty" yaml:"selector,omitempty"`
}

// Kustomize is used to expand kustomizations.
Expand Down

0 comments on commit 0bc0388

Please sign in to comment.