Skip to content

Commit

Permalink
change test ns knative-serving to knative-testing
Browse files Browse the repository at this point in the history
  • Loading branch information
xu zhao committed Jan 17, 2019
1 parent db5d6f2 commit 50e45de
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 7 deletions.
6 changes: 3 additions & 3 deletions cmd/queue/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ import (
"github.com/knative/serving/pkg/http/h2c"
"github.com/knative/serving/pkg/logging"
"github.com/knative/serving/pkg/queue"
"github.com/knative/serving/pkg/system"
_ "github.com/knative/serving/pkg/system/testing"
"github.com/knative/serving/pkg/utils"
"go.opencensus.io/exporter/prometheus"
"go.opencensus.io/stats/view"
Expand Down Expand Up @@ -70,6 +68,7 @@ var (
servingRevision string
servingRevisionKey string
servingAutoscaler string
acNamespaces string
servingAutoscalerPort int
userTargetPort int
containerConcurrency int
Expand All @@ -94,6 +93,7 @@ func initEnv() {
servingNamespace = util.GetRequiredEnvOrFatal("SERVING_NAMESPACE", logger)
servingRevision = util.GetRequiredEnvOrFatal("SERVING_REVISION", logger)
servingAutoscaler = util.GetRequiredEnvOrFatal("SERVING_AUTOSCALER", logger)
acNamespaces = util.GetRequiredEnvOrFatal("AUTOSCALER_NAMESPACE", logger)
servingAutoscalerPort = util.MustParseIntEnvOrFatal("SERVING_AUTOSCALER_PORT", logger)
containerConcurrency = util.MustParseIntEnvOrFatal("CONTAINER_CONCURRENCY", logger)
revisionTimeoutSeconds = util.MustParseIntEnvOrFatal("REVISION_TIMEOUT_SECONDS", logger)
Expand Down Expand Up @@ -304,7 +304,7 @@ func main() {
}()

// Open a websocket connection to the autoscaler
autoscalerEndpoint := fmt.Sprintf("ws://%s.%s.svc.%s:%d", servingAutoscaler, system.Namespace(), utils.GetClusterDomainName(), servingAutoscalerPort)
autoscalerEndpoint := fmt.Sprintf("ws://%s.%s.svc.%s:%d", servingAutoscaler, acNamespaces, utils.GetClusterDomainName(), servingAutoscalerPort)
logger.Infof("Connecting to autoscaler at %s", autoscalerEndpoint)
statSink = websocket.NewDurableSendingConnection(autoscalerEndpoint)
go statReporter()
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/v1alpha1/autoscaling/kpa/kpa_scaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ import (
"github.com/knative/serving/pkg/apis/serving/v1alpha1"
clientset "github.com/knative/serving/pkg/client/clientset/versioned"
fakeKna "github.com/knative/serving/pkg/client/clientset/versioned/fake"
_ "github.com/knative/serving/pkg/system/testing"
revisionresources "github.com/knative/serving/pkg/reconciler/v1alpha1/revision/resources"
"github.com/knative/serving/pkg/reconciler/v1alpha1/revision/resources/names"
_ "github.com/knative/serving/pkg/system/testing"
v1 "k8s.io/api/apps/v1"
autoscalingv1 "k8s.io/api/autoscaling/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down
1 change: 1 addition & 0 deletions pkg/reconciler/v1alpha1/autoscaling/kpa/kpa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
"github.com/knative/serving/pkg/reconciler"
revisionresources "github.com/knative/serving/pkg/reconciler/v1alpha1/revision/resources"
"github.com/knative/serving/pkg/system"
_ "github.com/knative/serving/pkg/system/testing"
"go.uber.org/atomic"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
Expand Down
4 changes: 4 additions & 0 deletions pkg/reconciler/v1alpha1/revision/resources/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func makeQueueContainer(rev *v1alpha1.Revision, loggingConfig *logging.Config, a
}

autoscalerAddress := "autoscaler"
autoscalerNamespacs := "knative-serving"
userPort := getUserPort(rev)

var loggingLevel string
Expand Down Expand Up @@ -131,6 +132,9 @@ func makeQueueContainer(rev *v1alpha1.Revision, loggingConfig *logging.Config, a
}, {
Name: "USER_PORT",
Value: strconv.Itoa(int(userPort)),
}, {
Name: "AUTOSCALER_NAMESPACE",
Value: autoscalerNamespacs,
}},
}
}
3 changes: 2 additions & 1 deletion pkg/system/testing/names.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ import (
)

func init() {
os.Setenv(system.NamespaceEnvKey, "knative-serving")
os.Setenv(system.NamespaceEnvKey, "knative-testing")

}
5 changes: 5 additions & 0 deletions test/config/300-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,8 @@ spec:
# This is the Go import path for the binary that is containerized
# and substituted here.
image: github.com/knative/serving/test/controller
env:
- name: SYSTEM_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
3 changes: 1 addition & 2 deletions test/crd_checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (

pkgTest "github.com/knative/pkg/test"
"github.com/knative/serving/pkg/apis/serving/v1alpha1"
"github.com/knative/serving/pkg/system"
"github.com/pkg/errors"
"go.opencensus.io/trace"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -205,5 +204,5 @@ func CheckServiceState(client *ServingClients, name string, inState func(s *v1al

// GetConfigMap gets the knative serving config map.
func GetConfigMap(client *pkgTest.KubeClient) k8styped.ConfigMapInterface {
return client.Kube.CoreV1().ConfigMaps(system.Namespace())
return client.Kube.CoreV1().ConfigMaps("knative-serving")
}

0 comments on commit 50e45de

Please sign in to comment.