diff --git a/README.md b/README.md index c846121..31443c5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ -

diff --git a/deploy/k8s.yaml b/deploy/k8s.yaml index 32084db..0ef75ed 100644 --- a/deploy/k8s.yaml +++ b/deploy/k8s.yaml @@ -13,7 +13,6 @@ spec: metadata: labels: app: app-a - annotations: spec: containers: - name: app-a @@ -37,7 +36,6 @@ spec: metadata: labels: app: app-b - annotations: spec: containers: - name: app-b @@ -61,7 +59,6 @@ spec: metadata: labels: app: app-c - annotations: spec: containers: - name: app-c diff --git a/smi-test/trafficAccess/00-assert.yaml b/smi-test/trafficAccess/00-assert.yaml new file mode 100644 index 0000000..30e87f7 --- /dev/null +++ b/smi-test/trafficAccess/00-assert.yaml @@ -0,0 +1,14 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: traffictargets.access.smi-spec.io +spec: + group: access.smi-spec.io +status: + acceptedNames: + kind: TrafficTarget + shortNames: + - tt + plural: traffictargets + singular: traffictarget + diff --git a/smi-test/trafficAccess/01-assert.yaml b/smi-test/trafficAccess/01-assert.yaml new file mode 100644 index 0000000..ca3552d --- /dev/null +++ b/smi-test/trafficAccess/01-assert.yaml @@ -0,0 +1,125 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: app-a + labels: + app: app-a +spec: + replicas: 1 + selector: + matchLabels: + app: app-a + template: + metadata: + labels: + app: app-a + spec: + containers: + - name: app-a + image: layer5/sample-app-service:dev + imagePullPolicy: Never + ports: + - containerPort: 9091 +status: + availableReplicas: 1 + readyReplicas: 1 + replicas: 1 + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: app-b + labels: + app: app-b +spec: + replicas: 1 + selector: + matchLabels: + app: app-b + template: + metadata: + labels: + app: app-b + spec: + containers: + - name: app-b + image: layer5/sample-app-service:dev + imagePullPolicy: Never + ports: + - containerPort: 9091 +status: + availableReplicas: 1 + readyReplicas: 1 + replicas: 1 + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: app-c + labels: + app: app-c +spec: + replicas: 1 + selector: + matchLabels: + app: app-c + template: + metadata: + labels: + app: app-c + spec: + containers: + - name: app-c + image: layer5/sample-app-service:dev + imagePullPolicy: Never + ports: + - containerPort: 9091 +status: + availableReplicas: 1 + readyReplicas: 1 + replicas: 1 + +--- +apiVersion: v1 +kind: Service +metadata: + name: service-a +spec: + type: NodePort + selector: + app: app-a + ports: + - name: http + protocol: TCP + port: 9091 + targetPort: 9091 +--- +apiVersion: v1 +kind: Service +metadata: + name: service-b +spec: + type: ClusterIP + selector: + app: app-b + ports: + - name: http + protocol: TCP + port: 9091 + targetPort: 9091 +--- +apiVersion: v1 +kind: Service +metadata: + name: service-c +spec: + type: ClusterIP + selector: + app: app-c + ports: + - name: http + protocol: TCP + port: 9091 + targetPort: 9091 diff --git a/smi-test/trafficAccess/01-install.yaml b/smi-test/trafficAccess/01-install.yaml new file mode 100644 index 0000000..0ef75ed --- /dev/null +++ b/smi-test/trafficAccess/01-install.yaml @@ -0,0 +1,110 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: app-a + labels: + app: app-a +spec: + replicas: 1 + selector: + matchLabels: + app: app-a + template: + metadata: + labels: + app: app-a + spec: + containers: + - name: app-a + image: layer5/sample-app-service:dev + imagePullPolicy: Never + ports: + - containerPort: 9091 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: app-b + labels: + app: app-b +spec: + replicas: 1 + selector: + matchLabels: + app: app-b + template: + metadata: + labels: + app: app-b + spec: + containers: + - name: app-b + image: layer5/sample-app-service:dev + imagePullPolicy: Never + ports: + - containerPort: 9091 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: app-c + labels: + app: app-c +spec: + replicas: 1 + selector: + matchLabels: + app: app-c + template: + metadata: + labels: + app: app-c + spec: + containers: + - name: app-c + image: layer5/sample-app-service:dev + imagePullPolicy: Never + ports: + - containerPort: 9091 +--- +apiVersion: v1 +kind: Service +metadata: + name: service-a +spec: + type: NodePort + selector: + app: app-a + ports: + - name: http + protocol: TCP + port: 9091 + targetPort: 9091 +--- +apiVersion: v1 +kind: Service +metadata: + name: service-b +spec: + type: ClusterIP + selector: + app: app-b + ports: + - name: http + protocol: TCP + port: 9091 + targetPort: 9091 +--- +apiVersion: v1 +kind: Service +metadata: + name: service-c +spec: + type: ClusterIP + selector: + app: app-c + ports: + - name: http + protocol: TCP + port: 9091 + targetPort: 9091 diff --git a/smi-test/trafficAccess/02-traffic.yaml b/smi-test/trafficAccess/02-traffic.yaml new file mode 100644 index 0000000..d0a9078 --- /dev/null +++ b/smi-test/trafficAccess/02-traffic.yaml @@ -0,0 +1,9 @@ +apiVersion: kudo.dev/v1alpha1 +kind: TestStep +delete: +- apiVersion: v1 + kind: Pod + name: my-pod +commands: +- command: chmod +x ./execThis.sh +- command: sh ./execThis.sh \ No newline at end of file diff --git a/smi-test/trafficAccess/execThis.sh b/smi-test/trafficAccess/execThis.sh new file mode 100755 index 0000000..db67625 --- /dev/null +++ b/smi-test/trafficAccess/execThis.sh @@ -0,0 +1,7 @@ + +echo $(kubectl get service service-a --namespace=$NAMESPACE -o jsonpath="{.spec.ports[0].nodePort}") +kubectl describe pods --namespace=$NAMESPACE +curl --location --request POST 'http://localhost:'$(echo $(kubectl get service service-a --namespace=$NAMESPACE -o jsonpath="{.spec.ports[0].nodePort}"))'/call' -w "%{http_code}" --data-raw '{"host": "http://service-b/post",}' + + +curl --location --request GET 'localhost:'$(echo $(kubectl get service service-a --namespace=$NAMESPACE -o jsonpath="{.spec.ports[0].nodePort}"))'/metrics' --header 'Content-Type: application/json' --data-raw '{"hello": "bye"}' \ No newline at end of file diff --git a/smi-test/trafficSpecs/00-assert.yaml b/smi-test/trafficSpecs/00-assert.yaml new file mode 100644 index 0000000..dce1376 --- /dev/null +++ b/smi-test/trafficSpecs/00-assert.yaml @@ -0,0 +1,32 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: httproutegroups.specs.smi-spec.io +spec: + group: specs.smi-spec.io + scope: Namespaced +status: + acceptedNames: + kind: HTTPRouteGroup + shortNames: + - htr + plural: httproutegroups + singular: httproutegroup + +--- + +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: tcproutes.specs.smi-spec.io +spec: + group: specs.smi-spec.io + scope: Namespaced +status: + acceptedNames: + kind: TCPRoute + shortNames: + - tr + plural: tcproutes + singular: tcproute + diff --git a/smi-test/trafficSplit/00-assert.yaml b/smi-test/trafficSplit/00-assert.yaml new file mode 100644 index 0000000..cdb1401 --- /dev/null +++ b/smi-test/trafficSplit/00-assert.yaml @@ -0,0 +1,15 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: trafficsplits.split.smi-spec.io +spec: + group: split.smi-spec.io + scope: Namespaced +status: + acceptedNames: + kind: TrafficSplit + listKind: TrafficSplitList + plural: trafficsplits + singular: trafficsplit + shortNames: + - ts