Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
k8s-ingress
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
uplex-varnish
k8s-ingress
Commits
08d5b70e
Commit
08d5b70e
authored
May 03, 2024
by
Tim Leers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: skip unhealty deployments
parent
8efe0888
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
212 additions
and
1 deletion
+212
-1
ingress.go
pkg/controller/ingress.go
+3
-1
Makefile
test/e2e/unhealtyPod/Makefile
+58
-0
README.md
test/e2e/unhealtyPod/README.md
+1
-0
cafe-ingress.yaml
test/e2e/unhealtyPod/cafe-ingress.yaml
+35
-0
cafe.vtc
test/e2e/unhealtyPod/cafe.vtc
+33
-0
cafe.yaml
test/e2e/unhealtyPod/cafe.yaml
+67
-0
verify.sh
test/e2e/unhealtyPod/verify.sh
+15
-0
No files found.
pkg/controller/ingress.go
View file @
08d5b70e
...
...
@@ -227,6 +227,7 @@ func (worker *NamespaceWorker) ingBackend2Addrs(
backend
net_v1
.
IngressBackend
,
)
(
addrs
[]
vcl
.
Address
,
extName
string
,
extPort
string
,
status
update
.
Status
)
{
nsLister
:=
worker
.
listers
.
svc
.
Services
(
namespace
)
svc
,
err
:=
nsLister
.
Get
(
backend
.
Service
.
Name
)
if
err
!=
nil
{
status
=
IncompleteIfNotFound
(
err
,
"%v"
,
err
)
...
...
@@ -560,7 +561,7 @@ func (worker *NamespaceWorker) ings2VCLSpec(ings []*net_v1.Ingress) (
addrs
,
extName
,
extPort
,
status
:=
worker
.
ingBackend2Addrs
(
namespace
,
*
backend
)
if
status
.
IsError
()
{
return
vclSpec
,
bcfgs
,
onlds
,
status
continue
}
vclSvc
,
bcfg
,
onload
,
status
:=
worker
.
getVCLSvc
(
namespace
,
backend
.
Service
.
Name
,
...
...
@@ -599,6 +600,7 @@ func (worker *NamespaceWorker) ings2VCLSpec(ings []*net_v1.Ingress) (
addrs
,
extName
,
extPort
,
status
:=
worker
.
ingBackend2Addrs
(
namespace
,
path
.
Backend
)
if
status
.
IsError
()
{
return
vclSpec
,
bcfgs
,
onlds
,
status
}
...
...
test/e2e/unhealtyPod/Makefile
0 → 100644
View file @
08d5b70e
# Copyright (c) 2020 UPLEX Nils Goroll Systemoptimierung
# All rights reserved
#
# Author: Geoffrey Simmons <geoffrey.simmons@uplex.de>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
# GNU make is required.
mkpath
:=
$
(
abspath
$
(
lastword
$(MAKEFILE_LIST)
))
mkdir
:=
$
(
dir
$(mkpath)
)
TESTDIR
=
$(mkdir)
/../../../test
all
:
deploy
deploy-kubectl
:
@
kubectl create
-f
cafe.yaml
@
kubectl create
-f
cafe-ingress.yaml
deploy
:
deploy-kubectl
# TESTOPTS are passed to varnishtest, e.g.: make TESTOPTS=-v verify
verify
:
$(mkdir)
/verify.sh
wait
:
@
echo
Waiting
until
varnish-ingress Pods are not configured
for
Ingress
$(TESTDIR)
/wait.sh
app
=
varnish-ingress
uninstall-kubectl
:
@
kubectl delete
-f
cafe-ingress.yaml
@
kubectl delete
-f
cafe.yaml
undeploy-kubectl
:
uninstall-kubectl wait
undeploy
:
undeploy-kubectl
.PHONY
:
all $(MAKECMDGOALS)
test/e2e/unhealtyPod/README.md
0 → 100644
View file @
08d5b70e
# TODO documentation
test/e2e/unhealtyPod/cafe-ingress.yaml
0 → 100644
View file @
08d5b70e
apiVersion
:
networking.k8s.io/v1
kind
:
Ingress
metadata
:
name
:
cafe-ingress-varnish
spec
:
ingressClassName
:
viking-controller.uplex.de
rules
:
-
host
:
cafe.example.com
http
:
paths
:
-
path
:
/coffee
pathType
:
ImplementationSpecific
backend
:
service
:
name
:
coffee-svc
port
:
number
:
80
---
apiVersion
:
networking.k8s.io/v1
kind
:
Ingress
metadata
:
name
:
tea-ingress-varnish
spec
:
ingressClassName
:
viking-controller.uplex.de
rules
:
-
host
:
tea.example.com
http
:
paths
:
-
path
:
/tea
pathType
:
ImplementationSpecific
backend
:
service
:
name
:
tea-svc
port
:
number
:
80
test/e2e/unhealtyPod/cafe.vtc
0 → 100644
View file @
08d5b70e
# looks like -*- vcl -*-
varnishtest "cafe example (hello world for Ingress)"
# The beresp may send Connection:close, if Varnish went to pipe due to
# primary-only. So we run each test in a separate connection.
client c1 -connect "${localhost} ${localport}" {
txreq -url /coffee/foo/bar -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 200
expect resp.body ~ "(?m)^URI: /coffee/foo/bar$"
expect resp.body ~ "(?m)^Server name: coffee-[a-z0-9]+-[a-z0-9]+$"
} -run
client c1 -connect "${localhost} ${localport}" {
txreq -url /muckefuck/baz/quux -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 200
expect resp.body ~ "(?m)^URI: /muckefuck/baz/quux$"
expect resp.body ~ "(?m)^Server name: muckefuck-[a-z0-9]+-[a-z0-9]+$"
} -run
client c1 -connect "${localhost} ${localport}" {
txreq -url /coffee/foo/bar
rxresp
expect resp.status == 404
} -run
client c1 -connect "${localhost} ${localport}" {
txreq -url /milk -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 404
} -run
test/e2e/unhealtyPod/cafe.yaml
0 → 100644
View file @
08d5b70e
apiVersion
:
apps/v1
kind
:
Deployment
metadata
:
name
:
coffee
spec
:
replicas
:
7
selector
:
matchLabels
:
app
:
coffee
template
:
metadata
:
labels
:
app
:
coffee
spec
:
containers
:
-
name
:
coffee
image
:
nginxdemos/hello:plain-text
ports
:
-
containerPort
:
80
---
apiVersion
:
v1
kind
:
Service
metadata
:
name
:
coffee-svc
spec
:
ports
:
-
port
:
80
targetPort
:
80
protocol
:
TCP
name
:
http
selector
:
app
:
coffee
---
apiVersion
:
apps/v1
kind
:
Deployment
metadata
:
name
:
tea
spec
:
replicas
:
3
selector
:
matchLabels
:
app
:
tea
template
:
metadata
:
labels
:
app
:
tea
spec
:
containers
:
-
name
:
tea
image
:
nginxdemos/hello:plain-text
ports
:
-
containerPort
:
80
command
:
[
"
/bin/bash"
,
"
-c"
,
"
exit
1"
]
---
apiVersion
:
v1
kind
:
Service
metadata
:
name
:
tea-svc
labels
:
spec
:
ports
:
-
port
:
80
targetPort
:
80
protocol
:
TCP
name
:
http
selector
:
app
:
tea
test/e2e/unhealtyPod/verify.sh
0 → 100755
View file @
08d5b70e
#! /bin/bash -ex
MYDIR
=
$(
dirname
${
BASH_SOURCE
[0]
})
source
${
MYDIR
}
/../../../test/utils.sh
LOCALPORT
=
${
LOCALPORT
:-
8888
}
wait_until_ready
app
=
varnish-ingress
wait_until_configured
app
=
varnish-ingress
kubectl port-forward svc/varnish-ingress
${
LOCALPORT
}
:80
>
/dev/null &
trap
'kill $(jobs -p)'
EXIT
wait_for_port
${
LOCALPORT
}
varnishtest
${
TESTOPTS
}
-Dlocalport
=
${
LOCALPORT
}
cafe.vtc
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment