Skip to content

Commit

Permalink
Remove unneeded constants. (#3974)
Browse files Browse the repository at this point in the history
* Remove unneeded constants.

* Fix tests.
  • Loading branch information
markusthoemmes authored and knative-prow-robot committed May 2, 2019
1 parent a70917e commit 1b6908c
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 73 deletions.
15 changes: 6 additions & 9 deletions pkg/reconciler/revision/resources/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,23 @@ const (
UserContainerName = "user-container"
// FluentdContainerName is the name of the fluentd sidecar when enabled
FluentdContainerName = "fluentd-proxy"
// EnvoyContainerName is the name of the envoy sidecar when enabled
EnvoyContainerName = "istio-proxy"
// QueueContainerName is the name of the queue proxy side car
QueueContainerName = "queue-proxy"

sidecarIstioInjectAnnotation = "sidecar.istio.io/inject"
// IstioOutboundIPRangeAnnotation defines the outbound ip ranges istio allows.
// TODO(mattmoor): Make this private once we remove revision_test.go
IstioOutboundIPRangeAnnotation = "traffic.sidecar.istio.io/includeOutboundIPRanges"

userPortEnvName = "PORT"

autoscalerPort = 8080

// ServicePort is the external port of the service
ServicePort = int32(80)
// AppLabelKey is the label defining the application's name.
AppLabelKey = "app"
)

var (
ProgressDeadlineSeconds int32 = 120
// ProgressDeadlineSeconds is the time in seconds we wait for the deployment to
// be ready before considering it failed.
ProgressDeadlineSeconds = int32(120)

// See https://github.com/knative/serving/pull/1124#issuecomment-397120430
// for how CPU and memory values were calculated.
fluentdContainerCPU = resource.MustParse("25m")
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/revision/resources/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func buildContainerPorts(userPort int32) []corev1.ContainerPort {

func buildUserPortEnv(userPort string) corev1.EnvVar {
return corev1.EnvVar{
Name: userPortEnvName,
Name: "PORT",
Value: userPort,
}
}
Expand Down
6 changes: 0 additions & 6 deletions pkg/reconciler/revision/resources/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ var (
}, {
Name: "SERVING_REVISION",
Value: "bar", // matches name
}, {
Name: "SERVING_AUTOSCALER",
Value: "autoscaler", // no autoscaler configured.
}, {
Name: "SERVING_AUTOSCALER_PORT",
Value: "8080",
}, {
Name: "QUEUE_SERVING_PORT",
Value: "8012",
Expand Down
7 changes: 0 additions & 7 deletions pkg/reconciler/revision/resources/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ func makeQueueContainer(rev *v1alpha1.Revision, loggingConfig *logging.Config, o
}
serviceName := rev.Labels[serving.ServiceLabelKey]

autoscalerAddress := "autoscaler"
userPort := getUserPort(rev)

var loggingLevel string
Expand Down Expand Up @@ -128,12 +127,6 @@ func makeQueueContainer(rev *v1alpha1.Revision, loggingConfig *logging.Config, o
}, {
Name: "SERVING_REVISION",
Value: rev.Name,
}, {
Name: "SERVING_AUTOSCALER",
Value: autoscalerAddress,
}, {
Name: "SERVING_AUTOSCALER_PORT",
Value: strconv.Itoa(autoscalerPort),
}, {
Name: "QUEUE_SERVING_PORT",
Value: strconv.Itoa(int(ports[len(ports)-1].ContainerPort)),
Expand Down
48 changes: 0 additions & 48 deletions pkg/reconciler/revision/resources/queue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,6 @@ func TestMakeQueueContainer(t *testing.T) {
}, {
Name: "SERVING_REVISION",
Value: "bar", // matches name
}, {
Name: "SERVING_AUTOSCALER",
Value: "autoscaler", // no autoscaler configured.
}, {
Name: "SERVING_AUTOSCALER_PORT",
Value: "8080",
}, {
Name: "QUEUE_SERVING_PORT",
Value: "8012",
Expand Down Expand Up @@ -180,12 +174,6 @@ func TestMakeQueueContainer(t *testing.T) {
}, {
Name: "SERVING_REVISION",
Value: "bar", // matches name
}, {
Name: "SERVING_AUTOSCALER",
Value: "autoscaler", // no autoscaler configured.
}, {
Name: "SERVING_AUTOSCALER_PORT",
Value: "8080",
}, {
Name: "QUEUE_SERVING_PORT",
Value: "8013",
Expand Down Expand Up @@ -269,12 +257,6 @@ func TestMakeQueueContainer(t *testing.T) {
}, {
Name: "SERVING_REVISION",
Value: "bar", // matches name
}, {
Name: "SERVING_AUTOSCALER",
Value: "autoscaler", // no autoscaler configured.
}, {
Name: "SERVING_AUTOSCALER_PORT",
Value: "8080",
}, {
Name: "QUEUE_SERVING_PORT",
Value: "8012",
Expand Down Expand Up @@ -358,12 +340,6 @@ func TestMakeQueueContainer(t *testing.T) {
}, {
Name: "SERVING_REVISION",
Value: "blah", // matches name
}, {
Name: "SERVING_AUTOSCALER",
Value: "autoscaler", // no autoscaler configured.
}, {
Name: "SERVING_AUTOSCALER_PORT",
Value: "8080",
}, {
Name: "QUEUE_SERVING_PORT",
Value: "8012",
Expand Down Expand Up @@ -446,12 +422,6 @@ func TestMakeQueueContainer(t *testing.T) {
}, {
Name: "SERVING_REVISION",
Value: "this", // matches name
}, {
Name: "SERVING_AUTOSCALER",
Value: "autoscaler", // no autoscaler configured.
}, {
Name: "SERVING_AUTOSCALER_PORT",
Value: "8080",
}, {
Name: "QUEUE_SERVING_PORT",
Value: "8012",
Expand Down Expand Up @@ -529,12 +499,6 @@ func TestMakeQueueContainer(t *testing.T) {
}, {
Name: "SERVING_REVISION",
Value: "bar", // matches name
}, {
Name: "SERVING_AUTOSCALER",
Value: "autoscaler", // no autoscaler configured.
}, {
Name: "SERVING_AUTOSCALER_PORT",
Value: "8080",
}, {
Name: "QUEUE_SERVING_PORT",
Value: "8012",
Expand Down Expand Up @@ -612,12 +576,6 @@ func TestMakeQueueContainer(t *testing.T) {
}, {
Name: "SERVING_REVISION",
Value: "bar", // matches name
}, {
Name: "SERVING_AUTOSCALER",
Value: "autoscaler", // no autoscaler configured.
}, {
Name: "SERVING_AUTOSCALER_PORT",
Value: "8080",
}, {
Name: "QUEUE_SERVING_PORT",
Value: "8012",
Expand Down Expand Up @@ -697,12 +655,6 @@ func TestMakeQueueContainer(t *testing.T) {
}, {
Name: "SERVING_REVISION",
Value: "bar", // matches name
}, {
Name: "SERVING_AUTOSCALER",
Value: "autoscaler", // no autoscaler configured.
}, {
Name: "SERVING_AUTOSCALER_PORT",
Value: "8080",
}, {
Name: "QUEUE_SERVING_PORT",
Value: "8012",
Expand Down
3 changes: 1 addition & 2 deletions pkg/reconciler/route/resources/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
"github.com/knative/serving/pkg/apis/networking"
netv1alpha1 "github.com/knative/serving/pkg/apis/networking/v1alpha1"
"github.com/knative/serving/pkg/apis/serving/v1alpha1"
"github.com/knative/serving/pkg/reconciler/revision/resources"
"github.com/knative/serving/pkg/reconciler/route/resources/names"
)

Expand Down Expand Up @@ -90,7 +89,7 @@ func makeServiceSpec(ingress *netv1alpha1.ClusterIngress) (*corev1.ServiceSpec,
Type: corev1.ServiceTypeClusterIP,
Ports: []corev1.ServicePort{{
Name: networking.ServicePortNameHTTP1,
Port: resources.ServicePort,
Port: networking.ServiceHTTPPort,
}},
}, nil
case len(balancer.IP) != 0:
Expand Down

0 comments on commit 1b6908c

Please sign in to comment.