Skip to content

Commit

Permalink
resolve conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Sindweller committed Nov 17, 2021
2 parents d825c18 + 774077a commit 11e39a3
Show file tree
Hide file tree
Showing 16 changed files with 95 additions and 13 deletions.
1 change: 1 addition & 0 deletions docs/en/latest/deployments/ack.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ helm install apisix apisix/apisix \
--set etcd.persistence.storageClass="alicloud-disk-ssd" \
--set etcd.persistence.size="20Gi" \
--namespace ingress-apisix
--set ingress-controller.config.apisix.serviceNamespace=ingress-apisix
kubectl get service --namespace ingress-apisix
```

Expand Down
1 change: 1 addition & 0 deletions docs/en/latest/deployments/aws.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ helm install apisix apisix/apisix \
--set gateway.type=LoadBalancer \
--set ingress-controller.enabled=true \
--namespace ingress-apisix
--set ingress-controller.config.apisix.serviceNamespace=ingress-apisix
kubectl get service --namespace ingress-apisix
```

Expand Down
1 change: 1 addition & 0 deletions docs/en/latest/deployments/azure.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ helm install apisix apisix/apisix \
--set gateway.type=LoadBalancer \
--set ingress-controller.enabled=true \
--namespace ingress-apisix
--set ingress-controller.config.apisix.serviceNamespace=ingress-apisix
kubectl get service --namespace ingress-apisix
```

Expand Down
1 change: 1 addition & 0 deletions docs/en/latest/deployments/gke.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ helm install apisix apisix/apisix \
--set gateway.type=LoadBalancer \
--set ingress-controller.enabled=true \
--namespace ingress-apisix
--set ingress-controller.config.apisix.serviceNamespace=ingress-apisix
kubectl get service --namespace ingress-apisix
```

Expand Down
1 change: 1 addition & 0 deletions docs/en/latest/deployments/k3s-rke.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ helm install apisix apisix/apisix \
--set gateway.type=NodePort \
--set ingress-controller.enabled=true \
--namespace ingress-apisix \
--set ingress-controller.config.apisix.serviceNamespace=ingress-apisix
--kubeconfig /etc/rancher/k3s/k3s.yaml
kubectl get service --namespace ingress-apisix
```
Expand Down
1 change: 1 addition & 0 deletions docs/en/latest/deployments/kubesphere.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ helm install apisix apisix/apisix \
--set gateway.type=NodePort \
--set ingress-controller.enabled=true \
--namespace ingress-apisix
--set ingress-controller.config.apisix.serviceNamespace=ingress-apisix
kubectl get service --namespace ingress-apisix
```

Expand Down
1 change: 1 addition & 0 deletions docs/en/latest/deployments/minikube.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ helm install apisix apisix/apisix \
--set gateway.type=NodePort \
--set ingress-controller.enabled=true \
--namespace ingress-apisix
--set ingress-controller.config.apisix.serviceNamespace=ingress-apisix
kubectl get service --namespace ingress-apisix
```

Expand Down
1 change: 1 addition & 0 deletions docs/en/latest/deployments/tke.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ helm install apisix apisix/apisix \
--set ingress-controller.enabled=true \
--set etcd.persistence.size="10Gi" \
--namespace ingress-apisix
--set ingress-controller.config.apisix.serviceNamespace=ingress-apisix
kubectl get service --namespace ingress-apisix
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ In this guide, we assume that your APISIX is installed with `ssl` enabled, which
For example, you could install APISIX and APISIX ingress controller by running:

```bash
helm install apisix apisix/apisix --set gateway.type=NodePort --set ingress-controller.enabled=true --set gateway.tls.enabled=true
helm install apisix apisix/apisix --set gateway.type=NodePort --set ingress-controller.enabled=true --set gateway.tls.enabled=true --set ingress-controller.config.apisix.serviceNamespace=default
```

Assume that the SSL port is `9443`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ In this guide, we assume that your APISIX is installed with `ssl` enabled, which
For example, you could install APISIX and APISIX ingress controller by running:

```bash
helm install apisix apisix/apisix --set gateway.type=NodePort --set ingress-controller.enabled=true --set gateway.tls.enabled=true
helm install apisix apisix/apisix --set gateway.type=NodePort --set ingress-controller.enabled=true --set gateway.tls.enabled=true --set ingress-controller.config.apisix.serviceNamespace=default
```

Assume that the SSL port is `9443`.
Expand Down
2 changes: 1 addition & 1 deletion docs/en/latest/practices/proxy-grpc-service.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ kubectl create ns ingress-apisix
You could install APISIX and APISIX ingress controller by running:

```bash
helm install apisix apisix/apisix -n ingress-apisix --set gateway.type=NodePort --set ingress-controller.enabled=true --set gateway.tls.enabled=true
helm install apisix apisix/apisix -n ingress-apisix --set gateway.type=NodePort --set ingress-controller.enabled=true --set gateway.tls.enabled=true --set ingress-controller.config.apisix.serviceNamespace=ingress-apisix
```

Check that all related components have been installed successfully, including ETCD cluster / APISIX / apisix-ingress-controller.
Expand Down
4 changes: 2 additions & 2 deletions pkg/kube/apisix/apis/config/v2alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ type ApisixRouteHTTPMatchExpr struct {
Op string `json:"op" yaml:"op"`
// Set is an array type object of the expression.
// It should be used when the Op is "in" or "not_in";
Set []string `json:"set" yaml:"set"`
Set []string `json:"set,omitempty" yaml:"set,omitempty"`
// Value is the normal type object for the expression,
// it should be used when the Op is not "in" and "not_in".
// Set and Value are exclusive so only of them can be set
// in the same time.
Value *string `json:"value" yaml:"value"`
Value *string `json:"value,omitempty" yaml:"value,omitempty"`
}

// ApisixRouteHTTPMatchExprSubject describes the route match expression subject.
Expand Down
54 changes: 51 additions & 3 deletions test/e2e/ingress/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,56 @@ spec:
resp.Body().Contains("x-my-value")
})
ginkgo.It("stream udp proxy", func() {
assert.Nil(ginkgo.GinkgoT(), s.CreateResourceFromString(`
apiVersion: apps/v1
kind: Deployment
metadata:
name: coredns
spec:
replicas: 1
selector:
matchLabels:
app: coredns
template:
metadata:
labels:
app: coredns
spec:
containers:
- name: coredns
image: coredns/coredns:1.8.4
livenessProbe:
tcpSocket:
port: 53
initialDelaySeconds: 5
periodSeconds: 10
readinessProbe:
tcpSocket:
port: 53
initialDelaySeconds: 5
periodSeconds: 10
ports:
- name: dns
containerPort: 53
protocol: UDP
`))
assert.Nil(ginkgo.GinkgoT(), s.CreateResourceFromString(`
kind: Service
apiVersion: v1
metadata:
name: coredns
spec:
selector:
app: coredns
type: ClusterIP
ports:
- port: 53
targetPort: 53
protocol: UDP
`))

s.EnsureNumEndpointsReady(ginkgo.GinkgoT(), "coredns", 1)

apisixRoute := fmt.Sprintf(`
apiVersion: apisix.apache.org/v2beta2
kind: ApisixRoute
Expand All @@ -84,11 +134,9 @@ spec:
match:
ingressPort: 9200
backend:
serviceName: kube-dns
serviceName: coredns
servicePort: 53
`)
// update namespace only for this case
s.UpdateNamespace("kube-system")
assert.Nil(ginkgo.GinkgoT(), s.CreateResourceFromString(apisixRoute))
defer func() {
err := s.RemoveResourceByString(apisixRoute)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/plugins/response_rewrite.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ spec:
location: https://a.com/b/c
x-changed-by: apisix
vars:
- ["status", "==", "200"]
- ["status", "==", 200]
`, backendSvc, backendPorts[0])

assert.Nil(ginkgo.GinkgoT(), s.CreateResourceFromString(ar))
Expand Down
2 changes: 0 additions & 2 deletions test/e2e/scaffold/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,6 @@ spec:
- http://apisix-service-e2e-test:9180/apisix/admin
- --default-apisix-cluster-admin-key
- edd1c9f034335f136f87ad84b625c8f1
- --app-namespace
- kube-system
- --namespace-selector
- %s
- --apisix-route-version
Expand Down
32 changes: 30 additions & 2 deletions test/e2e/scaffold/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"context"
"encoding/json"
"github.com/apache/apisix-ingress-controller/pkg/metrics"
"fmt"
"io/ioutil"
"net/http"
"net/url"
Expand All @@ -28,6 +29,8 @@ import (
"github.com/apache/apisix-ingress-controller/pkg/apisix"
v1 "github.com/apache/apisix-ingress-controller/pkg/types/apisix/v1"
"github.com/gruntwork-io/terratest/modules/k8s"
"github.com/gruntwork-io/terratest/modules/retry"
"github.com/gruntwork-io/terratest/modules/testing"
"github.com/onsi/ginkgo"
"github.com/stretchr/testify/assert"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -275,7 +278,6 @@ func (s *Scaffold) ListApisixUpstreams() ([]*v1.Upstream, error) {
err = cli.AddCluster(context.Background(), &apisix.ClusterOptions{
BaseURL: u.String(),
AdminKey: s.opts.APISIXAdminAPIKey,
MetricsCollector: metrics.NewPrometheusCollector(),
})
if err != nil {
return nil, err
Expand All @@ -297,7 +299,6 @@ func (s *Scaffold) ListApisixGlobalRules() ([]*v1.GlobalRule, error) {
err = cli.AddCluster(context.Background(), &apisix.ClusterOptions{
BaseURL: u.String(),
AdminKey: s.opts.APISIXAdminAPIKey,
MetricsCollector: metrics.NewPrometheusCollector(),
})
if err != nil {
return nil, err
Expand Down Expand Up @@ -474,3 +475,30 @@ func (s *Scaffold) newAPISIXTunnels() error {
func (s *Scaffold) Namespace() string {
return s.kubectlOptions.Namespace
}

func (s *Scaffold) EnsureNumEndpointsReady(t testing.TestingT, endpointsName string, desired int) {
e, err := k8s.GetKubernetesClientFromOptionsE(t, s.kubectlOptions)
assert.Nil(t, err, "get kubernetes client")
statusMsg := fmt.Sprintf("Wait for endpoints %s to be ready.", endpointsName)
message := retry.DoWithRetry(
t,
statusMsg,
20,
5*time.Second,
func() (string, error) {
endpoints, err := e.CoreV1().Endpoints(s.Namespace()).Get(context.Background(), endpointsName, metav1.GetOptions{})
if err != nil {
return "", err
}
readyNum := 0
for _, subset := range endpoints.Subsets {
readyNum += len(subset.Addresses)
}
if readyNum == desired {
return "Service is now available", nil
}
return fmt.Sprintf("Endpoints not ready yet, expect %v, actual %v", desired, readyNum), nil
},
)
ginkgo.GinkgoT().Log(message)
}

0 comments on commit 11e39a3

Please sign in to comment.