fix: remove non-existed namespaces and separate bases (#541)

Signed-off-by: bitliu <bitliu@tencent.com>
This commit is contained in:
Xunzhuo
2023-09-19 17:12:38 +08:00
committed by GitHub
parent 8062625d75
commit 8d8ad6d624
6 changed files with 346 additions and 254 deletions

View File

@@ -0,0 +1,119 @@
# Copyright (c) 2022 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This file contains the base resources that most conformance tests will rely
# on. This includes 3 namespaces along with Gateways, Services and Deployments
# that can be used as backends for routing traffic. The most important
# resources included are the Gateways (all in the higress-conformance-infra
# namespace):
# - same-namespace (only supports route in same ns)
# - all-namespaces (supports routes in all ns)
# - backend-namespaces (supports routes in ns with backend label)
apiVersion: v1
kind: Pod
metadata:
name: consul-standlone
namespace: higress-conformance-app-backend
labels:
name: consul-standlone
spec:
containers:
- name: consul
image: docker.io/hashicorp/consul:1.16.0
resources:
requests:
cpu: 10m
ports:
- containerPort: 8500
name: http
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
name: consul-service
namespace: higress-conformance-app-backend
labels:
name: consul-standlone
spec:
clusterIP: None
ports:
- name: http-query
port: 8500
protocol: TCP
targetPort: 8500
selector:
name: consul-standlone
---
apiVersion: v1
kind: Pod
metadata:
name: httpbin
namespace: higress-conformance-app-backend
spec:
containers:
- name: httpbin
image: registry.cn-hangzhou.aliyuncs.com/2456868764/httpbin:1.0.2
command:
- /app/httpbin
- --registry-type=consul
- --consul-server-address=consul-service:8500
- --server-port=8080
- --service-tags=higress,httpbin
env:
- name: SERVICE_NAME
value: httpbin
- name: VERSION
value: v1
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: SERVICE_ACCOUNT
valueFrom:
fieldRef:
fieldPath: spec.serviceAccountName
ports:
- containerPort: 8080
name: http
protocol: TCP
readinessProbe:
failureThreshold: 5
httpGet:
path: /ping
port: 8080
scheme: HTTP
periodSeconds: 20
successThreshold: 1
timeoutSeconds: 1
livenessProbe:
httpGet:
path: /ping
port: 8080
scheme: HTTP
initialDelaySeconds: 20
periodSeconds: 20

View File

@@ -0,0 +1,39 @@
# Copyright (c) 2022 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This file contains the base resources that most conformance tests will rely
# on. This includes 3 namespaces along with Gateways, Services and Deployments
# that can be used as backends for routing traffic. The most important
# resources included are the Gateways (all in the higress-conformance-infra
# namespace):
# - same-namespace (only supports route in same ns)
# - all-namespaces (supports routes in all ns)
# - backend-namespaces (supports routes in ns with backend label)
apiVersion: v1
kind: Pod
metadata:
name: dubbo-demo-provider
namespace: higress-conformance-app-backend
spec:
containers:
- name: dubbo-demo-provider
image: registry.cn-hangzhou.aliyuncs.com/hinsteny/dubbo-provider-demo:0.0.2
env:
- name: NACOS_K8S_NAMESPACE
value: higress-conformance-app-backend
- name: DUBBO_GROUP
value: dev
ports:
- containerPort: 20880

View File

@@ -0,0 +1,125 @@
# Copyright (c) 2022 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This file contains the base resources that most conformance tests will rely
# on. This includes 3 namespaces along with Gateways, Services and Deployments
# that can be used as backends for routing traffic. The most important
# resources included are the Gateways (all in the higress-conformance-infra
# namespace):
# - same-namespace (only supports route in same ns)
# - all-namespaces (supports routes in all ns)
# - backend-namespaces (supports routes in ns with backend label)
apiVersion: v1
kind: ConfigMap
metadata:
name: eureka-cm
namespace: higress-conformance-app-backend
data:
# if you want to deploy n instances of eureka cluster,
# you should set eureka_service_address: http://eureka-0.eureka:8761/eureka,...,http://eureka-(n-1).eureka:8761/eureka
eureka_service_address: "http://eureka-0.eureka.higress-conformance-app-backend.svc:8761/eureka"
---
apiVersion: v1
kind: Service
metadata:
name: eureka
namespace: higress-conformance-app-backend
labels:
app: eureka
spec:
clusterIP: None
ports:
- port: 8761
name: eureka
selector:
app: eureka
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: eureka
namespace: higress-conformance-app-backend
spec:
serviceName: eureka
# n instances
replicas: 1
selector:
matchLabels:
app: eureka
template:
metadata:
labels:
app: eureka
spec:
containers:
- name: eureka
image: bitinit/eureka
ports:
- containerPort: 8761
name: http
protocol: TCP
resources:
requests:
memory: "500Mi"
cpu: "500m"
env:
- name: EUREKA_SERVER_ADDRESS
valueFrom:
configMapKeyRef:
name: eureka-cm
key: eureka_service_address
- name: ENVIRONMENT
value: "prod"
- name: JVM_OPTS
value: "-Xms1g -Xmx1g"
livenessProbe:
httpGet:
path: /
port: 8761
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /
port: 8761
initialDelaySeconds: 30
periodSeconds: 10
---
apiVersion: v1
kind: Pod
metadata:
name: eureka-registry-provider
namespace: higress-conformance-app-backend
spec:
containers:
- name: eureka-registry-provider
image: charlie1380/eureka-registry-provider:v0.3.0
env:
- name: EUREKA_SERVER_ADDRESS
valueFrom:
configMapKeyRef:
name: eureka-cm
key: eureka_service_address
ports:
- containerPort: 8888
name: http
protocol: TCP
readinessProbe:
failureThreshold: 5
httpGet:
path: /healthz
port: 8888
scheme: HTTP
periodSeconds: 1

View File

@@ -318,250 +318,3 @@ spec:
resources:
requests:
cpu: 10m
---
apiVersion: v1
kind: Pod
metadata:
name: nacos-standlone-rc3
namespace: higress-conformance-app-backend
labels:
name: nacos-standlone-rc3
spec:
containers:
- name: nacos-standlone-rc3
image: registry.cn-hangzhou.aliyuncs.com/hinsteny/nacos-standlone-rc3:1.0.0-RC3
ports:
- containerPort: 8848
---
apiVersion: v1
kind: Service
metadata:
name: nacos-standlone-rc3-service
namespace: higress-conformance-app-backend
spec:
selector:
name: nacos-standlone-rc3
clusterIP: None
ports:
- name: foo # name is not required for single-port Services
port: 8848
---
apiVersion: v1
kind: Pod
metadata:
name: dubbo-demo-provider
namespace: higress-conformance-app-backend
spec:
containers:
- name: dubbo-demo-provider
image: registry.cn-hangzhou.aliyuncs.com/hinsteny/dubbo-provider-demo:0.0.2
env:
- name: NACOS_K8S_NAMESPACE
value: higress-conformance-app-backend
- name: DUBBO_GROUP
value: dev
ports:
- containerPort: 20880
---
apiVersion: v1
kind: Pod
metadata:
name: consul-standlone
namespace: higress-conformance-app-backend
labels:
name: consul-standlone
spec:
containers:
- name: consul
image: docker.io/hashicorp/consul:1.16.0
resources:
requests:
cpu: 10m
ports:
- containerPort: 8500
name: http
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
name: consul-service
namespace: higress-conformance-app-backend
labels:
name: consul-standlone
spec:
clusterIP: None
ports:
- name: http-query
port: 8500
protocol: TCP
targetPort: 8500
selector:
name: consul-standlone
---
apiVersion: v1
kind: Pod
metadata:
name: httpbin
namespace: higress-conformance-app-backend
spec:
containers:
- name: httpbin
image: registry.cn-hangzhou.aliyuncs.com/2456868764/httpbin:1.0.2
command:
- /app/httpbin
- --registry-type=consul
- --consul-server-address=consul-service:8500
- --server-port=8080
- --service-tags=higress,httpbin
env:
- name: SERVICE_NAME
value: httpbin
- name: VERSION
value: v1
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: SERVICE_ACCOUNT
valueFrom:
fieldRef:
fieldPath: spec.serviceAccountName
ports:
- containerPort: 8080
name: http
protocol: TCP
readinessProbe:
failureThreshold: 5
httpGet:
path: /ping
port: 8080
scheme: HTTP
periodSeconds: 20
successThreshold: 1
timeoutSeconds: 1
livenessProbe:
httpGet:
path: /ping
port: 8080
scheme: HTTP
initialDelaySeconds: 20
periodSeconds: 20
---
# Eureka service registry
---
apiVersion: v1
kind: ConfigMap
metadata:
name: eureka-cm
namespace: higress-conformance-app-backend
data:
# if you want to deploy n instances of eureka cluster,
# you should set eureka_service_address: http://eureka-0.eureka:8761/eureka,...,http://eureka-(n-1).eureka:8761/eureka
eureka_service_address: "http://eureka-0.eureka.higress-conformance-app-backend.svc:8761/eureka"
---
apiVersion: v1
kind: Service
metadata:
name: eureka
namespace: higress-conformance-app-backend
labels:
app: eureka
spec:
clusterIP: None
ports:
- port: 8761
name: eureka
selector:
app: eureka
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: eureka
namespace: higress-conformance-app-backend
spec:
serviceName: eureka
# n instances
replicas: 1
selector:
matchLabels:
app: eureka
template:
metadata:
labels:
app: eureka
spec:
containers:
- name: eureka
image: bitinit/eureka
ports:
- containerPort: 8761
name: http
protocol: TCP
resources:
requests:
memory: "500Mi"
cpu: "500m"
env:
- name: EUREKA_SERVER_ADDRESS
valueFrom:
configMapKeyRef:
name: eureka-cm
key: eureka_service_address
- name: ENVIRONMENT
value: "prod"
- name: JVM_OPTS
value: "-Xms1g -Xmx1g"
livenessProbe:
httpGet:
path: /
port: 8761
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /
port: 8761
initialDelaySeconds: 30
periodSeconds: 10
---
apiVersion: v1
kind: Pod
metadata:
name: eureka-registry-provider
namespace: higress-conformance-app-backend
spec:
containers:
- name: eureka-registry-provider
image: charlie1380/eureka-registry-provider:v0.3.0
env:
- name: EUREKA_SERVER_ADDRESS
valueFrom:
configMapKeyRef:
name: eureka-cm
key: eureka_service_address
ports:
- containerPort: 8888
name: http
protocol: TCP
readinessProbe:
failureThreshold: 5
httpGet:
path: /healthz
port: 8888
scheme: HTTP
periodSeconds: 1

View File

@@ -0,0 +1,49 @@
# Copyright (c) 2022 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This file contains the base resources that most conformance tests will rely
# on. This includes 3 namespaces along with Gateways, Services and Deployments
# that can be used as backends for routing traffic. The most important
# resources included are the Gateways (all in the higress-conformance-infra
# namespace):
# - same-namespace (only supports route in same ns)
# - all-namespaces (supports routes in all ns)
# - backend-namespaces (supports routes in ns with backend label)
apiVersion: v1
kind: Pod
metadata:
name: nacos-standlone-rc3
namespace: higress-conformance-app-backend
labels:
name: nacos-standlone-rc3
spec:
containers:
- name: nacos-standlone-rc3
image: registry.cn-hangzhou.aliyuncs.com/hinsteny/nacos-standlone-rc3:1.0.0-RC3
ports:
- containerPort: 8848
---
apiVersion: v1
kind: Service
metadata:
name: nacos-standlone-rc3-service
namespace: higress-conformance-app-backend
spec:
selector:
name: nacos-standlone-rc3
clusterIP: None
ports:
- name: foo # name is not required for single-port Services
port: 8848

View File

@@ -33,7 +33,7 @@ type ConformanceTestSuite struct {
IngressClassName string
Debug bool
Cleanup bool
BaseManifests string
BaseManifests []string
Applier kubernetes.Applier
SkipTests sets.Set
TimeoutConfig config.TimeoutConfig
@@ -51,7 +51,7 @@ type Options struct {
IngressClassName string
Debug bool
RoundTripper roundtripper.RoundTripper
BaseManifests string
BaseManifests []string
NamespaceLabels map[string]string
// Options for wasm extended features
WASMOptions
@@ -111,8 +111,14 @@ func New(s Options) *ConformanceTestSuite {
}
// apply defaults
if suite.BaseManifests == "" {
suite.BaseManifests = "base/manifests.yaml"
if suite.BaseManifests == nil {
suite.BaseManifests = []string{
"base/manifests.yaml",
"base/consul.yaml",
"base/dubbo.yaml",
"base/eureka.yaml",
"base/nacos.yaml",
}
}
return suite
@@ -126,7 +132,10 @@ func (suite *ConformanceTestSuite) Setup(t *testing.T) {
suite.Applier.IngressClass = suite.IngressClassName
t.Logf("📦 Test Setup: Applying base manifests")
suite.Applier.MustApplyWithCleanup(t, suite.Client, suite.TimeoutConfig, suite.BaseManifests, suite.Cleanup)
for _, baseManifest := range suite.BaseManifests {
suite.Applier.MustApplyWithCleanup(t, suite.Client, suite.TimeoutConfig, baseManifest, suite.Cleanup)
}
t.Logf("📦 Test Setup: Applying programmatic resources")
secret := kubernetes.MustCreateSelfSignedCertSecret(t, "higress-conformance-web-backend", "certificate", []string{"*"})
@@ -139,8 +148,6 @@ func (suite *ConformanceTestSuite) Setup(t *testing.T) {
"higress-conformance-infra",
"higress-conformance-app-backend",
"higress-conformance-web-backend",
"nacos-standlone-rc3",
"dubbo-demo-provider",
}
kubernetes.NamespacesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, namespaces)