Skip to content

Commit

Permalink
Pick up the KindToResource helper. (knative#2075)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmoor authored and knative-prow-robot committed Sep 21, 2018
1 parent 69811e7 commit 6650128
Show file tree
Hide file tree
Showing 13 changed files with 149 additions and 13 deletions.
4 changes: 2 additions & 2 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ required = [
# HEAD as of 2018-09-20
revision = "2891231d4e47f80c9b72637da071468d7072cb62"

[[constraint]]
[[override]]
name = "github.com/knative/pkg"
# HEAD as of 2018-09-20
revision = "51f6214feeea1485dc8691a661d953fea1409402"
# HEAD as of 2018-09-21
revision = "f81d0f8f0fac9943f3892c5e86007dc00382a909"

[[constraint]]
name = "github.com/knative/caching"
Expand Down
8 changes: 2 additions & 6 deletions pkg/reconciler/v1alpha1/autoscaling/kpa_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package autoscaling

import (
"context"
"strings"
"sync"

"go.uber.org/zap"
Expand All @@ -27,6 +26,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/scale"

"github.com/knative/pkg/apis"
"github.com/knative/pkg/configmap"
"github.com/knative/pkg/logging"
kpa "github.com/knative/serving/pkg/apis/autoscaling/v1alpha1"
Expand Down Expand Up @@ -116,11 +116,7 @@ func (rs *kpaScaler) Scale(ctx context.Context, kpa *kpa.PodAutoscaler, desiredS
logger.Error("Unable to parse APIVersion.", zap.Error(err))
return err
}
resource := schema.GroupResource{
Group: gv.Group,
// TODO(mattmoor): Do something better than this.
Resource: strings.ToLower(kpa.Spec.ScaleTargetRef.Kind) + "s",
}
resource := apis.KindToResource(gv.WithKind(kpa.Spec.ScaleTargetRef.Kind)).GroupResource()
resourceName := kpa.Spec.ScaleTargetRef.Name

// Identify the current scale.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions vendor/github.com/knative/pkg/apis/duck/v1alpha1/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions vendor/github.com/knative/pkg/apis/duck/v1alpha1/sinkable_types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions vendor/github.com/knative/pkg/apis/interfaces.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions vendor/github.com/knative/pkg/apis/kind2resource.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6650128

Please sign in to comment.