Skip to content

Commit

Permalink
Merge pull request #9 from layer5io/smi-conformace
Browse files Browse the repository at this point in the history
Added support to check for CRDs
  • Loading branch information
leecalcote authored Jun 22, 2020
2 parents c110733 + 9e02a61 commit 69a8677
Show file tree
Hide file tree
Showing 9 changed files with 312 additions and 4 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

<p style="text-align:center;" align="center">
<img align="center" src="https://raw.githubusercontent.com/layer5io/layer5/master/assets/images/layer5/layer5-tag-white-bg.png" width="45%" /></p>

Expand Down
3 changes: 0 additions & 3 deletions deploy/k8s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ spec:
metadata:
labels:
app: app-a
annotations:
spec:
containers:
- name: app-a
Expand All @@ -37,7 +36,6 @@ spec:
metadata:
labels:
app: app-b
annotations:
spec:
containers:
- name: app-b
Expand All @@ -61,7 +59,6 @@ spec:
metadata:
labels:
app: app-c
annotations:
spec:
containers:
- name: app-c
Expand Down
14 changes: 14 additions & 0 deletions smi-test/trafficAccess/00-assert.yaml
Original file line number Diff line number Diff line change
@@ -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

125 changes: 125 additions & 0 deletions smi-test/trafficAccess/01-assert.yaml
Original file line number Diff line number Diff line change
@@ -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
110 changes: 110 additions & 0 deletions smi-test/trafficAccess/01-install.yaml
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions smi-test/trafficAccess/02-traffic.yaml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions smi-test/trafficAccess/execThis.sh
Original file line number Diff line number Diff line change
@@ -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"}'
32 changes: 32 additions & 0 deletions smi-test/trafficSpecs/00-assert.yaml
Original file line number Diff line number Diff line change
@@ -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

15 changes: 15 additions & 0 deletions smi-test/trafficSplit/00-assert.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 69a8677

Please sign in to comment.