This is an automated email from the ASF dual-hosted git repository. ashishtiwari pushed a commit to branch epnotfound in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git
commit 327808ff8adfff75208f2a51c7ade5598d9524bb Merge: 1c32d795 0385d285 Author: Ashish Tiwari <[email protected]> AuthorDate: Mon Jan 22 12:30:28 2024 +0530 merge master Signed-off-by: Ashish Tiwari <[email protected]> .asf.yaml | 6 + .github/ISSUE_TEMPLATE/bug_report.yml | 72 +- .github/ISSUE_TEMPLATE/feature_request.yml | 23 + .github/ISSUE_TEMPLATE/improve_docs.yml | 33 + .github/ISSUE_TEMPLATE/performance_issue.yml | 53 + .github/PULL_REQUEST_TEMPLATE | 15 +- .github/dependabot.yml | 9 + .../license-checker.yml => release-drafter.yml} | 41 +- .github/workflows/codeql-analysis.yml | 14 +- .github/workflows/dependency-review.yml | 7 +- .github/workflows/docker-push.yml | 61 + ...-ci-v2-cron.yml => e2e-test-ci-v2-cron-dev.yml} | 77 +- .github/workflows/e2e-test-ci-v2-cron.yml | 35 +- .github/workflows/e2e-test-ci.yml | 42 +- .github/workflows/goimports-reviser.yml | 11 +- .github/workflows/golangci-lint.yml | 13 +- .github/workflows/k8s-timer-ci.yml | 31 +- .github/workflows/license-checker.yml | 7 +- .github/workflows/lint-checker.yml | 23 +- .../{license-checker.yml => release-drafter.yml} | 24 +- .github/workflows/spell-checker.yml | 5 +- .github/workflows/unit-test-ci.yml | 11 +- .github/workflows/verify-codegen.yml | 11 +- .../{verify-codegen.yml => yamllint-checker.yml} | 47 +- .gitignore | 1 + .licenserc.yaml | 1 + .github/dependabot.yml => .yamllint.yml | 61 +- CHANGELOG.md | 358 + Dockerfile | 21 +- Makefile | 73 +- NOTICE | 2 +- README.md | 2 +- cmd/ingress/ingress.go | 22 +- cmd/ingress/ingress_test.go | 2 +- conf/apisix-schema.json | 11166 +++++++++++++++++++ conf/config-default.yaml | 21 +- .../ingress-apisix-composite-architecture.png | Bin 0 -> 151424 bytes ...ress-apisix-new-architecture-timing-diagram.png | Bin 0 -> 104324 bytes docs/en/latest/FAQ.md | 15 + docs/en/latest/composite.md | 131 + docs/en/latest/concepts/annotations.md | 84 + docs/en/latest/concepts/apisix_consumer.md | 108 + docs/en/latest/concepts/apisix_global_rule.md | 50 + docs/en/latest/concepts/apisix_plugin_config.md | 55 + docs/en/latest/concepts/apisix_route.md | 74 +- docs/en/latest/concepts/apisix_tls.md | 30 + docs/en/latest/config.json | 28 +- docs/en/latest/contribute.md | 2 +- docs/en/latest/deployments/ack.md | 18 +- docs/en/latest/deployments/aws.md | 20 +- docs/en/latest/deployments/azure.md | 20 +- docs/en/latest/deployments/gke.md | 18 +- docs/en/latest/deployments/k3s-rke.md | 18 +- docs/en/latest/deployments/kind.md | 19 +- docs/en/latest/deployments/kubesphere.md | 20 +- docs/en/latest/deployments/minikube.md | 18 +- .../latest/deployments/{kind.md => openshift.md} | 49 +- docs/en/latest/deployments/tke.md | 18 +- docs/en/latest/monitoring.md | 142 + docs/en/latest/plugins/traffic-split.md | 196 + docs/en/latest/references/apisix_consumer_v2.md | 46 + docs/en/latest/references/apisix_global_rule_v2.md | 37 + docs/en/latest/references/apisix_route_v2.md | 1 + docs/en/latest/references/apisix_tls_v2.md | 1 + docs/en/latest/references/apisix_upstream.md | 6 + docs/en/latest/references/v2.mdx | 3564 ++++++ docs/en/latest/tutorials/cert-manager/issuer.yaml | 2 +- docs/en/latest/tutorials/check-crd-status.md | 8 +- .../configure-ingress-with-gateway-api.md | 2 +- .../enable-authentication-and-restriction.md | 12 +- .../latest/tutorials/external-service-discovery.md | 15 + ...cess-Apache-APISIX-Prometheus-Metrics-on-k8s.md | 90 +- ...ow-to-avoid-race-condition-when-scaling-down.md | 63 + ...ow-to-use-go-plugin-runner-in-apisix-ingress.md | 2 +- docs/en/latest/tutorials/istio-egress-gateway.md | 270 + .../manage-certificates-with-cert-manager.md | 6 +- ...anage-ingress-certificates-with-cert-manager.md | 6 +- docs/en/latest/tutorials/mtls-bypass.md | 50 + docs/en/latest/tutorials/mtls.md | 59 +- docs/en/latest/tutorials/proxy-grpc-service.md | 24 +- docs/en/latest/tutorials/the-hard-way.md | 184 +- docs/en/latest/tutorials/using-custom-plugins.md | 223 + docs/en/latest/upgrade.md | 83 +- go.mod | 130 +- go.sum | 685 +- pkg/api/router/webhook.go | 10 +- pkg/api/server.go | 55 +- pkg/api/validation/apisix_consumer.go | 77 - .../validation/apisix_plugin_config.go} | 21 +- pkg/api/validation/apisix_route.go | 115 +- pkg/api/validation/apisix_route_test.go | 8 +- pkg/api/validation/apisix_tls.go | 77 - pkg/api/validation/apisix_upstream.go | 77 - pkg/api/validation/utils.go | 35 +- pkg/api/validation/utils_test.go | 4 +- pkg/api/validation/validator.go | 227 + pkg/apisix/apisix.go | 111 +- pkg/apisix/cache/cache.go | 6 +- pkg/apisix/cache/noop_db.go | 174 + pkg/apisix/cluster.go | 473 +- pkg/apisix/cluster_test.go | 16 +- pkg/apisix/consumer.go | 148 +- pkg/apisix/consumer_test.go | 17 +- pkg/apisix/global_rule.go | 158 +- pkg/apisix/global_rule_test.go | 17 +- pkg/apisix/nonexistentclient.go | 52 +- pkg/apisix/noop.go | 4 +- pkg/apisix/plugin_metadata.go | 142 +- pkg/apisix/plugin_test.go | 11 +- pkg/apisix/pluginconfig.go | 183 +- pkg/apisix/pluginconfig_test.go | 17 +- pkg/apisix/route.go | 160 +- pkg/apisix/route_test.go | 17 +- pkg/apisix/schema.go | 2 +- pkg/apisix/schema_test.go | 13 +- pkg/apisix/ssl.go | 158 +- pkg/apisix/ssl_test.go | 17 +- pkg/apisix/stream_route.go | 159 +- pkg/apisix/stream_route_test.go | 17 +- pkg/apisix/upstream.go | 191 +- pkg/apisix/upstream_test.go | 7 +- pkg/apisix/upstreamservicerelation.go | 4 +- pkg/apisix/upstreamservicerelation_test.go | 28 +- pkg/apisix/utils.go | 320 + pkg/apisix/validator.go | 138 + pkg/apisix/validator_test.go | 119 + pkg/config/config.go | 129 +- pkg/config/config_test.go | 121 +- pkg/id/idgen.go | 11 +- pkg/kube/apisix/apis/config/v1/doc.go | 18 - pkg/kube/apisix/apis/config/v1/types.go | 333 - .../apisix/apis/config/v1/zz_generated.deepcopy.go | 718 -- .../apisix/apis/config/v1/zz_generated.register.go | 73 - pkg/kube/apisix/apis/config/v2/types.go | 142 +- .../apisix/apis/config/v2/zz_generated.deepcopy.go | 155 +- .../apisix/apis/config/v2/zz_generated.register.go | 2 + pkg/kube/apisix/apis/config/v2beta3/doc.go | 18 - pkg/kube/apisix/apis/config/v2beta3/types.go | 708 -- .../apis/config/v2beta3/zz_generated.deepcopy.go | 1496 --- .../apis/config/v2beta3/zz_generated.register.go | 79 - .../apisix/client/clientset/versioned/clientset.go | 15 +- .../versioned/fake/clientset_generated.go | 7 - .../client/clientset/versioned/fake/register.go | 2 - .../client/clientset/versioned/scheme/register.go | 2 - .../versioned/typed/config/v2/apisixglobalrule.go | 194 + .../versioned/typed/config/v2/config_client.go | 5 + .../config/v2/fake/fake_apisixclusterconfig.go | 5 +- .../typed/config/v2/fake/fake_apisixconsumer.go | 5 +- .../typed/config/v2/fake/fake_apisixglobalrule.go | 140 + .../config/v2/fake/fake_apisixpluginconfig.go | 5 +- .../typed/config/v2/fake/fake_apisixroute.go | 5 +- .../typed/config/v2/fake/fake_apisixtls.go | 5 +- .../typed/config/v2/fake/fake_apisixupstream.go | 5 +- .../typed/config/v2/fake/fake_config_client.go | 4 + .../typed/config/v2/generated_expansion.go | 2 + .../typed/config/v2beta3/apisixclusterconfig.go | 183 - .../typed/config/v2beta3/apisixconsumer.go | 194 - .../typed/config/v2beta3/apisixpluginconfig.go | 194 - .../versioned/typed/config/v2beta3/apisixroute.go | 194 - .../versioned/typed/config/v2beta3/apisixtls.go | 194 - .../typed/config/v2beta3/apisixupstream.go | 194 - .../typed/config/v2beta3/config_client.go | 131 - .../versioned/typed/config/v2beta3/doc.go | 19 - .../v2beta3/fake/fake_apisixclusterconfig.go | 132 - .../config/v2beta3/fake/fake_apisixconsumer.go | 141 - .../config/v2beta3/fake/fake_apisixpluginconfig.go | 141 - .../typed/config/v2beta3/fake/fake_apisixroute.go | 141 - .../typed/config/v2beta3/fake/fake_apisixtls.go | 141 - .../config/v2beta3/fake/fake_apisixupstream.go | 141 - .../config/v2beta3/fake/fake_config_client.go | 59 - .../informers/externalversions/config/interface.go | 8 - .../apisixroute.go => v2/apisixglobalrule.go} | 44 +- .../externalversions/config/v2/interface.go | 7 + .../config/v2beta3/apisixclusterconfig.go | 88 - .../config/v2beta3/apisixconsumer.go | 89 - .../config/v2beta3/apisixpluginconfig.go | 89 - .../externalversions/config/v2beta3/apisixtls.go | 89 - .../config/v2beta3/apisixupstream.go | 89 - .../externalversions/config/v2beta3/interface.go | 79 - .../client/informers/externalversions/factory.go | 4 +- .../client/informers/externalversions/generic.go | 17 +- .../client/listers/config/v2/apisixglobalrule.go | 98 + .../listers/config/v2/expansion_generated.go | 8 + .../listers/config/v2beta3/apisixclusterconfig.go | 67 - .../listers/config/v2beta3/apisixconsumer.go | 98 - .../listers/config/v2beta3/apisixpluginconfig.go | 98 - .../client/listers/config/v2beta3/apisixroute.go | 98 - .../client/listers/config/v2beta3/apisixtls.go | 98 - .../listers/config/v2beta3/apisixupstream.go | 98 - .../listers/config/v2beta3/expansion_generated.go | 62 - pkg/kube/apisix_cluster_config.go | 47 +- pkg/kube/apisix_consumer.go | 56 +- pkg/kube/apisix_global_rule.go | 156 + pkg/kube/apisix_plugin_config.go | 55 +- pkg/kube/apisix_route.go | 59 +- pkg/kube/apisix_tls.go | 68 +- pkg/kube/apisix_upstream.go | 55 +- pkg/kube/ingress.go | 72 +- pkg/log/gin_logger.go | 14 +- pkg/log/gin_logger_test.go | 12 +- pkg/metrics/prometheus.go | 28 +- pkg/metrics/prometheus_test.go | 20 +- pkg/providers/apisix/apisix_cluster_config.go | 166 +- pkg/providers/apisix/apisix_consumer.go | 198 +- pkg/providers/apisix/apisix_global_rule.go | 452 + pkg/providers/apisix/apisix_plugin_config.go | 338 +- pkg/providers/apisix/apisix_route.go | 440 +- pkg/providers/apisix/apisix_tls.go | 445 +- pkg/providers/apisix/apisix_upstream.go | 314 +- pkg/providers/apisix/provider.go | 45 +- pkg/providers/apisix/provider_init.go | 68 - .../apisix/translation/apisix_cluster_config.go | 29 +- .../translation/apisix_cluster_config_test.go | 23 +- .../apisix/translation/apisix_consumer.go | 53 +- .../apisix/translation/apisix_consumer_test.go | 150 +- .../apisix/translation/apisix_global_rule.go | 77 + pkg/providers/apisix/translation/apisix_plugin.go | 248 +- .../apisix/translation/apisix_plugin_test.go | 185 +- .../apisix/translation/apisix_pluginconfig.go | 56 +- .../apisix/translation/apisix_pluginconfig_test.go | 22 +- pkg/providers/apisix/translation/apisix_route.go | 376 +- .../apisix/translation/apisix_route_test.go | 195 +- pkg/providers/apisix/translation/apisix_ssl.go | 50 +- .../apisix/translation/apisix_upstream.go | 3 + pkg/providers/apisix/translation/translator.go | 30 +- .../{gateway/types/types.go => apisix/utils.go} | 27 +- pkg/providers/controller.go | 239 +- pkg/providers/gateway/gateway.go | 17 +- pkg/providers/gateway/gateway_class.go | 3 - pkg/providers/gateway/gateway_httproute.go | 38 +- pkg/providers/gateway/gateway_tcproute.go | 39 +- pkg/providers/gateway/gateway_tlsroute.go | 11 +- pkg/providers/gateway/gateway_udproute.go | 12 +- pkg/providers/gateway/provider.go | 38 + pkg/providers/gateway/translation/gateway.go | 35 +- .../gateway/translation/gateway_httproute.go | 25 +- .../gateway/translation/gateway_httproute_test.go | 319 +- .../gateway/translation/gateway_tcproute_test.go | 1 - .../gateway/translation/gateway_tlsroute.go | 4 +- .../gateway/translation/gateway_udproute.go | 6 +- pkg/providers/gateway/types/types.go | 49 +- pkg/providers/gateway/validator.go | 274 + pkg/providers/ingress/ingress.go | 491 +- pkg/providers/ingress/ingress_test.go | 40 - pkg/providers/ingress/provider.go | 9 +- pkg/providers/ingress/translation/annotations.go | 6 +- .../annotations/plugins/response_rewrite.go | 5 + .../annotations/plugins/response_rewrite_test.go | 19 +- .../ingress/translation/annotations/types.go | 17 +- .../translation/annotations/upstream/upstream.go | 89 + .../annotations/upstream/upstream_test.go | 98 + .../annotations/upstreamscheme/upstreamscheme.go | 47 - .../upstreamscheme/upstreamscheme_test.go | 44 - pkg/providers/ingress/translation/translator.go | 280 +- .../ingress/translation/translator_test.go | 154 + pkg/providers/k8s/configmap/configmap.go | 26 +- pkg/providers/k8s/endpoint/base.go | 39 +- pkg/providers/k8s/endpoint/endpoint.go | 2 +- pkg/providers/k8s/endpoint/endpointslice.go | 4 +- pkg/providers/k8s/namespace/namespace.go | 20 +- pkg/providers/k8s/namespace/namespace_provider.go | 78 +- pkg/providers/k8s/secret.go | 7 +- pkg/providers/translation/apisix_upstream.go | 338 +- pkg/providers/translation/apisix_upstream_test.go | 433 +- pkg/providers/translation/context.go | 5 + pkg/providers/translation/service.go | 92 +- pkg/providers/translation/service_test.go | 6 +- pkg/providers/translation/translator.go | 7 +- pkg/providers/translation/translator_test.go | 67 - pkg/providers/types/types.go | 72 +- pkg/providers/utils/domain.go | 70 + pkg/providers/utils/domain_test.go | 46 + .../labels.go => providers/utils/ingress_class.go} | 24 +- pkg/providers/utils/ingress_status.go | 95 +- pkg/providers/utils/ingress_status_test.go | 185 + .../utils/insert_map.go} | 39 +- pkg/providers/utils/insert_map_test.go | 133 + pkg/providers/utils/manifest.go | 72 +- pkg/providers/utils/status.go | 16 + pkg/providers/utils/status_test.go | 102 + pkg/providers/utils/string.go | 9 + pkg/types/apisix/v1/plugin_types.go | 102 +- pkg/types/apisix/v1/types.go | 120 +- pkg/types/apisix/v1/zz_generated.deepcopy.go | 23 +- pkg/types/event.go | 14 + pkg/types/labels.go | 40 + pkg/types/labels_test.go | 31 + .../config/v2beta3/fake/doc.go => utils/s2b.go} | 13 +- pkg/{id/idgen.go => utils/s2b_test.go} | 40 +- powered-by.md | 1 + releases/v1.8.0.toml | 53 + samples/deploy/admission/webhook-certs.yaml | 9 +- samples/deploy/admission/webhook-registration.yaml | 37 +- samples/deploy/admission/webhook-service.yaml | 4 +- samples/deploy/composite.yaml | 504 + samples/deploy/configmap/apisix-ingress-cm.yaml | 58 +- samples/deploy/crd/v1/ApisixClusterConfig.yaml | 65 +- samples/deploy/crd/v1/ApisixConsumer.yaml | 192 +- ...isixPluginConfig.yaml => ApisixGlobalRule.yaml} | 65 +- samples/deploy/crd/v1/ApisixPluginConfig.yaml | 55 +- samples/deploy/crd/v1/ApisixRoute.yaml | 304 +- samples/deploy/crd/v1/ApisixTls.yaml | 448 +- samples/deploy/crd/v1/ApisixUpstream.yaml | 411 +- samples/deploy/crd/v1/kustomization.yaml | 1 + samples/deploy/deployment/ingress-controller.yaml | 48 +- .../gateway-api/v0.5.1/experimental-install.yaml | 7206 ------------ .../gateway-api/v0.5.1/standard-install.yaml | 4813 -------- .../gateway-api/v0.6.0/experimental-install.yaml | 9425 ++++++++++++++++ .../gateway-api/v0.6.0/standard-install.yaml | 5294 +++++++++ samples/deploy/rbac/apisix_view_clusterrole.yaml | 82 +- .../rbac/apisix_view_clusterrolebinding.yaml | 6 +- samples/deploy/rbac/service_account.yaml | 1 + samples/httpbin/httpbin-route.yaml | 90 + test/e2e/e2e.go | 17 +- test/e2e/go.mod | 141 +- test/e2e/go.sum | 678 +- test/e2e/scaffold/apisix.go | 32 +- test/e2e/scaffold/cluster_config.go | 24 +- test/e2e/scaffold/etcd.go | 13 +- test/e2e/scaffold/ingress.go | 388 +- test/e2e/scaffold/k8s.go | 69 +- test/e2e/scaffold/scaffold.go | 248 +- test/e2e/scaffold/ssl.go | 157 +- test/e2e/scaffold/test_backend.go | 91 +- test/e2e/scaffold/upstream_tls.go | 2 +- test/e2e/suite-annotations/authorization.go | 95 - test/e2e/suite-annotations/cors.go | 85 - test/e2e/suite-annotations/csrf.go | 54 - test/e2e/suite-annotations/forward_auth.go | 48 +- test/e2e/suite-annotations/http_method.go | 70 - test/e2e/suite-annotations/iprestriction.go | 58 - test/e2e/suite-annotations/plugin_conifg.go | 31 +- test/e2e/suite-annotations/redirect.go | 95 - test/e2e/suite-annotations/response_rewrite.go | 99 - test/e2e/suite-annotations/rewrite.go | 59 - test/e2e/suite-annotations/svc_namespace.go | 443 +- test/e2e/suite-annotations/upstreamprotocol.go | 33 - test/e2e/suite-annotations/upstreamretry.go | 97 + test/e2e/suite-annotations/websocket.go | 88 +- test/e2e/suite-chore/admin_api.go | 7 +- test/e2e/suite-chore/chaos.go | 6 +- test/e2e/suite-chore/config.go | 5 +- test/e2e/suite-chore/consistency.go | 179 +- test/e2e/suite-chore/endpoints.go | 14 +- test/e2e/suite-chore/resolvegranularity.go | 3 + test/e2e/suite-cluster/apisix_cluster_config.go | 289 + test/e2e/suite-cluster/status.go | 42 + test/e2e/suite-features/external-sd.go | 24 +- test/e2e/suite-features/external-service.go | 106 +- test/e2e/suite-features/global_rule.go | 161 +- test/e2e/suite-features/healthcheck.go | 11 +- test/e2e/suite-features/remote_addrs_match.go | 7 +- test/e2e/suite-features/retries.go | 18 +- test/e2e/suite-features/route_match_exprs.go | 36 +- test/e2e/suite-features/scheme.go | 11 +- test/e2e/suite-features/subset.go | 13 +- test/e2e/suite-features/sync-comparison.go | 186 + test/e2e/suite-features/sync-delay.go | 330 + test/e2e/suite-features/traffic_split.go | 7 +- .../{retries.go => upstream_pass_host.go} | 94 +- test/e2e/suite-features/websocket.go | 7 +- test/e2e/suite-gateway/gateway_httproute.go | 3 +- test/e2e/suite-gateway/gateway_udproute.go | 13 +- test/e2e/suite-gateway/route_attchment.go | 288 + .../suite-ingress-features/compare.go | 10 +- .../suite-ingress-features/ingress-class.go | 1073 ++ .../suite-ingress-features/namespace.go | 252 +- .../suite-ingress-features/resourcesync.go | 29 +- .../suite-ingress/suite-ingress-features/sanity.go | 24 +- .../suite-ingress/suite-ingress-features/secret.go | 708 +- .../suite-ingress/suite-ingress-features/status.go | 300 +- .../suite-ingress-features/webhook.go | 443 +- .../suite-ingress-resource/ingress.go | 259 +- .../suite-ingress-resource/resourcepushing.go | 31 +- .../suite-ingress/suite-ingress-resource/ssl.go | 279 +- .../suite-ingress/suite-ingress-resource/stream.go | 146 +- .../suite-ingress-resource/upstream_tls.go | 7 +- .../suite-plugins-authentication/basic.go | 7 +- .../suite-plugins-authentication/hmac.go | 15 +- .../suite-plugins-authentication/jwt.go | 15 +- .../suite-plugins-authentication/key.go | 7 +- .../{jwt.go => ldap.go} | 197 +- .../suite-plugins-authentication/wolfrbac.go | 15 +- .../suite-plugins/suite-plugins-general/echo.go | 13 +- .../suite-plugins-general/redirect.go | 14 +- .../suite-plugins-general/secret_ref.go | 55 + .../suite-plugins-general/server-info.go | 4 + .../suite-plugins-other/plugin_config.go | 624 +- .../suite-plugins-other/serverless.go | 7 +- .../suite-plugins-security/consumer-restriction.go | 7 +- .../suite-plugins/suite-plugins-security/cors.go | 18 +- .../suite-plugins/suite-plugins-security/csrf.go | 7 +- .../suite-plugins-security/ip-restriction.go | 13 +- .../suite-plugins-security/referer-restriction.go | 13 +- .../suite-plugins-security/uri_blocker.go | 11 +- .../suite-plugins-traffic/api_breaker.go | 7 +- .../suite-plugins-traffic/client-control.go | 7 +- .../suite-plugins-traffic/limit_count.go | 11 +- .../suite-plugins-traffic/request-validation.go | 7 +- .../suite-plugins-traffic/request_id.go | 11 +- .../fault_injection.go | 13 +- .../suite-plugins-transformation/proxy_rewrite.go | 13 +- .../response_rewrite.go | 13 +- test/e2e/testbackend/go.mod | 14 +- test/e2e/testbackend/go.sum | 1433 ++- .../testdata/apisix-gw-config-v3-etcd-server.yaml | 144 + test/e2e/testdata/apisix-gw-config-v3-with-sd.yaml | 93 +- test/e2e/testdata/apisix-gw-config-v3.yaml | 5 + test/e2e/testdata/apisix-gw-config-with-sd.yaml | 2 +- test/e2e/testdata/apisix-stream-disabled.yaml | 2 +- .../{apisix-gw-config-v3.yaml => ldap/cmd.sh} | 57 +- .../e2e/testdata/ldap/docker-compose.yaml | 23 +- test/e2e/testdata/webhook-create-cert.sh | 145 + test/e2e/testdata/webhook-create-signed-cert.sh | 152 - test/e2e/testdata/wolf-rbac/cmd.sh | 20 +- test/e2e/testdata/wolf-rbac/docker-compose.yaml | 2 +- .../e2e/testtimeout/Dockerfile | 14 +- test/e2e/testtimeout/go.mod | 3 + .../labels_test.go => test/e2e/testtimeout/main.go | 43 +- utils/kind-with-registry.sh | 5 +- utils/update-codegen.sh | 4 +- utils/verify-codegen.sh | 4 +- 422 files changed, 50501 insertions(+), 30626 deletions(-) diff --cc pkg/providers/ingress/ingress.go index 603a9fcb,9cb9f75a..fdab6fb7 --- a/pkg/providers/ingress/ingress.go +++ b/pkg/providers/ingress/ingress.go @@@ -162,56 -163,78 +163,79 @@@ func (c *ingressController) sync(ctx co } } - log.Debugw("translated ingress resource to a couple of routes, upstreams and pluginConfigs", - zap.Any("ingress", ing), - zap.Any("routes", tctx.Routes), - zap.Any("upstreams", tctx.Upstreams), - zap.Any("ssl", tctx.SSL), - zap.Any("pluginConfigs", tctx.PluginConfigs), - ) - - m := &utils.Manifest{ - SSLs: tctx.SSL, - Routes: tctx.Routes, - Upstreams: tctx.Upstreams, - PluginConfigs: tctx.PluginConfigs, + for _, secret := range secrets { + // We don't support annotation in Ingress + // _caAnnotation = "nginx.ingress.kubernetes.io/auth-tls-secret" + c.storeSecretReference(namespace+"/"+secret, ingEv.Key+"_"+ingEv.GroupVersion, ev.Type) } - var ( - added *utils.Manifest - updated *utils.Manifest - deleted *utils.Manifest - ) - - if ev.Type == types.EventDelete { - deleted = m - } else if ev.Type == types.EventAdd { - added = m - } else { - oldCtx, err := c.translator.TranslateOldIngress(ingEv.OldObject) + { + if ev.Type == types.EventDelete { + tctx, err = c.translator.TranslateIngressDeleteEvent(ing) + } else { + tctx, err = c.translator.TranslateIngress(ing) + } if err != nil { - log.Errorw("failed to translate ingress", + log.Errorw("failed to translate old ingress", + zap.String("event", "update"), zap.Error(err), - zap.Any("ingress", ingEv.OldObject), + zap.Any("ingress", ing), ) - return err - } - om := &utils.Manifest{ - Routes: oldCtx.Routes, - Upstreams: oldCtx.Upstreams, - SSLs: oldCtx.SSL, - PluginConfigs: oldCtx.PluginConfigs, + goto updateStatus } - added, updated, deleted = m.Diff(om) + + log.Debugw("translated ingress resource to a couple of routes, upstreams and pluginConfigs", + zap.Any("ingress", ing), + zap.Any("routes", tctx.Routes), + zap.Any("upstreams", tctx.Upstreams), + zap.Any("ssl", tctx.SSL), + zap.Any("pluginConfigs", tctx.PluginConfigs), + ) } - if err := c.SyncManifests(ctx, added, updated, deleted); err != nil { - log.Errorw("failed to sync ingress artifacts", - zap.Error(err), + { + m := &utils.Manifest{ + SSLs: tctx.SSL, + Routes: tctx.Routes, + Upstreams: tctx.Upstreams, + PluginConfigs: tctx.PluginConfigs, + } + + var ( + added *utils.Manifest + updated *utils.Manifest + deleted *utils.Manifest ) - return err + + if ev.Type == types.EventDelete { + deleted = m + } else if ev.Type.IsAddEvent() { + added = m + } else { + oldCtx, _ := c.translator.TranslateOldIngress(ingEv.OldObject) + om := &utils.Manifest{ + Routes: oldCtx.Routes, + Upstreams: oldCtx.Upstreams, + SSLs: oldCtx.SSL, + PluginConfigs: oldCtx.PluginConfigs, + } + added, updated, deleted = m.Diff(om) + } + if err = c.SyncManifests(ctx, added, updated, deleted, ev.Type.IsSyncEvent()); err != nil { + log.Errorw("failed to sync Ingress to apisix", + zap.Error(err), + ) + goto updateStatus + } } - return nil + updateStatus: + c.pool.Queue(func(wu pool.WorkUnit) (interface{}, error) { + if wu.IsCancelled() { + return nil, nil + } + c.UpdateStatus(ing) + return true, nil + }) + return err } func (c *ingressController) handleSyncErr(obj interface{}, err error) { diff --cc pkg/providers/translation/service.go index 9dc391eb,50f00a0a..47577e4c --- a/pkg/providers/translation/service.go +++ b/pkg/providers/translation/service.go @@@ -147,16 -90,12 +90,16 @@@ func (t *translator) translateUpstreamV } } } + + nodes := apisixv1.UpstreamNodes{} // Filter nodes by subset. - nodes, err := t.TranslateEndpoint(*ep, port, labels) - if err != nil { - return nil, err + if *ep != nil { + nodes, err = t.TranslateEndpoint(*ep, port, labels) + if err != nil { + return nil, err + } } - if au == nil || au.V2beta3().Spec == nil { + if au == nil || au.V2().Spec == nil { ups.Nodes = nodes return ups, nil } diff --cc pkg/providers/translation/service_test.go index 653e1224,00000000..48986a51 mode 100644,000000..100644 --- a/pkg/providers/translation/service_test.go +++ b/pkg/providers/translation/service_test.go @@@ -1,64 -1,0 +1,62 @@@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package translation + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "k8s.io/client-go/informers" + "k8s.io/client-go/kubernetes/fake" + "k8s.io/client-go/tools/cache" + + "github.com/apache/apisix-ingress-controller/pkg/config" + "github.com/apache/apisix-ingress-controller/pkg/kube" + v2 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/listers/config/v2" - "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/listers/config/v2beta3" + v1 "github.com/apache/apisix-ingress-controller/pkg/types/apisix/v1" +) + +func TestTranslateServiceNoEndpoints(t *testing.T) { + client := fake.NewSimpleClientset() + informersFactory := informers.NewSharedInformerFactory(client, 0) + epLister, _ := kube.NewEndpointListerAndInformer(informersFactory, false) + auLister2 := v2.NewApisixUpstreamLister(cache.NewIndexer(func(obj interface{}) (out string, err error) { return }, map[string]cache.IndexFunc{})) - auLister2beta3 := v2beta3.NewApisixUpstreamLister(cache.NewIndexer(func(obj interface{}) (out string, err error) { return }, map[string]cache.IndexFunc{})) + + tr := &translator{&TranslatorOptions{ + APIVersion: config.ApisixV2, + EndpointLister: epLister, - ApisixUpstreamLister: kube.NewApisixUpstreamLister(auLister2beta3, auLister2), ++ ApisixUpstreamLister: kube.NewApisixUpstreamLister(auLister2), + }} + + expected := &v1.Upstream{ + Metadata: v1.Metadata{ + Desc: "Created by apisix-ingress-controller, DO NOT modify it manually", + Labels: map[string]string{"managed-by": "apisix-ingress-controller"}, + }, + Type: "roundrobin", + Nodes: v1.UpstreamNodes{}, + Scheme: "http", + } + + upstream, err := tr.TranslateService("test", "svc", "", 9080) + assert.Nil(t, err) + assert.Equal(t, expected, upstream) + - tr.APIVersion = config.ApisixV2beta3 ++ tr.APIVersion = config.ApisixV2 + + upstream, err = tr.TranslateService("test", "svc", "", 9080) + assert.Nil(t, err) + assert.Equal(t, expected, upstream) +}
