test clusterip

This commit is contained in:
Ashley Gau
2018-05-16 09:30:40 -07:00
parent 101dde0c22
commit 2c73d99fce
4 changed files with 57 additions and 0 deletions

View File

@@ -539,6 +539,22 @@ var _ = SIGDescribe("Loadbalancing: L7", func() {
jig.WaitForIngress(true)
})
It("should be able to create a ClusterIP service [Unreleased]", func() {
var err error
By("Create a basic HTTP ingress using NEG")
jig.CreateIngress(filepath.Join(framework.IngressManifestPath, "neg-clusterip"), ns, map[string]string{}, map[string]string{})
jig.WaitForIngress(true)
svcPorts := jig.GetServicePorts(false)
usingNEG, err := gceController.BackendServiceUsingNEG(svcPorts)
Expect(err).NotTo(HaveOccurred())
Expect(usingNEG).To(BeTrue())
// ClusterIP ServicePorts have no NodePort
for _, sp := range svcPorts {
Expect(sp.NodePort).To(Equal(int32(0)))
}
})
It("should sync endpoints to NEG", func() {
name := "hostname"
scaleAndValidateNEG := func(num int) {

View File

@@ -0,0 +1,8 @@
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: hostname
spec:
backend:
serviceName: hostname
servicePort: 80

View File

@@ -0,0 +1,18 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
run: hostname
name: hostname
spec:
minReadySeconds: 60
template:
metadata:
labels:
run: hostname
spec:
containers:
- image: gcr.io/kubernetes-e2e-test-images/serve-hostname-amd64:1.1
imagePullPolicy: IfNotPresent
name: hostname
terminationGracePeriodSeconds: 120

View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: hostname
annotations:
alpha.cloud.google.com/load-balancer-neg: "true"
spec:
ports:
- port: 80
protocol: TCP
targetPort: 9376
selector:
run: hostname
sessionAffinity: None
type: ClusterIP