Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run Cilium CLI L7 tests #24414

Merged
merged 3 commits into from
Mar 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/conformance-aks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ env:
location: westeurope
cost_reduction: --node-vm-size Standard_B2s --node-osdisk-size 30
# renovate: datasource=github-releases depName=cilium/cilium-cli
cilium_cli_version: v0.13.1
cilium_cli_version: v0.13.2
check_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}

jobs:
Expand Down Expand Up @@ -164,6 +164,8 @@ jobs:
--helm-set=hubble.relay.image.repository=quay.io/${{ env.QUAY_ORGANIZATION_DEV }}/hubble-relay-ci \
--helm-set=hubble.relay.image.tag=${SHA} \
--helm-set=debug.enabled=true \
--helm-set loadBalancer.l7.backend=envoy \
--helm-set tls.secretsBackend=k8s \
--azure-resource-group ${{ env.name }} \
--wait=false \
--rollback=false \
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/conformance-eks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ env:
clusterName: ${{ github.repository_owner }}-${{ github.event.repository.name }}-${{ github.run_id }}
region: us-east-2
# renovate: datasource=github-releases depName=cilium/cilium-cli
cilium_cli_version: v0.13.1
cilium_cli_version: v0.13.2
check_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
eksctl_version: v0.122.0
kubectl_version: v1.23.6
Expand Down Expand Up @@ -162,6 +162,8 @@ jobs:
--helm-set=clustermesh.apiserver.image.useDigest=false \
--helm-set=hubble.relay.image.repository=quay.io/${{ env.QUAY_ORGANIZATION_DEV }}/hubble-relay-ci \
--helm-set=hubble.relay.image.tag=${SHA} \
--helm-set loadBalancer.l7.backend=envoy \
--helm-set tls.secretsBackend=k8s \
--wait=false \
--rollback=false \
--config monitor-aggregation=none \
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/conformance-gke.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ env:
clusterName: ${{ github.repository_owner }}-${{ github.event.repository.name }}-${{ github.run_id }}
zone: us-west2-a
# renovate: datasource=github-releases depName=cilium/cilium-cli
cilium_cli_version: v0.13.1
cilium_cli_version: v0.13.2
check_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
USE_GKE_GCLOUD_AUTH_PLUGIN: True
k8s_version: 1.24
Expand Down Expand Up @@ -163,6 +163,8 @@ jobs:
--helm-set=hubble.relay.image.repository=quay.io/${{ env.QUAY_ORGANIZATION_DEV }}/hubble-relay-ci \
--helm-set=hubble.relay.image.tag=${SHA} \
--helm-set=agentNotReadyTaintKey=ignore-taint.cluster-autoscaler.kubernetes.io/cilium-agent-not-ready \
--helm-set loadBalancer.l7.backend=envoy \
--helm-set tls.secretsBackend=k8s \
--wait=false \
--rollback=false \
--config monitor-aggregation=none \
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/conformance-kind.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ env:
kind_version: v0.17.0
kind_config: .github/kind-config.yaml
# renovate: datasource=github-releases depName=cilium/cilium-cli
cilium_cli_version: v0.13.1
cilium_cli_version: v0.13.2

jobs:
installation-and-connectivity:
Expand Down Expand Up @@ -64,6 +64,8 @@ jobs:
--helm-set=hubble.relay.image.repository=quay.io/${{ env.QUAY_ORGANIZATION_DEV }}/hubble-relay-ci \
--helm-set=hubble.relay.image.tag=${SHA} \
--helm-set cni.chainingMode=portmap \
--helm-set loadBalancer.l7.backend=envoy \
--helm-set tls.secretsBackend=k8s \
--wait=false \
--rollback=false \
--config monitor-aggregation=none \
Expand Down
4,524 changes: 0 additions & 4,524 deletions test/k8s/manifests/ca.crt

This file was deleted.

18 changes: 0 additions & 18 deletions test/k8s/manifests/internal-lyft.crt

This file was deleted.

27 changes: 0 additions & 27 deletions test/k8s/manifests/internal-lyft.key

This file was deleted.

67 changes: 0 additions & 67 deletions test/k8s/manifests/l7-policy-TLS.yaml

This file was deleted.

22 changes: 0 additions & 22 deletions test/k8s/manifests/testCA.crt

This file was deleted.

30 changes: 0 additions & 30 deletions test/k8s/manifests/testCA.key

This file was deleted.

56 changes: 0 additions & 56 deletions test/k8s/net_policies.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ var _ = SkipDescribeIf(func() bool {
ciliumFilename string
demoPath string
l3Policy string
l7PolicyTLS string
TLSCaCerts string
TLSLyftCrt string
TLSLyftKey string
TLSCa string
connectivityCheckYml string

app1Service = "app1-service"
Expand All @@ -56,11 +51,6 @@ var _ = SkipDescribeIf(func() bool {

demoPath = helpers.ManifestGet(kubectl.BasePath(), "demo-named-port.yaml")
l3Policy = helpers.ManifestGet(kubectl.BasePath(), "l3-l4-policy.yaml")
l7PolicyTLS = helpers.ManifestGet(kubectl.BasePath(), "l7-policy-TLS.yaml")
TLSCaCerts = helpers.ManifestGet(kubectl.BasePath(), "testCA.crt")
TLSLyftCrt = helpers.ManifestGet(kubectl.BasePath(), "internal-lyft.crt")
TLSLyftKey = helpers.ManifestGet(kubectl.BasePath(), "internal-lyft.key")
TLSCa = helpers.ManifestGet(kubectl.BasePath(), "ca.crt")
connectivityCheckYml = kubectl.GetFilePath("../examples/kubernetes/connectivity-check/connectivity-check-proxy.yaml")

daemonCfg = map[string]string{
Expand Down Expand Up @@ -88,7 +78,6 @@ var _ = SkipDescribeIf(func() bool {
var (
ciliumPod string
clusterIP string
appPods map[string]string
namespaceForTest string
)

Expand All @@ -106,7 +95,6 @@ var _ = SkipDescribeIf(func() bool {

clusterIP, _, err = kubectl.GetServiceHostPort(namespaceForTest, app1Service)
Expect(err).To(BeNil(), "Cannot get service in %q namespace", namespaceForTest)
appPods = helpers.GetAppPods(apps, namespaceForTest, kubectl, "id")
logger.WithFields(logrus.Fields{
"ciliumPod": ciliumPod,
"clusterIP": clusterIP}).Info("Initial data")
Expand Down Expand Up @@ -137,50 +125,6 @@ var _ = SkipDescribeIf(func() bool {
_ = kubectl.Exec(cmd)
})

SkipItIf(helpers.SkipQuarantined, "TLS policy", func() {
By("Testing L7 Policy with TLS")

res := kubectl.CreateSecret("generic", "user-agent", "default", "--from-literal=user-agent=CURRL")
res.ExpectSuccess("Cannot create secret %s", "user-agent")

res = kubectl.CreateSecret("generic", "test-client", "default", "--from-file="+TLSCa)
res.ExpectSuccess("Cannot create secret %s", "test-client")

res = kubectl.CreateSecret("tls", "lyft-server", "default", "--cert="+TLSLyftCrt+" --key="+TLSLyftKey)
res.ExpectSuccess("Cannot create secret %s", "lyft-server")

res = kubectl.CopyFileToPod(namespaceForTest, appPods[helpers.App2], TLSCaCerts, "/cacert.pem")
res.ExpectSuccess("Cannot copy certs to %s", appPods[helpers.App2])

res = kubectl.CopyFileToPod(namespaceForTest, appPods[helpers.App3], TLSCaCerts, "/cacert.pem")
res.ExpectSuccess("Cannot copy certs to %s", appPods[helpers.App3])

_, err := kubectl.CiliumPolicyAction(
namespaceForTest, l7PolicyTLS, helpers.KubectlApply, helpers.HelperTimeout)
Expect(err).Should(BeNil(), "Cannot install %q policy", l7PolicyTLS)

res = kubectl.ExecPodCmd(
namespaceForTest, appPods[helpers.App2],
helpers.CurlWithRetries("-4 %s https://www.lyft.com:443/privacy", 5, true, "-v --cacert /cacert.pem"))
res.ExpectSuccess("Cannot connect from %q to 'https://www.lyft.com:443/privacy'",
appPods[helpers.App2])

res = kubectl.ExecPodCmd(
namespaceForTest, appPods[helpers.App2],
helpers.CurlWithRetries("-4 %s https://www.lyft.com:443/private", 5, true, "-v --cacert /cacert.pem"))
res.ExpectFailWithError("403 Forbidden", "Unexpected connection from %q to 'https://www.lyft.com:443/private'",
appPods[helpers.App2])

By("Testing L7 Policy with TLS without HTTP rules")

res = kubectl.ExecPodCmd(
namespaceForTest, appPods[helpers.App3],
helpers.CurlWithRetries("-4 %s https://www.lyft.com:443/privacy", 5, true, "-v --cacert /cacert.pem"))
res.ExpectSuccess("Cannot connect from %q to 'https://www.lyft.com:443/privacy'",
appPods[helpers.App3])

}, 500)

It("Invalid Policy report status correctly", func() {
manifest := helpers.ManifestGet(kubectl.BasePath(), "invalid_cnp.yaml")
cnpName := "foo"
Expand Down