Skip to content

Commit

Permalink
check: Replace [www.]google.com with [jenkins.]cilium.io
Browse files Browse the repository at this point in the history
Use [jenkins.]cilium.io for FQDN tests to reduce external dependencies.

Ref: #367

Signed-off-by: Michi Mutsuzaki <[email protected]>
  • Loading branch information
michi-covalent committed Jun 29, 2021
1 parent ee9deee commit 34cb7c8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ To install Cilium while automatically detected:
-------------------------------------------------------------------------------------------
🔌 Validating from pod cilium-test/client-9f579495f-b2pcq to outside of cluster...
-------------------------------------------------------------------------------------------
✅ client pod client-9f579495f-b2pcq was able to communicate with google.com
✅ client pod client-9f579495f-b2pcq was able to communicate with cilium.io
-------------------------------------------------------------------------------------------
🔌 Validating from pod cilium-test/client-9f579495f-b2pcq to local host...
-------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -191,7 +191,7 @@ To install Cilium while automatically detected:
Jan 6 13:41:22.096: 10.0.0.11:45040 -> 172.217.168.46:443 to-stack FORWARDED (TCP Flags: ACK, RST)
Jan 6 13:41:22.097: 172.217.168.46:443 -> 10.0.0.11:45040 to-endpoint FORWARDED (TCP Flags: ACK, FIN)
Jan 6 13:41:22.097: 10.0.0.11:45040 -> 172.217.168.46:443 to-stack FORWARDED (TCP Flags: RST)
✅ client pod client-9f579495f-b2pcq was able to communicate with google.com
✅ client pod client-9f579495f-b2pcq was able to communicate with cilium.io
-------------------------------------------------------------------------------------------
🔌 Validating from pod cilium-test/client-9f579495f-b2pcq to local host...
-------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
namespace: cilium-test
name: client-egress-to-fqdns-google
name: client-egress-to-fqdns-cilium-io
spec:
endpointSelector:
matchLabels:
Expand All @@ -17,7 +17,7 @@ spec:
- method: "GET"
path: "/"
toFQDNs:
- matchName: "google.com"
- matchName: "cilium.io"
- toPorts:
- ports:
- port: "53"
Expand Down
14 changes: 7 additions & 7 deletions connectivity/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ var (
//go:embed manifests/client-ingress-from-client2.yaml
clientIngressFromClient2PolicyYAML string

//go:embed manifests/client-egress-to-fqdns-google.yaml
clientEgressToFQDNsGooglePolicyYAML string
//go:embed manifests/client-egress-to-fqdns-cilium-io.yaml
clientEgressToFQDNsCiliumIOPolicyYAML string

//go:embed manifests/echo-ingress-from-other-client.yaml
echoIngressFromOtherClientPolicyYAML string
Expand Down Expand Up @@ -79,7 +79,7 @@ func Run(ctx context.Context, ct *check.ConnectivityTest) error {
ct.NewTest("dns-only").WithPolicy(clientEgressOnlyDNSPolicyYAML).
WithScenarios(
tests.PodToPod(""), // connects to other Pods directly, no DNS
tests.PodToWorld(""), // resolves google.com
tests.PodToWorld(""), // resolves cilium.io
).
WithExpectations(
func(a *check.Action) (egress check.Result, ingress check.Result) {
Expand Down Expand Up @@ -117,17 +117,17 @@ func Run(ctx context.Context, ct *check.ConnectivityTest) error {
tests.PodToPod(""),
)

// This policy only allows port 80 to "google.com". DNS proxy enabled.
ct.NewTest("to-fqdns").WithPolicy(clientEgressToFQDNsGooglePolicyYAML).
// This policy only allows port 80 to "cilium.io". DNS proxy enabled.
ct.NewTest("to-fqdns").WithPolicy(clientEgressToFQDNsCiliumIOPolicyYAML).
WithScenarios(
tests.PodToWorld(""),
).WithExpectations(func(a *check.Action) (egress, ingress check.Result) {

if a.Destination().Port() == 80 && a.Destination().Address() == "google.com" {
if a.Destination().Port() == 80 && a.Destination().Address() == "cilium.io" {
egress = check.ResultDNSOK
egress.HTTP = check.HTTP{
Method: "GET",
URL: "http://google.com/",
URL: "http://cilium.io/",
}
return egress, check.ResultNone
}
Expand Down
22 changes: 11 additions & 11 deletions connectivity/tests/world.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/cilium/cilium-cli/connectivity/check"
)

// PodToWorld sends multiple HTTP(S) requests to google.com
// PodToWorld sends multiple HTTP(S) requests to cilium.io
// from random client Pods.
func PodToWorld(name string) check.Scenario {
return &podToWorld{
Expand All @@ -43,15 +43,15 @@ func (s *podToWorld) Name() string {
}

func (s *podToWorld) Run(ctx context.Context, t *check.Test) {
ghttp := check.HTTPEndpoint("google-http", "http://google.com")
ghttps := check.HTTPEndpoint("google-https", "https://google.com")
wwwghttp := check.HTTPEndpoint("www-google-http", "http://www.google.com")
chttp := check.HTTPEndpoint("cilium-io-http", "http://cilium.io")
chttps := check.HTTPEndpoint("cilium-io-https", "https://cilium.io")
jhttp := check.HTTPEndpoint("jenkins-cilium-io-http", "http://jenkins.cilium.io")

// With https, over port 443.
if client := t.Context().RandomClientPod(); client != nil {
cmd := curl(ghttps)
cmd := curl(chttps)

t.NewAction(s, "https-to-google", client, ghttps).Run(func(a *check.Action) {
t.NewAction(s, "https-to-cilium-io", client, chttps).Run(func(a *check.Action) {
a.ExecInPod(ctx, cmd)

a.ValidateFlows(ctx, client, a.GetEgressRequirements(check.FlowParameters{
Expand All @@ -63,9 +63,9 @@ func (s *podToWorld) Run(ctx context.Context, t *check.Test) {

// With http, over port 80.
if client := t.Context().RandomClientPod(); client != nil {
cmd := curl(ghttp)
cmd := curl(chttp)

t.NewAction(s, "http-to-google", client, ghttp).Run(func(a *check.Action) {
t.NewAction(s, "http-to-cilium-io", client, chttp).Run(func(a *check.Action) {
a.ExecInPod(ctx, cmd)

a.ValidateFlows(ctx, client, a.GetEgressRequirements(check.FlowParameters{
Expand All @@ -75,11 +75,11 @@ func (s *podToWorld) Run(ctx context.Context, t *check.Test) {
})
}

// With http to www.google.com.
// With http to jenkins.cilium.io
if client := t.Context().RandomClientPod(); client != nil {
cmd := curl(wwwghttp)
cmd := curl(jhttp)

t.NewAction(s, "http-to-www-google", client, wwwghttp).Run(func(a *check.Action) {
t.NewAction(s, "http-to-jenkins-cilium", client, jhttp).Run(func(a *check.Action) {
a.ExecInPod(ctx, cmd)

a.ValidateFlows(ctx, client, a.GetEgressRequirements(check.FlowParameters{
Expand Down

0 comments on commit 34cb7c8

Please sign in to comment.