You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by zh...@apache.org on 2025/11/08 14:42:24 UTC
(dubbo-kubernetes) branch master updated: Optimize content and fix logs (#814)
This is an automated email from the ASF dual-hosted git repository.
zhongxjian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-kubernetes.git
The following commit(s) were added to refs/heads/master by this push:
new 07c0b272 Optimize content and fix logs (#814)
07c0b272 is described below
commit 07c0b272b8e14a15292d0a62ef521a34e8f67ec7
Author: Jian Zhong <11...@qq.com>
AuthorDate: Sat Nov 8 22:42:19 2025 +0800
Optimize content and fix logs (#814)
---
.asf.yaml | 5 +-
.codecov.yml | 22 ++-
.github/ISSUE_TEMPLATE/feature-request.md | 56 +++++--
.github/PULL_REQUEST_TEMPLATE.md | 82 +++++++++-
.github/workflows/ci.yml | 122 +++++++++++----
.github/workflows/release.yaml | 2 +-
.licenserc.yaml | 67 ++++-----
CONTRIBUTING.md | 76 +++++++++-
Makefile | 16 +-
NOTICE | 7 +-
README.md | 11 +-
.../planet/cmd/planet-agent}/app/cmd.go | 31 ++--
.../planet/cmd/planet-agent}/app/wait.go | 0
.../planet/cmd/planet-agent}/config/config.go | 4 +-
.../planet/cmd/planet-agent}/main.go | 4 +-
.../planet/cmd/planet-agent}/options/agent.go | 0
.../cmd/planet-agent}/options/agent_proxy.go | 4 +-
.../planet/cmd/planet-agent}/options/options.go | 0
.../planet/cmd/planet-agent}/options/security.go | 8 +-
.../planet/cmd/planet-discovery}/app/cmd.go | 16 +-
.../planet/cmd/planet-discovery}/main.go | 2 +-
.../planet/docker/dockerfile.planet | 19 +--
.../planet/docker/dockerfile.proxyadapter | 19 +--
.../planet}/pkg/bootstrap/certcontroller.go | 21 +--
.../planet}/pkg/bootstrap/configcontroller.go | 37 ++---
{sail => dubbod/planet}/pkg/bootstrap/discovery.go | 12 +-
{sail => dubbod/planet}/pkg/bootstrap/dubbo_ca.go | 16 +-
{sail => dubbod/planet}/pkg/bootstrap/mesh.go | 15 +-
{sail => dubbod/planet}/pkg/bootstrap/options.go | 10 +-
.../planet}/pkg/bootstrap/proxylessinjector.go | 9 +-
{sail => dubbod/planet}/pkg/bootstrap/server.go | 97 ++++++------
.../planet}/pkg/bootstrap/servicecontroller.go | 11 +-
{sail => dubbod/planet}/pkg/bootstrap/util.go | 2 +-
.../planet}/pkg/bootstrap/validation.go | 4 +-
{sail => dubbod/planet}/pkg/bootstrap/webhook.go | 2 +-
.../planet}/pkg/config/aggregate/config.go | 2 +-
.../config/kube/clustertrustbundle/controller.go | 6 +-
.../planet}/pkg/config/kube/crd/config.go | 0
.../planet}/pkg/config/kube/crd/conversion.go | 0
.../planet}/pkg/config/kube/crdclient/client.go | 10 +-
.../planet}/pkg/config/kube/crdclient/types.go | 8 +-
.../planet}/pkg/config/kube/file/controller.go | 8 +-
.../planet}/pkg/config/memory/controller.go | 2 +-
.../planet}/pkg/config/memory/monitor.go | 2 +-
{sail => dubbod/planet}/pkg/config/memory/store.go | 2 +-
.../planet}/pkg/credentials/kube/secrets.go | 2 +-
{sail => dubbod/planet}/pkg/credentials/model.go | 0
.../planet}/pkg/features/experimental.go | 2 +-
.../planet/pkg/features/planet.go | 8 +-
{sail => dubbod/planet}/pkg/features/security.go | 4 +-
{sail => dubbod/planet}/pkg/features/tuning.go | 0
{sail => dubbod/planet}/pkg/features/xds.go | 12 +-
{sail => dubbod/planet}/pkg/grpc/grpc.go | 2 +-
{sail => dubbod/planet}/pkg/grpc/tls.go | 2 +-
.../planet}/pkg/keycertbundle/watcher.go | 0
.../k8sresourcelock/configmaplock.go | 0
.../k8sleaderelection/k8sresourcelock/interface.go | 0
.../k8sresourcelock/resourcelock.go | 0
.../k8sleaderelection/leaderelection.go | 2 +-
.../leaderelection/k8sleaderelection/metrics.go | 0
.../planet}/pkg/leaderelection/leaderelection.go | 6 +-
{sail => dubbod/planet}/pkg/model/addressmap.go | 0
.../planet}/pkg/model/authentication.go | 3 +-
{sail => dubbod/planet}/pkg/model/authorization.go | 0
{sail => dubbod/planet}/pkg/model/cluster_local.go | 1 -
{sail => dubbod/planet}/pkg/model/config.go | 0
{sail => dubbod/planet}/pkg/model/context.go | 6 +-
{sail => dubbod/planet}/pkg/model/controller.go | 0
.../planet}/pkg/model/endpointshards.go | 5 +-
.../planet/pkg/model/log.go | 6 +-
{sail => dubbod/planet}/pkg/model/network.go | 0
{sail => dubbod/planet}/pkg/model/push_context.go | 3 +-
{sail => dubbod/planet}/pkg/model/service.go | 2 +-
.../planet}/pkg/model/typed_xds_cache.go | 3 +-
{sail => dubbod/planet}/pkg/model/validation.go | 0
{sail => dubbod/planet}/pkg/model/xds_cache.go | 3 +-
.../planet}/pkg/networking/apigen/apigen.go | 2 +-
.../planet}/pkg/networking/core/cluster.go | 2 +-
.../planet}/pkg/networking/core/configgen.go | 2 +-
.../networking/core/extension_config_builder.go | 2 +-
.../planet}/pkg/networking/core/httproute.go | 2 +-
.../planet}/pkg/networking/core/listener.go | 2 +-
.../planet}/pkg/networking/grpcgen/cds.go | 8 +-
.../planet}/pkg/networking/grpcgen/grpcgen.go | 4 +-
.../planet}/pkg/networking/grpcgen/lds.go | 38 ++---
.../planet}/pkg/networking/grpcgen/rds.go | 4 +-
.../planet}/pkg/networking/networking.go | 0
.../planet}/pkg/networking/util/util.go | 4 +-
.../planet}/pkg/security/model/authentication.go | 0
{sail => dubbod/planet}/pkg/server/instance.go | 0
.../pkg/serviceregistry/aggregate/controller.go | 6 +-
.../planet}/pkg/serviceregistry/instance.go | 4 +-
.../serviceregistry/kube/controller/controller.go | 10 +-
.../kube/controller/endpoint_builder.go | 10 +-
.../kube/controller/endpointslice.go | 2 +-
.../kube/controller/multicluster.go | 18 +--
.../kube/controller/namespacecontroller.go | 8 +-
.../pkg/serviceregistry/kube/controller/network.go | 2 +-
.../pkg/serviceregistry/kube/controller/pod.go | 2 +-
.../pkg/serviceregistry/kube/controller/util.go | 0
.../planet}/pkg/serviceregistry/kube/conversion.go | 4 +-
.../pkg/serviceregistry/provider/provider.go | 0
.../pkg/serviceregistry/util/label/label.go | 2 +-
.../planet}/pkg/trustbundle/trustbundle.go | 0
{sail => dubbod/planet}/pkg/util/network/ip.go | 0
.../planet}/pkg/util/protoconv/protoconv.go | 2 +-
{sail => dubbod/planet}/pkg/xds/ads.go | 56 +++----
{sail => dubbod/planet}/pkg/xds/auth.go | 0
{sail => dubbod/planet}/pkg/xds/cds.go | 4 +-
{sail => dubbod/planet}/pkg/xds/delta.go | 57 ++++---
{sail => dubbod/planet}/pkg/xds/discovery.go | 7 +-
{sail => dubbod/planet}/pkg/xds/eds.go | 15 +-
.../planet}/pkg/xds/endpoints/endpoint_builder.go | 20 +--
{sail => dubbod/planet}/pkg/xds/lds.go | 6 +-
{sail => dubbod/planet}/pkg/xds/pushqueue.go | 2 +-
{sail => dubbod/planet}/pkg/xds/rds.go | 4 +-
{sail => dubbod/planet}/pkg/xds/statusgen.go | 7 +-
{sail => dubbod/planet}/pkg/xds/v3/model.go | 0
{sail => dubbod/planet}/pkg/xds/xdsgen.go | 51 ++++---
{security => dubbod/security}/pkg/cmd/constants.go | 0
.../security}/pkg/credentialfetcher/fetcher.go | 2 +-
.../pkg/credentialfetcher/plugin/token.go | 0
.../security}/pkg/k8s/chiron/utils.go | 2 +-
.../security}/pkg/k8s/configutil.go | 0
.../security}/pkg/k8s/controller/casecret.go | 0
.../security}/pkg/nodeagent/cache/secretcache.go | 68 ++++-----
.../pkg/nodeagent/caclient/credentials.go | 0
.../nodeagent/caclient/providers/aegis/client.go | 18 ++-
.../security}/pkg/nodeagent/cafile/cafile.go | 0
.../security}/pkg/nodeagent/sds/sdsservice.go | 8 +-
.../security}/pkg/nodeagent/sds/server.go | 0
.../security}/pkg/nodeagent/util/util.go | 0
{security => dubbod/security}/pkg/pki/ca/ca.go | 15 +-
.../pkg/pki/ca/selfsignedcarootcertrotator.go | 20 +--
.../security}/pkg/pki/error/error.go | 0
{security => dubbod/security}/pkg/pki/ra/common.go | 13 +-
.../ra.go => dubbod/security/pkg/pki/ra/k8s_ra.go | 11 +-
.../security}/pkg/pki/util/crypto.go | 0
.../security}/pkg/pki/util/dual_use.go | 0
.../security}/pkg/pki/util/generate_cert.go | 0
.../security}/pkg/pki/util/generate_csr.go | 0
.../security}/pkg/pki/util/keycertbundle.go | 0
{security => dubbod/security}/pkg/pki/util/san.go | 0
.../security}/pkg/pki/util/verify_cert.go | 0
.../server/ca/authenticate/cert_authenticator.go | 2 +-
.../security}/pkg/server/ca/authenticate/oidc.go | 0
.../security}/pkg/server/ca/server.go | 23 +--
{security => dubbod/security}/pkg/util/certutil.go | 2 +-
{security => dubbod/security}/pkg/util/jwtutil.go | 0
.../security/tools}/generate_cert/main.go | 4 +-
.../security/tools}/generate_csr/main.go | 2 +-
manifests/charts/admin/templates/clusterrole.yaml | 6 +-
.../charts/admin/templates/clusterrolebinding.yaml | 6 +-
manifests/charts/admin/templates/deployment.yaml | 14 +-
manifests/charts/admin/templates/service.yaml | 6 +-
.../charts/admin/templates/serviceaccount.yaml | 6 +-
.../dubbo-discovery/files/grpc-agent.yaml | 27 ++--
.../dubbo-discovery/templates/clusterrole.yaml | 5 +-
.../templates/configmap-values.yaml | 2 +-
.../dubbo-discovery/templates/configmap.yaml | 2 +-
.../dubbo-discovery/templates/deployment.yaml | 6 +-
.../templates/dubbd-injector-configmap.yaml | 2 +-
.../dubbo-discovery/templates/mutatingwebhook.yaml | 24 +--
.../templates/validatingwebhookconfiguration.yaml | 6 +-
.../nacos/templates/configmap.yaml | 6 +-
.../register-discovery/nacos/templates/mysql.yaml | 32 ++--
.../nacos/templates/poddisruptionbudget.yaml | 8 +-
.../nacos/templates/service.yaml | 12 +-
.../nacos/templates/statefulset.yaml | 14 +-
.../zookeeper/templates/configmap.yaml | 6 +-
.../zookeeper/templates/poddisruptionbudget.yaml | 8 +-
.../zookeeper/templates/service.yaml | 12 +-
.../zookeeper/templates/statefulset.yaml | 14 +-
manifests/profiles/default.yaml | 2 +-
manifests/profiles/demo.yaml | 2 +-
manifests/profiles/empty.yaml | 2 +-
operator/cmd/cluster/uninstall.go | 6 +-
operator/pkg/apis/proto/values_types.proto | 2 +-
operator/pkg/apis/register.go | 4 +-
operator/pkg/apis/types.go | 3 +-
operator/pkg/manifest/name.go | 8 +-
operator/pkg/render/manifest.go | 9 +-
pkg/adsc/adsc.go | 14 +-
pkg/adsc/util.go | 2 +-
pkg/bootstrap/config.go | 4 +-
pkg/config/constants/constants.go | 16 +-
pkg/config/model.go | 9 +-
pkg/config/schema/collections/collections.agent.go | 2 +-
pkg/config/schema/collections/collections.go | 10 +-
pkg/config/schema/gvk/resources.go | 10 +-
pkg/config/schema/gvr/resources.go | 10 +-
pkg/dubbo-agent/agent.go | 74 ++++-----
pkg/dubbo-agent/config/config.go | 50 +------
pkg/dubbo-agent/grpcxds/grpc_bootstrap.go | 4 +-
pkg/dubbo-agent/plugins.go | 12 +-
pkg/dubbo-agent/xds_proxy.go | 123 +++++++--------
pkg/dubbo-agent/xds_proxy_delta.go | 49 +++---
pkg/kube/inject/inject.go | 8 +-
pkg/kube/inject/webhook.go | 32 ++--
pkg/kube/kclient/client.go | 2 +-
pkg/kube/krt/files/files.go | 16 +-
pkg/kube/util.go | 2 +-
pkg/log/deduplicator.go | 17 +++
pkg/log/formatter.go | 17 +++
pkg/log/interceptor.go | 17 +++
pkg/log/klog_formatter.go | 17 +++
pkg/log/klog_interceptor.go | 17 +++
pkg/log/log.go | 165 +++++++++++++++++++++
pkg/log/pretty.go | 17 +++
pkg/model/proxy.go | 18 +--
pkg/model/xds.go | 2 +-
pkg/security/security.go | 19 ++-
pkg/uds/listener.go | 5 +-
pkg/webhooks/server/server.go | 2 +-
pkg/webhooks/util/util.go | 2 +-
pkg/webhooks/validation/controller/controller.go | 4 +-
pkg/webhooks/webhookpatch.go | 12 +-
pkg/xds/monitoring.go | 8 +
pkg/xds/server.go | 58 +++++---
samples/addons/README.md | 6 -
samples/addons/prometheus.yaml | 2 +-
samples/grpc-proxyless/README.md | 137 +++++++++++++++++
samples/grpc-proxyless/grpc-proxyless.yaml | 18 +--
tests/grpc-proxyless/consumer/main.go | 91 ++++++++++++
.../dockerfile.consumer} | 0
.../dockerfile.producer} | 0
tests/grpc-proxyless/producer/main.go | 88 +++++++++++
tests/grpc-proxyless/test-commands.sh | 49 ------
tests/grpc-proxyless/test.sh | 56 -------
229 files changed, 1877 insertions(+), 1158 deletions(-)
diff --git a/.asf.yaml b/.asf.yaml
index d939204f..9a25b306 100644
--- a/.asf.yaml
+++ b/.asf.yaml
@@ -35,7 +35,8 @@ github:
# foo: bar
labels:
- dubbo
- - kubernetes
+ - proxyless
- microservices
+ - kubernetes
- service-mesh
- - proxyless
+
diff --git a/.codecov.yml b/.codecov.yml
index 3c6026ad..f49dd894 100644
--- a/.codecov.yml
+++ b/.codecov.yml
@@ -16,17 +16,33 @@
# Documentation: https://docs.codecov.io/docs/codecov-yaml
codecov:
- require_ci_to_pass: false
+ require_ci_to_pass: true
notify:
- wait_for_ci: false
+ wait_for_ci: true
+
coverage:
status:
- # pull-requests only
+ # Pull requests only
patch:
default:
threshold: 0.1%
+ project:
+ default:
+ threshold: 0%
+
ignore:
+ # Generated code
- "**/generated/**"
- "**/*generated*"
- "**/*.pb.go"
+ - "**/*_embedded.go"
+
+ # Test files
- "**/*_test.go"
+
+ # Dependencies
+ - "**/vendor/**"
+ - "**/node_modules/**"
+
+ # Build artifacts
+ - "**/*.sum"
diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md
index b16d8ef3..ada6aa57 100644
--- a/.github/ISSUE_TEMPLATE/feature-request.md
+++ b/.github/ISSUE_TEMPLATE/feature-request.md
@@ -1,17 +1,51 @@
---
-name: Feature request
-about: Suggest an idea to improve Dubbo
+name: Feature Request
+about: Suggest a new feature or enhancement for Dubbo Kubernetes
+title: '[FEATURE] '
+labels: enhancement
+assignees: ''
---
-**Describe the feature request**
-**Describe alternatives you've considered**
+## Feature Description
-**Affected product area (please put an X in all that apply)**
+<!-- Provide a clear and concise description of the feature you'd like to see -->
-[ ] Docs
-[ ] Installation
-[ ] Dashboard
-[ ] Test and Release
-[ ] User Experience
+## Motivation
-**Additional context**
\ No newline at end of file
+<!-- Explain why this feature would be useful. What problem does it solve? -->
+
+## Proposed Solution
+
+<!-- Describe how you envision this feature working -->
+
+## Alternatives Considered
+
+<!-- Describe any alternative solutions or features you've considered -->
+
+## Affected Product Area
+
+<!-- Please put an X in all that apply -->
+
+- [ ] Core Components
+- [ ] Control Plane (Planet Discovery)
+- [ ] Data Plane (Planet Agent)
+- [ ] Operator
+- [ ] Helm Charts
+- [ ] Documentation
+- [ ] Installation
+- [ ] Testing
+- [ ] User Experience
+- [ ] Performance
+- [ ] Security
+
+## Additional Context
+
+<!-- Add any other context, screenshots, or examples about the feature request here -->
+
+## Related Issues
+
+<!-- Link to any related issues -->
+
+## Implementation Notes (Optional)
+
+<!-- If you have ideas about how this could be implemented, please share them here -->
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 414c17db..8bddf5e9 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,11 +1,79 @@
-**Please provide a description of this PR:**
+## Description
-**To help us figure out who should review this PR, please put an X in all the areas that this PR affects.**
+<!-- Provide a clear and concise description of what this PR does -->
+## Related Issue
+
+<!-- Link to the related issue(s) -->
+<!-- Example: Fixes #123, Related to #456 -->
+
+Closes #
+Related to #
+
+## Type of Change
+
+<!-- Please put an X in all that apply -->
+
+- [ ] Bug fix (non-breaking change which fixes an issue)
+- [ ] New feature (non-breaking change which adds functionality)
+- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
+- [ ] Documentation update
+- [ ] Performance improvement
+- [ ] Code refactoring
+- [ ] Test update
+- [ ] Build/CI changes
+
+## Affected Areas
+
+<!-- Please put an X in all that apply -->
+
+- [ ] Core Components
+- [ ] Control Plane (Planet Discovery)
+- [ ] Data Plane (Planet Agent)
+- [ ] Operator
+- [ ] Helm Charts
+- [ ] Documentation
- [ ] Installation
-- [ ] Test and Release
-- [ ] User Experience
-- [ ] Register Plane Revisions
-- [ ] Control Plane Revisions
-**Please check any characteristics that apply to this pull request.**
+- [ ] Testing
+- [ ] Build/CI
+
+## Changes Made
+
+<!-- List the main changes in this PR -->
+
+-
+-
+-
+
+## Testing
+
+<!-- Describe the tests you ran and how to reproduce them -->
+
+- [ ] Unit tests added/updated
+- [ ] Integration tests added/updated
+- [ ] Manual testing performed
+
+### Test Results
+
+<!-- Provide test results or screenshots if applicable -->
+
+## Checklist
+
+<!-- Please check all that apply -->
+
+- [ ] My code follows the project's style guidelines
+- [ ] I have performed a self-review of my own code
+- [ ] I have commented my code, particularly in hard-to-understand areas
+- [ ] I have made corresponding changes to the documentation
+- [ ] My changes generate no new warnings
+- [ ] I have added tests that prove my fix is effective or that my feature works
+- [ ] New and existing unit tests pass locally with my changes
+- [ ] Any dependent changes have been merged and published
+
+## Screenshots (if applicable)
+
+<!-- Add screenshots to help explain your changes -->
+
+## Additional Notes
+<!-- Add any additional information that reviewers should know -->
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index f2e133a4..328adfad 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -13,70 +13,140 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-name: Continues Integration
+name: Dubbo Kubernetes CI
on:
push:
branches:
- master
+ - main
pull_request:
branches:
- master
+ - main
+ workflow_dispatch:
+
+env:
+ GO_VERSION: '1.21'
jobs:
unit-test:
- name: Go Test
+ name: Go Unit Tests
runs-on: ubuntu-latest
if: github.repository == 'apache/dubbo-kubernetes'
steps:
- - uses: actions/checkout@v4
- - name: Set up Go 1.x
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
+ cache-dependency-path: go.sum
+
- name: Download dependencies
+ run: go mod download
+
+ - name: Verify dependencies
+ run: go mod verify
+
+ - name: Run unit tests
run: |
- go mod download
- - name: Go Test
- run: |
- go test ./... -gcflags=-l -coverprofile=coverage.txt -covermode=atomic
- - name: "Upload test result"
+ go test ./... -gcflags=-l -coverprofile=coverage.txt -covermode=atomic -v
+
+ - name: Upload test coverage
if: always()
uses: actions/upload-artifact@v4
with:
name: test-coverage
path: "**/coverage.txt"
- - name: Coverage
- run: bash <(curl -s https://codecov.io/bash)
+ retention-days: 7
- license-check:
- name: License Check - Go
+ - name: Upload coverage to Codecov
+ uses: codecov/codecov-action@v4
+ with:
+ file: ./coverage.txt
+ flags: unittests
+ name: codecov-umbrella
+ fail_ci_if_error: false
+
+ lint:
+ name: Go Lint
+ runs-on: ubuntu-latest
+ if: github.repository == 'apache/dubbo-kubernetes'
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Set up Go
+ uses: actions/setup-go@v5
+ with:
+ go-version-file: go.mod
+ cache-dependency-path: go.sum
+
+ - name: Download dependencies
+ run: go mod download
+
+ - name: Run go vet
+ run: go vet ./...
+
+ - name: Run go fmt check
+ run: |
+ if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
+ echo "The following files need formatting:"
+ gofmt -s -d .
+ exit 1
+ fi
+
+ build:
+ name: Go Build
runs-on: ubuntu-latest
if: github.repository == 'apache/dubbo-kubernetes'
+ strategy:
+ matrix:
+ os: [ubuntu-latest]
steps:
- - uses: actions/checkout@v4
- - name: Set up Go 1.x
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
+ cache-dependency-path: go.sum
+
+ - name: Download dependencies
+ run: go mod download
+
+ - name: Build
+ run: go build ./...
+
+ license-check:
+ name: License Header Check
+ runs-on: ubuntu-latest
+ if: github.repository == 'apache/dubbo-kubernetes'
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
- name: Check License Header
uses: apache/skywalking-eyes/header@main
- go-fmt:
- name: Go fmt
+ security-scan:
+ name: Security Scan
runs-on: ubuntu-latest
if: github.repository == 'apache/dubbo-kubernetes'
steps:
- - uses: actions/checkout@v4
- - name: Set up Go 1.x
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- - name: Download dependencies
- run: |
- go mod download
- - name: Go Fmt
- run: |
- go fmt ./... && git status && [[ -z `git status -s` ]]
- # diff -u <(echo -n) <(gofmt -d -s .)
+ cache-dependency-path: go.sum
+
+ - name: Run Gosec Security Scanner
+ uses: securego/gosec@master
+ with:
+ args: './...'
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index b923493e..45e700df 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-name: Dubbo Release
+name: Dubbo Kubernetes Release
on:
push:
diff --git a/.licenserc.yaml b/.licenserc.yaml
index 4ca86d88..acc79317 100644
--- a/.licenserc.yaml
+++ b/.licenserc.yaml
@@ -18,56 +18,49 @@ header:
limitations under the License.
paths-ignore:
- - '**/*.versionsBackup'
- - '**/.idea/**'
- - '**/*.iml'
- - '**/.settings/*'
- - '**/.classpath'
- - '**/.project'
- - '**/*.log'
- - '**/codestyle/*'
- - '**/resources/META-INF/**'
- - '**/resources/mockito-extensions/**'
- - '**/*.proto'
+ # Build and dependency files
+ - '**/go.sum'
+ - '**/*.pb.go'
- '**/*.cache'
- - '**/*.txt'
- - '**/*.load'
- - '**/*.flex'
- - '**/*.fc'
+
+ # Configuration and template files
+ - '**/*.proto'
+ - '**/*.tpl'
+ - '**/*.json'
+ - '**/*.yaml'
+ - '**/*.yml'
+ - '**/*.conf'
- '**/*.properties'
- - '**/*.pb.go'
- - '**/*.sh'
- - '**/*.bat'
+ - '**/templates/**'
+
+ # Documentation and text files
- '**/*.md'
+ - '**/*.txt'
- '**/*.svg'
- '**/*.png'
- - '**/*.json'
- - '**/*.conf'
- - '**/*.ftl'
- - '**/*.tpl'
- - '**/*.factories'
- - '**/*.handlers'
- - '**/*.schemas'
- - '**/*.nojekyll'
- - '**/.browserslistrc'
+
+ # Scripts
+ - '**/*.sh'
+ - '**/*.bat'
+
+ # Git and version control
- '.git/'
- '.github/**'
- '**/.gitignore'
- '**/.gitattributes'
+ - '**/.gitmodules'
- '**/.helmignore'
- - '.repository/'
- - 'compiler/**'
- - '.gitmodules'
- - '**/.gitrepo'
+
+ # License and notice files
- 'LICENSE'
- 'NOTICE'
- - 'CNAME'
- - '**/go.sum'
- - '**/templates/**'
+
+ # Test data
- '**/testdata/**'
- - '**/deploy.tpl'
- - '**/docs/**'
- - '**/.husky/pre-commit'
+
+ # Log files
+ - '**/*.log'
+
comment: on-failure
license-location-threshold: 130
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 519635dd..30207a53 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,19 +1,79 @@
-# Contributing to Dubbo
+# Contributing to Dubbo Kubernetes
-Dubbo is released under the non-restrictive Apache 2.0 licenses and follows a very standard Github development process, using Github tracker for issues and merging pull requests into master. Contributions of all form to this repository is acceptable, as long as it follows the prescribed community guidelines enumerated below.
+Dubbo Kubernetes is released under the non-restrictive Apache 2.0 license and follows a very standard GitHub development process, using GitHub tracker for issues and merging pull requests into master. Contributions of all forms to this repository are acceptable, as long as they follow the prescribed community guidelines enumerated below.
## Sign the Contributor License Agreement
-Before we accept a non-trivial patch or pull request (PRs), we will need you to sign the Contributor License Agreement. Signing the contributors' agreement does not grant anyone commits rights to the main repository, but it does mean that we can accept your contributions, and you will get an author credit if we do. Active contributors may get invited to join the core team that will grant them privileges to merge existing PRs.
+Before we accept a non-trivial patch or pull request (PR), we will need you to sign the Contributor License Agreement. Signing the contributors' agreement does not grant anyone commit rights to the main repository, but it does mean that we can accept your contributions, and you will get an author credit if we do. Active contributors may get invited to join the core team, which will grant them privileges to merge existing PRs.
## Contact
The mailing list is the recommended way of pursuing a discussion on almost anything related to Dubbo. Please refer to this [guide](https://github.com/apache/dubbo/wiki/Mailing-list-subscription-guide) for detailed documentation on how to subscribe.
-- [dev@dubbo.apache.org](mailto:dev-subscribe@dubbo.apache.org): the developer mailing list where you can ask questions about an issue you may have encountered while working with Dubbo.
-- [commits@dubbo.apache.org](mailto:commits-subscribe@dubbo.apache.org): the commit updates will get broadcasted on this mailing list. You can subscribe to it, should you be interested in following Dubbo's development.
-- [notifications@dubbo.apache.org](mailto:notifications-subscribe@dubbo.apache.org): all the Github [issue](https://github.com/apache/dubbo/issues) updates and [pull request](https://github.com/apache/dubbo/pulls) updates will be sent to this mailing list.
+### Mailing Lists
-## Reporting Issue
+- **dev@dubbo.apache.org**: The developer mailing list where you can ask questions about issues you may have encountered while working with Dubbo.
+ - Subscribe: [dev-subscribe@dubbo.apache.org](mailto:dev-subscribe@dubbo.apache.org)
-Please create an issue [here](https://github.com/apache/dubbo-kubernetes)
\ No newline at end of file
+- **commits@dubbo.apache.org**: Commit updates will be broadcasted on this mailing list. You can subscribe to it if you are interested in following Dubbo's development.
+ - Subscribe: [commits-subscribe@dubbo.apache.org](mailto:commits-subscribe@dubbo.apache.org)
+
+- **notifications@dubbo.apache.org**: All GitHub [issue](https://github.com/apache/dubbo/issues) updates and [pull request](https://github.com/apache/dubbo/pulls) updates will be sent to this mailing list.
+ - Subscribe: [notifications-subscribe@dubbo.apache.org](mailto:notifications-subscribe@dubbo.apache.org)
+
+## Reporting Issues
+
+Please create an issue [here](https://github.com/apache/dubbo-kubernetes/issues) if you encounter any problems or have suggestions for improvements.
+
+### Issue Guidelines
+
+- Use a clear and descriptive title
+- Provide detailed information about the issue
+- Include steps to reproduce the problem
+- Add relevant labels if possible
+- Reference related issues or pull requests
+
+## Submitting Pull Requests
+
+### Before Submitting
+
+1. Ensure your code follows the project's coding standards
+2. Add tests for new features or bug fixes
+3. Update documentation as needed
+4. Make sure all tests pass locally
+
+### Pull Request Process
+
+1. Fork the repository
+2. Create a feature branch from `master`
+3. Make your changes
+4. Commit your changes with clear commit messages
+5. Push to your fork and create a pull request
+6. Ensure all CI checks pass
+7. Address any review comments
+
+### Commit Message Guidelines
+
+- Use the present tense ("Add feature" not "Added feature")
+- Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
+- Limit the first line to 72 characters or less
+- Reference issues and pull requests liberally after the first line
+
+## Code Style
+
+- Follow Go code style guidelines
+- Run `go fmt` before committing
+- Ensure `go vet` passes without errors
+- Add appropriate comments for exported functions and types
+
+## Development Setup
+
+Please refer to the project's README.md for instructions on setting up your development environment.
+
+## Questions?
+
+If you have any questions about contributing, please feel free to reach out via:
+- The developer mailing list: [dev@dubbo.apache.org](mailto:dev@dubbo.apache.org)
+- GitHub Issues: [https://github.com/apache/dubbo-kubernetes/issues](https://github.com/apache/dubbo-kubernetes/issues)
+
+Thank you for contributing to Dubbo Kubernetes!
diff --git a/Makefile b/Makefile
index 39a426b7..feab95d1 100644
--- a/Makefile
+++ b/Makefile
@@ -13,8 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-SHELL := /usr/bin/env bash
-
.PHONY: build-dubboctl
build-dubboctl:
CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build \
@@ -24,4 +22,16 @@ build-dubboctl:
.PHONY: clone-sample
clone-sample:
mkdir -p bin
- cp -r samples bin/samples
\ No newline at end of file
+ cp -r samples bin/samples
+
+.PHONY: build-planet
+build-planet:
+ mkdir -p bin
+ CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -buildvcs=false -o bin/planet-discovery ./dubbod/planet/cmd/planet-discovery
+
+ nerdctl build --build-arg GOOS=linux --build-arg GOARCH=arm64 \
+ -f dubbod/planet/docker/dockerfile.planet \
+ -t mfordjody/planet:0.3.0-debug \
+ .
+
+ nerdctl push mfordjody/planet:0.3.0-debug
\ No newline at end of file
diff --git a/NOTICE b/NOTICE
index 72cdc59c..f1ff4693 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,8 @@
Apache Dubbo Kubernetes
Copyright 2018-2025 The Apache Software Foundation
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
+This product includes software developed by the Dubbo Kubernetes project
+at The Apache Software Foundation (http://dubbo.apache.org/).
+
+For additional information about the Apache Software Foundation, please see
+<http://www.apache.org/>.
diff --git a/README.md b/README.md
index 7bb4e052..970edb7e 100644
--- a/README.md
+++ b/README.md
@@ -1,23 +1,22 @@
<h1 align="center">
-Dubbo Kubernetes
+Dubbo Service Mesh for Kubernetes
</h1>
-[](https://github.com/apache/dubbo-kubernetes/actions/workflows/ci.yml)
[](https://codecov.io/gh/apache/dubbo-kubernetes)

-A cloud-native **proxyless service mesh** platform for Dubbo microservices, enabling zero-latency inter-service communication across multiple protocols, advanced traffic management, and enterprise-grade security without sidecar proxies. Built on Istio's control plane architecture with native Kubernetes integration, it delivers service mesh capabilities with minimal resource overhead and maximum performance.
+Cloud-Native proxyless service mesh platform for Dubbo microservices, enabling zero-latency inter-service communication across multiple protocols, advanced traffic management, and enterprise-grade security without sidecar proxies. Built on Istio's control plane architecture with native Kubernetes integration, it delivers service mesh capabilities with minimal resource overhead and maximum performance.
## Project Structure
The main repositories of Dubbo on Kubernetes include:
- **dubboctl** — The command-line management tool that provides control plane management, development framework scaffolding, and application deployment.
-- **dubbod** — The dubbo control plane. It is built on Istio to implement a proxyless service mesh and includes the following components:
- - **sail** - Runtime proxy configuration and XDS server
+- **dubbod** — The dubbo control plane. It is similar to the Istio components, used to implement a proxyless service mesh, and includes the following components:
+ - **planet** - Runtime proxy configuration and xDS server
- **aegis** - Certificate issuance and rotation
- **gear** - Validation, aggregation, transformation, and distribution of Dubbo configuration
-- **operator**: Provides user-friendly options to operate the Dubbo proxyless service mesh.
+- **operator** — Provides user-friendly options to operate the Dubbo proxyless service mesh.
## Quick Start
diff --git a/sail/cmd/sail-agent/app/cmd.go b/dubbod/planet/cmd/planet-agent/app/cmd.go
similarity index 87%
rename from sail/cmd/sail-agent/app/cmd.go
rename to dubbod/planet/cmd/planet-agent/app/cmd.go
index 7b9d37b9..61820c60 100644
--- a/sail/cmd/sail-agent/app/cmd.go
+++ b/dubbod/planet/cmd/planet-agent/app/cmd.go
@@ -21,17 +21,18 @@ import (
"context"
"errors"
"fmt"
+ "github.com/apache/dubbo-kubernetes/pkg/log"
+ "net/netip"
+
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/cmd/planet-agent/options"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/util/network"
"github.com/apache/dubbo-kubernetes/pkg/cmd"
"github.com/apache/dubbo-kubernetes/pkg/config/constants"
dubboagent "github.com/apache/dubbo-kubernetes/pkg/dubbo-agent"
"github.com/apache/dubbo-kubernetes/pkg/dubbo-agent/config"
"github.com/apache/dubbo-kubernetes/pkg/model"
"github.com/apache/dubbo-kubernetes/pkg/util/protomarshal"
- "github.com/apache/dubbo-kubernetes/sail/cmd/sail-agent/options"
- "github.com/apache/dubbo-kubernetes/sail/pkg/util/network"
"github.com/spf13/cobra"
- "k8s.io/klog/v2"
- "net/netip"
)
const (
@@ -45,9 +46,9 @@ var (
func NewRootCommand(sds dubboagent.SDSServiceFactory) *cobra.Command {
rootCmd := &cobra.Command{
- Use: "sail-agent",
- Short: "Dubbo Sail agent.",
- Long: "Dubbo Sail agent bootstraps via gRPC xDS.",
+ Use: "planet-agent",
+ Short: "Dubbo Planet agent.",
+ Long: "Dubbo Planet agent bootstraps via gRPC xDS.",
SilenceUsage: true,
FParseErrWhitelist: cobra.FParseErrWhitelist{
UnknownFlags: true,
@@ -82,9 +83,9 @@ func newProxyCommand(sds dubboagent.SDSServiceFactory) *cobra.Command {
}
if out, err := protomarshal.ToYAML(proxyConfig); err != nil {
- klog.Infof("Failed to serialize to YAML: %v", err)
+ log.Infof("Failed to serialize to YAML: %v", err)
} else {
- klog.Infof("Effective config: %s", out)
+ log.Infof("Effective config: %s", out)
}
secOpts, err := options.NewSecurityOptions(proxyConfig, proxyArgs.StsPort, proxyArgs.TokenManagerPlugin)
@@ -141,20 +142,14 @@ func initProxy(args []string) error {
}
proxyArgs.IPAddresses = append(proxyArgs.IPAddresses, proxyAddrs...)
- klog.Infof("proxy IPAddresses: %v", proxyArgs.IPAddresses)
+ log.Debugf("Proxy IPAddresses: %v", proxyArgs.IPAddresses)
proxyArgs.DiscoverIPMode()
proxyArgs.ID = proxyArgs.PodName + "." + proxyArgs.PodNamespace
proxyArgs.DNSDomain = getDNSDomain(proxyArgs.PodNamespace, proxyArgs.DNSDomain)
- klog.Infof(
- "Proxy role: ips=%v, type=%s, id=%s, domain=%s",
- proxyArgs.IPAddresses,
- proxyArgs.Type,
- proxyArgs.ID,
- proxyArgs.DNSDomain,
- )
+ log.WithLabels("ips", proxyArgs.IPAddresses, "type", proxyArgs.Type, "id", proxyArgs.ID, "domain", proxyArgs.DNSDomain).Info("Proxy role")
return nil
}
@@ -175,5 +170,5 @@ func addFlags(proxyCmd *cobra.Command) {
"Go template bootstrap config")
proxyCmd.PersistentFlags().StringVar(&proxyArgs.MeshConfigFile, "meshConfig", "./etc/dubbo/config/mesh",
"File name for Dubbo mesh configuration. If not specified, a default mesh will be used. This may be overridden by "+
- "PROXY_CONFIG environment variable or proxy.dubbo.io/config annotation.")
+ "PROXY_CONFIG environment variable or proxy.dubbo.apache.org/config annotation.")
}
diff --git a/sail/cmd/sail-agent/app/wait.go b/dubbod/planet/cmd/planet-agent/app/wait.go
similarity index 100%
rename from sail/cmd/sail-agent/app/wait.go
rename to dubbod/planet/cmd/planet-agent/app/wait.go
diff --git a/sail/cmd/sail-agent/config/config.go b/dubbod/planet/cmd/planet-agent/config/config.go
similarity index 91%
rename from sail/cmd/sail-agent/config/config.go
rename to dubbod/planet/cmd/planet-agent/config/config.go
index 6b1d8fe5..c1396e20 100644
--- a/sail/cmd/sail-agent/config/config.go
+++ b/dubbod/planet/cmd/planet-agent/config/config.go
@@ -19,9 +19,9 @@ package config
import "strings"
-func GetSailSan(discoveryAddress string) string {
+func GetPlanetSan(discoveryAddress string) string {
discHost := strings.Split(discoveryAddress, ":")[0]
- // For local debugging - the discoveryAddress is set to localhost, but the cert issued for normal SA.
+ // For local debugging - the discoveryAddress is set to localhost, but the cert issued for normal PA.
if discHost == "localhost" {
discHost = "dubbod.dubbo-system.svc"
}
diff --git a/sail/cmd/sail-agent/main.go b/dubbod/planet/cmd/planet-agent/main.go
similarity index 90%
rename from sail/cmd/sail-agent/main.go
rename to dubbod/planet/cmd/planet-agent/main.go
index 5e97d394..a75d5631 100644
--- a/sail/cmd/sail-agent/main.go
+++ b/dubbod/planet/cmd/planet-agent/main.go
@@ -20,8 +20,8 @@ package main
import (
dubboagent "github.com/apache/dubbo-kubernetes/pkg/dubbo-agent"
"github.com/apache/dubbo-kubernetes/pkg/security"
- "github.com/apache/dubbo-kubernetes/sail/cmd/sail-agent/app"
- "github.com/apache/dubbo-kubernetes/security/pkg/nodeagent/sds"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/cmd/planet-agent/app"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/nodeagent/sds"
meshconfig "istio.io/api/mesh/v1alpha1"
"os"
)
diff --git a/sail/cmd/sail-agent/options/agent.go b/dubbod/planet/cmd/planet-agent/options/agent.go
similarity index 100%
rename from sail/cmd/sail-agent/options/agent.go
rename to dubbod/planet/cmd/planet-agent/options/agent.go
diff --git a/sail/cmd/sail-agent/options/agent_proxy.go b/dubbod/planet/cmd/planet-agent/options/agent_proxy.go
similarity index 93%
rename from sail/cmd/sail-agent/options/agent_proxy.go
rename to dubbod/planet/cmd/planet-agent/options/agent_proxy.go
index 657e519d..d7402cda 100644
--- a/sail/cmd/sail-agent/options/agent_proxy.go
+++ b/dubbod/planet/cmd/planet-agent/options/agent_proxy.go
@@ -17,11 +17,11 @@
package options
-import sailagent "github.com/apache/dubbo-kubernetes/pkg/dubbo-agent"
+import planetagent "github.com/apache/dubbo-kubernetes/pkg/dubbo-agent"
// ProxyArgs provides all of the configuration parameters for the Saku proxy.
type ProxyArgs struct {
- sailagent.Proxy
+ planetagent.Proxy
Concurrency int
StsPort int
diff --git a/sail/cmd/sail-agent/options/options.go b/dubbod/planet/cmd/planet-agent/options/options.go
similarity index 100%
rename from sail/cmd/sail-agent/options/options.go
rename to dubbod/planet/cmd/planet-agent/options/options.go
diff --git a/sail/cmd/sail-agent/options/security.go b/dubbod/planet/cmd/planet-agent/options/security.go
similarity index 93%
rename from sail/cmd/sail-agent/options/security.go
rename to dubbod/planet/cmd/planet-agent/options/security.go
index 8556a344..84470d1e 100644
--- a/sail/cmd/sail-agent/options/security.go
+++ b/dubbod/planet/cmd/planet-agent/options/security.go
@@ -24,9 +24,9 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/jwt"
"github.com/apache/dubbo-kubernetes/pkg/security"
- "github.com/apache/dubbo-kubernetes/sail/pkg/features"
- "github.com/apache/dubbo-kubernetes/security/pkg/credentialfetcher"
- "github.com/apache/dubbo-kubernetes/security/pkg/nodeagent/cafile"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/features"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/credentialfetcher"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/nodeagent/cafile"
meshconfig "istio.io/api/mesh/v1alpha1"
"k8s.io/klog/v2"
)
@@ -37,7 +37,7 @@ func NewSecurityOptions(proxyConfig *meshconfig.ProxyConfig, stsPort int, tokenM
o := &security.Options{
CAEndpoint: caEndpointEnv,
CAProviderName: caProviderEnv,
- SailCertProvider: features.SailCertProvider,
+ PlanetCertProvider: features.PlanetCertProvider,
OutputKeyCertToDir: outputKeyCertToDir,
ProvCert: provCert,
ClusterID: clusterIDVar.Get(),
diff --git a/sail/cmd/sail-discovery/app/cmd.go b/dubbod/planet/cmd/planet-discovery/app/cmd.go
similarity index 91%
rename from sail/cmd/sail-discovery/app/cmd.go
rename to dubbod/planet/cmd/planet-discovery/app/cmd.go
index 329202bb..cb393dcd 100644
--- a/sail/cmd/sail-discovery/app/cmd.go
+++ b/dubbod/planet/cmd/planet-discovery/app/cmd.go
@@ -23,21 +23,21 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/cmd"
"github.com/apache/dubbo-kubernetes/pkg/config/constants"
"github.com/apache/dubbo-kubernetes/pkg/ctrlz"
- "github.com/apache/dubbo-kubernetes/sail/pkg/bootstrap"
- "github.com/apache/dubbo-kubernetes/sail/pkg/features"
- "github.com/apache/dubbo-kubernetes/sail/pkg/serviceregistry/provider"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/bootstrap"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/features"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/serviceregistry/provider"
"github.com/spf13/cobra"
)
var (
- serverArgs *bootstrap.SailArgs
+ serverArgs *bootstrap.PlanetArgs
)
func NewRootCommand() *cobra.Command {
rootCmd := &cobra.Command{
- Use: "sail-discovery",
- Short: "Dubbo Sail.",
- Long: "Dubbo Sail provides mesh-wide traffic management, security and policy capabilities in the Dubbo Service Mesh.",
+ Use: "planet-discovery",
+ Short: "Dubbo Planet.",
+ Long: "Dubbo Planet provides mesh-wide traffic management, security and policy capabilities in the Dubbo Service Mesh.",
SilenceUsage: true,
FParseErrWhitelist: cobra.FParseErrWhitelist{
// Allow unknown flags for backward-compatibility.
@@ -90,7 +90,7 @@ func newDiscoveryCommand() *cobra.Command {
}
func addFlags(c *cobra.Command) {
- serverArgs = bootstrap.NewSailArgs(func(p *bootstrap.SailArgs) {
+ serverArgs = bootstrap.NewPlanetArgs(func(p *bootstrap.PlanetArgs) {
p.CtrlZOptions = ctrlz.DefaultOptions()
p.InjectionOptions = bootstrap.InjectionOptions{
InjectionDirectory: "./var/lib/dubbo/inject",
diff --git a/sail/cmd/sail-discovery/main.go b/dubbod/planet/cmd/planet-discovery/main.go
similarity index 92%
rename from sail/cmd/sail-discovery/main.go
rename to dubbod/planet/cmd/planet-discovery/main.go
index e6d52203..5a68a143 100644
--- a/sail/cmd/sail-discovery/main.go
+++ b/dubbod/planet/cmd/planet-discovery/main.go
@@ -18,7 +18,7 @@
package main
import (
- "github.com/apache/dubbo-kubernetes/sail/cmd/sail-discovery/app"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/cmd/planet-discovery/app"
"os"
)
diff --git a/manifests/profiles/empty.yaml b/dubbod/planet/docker/dockerfile.planet
similarity index 76%
copy from manifests/profiles/empty.yaml
copy to dubbod/planet/docker/dockerfile.planet
index 0c4650a5..fe9e7904 100644
--- a/manifests/profiles/empty.yaml
+++ b/dubbod/planet/docker/dockerfile.planet
@@ -13,18 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-apiVersion: install.dubbo.io/v1alpha1
-kind: DubboOperator
-spec:
- components:
- base:
- enabled: false
- register:
- nacos:
- enabled: false
- zookeeper:
- enabled: false
- dashboard:
- admin:
- enabled: false
-
+FROM gcr.io/distroless/static:debug
+COPY bin/planet-discovery /usr/local/bin/planet-discovery
+USER 9999:9999
+ENTRYPOINT ["/usr/local/bin/planet-discovery"]
diff --git a/manifests/profiles/empty.yaml b/dubbod/planet/docker/dockerfile.proxyadapter
similarity index 76%
copy from manifests/profiles/empty.yaml
copy to dubbod/planet/docker/dockerfile.proxyadapter
index 0c4650a5..5c1530ea 100644
--- a/manifests/profiles/empty.yaml
+++ b/dubbod/planet/docker/dockerfile.proxyadapter
@@ -13,18 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-apiVersion: install.dubbo.io/v1alpha1
-kind: DubboOperator
-spec:
- components:
- base:
- enabled: false
- register:
- nacos:
- enabled: false
- zookeeper:
- enabled: false
- dashboard:
- admin:
- enabled: false
-
+FROM gcr.io/distroless/static:debug
+COPY bin/planet-agent /usr/local/bin/planet-agent
+USER 9999:9999
+ENTRYPOINT ["/usr/local/bin/planet-agent"]
diff --git a/sail/pkg/bootstrap/certcontroller.go b/dubbod/planet/pkg/bootstrap/certcontroller.go
similarity index 94%
rename from sail/pkg/bootstrap/certcontroller.go
rename to dubbod/planet/pkg/bootstrap/certcontroller.go
index 7c732173..2557f4ba 100644
--- a/sail/pkg/bootstrap/certcontroller.go
+++ b/dubbod/planet/pkg/bootstrap/certcontroller.go
@@ -20,18 +20,19 @@ package bootstrap
import (
"bytes"
"fmt"
- "github.com/apache/dubbo-kubernetes/pkg/config/constants"
- "github.com/apache/dubbo-kubernetes/pkg/log"
- "github.com/apache/dubbo-kubernetes/pkg/sleep"
- "github.com/apache/dubbo-kubernetes/sail/pkg/features"
- tb "github.com/apache/dubbo-kubernetes/sail/pkg/trustbundle"
- "github.com/apache/dubbo-kubernetes/security/pkg/k8s/chiron"
- "github.com/apache/dubbo-kubernetes/security/pkg/pki/ca"
- certutil "github.com/apache/dubbo-kubernetes/security/pkg/util"
"os"
"path"
"strings"
"time"
+
+ "github.com/apache/dubbo-kubernetes/pkg/config/constants"
+ "github.com/apache/dubbo-kubernetes/pkg/log"
+ "github.com/apache/dubbo-kubernetes/pkg/sleep"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/features"
+ tb "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/trustbundle"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/k8s/chiron"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/pki/ca"
+ certutil "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/util"
)
const (
@@ -132,9 +133,9 @@ func (s *Server) RotateDNSCertForK8sCA(stop <-chan struct{},
func (s *Server) initDNSCertsK8SRA() error {
var certChain, keyPEM, caBundle []byte
var err error
- sailCertProviderName := features.SailCertProvider
+ planetCertProviderName := features.PlanetCertProvider
- signerName := strings.TrimPrefix(sailCertProviderName, constants.CertProviderKubernetesSignerPrefix)
+ signerName := strings.TrimPrefix(planetCertProviderName, constants.CertProviderKubernetesSignerPrefix)
log.Infof("Generating K8S-signed cert for %v using signer %v", s.dnsNames, signerName)
certChain, keyPEM, _, err = chiron.GenKeyCertK8sCA(s.kubeClient.Kube(),
strings.Join(s.dnsNames, ","), "", signerName, true, SelfSignedCACertTTL.Get())
diff --git a/sail/pkg/bootstrap/configcontroller.go b/dubbod/planet/pkg/bootstrap/configcontroller.go
similarity index 89%
rename from sail/pkg/bootstrap/configcontroller.go
rename to dubbod/planet/pkg/bootstrap/configcontroller.go
index 5a8ab10f..cc047e6e 100644
--- a/sail/pkg/bootstrap/configcontroller.go
+++ b/dubbod/planet/pkg/bootstrap/configcontroller.go
@@ -23,23 +23,24 @@ import (
"crypto/x509"
"encoding/pem"
"fmt"
+ "net/url"
+ "strings"
+
"github.com/apache/dubbo-kubernetes/pkg/adsc"
"github.com/apache/dubbo-kubernetes/pkg/config/schema/collections"
"github.com/apache/dubbo-kubernetes/pkg/log"
- configaggregate "github.com/apache/dubbo-kubernetes/sail/pkg/config/aggregate"
- "github.com/apache/dubbo-kubernetes/sail/pkg/config/kube/crdclient"
- "github.com/apache/dubbo-kubernetes/sail/pkg/config/kube/file"
- "github.com/apache/dubbo-kubernetes/sail/pkg/config/memory"
- dubboCredentials "github.com/apache/dubbo-kubernetes/sail/pkg/credentials"
- "github.com/apache/dubbo-kubernetes/sail/pkg/credentials/kube"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
+ configaggregate "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/config/aggregate"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/config/kube/crdclient"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/config/kube/file"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/config/memory"
+ dubboCredentials "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/credentials"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/credentials/kube"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/credentials/insecure"
"istio.io/api/networking/v1alpha3"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "net/url"
- "strings"
)
type ConfigSourceAddressScheme string
@@ -50,7 +51,7 @@ const (
Kubernetes ConfigSourceAddressScheme = "k8s"
)
-func (s *Server) initConfigController(args *SailArgs) error {
+func (s *Server) initConfigController(args *PlanetArgs) error {
meshConfig := s.environment.Mesh()
if len(meshConfig.ConfigSources) > 0 {
// Using MCP for config.
@@ -62,7 +63,7 @@ func (s *Server) initConfigController(args *SailArgs) error {
configController, err := file.NewController(
args.RegistryOptions.FileDir,
args.RegistryOptions.KubeOptions.DomainSuffix,
- collections.Sail,
+ collections.Planet,
args.RegistryOptions.KubeOptions,
)
if err != nil {
@@ -100,7 +101,7 @@ func (s *Server) initConfigController(args *SailArgs) error {
// initConfigSources will process mesh config 'configSources' and initialize
// associated configs.
-func (s *Server) initConfigSources(args *SailArgs) (err error) {
+func (s *Server) initConfigSources(args *PlanetArgs) (err error) {
for _, configSource := range s.environment.Mesh().ConfigSources {
srcAddress, err := url.Parse(configSource.Address)
if err != nil {
@@ -116,7 +117,7 @@ func (s *Server) initConfigSources(args *SailArgs) (err error) {
configController, err := file.NewController(
srcAddress.Path,
args.RegistryOptions.KubeOptions.DomainSuffix,
- collections.Sail,
+ collections.Planet,
args.RegistryOptions.KubeOptions,
)
if err != nil {
@@ -145,7 +146,7 @@ func (s *Server) initConfigSources(args *SailArgs) (err error) {
if err != nil {
return fmt.Errorf("failed to dial XDS %s %v", configSource.Address, err)
}
- store := memory.Make(collections.Sail)
+ store := memory.Make(collections.Planet)
// TODO: enable namespace filter for memory controller
configController := memory.NewController(store)
configController.RegisterHasSyncedHandler(xdsMCP.HasSynced)
@@ -176,19 +177,19 @@ func (s *Server) initConfigSources(args *SailArgs) (err error) {
return nil
}
-func (s *Server) makeKubeConfigController(args *SailArgs) *crdclient.Client {
+func (s *Server) makeKubeConfigController(args *PlanetArgs) *crdclient.Client {
opts := crdclient.Option{
DomainSuffix: args.RegistryOptions.KubeOptions.DomainSuffix,
Identifier: "crd-controller",
KrtDebugger: args.KrtDebugger,
}
- schemas := collections.Sail
+ schemas := collections.Planet
return crdclient.NewForSchemas(s.kubeClient, opts, schemas)
}
-func (s *Server) initK8SConfigStore(args *SailArgs) error {
+func (s *Server) initK8SConfigStore(args *PlanetArgs) error {
if s.kubeClient == nil {
return nil
}
@@ -207,7 +208,7 @@ func (s *Server) initK8SConfigStore(args *SailArgs) error {
// TODO:
//
// Implement for MUTUAL_TLS/DUBBO_MUTUAL_TLS modes
-func (s *Server) getTransportCredentials(args *SailArgs, tlsSettings *v1alpha3.ClientTLSSettings) (credentials.TransportCredentials, error) {
+func (s *Server) getTransportCredentials(args *PlanetArgs, tlsSettings *v1alpha3.ClientTLSSettings) (credentials.TransportCredentials, error) {
// TODO ValidateTLS
switch tlsSettings.GetMode() {
diff --git a/sail/pkg/bootstrap/discovery.go b/dubbod/planet/pkg/bootstrap/discovery.go
similarity index 81%
rename from sail/pkg/bootstrap/discovery.go
rename to dubbod/planet/pkg/bootstrap/discovery.go
index 8432a57b..2479ca60 100644
--- a/sail/pkg/bootstrap/discovery.go
+++ b/dubbod/planet/pkg/bootstrap/discovery.go
@@ -18,12 +18,12 @@
package bootstrap
import (
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
- "github.com/apache/dubbo-kubernetes/sail/pkg/networking/apigen"
- "github.com/apache/dubbo-kubernetes/sail/pkg/networking/core"
- "github.com/apache/dubbo-kubernetes/sail/pkg/networking/grpcgen"
- "github.com/apache/dubbo-kubernetes/sail/pkg/xds"
- v3 "github.com/apache/dubbo-kubernetes/sail/pkg/xds/v3"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/networking/apigen"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/networking/core"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/networking/grpcgen"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/xds"
+ v3 "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/xds/v3"
)
func InitGenerators(
diff --git a/sail/pkg/bootstrap/dubbo_ca.go b/dubbod/planet/pkg/bootstrap/dubbo_ca.go
similarity index 97%
rename from sail/pkg/bootstrap/dubbo_ca.go
rename to dubbod/planet/pkg/bootstrap/dubbo_ca.go
index 3405d984..b72065e4 100644
--- a/sail/pkg/bootstrap/dubbo_ca.go
+++ b/dubbod/planet/pkg/bootstrap/dubbo_ca.go
@@ -26,14 +26,14 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/env"
"github.com/apache/dubbo-kubernetes/pkg/log"
"github.com/apache/dubbo-kubernetes/pkg/security"
- "github.com/apache/dubbo-kubernetes/sail/pkg/features"
- securityModel "github.com/apache/dubbo-kubernetes/sail/pkg/security/model"
- "github.com/apache/dubbo-kubernetes/security/pkg/cmd"
- "github.com/apache/dubbo-kubernetes/security/pkg/pki/ca"
- "github.com/apache/dubbo-kubernetes/security/pkg/pki/ra"
- caserver "github.com/apache/dubbo-kubernetes/security/pkg/server/ca"
- "github.com/apache/dubbo-kubernetes/security/pkg/server/ca/authenticate"
- "github.com/apache/dubbo-kubernetes/security/pkg/util"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/features"
+ securityModel "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/security/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/cmd"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/pki/ca"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/pki/ra"
+ caserver "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/server/ca"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/server/ca/authenticate"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/util"
"github.com/fsnotify/fsnotify"
"google.golang.org/grpc"
"istio.io/api/security/v1beta1"
diff --git a/sail/pkg/bootstrap/mesh.go b/dubbod/planet/pkg/bootstrap/mesh.go
similarity index 85%
rename from sail/pkg/bootstrap/mesh.go
rename to dubbod/planet/pkg/bootstrap/mesh.go
index 98db06ac..b8c56595 100644
--- a/sail/pkg/bootstrap/mesh.go
+++ b/dubbod/planet/pkg/bootstrap/mesh.go
@@ -19,14 +19,15 @@ package bootstrap
import (
"fmt"
+ "os"
+
"github.com/apache/dubbo-kubernetes/pkg/config/mesh/kubemesh"
"github.com/apache/dubbo-kubernetes/pkg/config/mesh/meshwatcher"
"github.com/apache/dubbo-kubernetes/pkg/filewatcher"
"github.com/apache/dubbo-kubernetes/pkg/kube/krt"
"github.com/apache/dubbo-kubernetes/pkg/log"
"github.com/apache/dubbo-kubernetes/pkg/ptr"
- "github.com/apache/dubbo-kubernetes/sail/pkg/features"
- "os"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/features"
"sigs.k8s.io/yaml"
)
@@ -34,7 +35,7 @@ const (
defaultMeshConfigMapName = "dubbo"
)
-func (s *Server) initMeshConfiguration(args *SailArgs, fileWatcher filewatcher.FileWatcher) {
+func (s *Server) initMeshConfiguration(args *PlanetArgs, fileWatcher filewatcher.FileWatcher) {
log.Infof("initializing mesh configuration %v", args.MeshConfigFile)
col := s.getMeshConfiguration(args, fileWatcher)
col.AsCollection().WaitUntilSynced(s.internalStop)
@@ -44,7 +45,7 @@ func (s *Server) initMeshConfiguration(args *SailArgs, fileWatcher filewatcher.F
log.Infof("flags: \n%s", argsdump)
}
-func (s *Server) initMeshNetworks(args *SailArgs, fileWatcher filewatcher.FileWatcher) {
+func (s *Server) initMeshNetworks(args *PlanetArgs, fileWatcher filewatcher.FileWatcher) {
log.Infof("initializing mesh networks configuration %v", args.NetworksConfigFile)
col := s.getMeshNetworks(args, fileWatcher)
col.AsCollection().WaitUntilSynced(s.internalStop)
@@ -52,7 +53,7 @@ func (s *Server) initMeshNetworks(args *SailArgs, fileWatcher filewatcher.FileWa
log.Infof("mesh networks configuration: %s", meshwatcher.PrettyFormatOfMeshNetworks(s.environment.MeshNetworks()))
}
-func (s *Server) getMeshNetworks(args *SailArgs, fileWatcher filewatcher.FileWatcher) krt.Singleton[meshwatcher.MeshNetworksResource] {
+func (s *Server) getMeshNetworks(args *PlanetArgs, fileWatcher filewatcher.FileWatcher) krt.Singleton[meshwatcher.MeshNetworksResource] {
// We need to get mesh networks up-front, before we start anything, so we use internalStop rather than scheduling a task to run
// later.
opts := krt.NewOptionsBuilder(s.internalStop, "", args.KrtDebugger)
@@ -63,7 +64,7 @@ func (s *Server) getMeshNetworks(args *SailArgs, fileWatcher filewatcher.FileWat
return meshwatcher.NewNetworksCollection(opts, sources...)
}
-func (s *Server) getMeshConfiguration(args *SailArgs, fileWatcher filewatcher.FileWatcher) krt.Singleton[meshwatcher.MeshConfigResource] {
+func (s *Server) getMeshConfiguration(args *PlanetArgs, fileWatcher filewatcher.FileWatcher) krt.Singleton[meshwatcher.MeshConfigResource] {
opts := krt.NewOptionsBuilder(s.internalStop, "", args.KrtDebugger)
sources := s.getConfigurationSources(args, fileWatcher, args.MeshConfigFile, kubemesh.MeshConfigKey)
if len(sources) == 0 {
@@ -72,7 +73,7 @@ func (s *Server) getMeshConfiguration(args *SailArgs, fileWatcher filewatcher.Fi
return meshwatcher.NewCollection(opts, sources...)
}
-func (s *Server) getConfigurationSources(args *SailArgs, fileWatcher filewatcher.FileWatcher, file string, cmKey string) []meshwatcher.MeshConfigSource {
+func (s *Server) getConfigurationSources(args *PlanetArgs, fileWatcher filewatcher.FileWatcher, file string, cmKey string) []meshwatcher.MeshConfigSource {
opts := krt.NewOptionsBuilder(s.internalStop, "", args.KrtDebugger)
var userMeshConfig *meshwatcher.MeshConfigSource
if features.SharedMeshConfig != "" && s.kubeClient != nil {
diff --git a/sail/pkg/bootstrap/options.go b/dubbod/planet/pkg/bootstrap/options.go
similarity index 91%
rename from sail/pkg/bootstrap/options.go
rename to dubbod/planet/pkg/bootstrap/options.go
index f1c99bb5..e3df14a5 100644
--- a/sail/pkg/bootstrap/options.go
+++ b/dubbod/planet/pkg/bootstrap/options.go
@@ -23,7 +23,7 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/env"
"github.com/apache/dubbo-kubernetes/pkg/keepalive"
"github.com/apache/dubbo-kubernetes/pkg/kube/krt"
- kubecontroller "github.com/apache/dubbo-kubernetes/sail/pkg/serviceregistry/kube/controller"
+ kubecontroller "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/serviceregistry/kube/controller"
)
var (
@@ -44,7 +44,7 @@ type InjectionOptions struct {
InjectionDirectory string
}
-type SailArgs struct {
+type PlanetArgs struct {
ServerOptions DiscoveryServerOptions
RegistryOptions RegistryOptions
InjectionOptions InjectionOptions
@@ -76,8 +76,8 @@ type TLSOptions struct {
CipherSuits []uint16 // This is the parsed cipher suites
}
-func NewSailArgs(initFuncs ...func(*SailArgs)) *SailArgs {
- p := &SailArgs{}
+func NewPlanetArgs(initFuncs ...func(*PlanetArgs)) *PlanetArgs {
+ p := &PlanetArgs{}
// Apply Default Values.
p.applyDefaults()
@@ -92,7 +92,7 @@ func NewSailArgs(initFuncs ...func(*SailArgs)) *SailArgs {
var Revision = env.Register("REVISION", "", "").Get()
-func (p *SailArgs) applyDefaults() {
+func (p *PlanetArgs) applyDefaults() {
p.Namespace = PodNamespace
p.PodName = PodName
p.Revision = Revision
diff --git a/sail/pkg/bootstrap/proxylessinjector.go b/dubbod/planet/pkg/bootstrap/proxylessinjector.go
similarity index 94%
rename from sail/pkg/bootstrap/proxylessinjector.go
rename to dubbod/planet/pkg/bootstrap/proxylessinjector.go
index 7e490cad..774a2726 100644
--- a/sail/pkg/bootstrap/proxylessinjector.go
+++ b/dubbod/planet/pkg/bootstrap/proxylessinjector.go
@@ -20,26 +20,27 @@ package bootstrap
import (
"context"
"fmt"
- "github.com/apache/dubbo-kubernetes/pkg/log"
"os"
"path/filepath"
+ "github.com/apache/dubbo-kubernetes/pkg/log"
+
"github.com/apache/dubbo-kubernetes/pkg/env"
"github.com/apache/dubbo-kubernetes/pkg/kube/inject"
"github.com/apache/dubbo-kubernetes/pkg/webhooks"
- "github.com/apache/dubbo-kubernetes/sail/pkg/features"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/features"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
const (
- webhookName = "proxyless-injector.dubbo.io"
+ webhookName = "proxyless-injector.dubbo.apache.org"
defaultInjectorConfigMapName = "dubbo-proxyless-injector"
)
var injectionEnabled = env.Register("INJECT_ENABLED", true, "Enable mutating webhook handler.")
-func (s *Server) initProxylessInjector(args *SailArgs) (*inject.Webhook, error) {
+func (s *Server) initProxylessInjector(args *PlanetArgs) (*inject.Webhook, error) {
// currently the constant: "./var/lib/dubbo/inject"
injectPath := args.InjectionOptions.InjectionDirectory
if injectPath == "" || !injectionEnabled.Get() {
diff --git a/sail/pkg/bootstrap/server.go b/dubbod/planet/pkg/bootstrap/server.go
similarity index 89%
rename from sail/pkg/bootstrap/server.go
rename to dubbod/planet/pkg/bootstrap/server.go
index 19adb183..8945b632 100644
--- a/sail/pkg/bootstrap/server.go
+++ b/dubbod/planet/pkg/bootstrap/server.go
@@ -22,6 +22,13 @@ import (
"crypto/tls"
"crypto/x509"
"fmt"
+ "net"
+ "net/http"
+ "os"
+ "strings"
+ "sync"
+ "time"
+
"github.com/apache/dubbo-kubernetes/pkg/cluster"
"github.com/apache/dubbo-kubernetes/pkg/config"
"github.com/apache/dubbo-kubernetes/pkg/config/constants"
@@ -42,19 +49,19 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/network"
"github.com/apache/dubbo-kubernetes/pkg/spiffe"
"github.com/apache/dubbo-kubernetes/pkg/util/sets"
- "github.com/apache/dubbo-kubernetes/sail/pkg/features"
- dubbogrpc "github.com/apache/dubbo-kubernetes/sail/pkg/grpc"
- "github.com/apache/dubbo-kubernetes/sail/pkg/keycertbundle"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
- "github.com/apache/dubbo-kubernetes/sail/pkg/networking/core"
- "github.com/apache/dubbo-kubernetes/sail/pkg/server"
- "github.com/apache/dubbo-kubernetes/sail/pkg/serviceregistry/aggregate"
- "github.com/apache/dubbo-kubernetes/sail/pkg/serviceregistry/provider"
- tb "github.com/apache/dubbo-kubernetes/sail/pkg/trustbundle"
- "github.com/apache/dubbo-kubernetes/sail/pkg/xds"
- "github.com/apache/dubbo-kubernetes/security/pkg/pki/ca"
- "github.com/apache/dubbo-kubernetes/security/pkg/pki/ra"
- caserver "github.com/apache/dubbo-kubernetes/security/pkg/server/ca"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/features"
+ dubbogrpc "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/grpc"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/keycertbundle"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/networking/core"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/server"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/serviceregistry/aggregate"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/serviceregistry/provider"
+ tb "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/trustbundle"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/xds"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/pki/ca"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/pki/ra"
+ caserver "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/server/ca"
"github.com/fsnotify/fsnotify"
grpcprom "github.com/grpc-ecosystem/go-grpc-prometheus"
"go.uber.org/atomic"
@@ -65,12 +72,6 @@ import (
meshconfig "istio.io/api/mesh/v1alpha1"
corev1 "k8s.io/api/core/v1"
"k8s.io/client-go/rest"
- "net"
- "net/http"
- "os"
- "strings"
- "sync"
- "time"
)
const (
@@ -140,7 +141,7 @@ type webhookInfo struct {
type readinessProbe func() bool
-func NewServer(args *SailArgs, initFuncs ...func(*Server)) (*Server, error) {
+func NewServer(args *PlanetArgs, initFuncs ...func(*Server)) (*Server, error) {
e := model.NewEnvironment()
e.DomainSuffix = args.RegistryOptions.KubeOptions.DomainSuffix
@@ -343,7 +344,7 @@ func (s *Server) initRegistryEventHandlers() {
if s.configController != nil {
configHandler := func(prev config.Config, curr config.Config, event model.Event) {}
- schemas := collections.Sail.All()
+ schemas := collections.Planet.All()
for _, schema := range schemas {
s.configController.RegisterEventHandler(schema.GroupVersionKind(), configHandler)
}
@@ -394,7 +395,7 @@ func (s *Server) startCA(caOpts *caOptions) {
})
}
-func (s *Server) initMulticluster(args *SailArgs) {
+func (s *Server) initMulticluster(args *PlanetArgs) {
if s.kubeClient == nil {
return
}
@@ -408,7 +409,7 @@ func (s *Server) initMulticluster(args *SailArgs) {
})
}
-func (s *Server) initKubeClient(args *SailArgs) error {
+func (s *Server) initKubeClient(args *PlanetArgs) error {
if s.kubeClient != nil {
// Already initialized by startup arguments
return nil
@@ -468,7 +469,7 @@ func (s *Server) initMeshHandlers(changeHandler func(_ *meshconfig.MeshConfig))
})
}
-func (s *Server) initServers(args *SailArgs) {
+func (s *Server) initServers(args *PlanetArgs) {
s.initGrpcServer(args.KeepaliveOptions)
multiplexGRPC := false
if args.ServerOptions.GRPCAddr != "" {
@@ -513,7 +514,7 @@ func (s *Server) initGrpcServer(options *dubbokeepalive.Options) {
reflection.Register(s.grpcServer)
}
-func (s *Server) initControllers(args *SailArgs) error {
+func (s *Server) initControllers(args *PlanetArgs) error {
log.Info("initializing controllers")
s.initMulticluster(args)
@@ -529,7 +530,7 @@ func (s *Server) initControllers(args *SailArgs) error {
return nil
}
-func (s *Server) initSecureDiscoveryService(args *SailArgs, trustDomain string) error {
+func (s *Server) initSecureDiscoveryService(args *PlanetArgs, trustDomain string) error {
if args.ServerOptions.SecureGRPCAddr == "" {
log.Info("The secure discovery port is disabled, multiplexing on httpAddr ")
return nil
@@ -604,8 +605,8 @@ func (s *Server) createPeerCertVerifier(tlsOptions TLSOptions, trustDomain strin
}
} else {
if s.RA != nil {
- if strings.HasPrefix(features.SailCertProvider, constants.CertProviderKubernetesSignerPrefix) {
- signerName := strings.TrimPrefix(features.SailCertProvider, constants.CertProviderKubernetesSignerPrefix)
+ if strings.HasPrefix(features.PlanetCertProvider, constants.CertProviderKubernetesSignerPrefix) {
+ signerName := strings.TrimPrefix(features.PlanetCertProvider, constants.CertProviderKubernetesSignerPrefix)
caBundle, _ := s.RA.GetRootCertFromMeshConfig(signerName)
rootCertBytes = append(rootCertBytes, caBundle...)
} else {
@@ -691,7 +692,7 @@ func (s *Server) addStartFunc(name string, fn server.Component) {
s.server.RunComponent(name, fn)
}
-func getClusterID(args *SailArgs) cluster.ID {
+func getClusterID(args *PlanetArgs) cluster.ID {
clusterID := args.RegistryOptions.KubeOptions.ClusterID
if clusterID == "" {
if hasKubeRegistry(args.RegistryOptions.Registries) {
@@ -707,7 +708,7 @@ func (s *Server) initSDSServer() {
}
if !features.EnableXDSIdentityCheck {
// Make sure we have security
- log.Warnf("skipping Kubernetes credential reader; SAIL_ENABLE_XDS_IDENTITY_CHECK must be set to true for this feature.")
+ log.Warnf("skipping Kubernetes credential reader; PLANET_ENABLE_XDS_IDENTITY_CHECK must be set to true for this feature.")
} else {
// TODO ConfigUpdated Multicluster get secret and configmap
}
@@ -715,7 +716,7 @@ func (s *Server) initSDSServer() {
// isK8SSigning returns whether K8S (as a RA) is used to sign certs instead of private keys known by Dubbod
func (s *Server) isK8SSigning() bool {
- return s.RA != nil && strings.HasPrefix(features.SailCertProvider, constants.CertProviderKubernetesSignerPrefix)
+ return s.RA != nil && strings.HasPrefix(features.PlanetCertProvider, constants.CertProviderKubernetesSignerPrefix)
}
func (s *Server) waitForShutdown(stop <-chan struct{}) {
@@ -810,7 +811,7 @@ func (s *Server) waitForCacheSync(stop <-chan struct{}) bool {
return kubelib.WaitForCacheSync("push context", stop, func() bool { return s.pushContextReady(expected) })
}
-func (s *Server) initDubbodCerts(args *SailArgs, host string) error {
+func (s *Server) initDubbodCerts(args *PlanetArgs, host string) error {
// Skip all certificates
var err error
@@ -827,17 +828,17 @@ func (s *Server) initDubbodCerts(args *SailArgs, host string) error {
log.Errorf("error initializing certificate watches: %v", err)
return nil
}
- } else if features.EnableCAServer && features.SailCertProvider == constants.CertProviderDubbod {
+ } else if features.EnableCAServer && features.PlanetCertProvider == constants.CertProviderDubbod {
log.Infof("initializing Dubbod DNS certificates host: %s, custom host: %s", host, features.DubbodServiceCustomHost)
err = s.initDNSCertsDubbod()
- } else if features.SailCertProvider == constants.CertProviderKubernetes {
- log.Warnf("SAIL_CERT_PROVIDER=kubernetes is no longer supported by upstream K8S")
- } else if strings.HasPrefix(features.SailCertProvider, constants.CertProviderKubernetesSignerPrefix) {
- log.Infof("initializing Dubbod DNS certificates using K8S RA:%s host: %s, custom host: %s", features.SailCertProvider,
+ } else if features.PlanetCertProvider == constants.CertProviderKubernetes {
+ log.Warnf("PLANET_CERT_PROVIDER=kubernetes is no longer supported by upstream K8S")
+ } else if strings.HasPrefix(features.PlanetCertProvider, constants.CertProviderKubernetesSignerPrefix) {
+ log.Infof("initializing Dubbod DNS certificates using K8S RA:%s host: %s, custom host: %s", features.PlanetCertProvider,
host, features.DubbodServiceCustomHost)
err = s.initDNSCertsK8SRA()
} else {
- log.Warnf("SAIL_CERT_PROVIDER=%s is not implemented", features.SailCertProvider)
+ log.Warnf("PLANET_CERT_PROVIDER=%s is not implemented", features.PlanetCertProvider)
}
if err == nil {
@@ -868,14 +869,14 @@ func (s *Server) shouldStartNsController() bool {
}
// For no CA we don't distribute it either, as there is no cert
- if features.SailCertProvider == constants.CertProviderNone {
+ if features.PlanetCertProvider == constants.CertProviderNone {
return false
}
return true
}
-func getDNSNames(args *SailArgs, host string) []string {
+func getDNSNames(args *PlanetArgs, host string) []string {
// Append custom hostname if there is any
customHost := features.DubbodServiceCustomHost
var cHosts []string
@@ -896,17 +897,17 @@ func hasCustomTLSCerts(tlsOptions TLSOptions) (ok bool, tlsCertPath, tlsKeyPath,
return true, tlsOptions.CertFile, tlsOptions.KeyFile, tlsOptions.CaCertFile
}
- if ok = checkPathsExist(constants.DefaultSailTLSCert, constants.DefaultSailTLSKey, constants.DefaultSailTLSCaCert); ok {
- tlsCertPath = constants.DefaultSailTLSCert
- tlsKeyPath = constants.DefaultSailTLSKey
- caCertPath = constants.DefaultSailTLSCaCert
+ if ok = checkPathsExist(constants.DefaultPlanetTLSCert, constants.DefaultPlanetTLSKey, constants.DefaultPlanetTLSCaCert); ok {
+ tlsCertPath = constants.DefaultPlanetTLSCert
+ tlsKeyPath = constants.DefaultPlanetTLSKey
+ caCertPath = constants.DefaultPlanetTLSCaCert
return
}
- if ok = checkPathsExist(constants.DefaultSailTLSCert, constants.DefaultSailTLSKey, constants.DefaultSailTLSCaCertAlternatePath); ok {
- tlsCertPath = constants.DefaultSailTLSCert
- tlsKeyPath = constants.DefaultSailTLSKey
- caCertPath = constants.DefaultSailTLSCaCertAlternatePath
+ if ok = checkPathsExist(constants.DefaultPlanetTLSCert, constants.DefaultPlanetTLSKey, constants.DefaultPlanetTLSCaCertAlternatePath); ok {
+ tlsCertPath = constants.DefaultPlanetTLSCert
+ tlsKeyPath = constants.DefaultPlanetTLSKey
+ caCertPath = constants.DefaultPlanetTLSCaCertAlternatePath
return
}
diff --git a/sail/pkg/bootstrap/servicecontroller.go b/dubbod/planet/pkg/bootstrap/servicecontroller.go
similarity index 87%
rename from sail/pkg/bootstrap/servicecontroller.go
rename to dubbod/planet/pkg/bootstrap/servicecontroller.go
index 4fa83bd3..ea185cbb 100644
--- a/sail/pkg/bootstrap/servicecontroller.go
+++ b/dubbod/planet/pkg/bootstrap/servicecontroller.go
@@ -19,12 +19,13 @@ package bootstrap
import (
"fmt"
+
"github.com/apache/dubbo-kubernetes/pkg/log"
"github.com/apache/dubbo-kubernetes/pkg/util/sets"
- "github.com/apache/dubbo-kubernetes/sail/pkg/serviceregistry/aggregate"
- kubecontroller "github.com/apache/dubbo-kubernetes/sail/pkg/serviceregistry/kube/controller"
- "github.com/apache/dubbo-kubernetes/sail/pkg/serviceregistry/provider"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/serviceregistry/aggregate"
+ kubecontroller "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/serviceregistry/kube/controller"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/serviceregistry/provider"
)
func (s *Server) ServiceController() *aggregate.Controller {
@@ -32,7 +33,7 @@ func (s *Server) ServiceController() *aggregate.Controller {
}
// initServiceControllers creates and initializes the service controllers
-func (s *Server) initServiceControllers(args *SailArgs) error {
+func (s *Server) initServiceControllers(args *PlanetArgs) error {
serviceControllers := s.ServiceController()
registered := sets.New[provider.ID]()
@@ -63,7 +64,7 @@ func (s *Server) initServiceControllers(args *SailArgs) error {
return nil
}
-func (s *Server) initKubeRegistry(args *SailArgs) (err error) {
+func (s *Server) initKubeRegistry(args *PlanetArgs) (err error) {
args.RegistryOptions.KubeOptions.ClusterID = s.clusterID
args.RegistryOptions.KubeOptions.Revision = args.Revision
args.RegistryOptions.KubeOptions.KrtDebugger = args.KrtDebugger
diff --git a/sail/pkg/bootstrap/util.go b/dubbod/planet/pkg/bootstrap/util.go
similarity index 92%
rename from sail/pkg/bootstrap/util.go
rename to dubbod/planet/pkg/bootstrap/util.go
index 9d4a15e4..d53828c8 100644
--- a/sail/pkg/bootstrap/util.go
+++ b/dubbod/planet/pkg/bootstrap/util.go
@@ -18,7 +18,7 @@
package bootstrap
import (
- "github.com/apache/dubbo-kubernetes/sail/pkg/serviceregistry/provider"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/serviceregistry/provider"
)
func hasKubeRegistry(registries []string) bool {
diff --git a/sail/pkg/bootstrap/validation.go b/dubbod/planet/pkg/bootstrap/validation.go
similarity index 92%
rename from sail/pkg/bootstrap/validation.go
rename to dubbod/planet/pkg/bootstrap/validation.go
index 26b4b02a..ccd3042c 100644
--- a/sail/pkg/bootstrap/validation.go
+++ b/dubbod/planet/pkg/bootstrap/validation.go
@@ -21,10 +21,10 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/log"
"github.com/apache/dubbo-kubernetes/pkg/webhooks/server"
"github.com/apache/dubbo-kubernetes/pkg/webhooks/validation/controller"
- "github.com/apache/dubbo-kubernetes/sail/pkg/features"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/features"
)
-func (s *Server) initConfigValidation(args *SailArgs) error {
+func (s *Server) initConfigValidation(args *PlanetArgs) error {
if s.kubeClient == nil {
return nil
}
diff --git a/sail/pkg/bootstrap/webhook.go b/dubbod/planet/pkg/bootstrap/webhook.go
similarity index 97%
rename from sail/pkg/bootstrap/webhook.go
rename to dubbod/planet/pkg/bootstrap/webhook.go
index 630c234a..19b030ba 100644
--- a/sail/pkg/bootstrap/webhook.go
+++ b/dubbod/planet/pkg/bootstrap/webhook.go
@@ -39,7 +39,7 @@ func (*httpServerErrorLogWriter) Write(p []byte) (int, error) {
return len(p), nil
}
-func (s *Server) initSecureWebhookServer(args *SailArgs) {
+func (s *Server) initSecureWebhookServer(args *PlanetArgs) {
if args.ServerOptions.HTTPSAddr == "" {
s.httpsMux = s.httpMux
dubbolog.Infof("HTTPS port is disabled, multiplexing webhooks on the httpAddr %v", args.ServerOptions.HTTPAddr)
diff --git a/sail/pkg/config/aggregate/config.go b/dubbod/planet/pkg/config/aggregate/config.go
similarity index 98%
rename from sail/pkg/config/aggregate/config.go
rename to dubbod/planet/pkg/config/aggregate/config.go
index 4da244c2..d9231971 100644
--- a/sail/pkg/config/aggregate/config.go
+++ b/dubbod/planet/pkg/config/aggregate/config.go
@@ -28,7 +28,7 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/config"
"github.com/apache/dubbo-kubernetes/pkg/util/sets"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
)
var errorUnsupported = errors.New("unsupported operation: the config aggregator is read-only")
diff --git a/sail/pkg/config/kube/clustertrustbundle/controller.go b/dubbod/planet/pkg/config/kube/clustertrustbundle/controller.go
similarity index 95%
rename from sail/pkg/config/kube/clustertrustbundle/controller.go
rename to dubbod/planet/pkg/config/kube/clustertrustbundle/controller.go
index 40772a8b..d7fcca3a 100644
--- a/sail/pkg/config/kube/clustertrustbundle/controller.go
+++ b/dubbod/planet/pkg/config/kube/clustertrustbundle/controller.go
@@ -25,12 +25,12 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/kube"
"github.com/apache/dubbo-kubernetes/pkg/kube/controllers"
"github.com/apache/dubbo-kubernetes/pkg/kube/kclient"
- "github.com/apache/dubbo-kubernetes/sail/pkg/keycertbundle"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/keycertbundle"
)
const (
- dubboClusterTrustBundleName = "dubbo.io:dubbo-ca:root-cert"
- dubboClusterTrustBundleSignerName = "dubbo.io/dubbod-ca"
+ dubboClusterTrustBundleName = "dubbo.apache.org:dubbo-ca:root-cert"
+ dubboClusterTrustBundleSignerName = "dubbo.apache.org/dubbod-ca"
maxRetries = 5
)
diff --git a/sail/pkg/config/kube/crd/config.go b/dubbod/planet/pkg/config/kube/crd/config.go
similarity index 100%
rename from sail/pkg/config/kube/crd/config.go
rename to dubbod/planet/pkg/config/kube/crd/config.go
diff --git a/sail/pkg/config/kube/crd/conversion.go b/dubbod/planet/pkg/config/kube/crd/conversion.go
similarity index 100%
rename from sail/pkg/config/kube/crd/conversion.go
rename to dubbod/planet/pkg/config/kube/crd/conversion.go
diff --git a/sail/pkg/config/kube/crdclient/client.go b/dubbod/planet/pkg/config/kube/crdclient/client.go
similarity index 96%
rename from sail/pkg/config/kube/crdclient/client.go
rename to dubbod/planet/pkg/config/kube/crdclient/client.go
index 72b5b972..92a34c23 100644
--- a/sail/pkg/config/kube/crdclient/client.go
+++ b/dubbod/planet/pkg/config/kube/crdclient/client.go
@@ -32,7 +32,7 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/kube/kubetypes"
"github.com/apache/dubbo-kubernetes/pkg/log"
"github.com/apache/dubbo-kubernetes/pkg/maps"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
jsonmerge "github.com/evanphx/json-patch/v5"
"go.uber.org/atomic"
"gomodules.xyz/jsonpatch/v2"
@@ -88,7 +88,7 @@ func NewForSchemas(client kube.Client, opts Option, schemas collection.Schemas)
client: client,
filtersByGVK: opts.FiltersByGVK,
stop: stop,
- logger: log.RegisterScope("crdclient", "Sail Kubernetes CRD controller"),
+ logger: log.RegisterScope("crdclient", "Planet Kubernetes CRD controller"),
}
kopts := krt.NewOptionsBuilder(stop, "crdclient", opts.KrtDebugger)
@@ -108,11 +108,11 @@ func (cl *Client) Run(stop <-chan struct{}) {
}
t0 := time.Now()
- cl.logger.Infof("Starting Sail Kubernetes CRD controller")
+ cl.logger.Infof("Starting Planet Kubernetes CRD controller")
if !kube.WaitForCacheSync("crdclient", stop, cl.informerSynced) {
- cl.logger.Infof("Failed to sync Sail Kubernetes CRD controller cache")
+ cl.logger.Infof("Failed to sync Planet Kubernetes CRD controller cache")
} else {
- cl.logger.Infof("Sail Kubernetes CRD controller synced in %v", time.Since(t0))
+ cl.logger.Infof("Planet Kubernetes CRD controller synced in %v", time.Since(t0))
}
<-stop
close(cl.stop)
diff --git a/sail/pkg/config/kube/crdclient/types.go b/dubbod/planet/pkg/config/kube/crdclient/types.go
similarity index 99%
rename from sail/pkg/config/kube/crdclient/types.go
rename to dubbod/planet/pkg/config/kube/crdclient/types.go
index 630129eb..cd833509 100644
--- a/sail/pkg/config/kube/crdclient/types.go
+++ b/dubbod/planet/pkg/config/kube/crdclient/types.go
@@ -139,7 +139,7 @@ func patch(c kube.Client, orig config.Config, origMeta metav1.ObjectMeta, mod co
return nil, err
}
return c.Dubbo().NetworkingV1().DestinationRules(orig.Namespace).
- Patch(context.TODO(), orig.Name, typ, patchBytes, metav1.PatchOptions{FieldManager: "sail-discovery"})
+ Patch(context.TODO(), orig.Name, typ, patchBytes, metav1.PatchOptions{FieldManager: "planet-discovery"})
case gvk.PeerAuthentication:
oldRes := &apiistioioapisecurityv1.PeerAuthentication{
ObjectMeta: origMeta,
@@ -154,7 +154,7 @@ func patch(c kube.Client, orig config.Config, origMeta metav1.ObjectMeta, mod co
return nil, err
}
return c.Dubbo().SecurityV1().PeerAuthentications(orig.Namespace).
- Patch(context.TODO(), orig.Name, typ, patchBytes, metav1.PatchOptions{FieldManager: "sail-discovery"})
+ Patch(context.TODO(), orig.Name, typ, patchBytes, metav1.PatchOptions{FieldManager: "planet-discovery"})
case gvk.RequestAuthentication:
oldRes := &apiistioioapisecurityv1.RequestAuthentication{
ObjectMeta: origMeta,
@@ -169,7 +169,7 @@ func patch(c kube.Client, orig config.Config, origMeta metav1.ObjectMeta, mod co
return nil, err
}
return c.Dubbo().SecurityV1().RequestAuthentications(orig.Namespace).
- Patch(context.TODO(), orig.Name, typ, patchBytes, metav1.PatchOptions{FieldManager: "sail-discovery"})
+ Patch(context.TODO(), orig.Name, typ, patchBytes, metav1.PatchOptions{FieldManager: "planet-discovery"})
case gvk.VirtualService:
oldRes := &apiistioioapinetworkingv1.VirtualService{
ObjectMeta: origMeta,
@@ -184,7 +184,7 @@ func patch(c kube.Client, orig config.Config, origMeta metav1.ObjectMeta, mod co
return nil, err
}
return c.Dubbo().NetworkingV1().VirtualServices(orig.Namespace).
- Patch(context.TODO(), orig.Name, typ, patchBytes, metav1.PatchOptions{FieldManager: "sail-discovery"})
+ Patch(context.TODO(), orig.Name, typ, patchBytes, metav1.PatchOptions{FieldManager: "planet-discovery"})
default:
return nil, fmt.Errorf("unsupported type: %v", orig.GroupVersionKind)
}
diff --git a/sail/pkg/config/kube/file/controller.go b/dubbod/planet/pkg/config/kube/file/controller.go
similarity index 94%
rename from sail/pkg/config/kube/file/controller.go
rename to dubbod/planet/pkg/config/kube/file/controller.go
index 1a5ab7dc..1861b8c0 100644
--- a/sail/pkg/config/kube/file/controller.go
+++ b/dubbod/planet/pkg/config/kube/file/controller.go
@@ -21,7 +21,7 @@ import (
"fmt"
"github.com/apache/dubbo-kubernetes/pkg/config/schema/collection"
- "github.com/apache/dubbo-kubernetes/sail/pkg/config/kube/crd"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/config/kube/crd"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/apache/dubbo-kubernetes/pkg/config"
@@ -29,8 +29,8 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/kube/controllers"
"github.com/apache/dubbo-kubernetes/pkg/kube/krt"
krtfiles "github.com/apache/dubbo-kubernetes/pkg/kube/krt/files"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
- kubecontroller "github.com/apache/dubbo-kubernetes/sail/pkg/serviceregistry/kube/controller"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
+ kubecontroller "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/serviceregistry/kube/controller"
)
var errUnsupportedOp = fmt.Errorf("unsupported operation: the file config store is a read-only view")
@@ -79,7 +79,7 @@ func NewController(fileDir string, domainSuffix string, schemas collection.Schem
data := make(map[config.GroupVersionKind]kindStore)
for _, s := range schemas.All() {
gvk := s.GroupVersionKind()
- if _, ok := collections.Sail.FindByGroupVersionKind(gvk); ok {
+ if _, ok := collections.Planet.FindByGroupVersionKind(gvk); ok {
collection := krt.NewCollection(mainCollection, func(ctx krt.HandlerContext, c ConfigKind) *config.Config {
if c.GroupVersionKind == gvk {
return c.Config
diff --git a/sail/pkg/config/memory/controller.go b/dubbod/planet/pkg/config/memory/controller.go
similarity index 98%
rename from sail/pkg/config/memory/controller.go
rename to dubbod/planet/pkg/config/memory/controller.go
index bef451d9..7b258757 100644
--- a/sail/pkg/config/memory/controller.go
+++ b/dubbod/planet/pkg/config/memory/controller.go
@@ -23,7 +23,7 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/config"
"github.com/apache/dubbo-kubernetes/pkg/config/schema/collection"
"github.com/apache/dubbo-kubernetes/pkg/slices"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
"k8s.io/apimachinery/pkg/types"
)
diff --git a/sail/pkg/config/memory/monitor.go b/dubbod/planet/pkg/config/memory/monitor.go
similarity index 95%
rename from sail/pkg/config/memory/monitor.go
rename to dubbod/planet/pkg/config/memory/monitor.go
index 805a63a0..b2b2b5bf 100644
--- a/sail/pkg/config/memory/monitor.go
+++ b/dubbod/planet/pkg/config/memory/monitor.go
@@ -19,7 +19,7 @@ package memory
import (
config2 "github.com/apache/dubbo-kubernetes/pkg/config"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
)
type Handler func(config2.Config, config2.Config, model.Event)
diff --git a/sail/pkg/config/memory/store.go b/dubbod/planet/pkg/config/memory/store.go
similarity index 99%
rename from sail/pkg/config/memory/store.go
rename to dubbod/planet/pkg/config/memory/store.go
index 0673d99e..b899e3e5 100644
--- a/sail/pkg/config/memory/store.go
+++ b/dubbod/planet/pkg/config/memory/store.go
@@ -25,7 +25,7 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/config"
"github.com/apache/dubbo-kubernetes/pkg/config/schema/collection"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
)
var (
diff --git a/sail/pkg/credentials/kube/secrets.go b/dubbod/planet/pkg/credentials/kube/secrets.go
similarity index 97%
rename from sail/pkg/credentials/kube/secrets.go
rename to dubbod/planet/pkg/credentials/kube/secrets.go
index 713ce6f3..fb941d7f 100644
--- a/sail/pkg/credentials/kube/secrets.go
+++ b/dubbod/planet/pkg/credentials/kube/secrets.go
@@ -22,7 +22,7 @@ import (
"sort"
"strings"
- "github.com/apache/dubbo-kubernetes/sail/pkg/credentials"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/credentials"
)
const (
diff --git a/sail/pkg/credentials/model.go b/dubbod/planet/pkg/credentials/model.go
similarity index 100%
rename from sail/pkg/credentials/model.go
rename to dubbod/planet/pkg/credentials/model.go
diff --git a/sail/pkg/features/experimental.go b/dubbod/planet/pkg/features/experimental.go
similarity index 93%
rename from sail/pkg/features/experimental.go
rename to dubbod/planet/pkg/features/experimental.go
index 7c461a13..fa6956f7 100644
--- a/sail/pkg/features/experimental.go
+++ b/dubbod/planet/pkg/features/experimental.go
@@ -20,7 +20,7 @@ package features
import "github.com/apache/dubbo-kubernetes/pkg/env"
var (
- CACertConfigMapName = env.Register("SAIL_CA_CERT_CONFIGMAP", "dubbo-ca-root-cert",
+ CACertConfigMapName = env.Register("PLANET_CA_CERT_CONFIGMAP", "dubbo-ca-root-cert",
"The name of the ConfigMap that stores the Root CA Certificate that is used by dubbod").Get()
EnableLeaderElection = env.Register("ENABLE_LEADER_ELECTION", true,
"If enabled (default), starts a leader election client and gains leadership before executing controllers. "+
diff --git a/sail/pkg/features/sail.go b/dubbod/planet/pkg/features/planet.go
similarity index 93%
rename from sail/pkg/features/sail.go
rename to dubbod/planet/pkg/features/planet.go
index 0dfa4d44..b9ce3596 100644
--- a/sail/pkg/features/sail.go
+++ b/dubbod/planet/pkg/features/planet.go
@@ -43,13 +43,13 @@ var (
"If this is set to false, will not create CA server in dubbod.").Get()
// EnableCACRL ToDo (nilekh): remove this feature flag once it's stable
EnableCACRL = env.Register(
- "SAIL_ENABLE_CA_CRL",
+ "PLANET_ENABLE_CA_CRL",
true, // Default value (true = feature enabled by default)
"If set to false, Dubbo will not watch for the ca-crl.pem file in the /etc/cacerts directory "+
"and will not distribute CRL data to namespaces for proxies to consume.",
).Get()
- SailCertProvider = env.Register("SAIL_CERT_PROVIDER", constants.CertProviderDubbod,
- "The provider of Sail DNS certificate. K8S RA will be used for k8s.io/NAME. 'dubbod' value will sign"+
+ PlanetCertProvider = env.Register("PLANET_CERT_PROVIDER", constants.CertProviderDubbod,
+ "The provider of Planet DNS certificate. K8S RA will be used for k8s.io/NAME. 'dubbod' value will sign"+
" using Dubbo build in CA. Other values will not not generate TLS certs, but still "+
" distribute ./etc/certs/root-cert.pem. Only used if custom certificates are not mounted.").Get()
DubbodServiceCustomHost = env.Register("DUBBOD_CUSTOM_HOST", "",
@@ -58,7 +58,7 @@ var (
InjectionWebhookConfigName = env.Register("INJECTION_WEBHOOK_CONFIG_NAME", "dubbo-proxyless-injector",
"Name of the mutatingwebhookconfiguration to patch, if dubboctl is not used.").Get()
EnableUnsafeAssertions = env.Register(
- "UNSAFE_SAIL_ENABLE_RUNTIME_ASSERTIONS",
+ "UNSAFE_PLANET_ENABLE_RUNTIME_ASSERTIONS",
false,
"If enabled, addition runtime asserts will be performed. "+
"These checks are both expensive and panic on failure. As a result, this should be used only for testing.",
diff --git a/sail/pkg/features/security.go b/dubbod/planet/pkg/features/security.go
similarity index 88%
rename from sail/pkg/features/security.go
rename to dubbod/planet/pkg/features/security.go
index fb2284ea..2e96d0c7 100644
--- a/sail/pkg/features/security.go
+++ b/dubbod/planet/pkg/features/security.go
@@ -25,8 +25,8 @@ var (
"If enabled, dubbod will use a secret named cacerts to store its self-signed dubbo-"+
"generated root certificate.").Get()
EnableXDSIdentityCheck = env.Register(
- "SAIL_ENABLE_XDS_IDENTITY_CHECK",
+ "PLANET_ENABLE_XDS_IDENTITY_CHECK",
true,
- "If enabled, sail will authorize XDS clients, to ensure they are acting only as namespaces they have permissions for.",
+ "If enabled, planet will authorize XDS clients, to ensure they are acting only as namespaces they have permissions for.",
).Get()
)
diff --git a/sail/pkg/features/tuning.go b/dubbod/planet/pkg/features/tuning.go
similarity index 100%
rename from sail/pkg/features/tuning.go
rename to dubbod/planet/pkg/features/tuning.go
diff --git a/sail/pkg/features/xds.go b/dubbod/planet/pkg/features/xds.go
similarity index 66%
rename from sail/pkg/features/xds.go
rename to dubbod/planet/pkg/features/xds.go
index e6d8600f..6e0e7798 100644
--- a/sail/pkg/features/xds.go
+++ b/dubbod/planet/pkg/features/xds.go
@@ -20,12 +20,12 @@ package features
import "github.com/apache/dubbo-kubernetes/pkg/env"
var (
- EnableCDSCaching = env.Register("SAIL_ENABLE_CDS_CACHE", true,
- "If true, SAIL will cache CDS responses. Note: this depends on SAIL_ENABLE_XDS_CACHE.").Get()
+ EnableCDSCaching = env.Register("PLANET_ENABLE_CDS_CACHE", true,
+ "If true, PLANET will cache CDS responses. Note: this depends on PLANET_ENABLE_XDS_CACHE.").Get()
- EnableRDSCaching = env.Register("SAIL_ENABLE_RDS_CACHE", true,
- "If true, SAIL will cache RDS responses. Note: this depends on SAIL_ENABLE_XDS_CACHE.").Get()
+ EnableRDSCaching = env.Register("PLANET_ENABLE_RDS_CACHE", true,
+ "If true, PLANET will cache RDS responses. Note: this depends on PLANET_ENABLE_XDS_CACHE.").Get()
- EnableXDSCaching = env.Register("SAIL_ENABLE_XDS_CACHE", true,
- "If true, Sail will cache XDS responses.").Get()
+ EnableXDSCaching = env.Register("PLANET_ENABLE_XDS_CACHE", true,
+ "If true, Planet will cache XDS responses.").Get()
)
diff --git a/sail/pkg/grpc/grpc.go b/dubbod/planet/pkg/grpc/grpc.go
similarity index 98%
rename from sail/pkg/grpc/grpc.go
rename to dubbod/planet/pkg/grpc/grpc.go
index 314060dc..fe1ffde6 100644
--- a/sail/pkg/grpc/grpc.go
+++ b/dubbod/planet/pkg/grpc/grpc.go
@@ -24,7 +24,7 @@ import (
dubbokeepalive "github.com/apache/dubbo-kubernetes/pkg/keepalive"
"github.com/apache/dubbo-kubernetes/pkg/util/sets"
- "github.com/apache/dubbo-kubernetes/sail/pkg/features"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/features"
middleware "github.com/grpc-ecosystem/go-grpc-middleware"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
diff --git a/sail/pkg/grpc/tls.go b/dubbod/planet/pkg/grpc/tls.go
similarity index 97%
rename from sail/pkg/grpc/tls.go
rename to dubbod/planet/pkg/grpc/tls.go
index f1eb31d4..ed758572 100644
--- a/sail/pkg/grpc/tls.go
+++ b/dubbod/planet/pkg/grpc/tls.go
@@ -26,7 +26,7 @@ import (
"strings"
sec_model "github.com/apache/dubbo-kubernetes/pkg/model"
- "github.com/apache/dubbo-kubernetes/security/pkg/pki/util"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/pki/util"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"k8s.io/klog/v2"
diff --git a/sail/pkg/keycertbundle/watcher.go b/dubbod/planet/pkg/keycertbundle/watcher.go
similarity index 100%
rename from sail/pkg/keycertbundle/watcher.go
rename to dubbod/planet/pkg/keycertbundle/watcher.go
diff --git a/sail/pkg/leaderelection/k8sleaderelection/k8sresourcelock/configmaplock.go b/dubbod/planet/pkg/leaderelection/k8sleaderelection/k8sresourcelock/configmaplock.go
similarity index 100%
rename from sail/pkg/leaderelection/k8sleaderelection/k8sresourcelock/configmaplock.go
rename to dubbod/planet/pkg/leaderelection/k8sleaderelection/k8sresourcelock/configmaplock.go
diff --git a/sail/pkg/leaderelection/k8sleaderelection/k8sresourcelock/interface.go b/dubbod/planet/pkg/leaderelection/k8sleaderelection/k8sresourcelock/interface.go
similarity index 100%
rename from sail/pkg/leaderelection/k8sleaderelection/k8sresourcelock/interface.go
rename to dubbod/planet/pkg/leaderelection/k8sleaderelection/k8sresourcelock/interface.go
diff --git a/sail/pkg/leaderelection/k8sleaderelection/k8sresourcelock/resourcelock.go b/dubbod/planet/pkg/leaderelection/k8sleaderelection/k8sresourcelock/resourcelock.go
similarity index 100%
rename from sail/pkg/leaderelection/k8sleaderelection/k8sresourcelock/resourcelock.go
rename to dubbod/planet/pkg/leaderelection/k8sleaderelection/k8sresourcelock/resourcelock.go
diff --git a/sail/pkg/leaderelection/k8sleaderelection/leaderelection.go b/dubbod/planet/pkg/leaderelection/k8sleaderelection/leaderelection.go
similarity index 98%
rename from sail/pkg/leaderelection/k8sleaderelection/leaderelection.go
rename to dubbod/planet/pkg/leaderelection/k8sleaderelection/leaderelection.go
index 61098133..1d49818a 100644
--- a/sail/pkg/leaderelection/k8sleaderelection/leaderelection.go
+++ b/dubbod/planet/pkg/leaderelection/k8sleaderelection/leaderelection.go
@@ -24,7 +24,7 @@ import (
"sync"
"time"
- "github.com/apache/dubbo-kubernetes/sail/pkg/leaderelection/k8sleaderelection/k8sresourcelock"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/leaderelection/k8sleaderelection/k8sresourcelock"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/runtime"
diff --git a/sail/pkg/leaderelection/k8sleaderelection/metrics.go b/dubbod/planet/pkg/leaderelection/k8sleaderelection/metrics.go
similarity index 100%
rename from sail/pkg/leaderelection/k8sleaderelection/metrics.go
rename to dubbod/planet/pkg/leaderelection/k8sleaderelection/metrics.go
diff --git a/sail/pkg/leaderelection/leaderelection.go b/dubbod/planet/pkg/leaderelection/leaderelection.go
similarity index 96%
rename from sail/pkg/leaderelection/leaderelection.go
rename to dubbod/planet/pkg/leaderelection/leaderelection.go
index e98d4cf5..9aebfeb4 100644
--- a/sail/pkg/leaderelection/leaderelection.go
+++ b/dubbod/planet/pkg/leaderelection/leaderelection.go
@@ -26,9 +26,9 @@ import (
"time"
"github.com/apache/dubbo-kubernetes/pkg/kube"
- "github.com/apache/dubbo-kubernetes/sail/pkg/features"
- "github.com/apache/dubbo-kubernetes/sail/pkg/leaderelection/k8sleaderelection"
- "github.com/apache/dubbo-kubernetes/sail/pkg/leaderelection/k8sleaderelection/k8sresourcelock"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/features"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/leaderelection/k8sleaderelection"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/leaderelection/k8sleaderelection/k8sresourcelock"
"go.uber.org/atomic"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
diff --git a/sail/pkg/model/addressmap.go b/dubbod/planet/pkg/model/addressmap.go
similarity index 100%
rename from sail/pkg/model/addressmap.go
rename to dubbod/planet/pkg/model/addressmap.go
diff --git a/sail/pkg/model/authentication.go b/dubbod/planet/pkg/model/authentication.go
similarity index 99%
rename from sail/pkg/model/authentication.go
rename to dubbod/planet/pkg/model/authentication.go
index d885a8b9..028e38b3 100644
--- a/sail/pkg/model/authentication.go
+++ b/dubbod/planet/pkg/model/authentication.go
@@ -26,7 +26,6 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/config"
"github.com/apache/dubbo-kubernetes/pkg/config/schema/gvk"
"istio.io/api/security/v1beta1"
- "k8s.io/klog/v2"
)
type MutualTLSMode int
@@ -79,7 +78,7 @@ func (policy *AuthenticationPolicies) addPeerAuthentication(configs []config.Con
spec := config.Spec.(*v1beta1.PeerAuthentication)
if spec.Selector == nil || len(spec.Selector.MatchLabels) == 0 {
if t, ok := seenNamespaceOrMeshConfig[config.Namespace]; ok {
- klog.Warningf(
+ log.Warnf(
"Namespace/mesh-level PeerAuthentication is already defined for %q at time %v. Ignore %q which was created at time %v",
config.Namespace, t, config.Name, config.CreationTimestamp)
continue
diff --git a/sail/pkg/model/authorization.go b/dubbod/planet/pkg/model/authorization.go
similarity index 100%
rename from sail/pkg/model/authorization.go
rename to dubbod/planet/pkg/model/authorization.go
diff --git a/sail/pkg/model/cluster_local.go b/dubbod/planet/pkg/model/cluster_local.go
similarity index 98%
rename from sail/pkg/model/cluster_local.go
rename to dubbod/planet/pkg/model/cluster_local.go
index 73cae2bf..000719cf 100644
--- a/sail/pkg/model/cluster_local.go
+++ b/dubbod/planet/pkg/model/cluster_local.go
@@ -18,7 +18,6 @@
package model
import (
- "github.com/apache/dubbo-kubernetes/pkg/log"
"strings"
"sync"
diff --git a/sail/pkg/model/config.go b/dubbod/planet/pkg/model/config.go
similarity index 100%
rename from sail/pkg/model/config.go
rename to dubbod/planet/pkg/model/config.go
diff --git a/sail/pkg/model/context.go b/dubbod/planet/pkg/model/context.go
similarity index 98%
rename from sail/pkg/model/context.go
rename to dubbod/planet/pkg/model/context.go
index 68c11264..3522c0f1 100644
--- a/sail/pkg/model/context.go
+++ b/dubbod/planet/pkg/model/context.go
@@ -27,6 +27,8 @@ import (
"sync"
"time"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/features"
+ networkutil "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/util/network"
"github.com/apache/dubbo-kubernetes/pkg/config/constants"
"github.com/apache/dubbo-kubernetes/pkg/config/host"
"github.com/apache/dubbo-kubernetes/pkg/config/mesh"
@@ -37,8 +39,6 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/util/protomarshal"
"github.com/apache/dubbo-kubernetes/pkg/util/sets"
"github.com/apache/dubbo-kubernetes/pkg/xds"
- "github.com/apache/dubbo-kubernetes/sail/pkg/features"
- networkutil "github.com/apache/dubbo-kubernetes/sail/pkg/util/network"
core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
"google.golang.org/protobuf/types/known/structpb"
@@ -362,7 +362,7 @@ func GetProxyConfigNamespace(proxy *Proxy) string {
return ""
}
- // First look for ISTIO_META_CONFIG_NAMESPACE
+ // First look for DUBBO_META_CONFIG_NAMESPACE
// All newer proxies (from Istio 1.1 onwards) are supposed to supply this
if len(proxy.Metadata.Namespace) > 0 {
return proxy.Metadata.Namespace
diff --git a/sail/pkg/model/controller.go b/dubbod/planet/pkg/model/controller.go
similarity index 100%
rename from sail/pkg/model/controller.go
rename to dubbod/planet/pkg/model/controller.go
diff --git a/sail/pkg/model/endpointshards.go b/dubbod/planet/pkg/model/endpointshards.go
similarity index 96%
rename from sail/pkg/model/endpointshards.go
rename to dubbod/planet/pkg/model/endpointshards.go
index 3190b076..f93d57fb 100644
--- a/sail/pkg/model/endpointshards.go
+++ b/dubbod/planet/pkg/model/endpointshards.go
@@ -18,14 +18,13 @@
package model
import (
- "github.com/apache/dubbo-kubernetes/pkg/log"
"sync"
"github.com/apache/dubbo-kubernetes/pkg/config/schema/kind"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/serviceregistry/provider"
"github.com/apache/dubbo-kubernetes/pkg/cluster"
"github.com/apache/dubbo-kubernetes/pkg/util/sets"
- "github.com/apache/dubbo-kubernetes/sail/pkg/serviceregistry/provider"
)
type ShardKey struct {
@@ -198,7 +197,7 @@ func (e *EndpointIndex) UpdateServiceEndpoints(
newUnhealthyCount++
}
}
- log.Warnf("UpdateServiceEndpoints: service=%s, shard=%v, oldEndpoints=%d (healthy=%d, unhealthy=%d), newEndpoints=%d (healthy=%d, unhealthy=%d), needPush=%v, pushType=%v",
+ log.Debugf("UpdateServiceEndpoints: service=%s, shard=%v, oldEndpoints=%d (healthy=%d, unhealthy=%d), newEndpoints=%d (healthy=%d, unhealthy=%d), needPush=%v, pushType=%v",
hostname, shard, len(oldDubboEndpoints), oldHealthyCount, oldUnhealthyCount, len(newDubboEndpoints), newHealthyCount, newUnhealthyCount, needPush, pushType)
}
diff --git a/sail/pkg/security/model/authentication.go b/dubbod/planet/pkg/model/log.go
similarity index 87%
copy from sail/pkg/security/model/authentication.go
copy to dubbod/planet/pkg/model/log.go
index 967e8634..f13aa24d 100644
--- a/sail/pkg/security/model/authentication.go
+++ b/dubbod/planet/pkg/model/log.go
@@ -17,6 +17,6 @@
package model
-const (
- ThirdPartyJwtPath = "/var/run/secrets/tokens/dubbo-token"
-)
+import dubbolog "github.com/apache/dubbo-kubernetes/pkg/log"
+
+var log = dubbolog.RegisterScope("model", "model")
diff --git a/sail/pkg/model/network.go b/dubbod/planet/pkg/model/network.go
similarity index 100%
rename from sail/pkg/model/network.go
rename to dubbod/planet/pkg/model/network.go
diff --git a/sail/pkg/model/push_context.go b/dubbod/planet/pkg/model/push_context.go
similarity index 99%
rename from sail/pkg/model/push_context.go
rename to dubbod/planet/pkg/model/push_context.go
index 02225999..203fcc8d 100644
--- a/sail/pkg/model/push_context.go
+++ b/dubbod/planet/pkg/model/push_context.go
@@ -19,10 +19,10 @@ package model
import (
"cmp"
- "github.com/apache/dubbo-kubernetes/pkg/log"
"sync"
"time"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/serviceregistry/provider"
"github.com/apache/dubbo-kubernetes/pkg/cluster"
"github.com/apache/dubbo-kubernetes/pkg/config"
"github.com/apache/dubbo-kubernetes/pkg/config/host"
@@ -32,7 +32,6 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/spiffe"
"github.com/apache/dubbo-kubernetes/pkg/util/sets"
"github.com/apache/dubbo-kubernetes/pkg/xds"
- "github.com/apache/dubbo-kubernetes/sail/pkg/serviceregistry/provider"
"go.uber.org/atomic"
meshconfig "istio.io/api/mesh/v1alpha1"
"k8s.io/apimachinery/pkg/types"
diff --git a/sail/pkg/model/service.go b/dubbod/planet/pkg/model/service.go
similarity index 99%
rename from sail/pkg/model/service.go
rename to dubbod/planet/pkg/model/service.go
index 1b95cff8..966a0b1e 100644
--- a/sail/pkg/model/service.go
+++ b/dubbod/planet/pkg/model/service.go
@@ -32,7 +32,7 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/network"
"github.com/apache/dubbo-kubernetes/pkg/slices"
"github.com/apache/dubbo-kubernetes/pkg/util/sets"
- "github.com/apache/dubbo-kubernetes/sail/pkg/serviceregistry/provider"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/serviceregistry/provider"
"github.com/google/go-cmp/cmp"
"istio.io/api/annotation"
corev1 "k8s.io/api/core/v1"
diff --git a/sail/pkg/model/typed_xds_cache.go b/dubbod/planet/pkg/model/typed_xds_cache.go
similarity index 98%
rename from sail/pkg/model/typed_xds_cache.go
rename to dubbod/planet/pkg/model/typed_xds_cache.go
index bbd25d6e..4776f164 100644
--- a/sail/pkg/model/typed_xds_cache.go
+++ b/dubbod/planet/pkg/model/typed_xds_cache.go
@@ -19,13 +19,12 @@ package model
import (
"fmt"
- "github.com/apache/dubbo-kubernetes/pkg/log"
"sync"
"time"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/features"
"github.com/apache/dubbo-kubernetes/pkg/slices"
"github.com/apache/dubbo-kubernetes/pkg/util/sets"
- "github.com/apache/dubbo-kubernetes/sail/pkg/features"
discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
"github.com/google/go-cmp/cmp"
"github.com/hashicorp/golang-lru/v2/simplelru"
diff --git a/sail/pkg/model/validation.go b/dubbod/planet/pkg/model/validation.go
similarity index 100%
rename from sail/pkg/model/validation.go
rename to dubbod/planet/pkg/model/validation.go
diff --git a/sail/pkg/model/xds_cache.go b/dubbod/planet/pkg/model/xds_cache.go
similarity index 98%
rename from sail/pkg/model/xds_cache.go
rename to dubbod/planet/pkg/model/xds_cache.go
index 614f27b0..6c96f05d 100644
--- a/sail/pkg/model/xds_cache.go
+++ b/dubbod/planet/pkg/model/xds_cache.go
@@ -18,12 +18,11 @@
package model
import (
- "github.com/apache/dubbo-kubernetes/pkg/log"
"time"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/features"
"github.com/apache/dubbo-kubernetes/pkg/config/schema/kind"
"github.com/apache/dubbo-kubernetes/pkg/util/sets"
- "github.com/apache/dubbo-kubernetes/sail/pkg/features"
discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
)
diff --git a/sail/pkg/networking/apigen/apigen.go b/dubbod/planet/pkg/networking/apigen/apigen.go
similarity index 95%
rename from sail/pkg/networking/apigen/apigen.go
rename to dubbod/planet/pkg/networking/apigen/apigen.go
index 44f6242c..6917b822 100644
--- a/sail/pkg/networking/apigen/apigen.go
+++ b/dubbod/planet/pkg/networking/apigen/apigen.go
@@ -18,7 +18,7 @@
package apigen
import (
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
)
type APIGenerator struct {
diff --git a/sail/pkg/networking/core/cluster.go b/dubbod/planet/pkg/networking/core/cluster.go
similarity index 95%
rename from sail/pkg/networking/core/cluster.go
rename to dubbod/planet/pkg/networking/core/cluster.go
index 80fa5cb3..2b325568 100644
--- a/sail/pkg/networking/core/cluster.go
+++ b/dubbod/planet/pkg/networking/core/cluster.go
@@ -18,7 +18,7 @@
package core
import (
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
)
diff --git a/sail/pkg/networking/core/configgen.go b/dubbod/planet/pkg/networking/core/configgen.go
similarity index 97%
rename from sail/pkg/networking/core/configgen.go
rename to dubbod/planet/pkg/networking/core/configgen.go
index de28d54a..27febd49 100644
--- a/sail/pkg/networking/core/configgen.go
+++ b/dubbod/planet/pkg/networking/core/configgen.go
@@ -18,7 +18,7 @@
package core
import (
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
listener "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3"
discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
diff --git a/sail/pkg/networking/core/extension_config_builder.go b/dubbod/planet/pkg/networking/core/extension_config_builder.go
similarity index 94%
rename from sail/pkg/networking/core/extension_config_builder.go
rename to dubbod/planet/pkg/networking/core/extension_config_builder.go
index 835c0a7c..45772a46 100644
--- a/sail/pkg/networking/core/extension_config_builder.go
+++ b/dubbod/planet/pkg/networking/core/extension_config_builder.go
@@ -18,7 +18,7 @@
package core
import (
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
)
diff --git a/sail/pkg/networking/core/httproute.go b/dubbod/planet/pkg/networking/core/httproute.go
similarity index 94%
rename from sail/pkg/networking/core/httproute.go
rename to dubbod/planet/pkg/networking/core/httproute.go
index 3f914c80..6f09d59f 100644
--- a/sail/pkg/networking/core/httproute.go
+++ b/dubbod/planet/pkg/networking/core/httproute.go
@@ -18,7 +18,7 @@
package core
import (
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
)
diff --git a/sail/pkg/networking/core/listener.go b/dubbod/planet/pkg/networking/core/listener.go
similarity index 94%
rename from sail/pkg/networking/core/listener.go
rename to dubbod/planet/pkg/networking/core/listener.go
index 103142fa..ee7d7ec3 100644
--- a/sail/pkg/networking/core/listener.go
+++ b/dubbod/planet/pkg/networking/core/listener.go
@@ -18,7 +18,7 @@
package core
import (
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
listener "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3"
)
diff --git a/sail/pkg/networking/grpcgen/cds.go b/dubbod/planet/pkg/networking/grpcgen/cds.go
similarity index 96%
rename from sail/pkg/networking/grpcgen/cds.go
rename to dubbod/planet/pkg/networking/grpcgen/cds.go
index e206d4f2..eb88dfdc 100644
--- a/sail/pkg/networking/grpcgen/cds.go
+++ b/dubbod/planet/pkg/networking/grpcgen/cds.go
@@ -19,13 +19,11 @@ package grpcgen
import (
"fmt"
- "github.com/apache/dubbo-kubernetes/pkg/log"
-
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/networking/util"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/util/protoconv"
"github.com/apache/dubbo-kubernetes/pkg/config/host"
"github.com/apache/dubbo-kubernetes/pkg/util/sets"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
- "github.com/apache/dubbo-kubernetes/sail/pkg/networking/util"
- "github.com/apache/dubbo-kubernetes/sail/pkg/util/protoconv"
cluster "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3"
core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
diff --git a/sail/pkg/networking/grpcgen/grpcgen.go b/dubbod/planet/pkg/networking/grpcgen/grpcgen.go
similarity index 94%
rename from sail/pkg/networking/grpcgen/grpcgen.go
rename to dubbod/planet/pkg/networking/grpcgen/grpcgen.go
index 2c23ea5c..032314db 100644
--- a/sail/pkg/networking/grpcgen/grpcgen.go
+++ b/dubbod/planet/pkg/networking/grpcgen/grpcgen.go
@@ -18,8 +18,8 @@
package grpcgen
import (
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
- v3 "github.com/apache/dubbo-kubernetes/sail/pkg/xds/v3"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
+ v3 "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/xds/v3"
)
type GrpcConfigGenerator struct{}
diff --git a/sail/pkg/networking/grpcgen/lds.go b/dubbod/planet/pkg/networking/grpcgen/lds.go
similarity index 90%
rename from sail/pkg/networking/grpcgen/lds.go
rename to dubbod/planet/pkg/networking/grpcgen/lds.go
index 8940814b..f928c7b3 100644
--- a/sail/pkg/networking/grpcgen/lds.go
+++ b/dubbod/planet/pkg/networking/grpcgen/lds.go
@@ -19,26 +19,28 @@ package grpcgen
import (
"fmt"
+ dubbolog "github.com/apache/dubbo-kubernetes/pkg/log"
"net"
"strconv"
"strings"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/networking/util"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/util/protoconv"
"github.com/apache/dubbo-kubernetes/pkg/config/host"
"github.com/apache/dubbo-kubernetes/pkg/dubbo-agent/grpcxds"
"github.com/apache/dubbo-kubernetes/pkg/util/sets"
"github.com/apache/dubbo-kubernetes/pkg/wellknown"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
- "github.com/apache/dubbo-kubernetes/sail/pkg/networking/util"
- "github.com/apache/dubbo-kubernetes/sail/pkg/util/protoconv"
core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
listener "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3"
route "github.com/envoyproxy/go-control-plane/envoy/config/route/v3"
routerv3 "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/router/v3"
hcmv3 "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3"
discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
- "k8s.io/klog/v2"
)
+var log = dubbolog.RegisterScope("grpcgen", "xDS Generator for Proxyless gRPC")
+
type listenerNames map[string]listenerName
type listenerName struct {
@@ -105,9 +107,9 @@ func (g *GrpcConfigGenerator) BuildListeners(node *model.Proxy, push *model.Push
names = append(names, listenerName)
}
}
- klog.V(2).Infof("BuildListeners: wildcard request for %s, generating %d listeners from ServiceTargets: %v", node.ID, len(names), names)
+ log.Debugf("BuildListeners: wildcard request for %s, generating %d listeners from ServiceTargets: %v", node.ID, len(names), names)
} else if len(names) > 0 {
- klog.V(2).Infof("BuildListeners: specific request for %s, requested listeners: %v", node.ID, names)
+ log.Debugf("BuildListeners: specific request for %s, requested listeners: %v", node.ID, names)
}
// CRITICAL: If names is provided (non-empty), we MUST only generate those specific listeners
@@ -130,7 +132,7 @@ func (g *GrpcConfigGenerator) BuildListeners(node *model.Proxy, push *model.Push
if requestedSet.Contains(r.Name) {
filtered = append(filtered, r)
} else {
- klog.V(2).Infof("BuildListeners: filtering out unrequested listener %s (requested: %v)", r.Name, names)
+ log.Debugf("BuildListeners: filtering out unrequested listener %s (requested: %v)", r.Name, names)
}
}
return filtered
@@ -177,7 +179,7 @@ func buildOutboundListeners(node *model.Proxy, push *model.PushContext, filter l
})
} else {
// No port, skip (shouldn't happen for outbound listeners)
- klog.V(2).Infof("buildOutboundListeners: skipping listener %s (no port information)", name)
+ log.Debugf("buildOutboundListeners: skipping listener %s (no port information)", name)
}
}
}
@@ -203,7 +205,7 @@ func buildOutboundListeners(node *model.Proxy, push *model.PushContext, filter l
port, err := strconv.Atoi(portStr)
if err != nil {
- klog.Warningf("buildOutboundListeners: failed to parse port from %s: %v", portStr, err)
+ log.Warnf("buildOutboundListeners: failed to parse port from %s: %v", portStr, err)
continue
}
@@ -226,7 +228,7 @@ func buildOutboundListeners(node *model.Proxy, push *model.PushContext, filter l
if svc == nil && shortName != "" {
svc = push.ServiceForHostname(node, host.Name(shortName))
if svc != nil {
- klog.V(2).Infof("buildOutboundListeners: found service %s using short name %s", svc.Hostname, shortName)
+ log.Debugf("buildOutboundListeners: found service %s using short name %s", svc.Hostname, shortName)
}
}
@@ -237,14 +239,14 @@ func buildOutboundListeners(node *model.Proxy, push *model.PushContext, filter l
for _, s := range allServices {
if s.Hostname == hostname || (shortName != "" && strings.HasPrefix(string(s.Hostname), shortName+".")) {
svc = s
- klog.V(2).Infof("buildOutboundListeners: found service %s/%s by iterating", svc.Attributes.Namespace, svc.Hostname)
+ log.Debugf("buildOutboundListeners: found service %s/%s by iterating", svc.Attributes.Namespace, svc.Hostname)
break
}
}
}
if svc == nil {
- klog.Warningf("buildOutboundListeners: service not found for hostname %s (tried FQDN and short name)", hostStr)
+ log.Warnf("buildOutboundListeners: service not found for hostname %s (tried FQDN and short name)", hostStr)
continue
}
@@ -259,7 +261,7 @@ func buildOutboundListeners(node *model.Proxy, push *model.PushContext, filter l
}
}
if !hasPort {
- klog.Warningf("buildOutboundListeners: port %d not found in service %s (available ports: %v)",
+ log.Warnf("buildOutboundListeners: port %d not found in service %s (available ports: %v)",
port, hostStr, func() []int {
ports := make([]int, 0, len(svc.Ports))
for _, p := range svc.Ports {
@@ -270,7 +272,7 @@ func buildOutboundListeners(node *model.Proxy, push *model.PushContext, filter l
continue
}
- klog.V(2).Infof("buildOutboundListeners: building outbound listener for %s:%d (service: %s/%s, port: %s)",
+ log.Debugf("buildOutboundListeners: building outbound listener for %s:%d (service: %s/%s, port: %s)",
hostStr, port, svc.Attributes.Namespace, svc.Attributes.Name, matchedPort.Name)
// Build cluster name using BuildSubsetKey to ensure correct format
@@ -331,7 +333,7 @@ func buildOutboundListeners(node *model.Proxy, push *model.PushContext, filter l
}
// CRITICAL: Log listener details for debugging gRPC xDS client connection issues
- klog.V(3).Infof("buildOutboundListeners: created ApiListener name=%s, address=%s:%d, routeName=%s",
+ log.Debugf("buildOutboundListeners: created ApiListener name=%s, address=%s:%d, routeName=%s",
ll.Name, ll.Address.GetSocketAddress().Address, ll.Address.GetSocketAddress().GetPortValue(), routeName)
out = append(out, &discovery.Resource{
@@ -377,12 +379,12 @@ func buildInboundListeners(node *model.Proxy, push *model.PushContext, names []s
listenAddress := strings.TrimPrefix(name, grpcxds.ServerListenerNamePrefix)
listenHost, listenPortStr, err := net.SplitHostPort(listenAddress)
if err != nil {
- klog.Errorf("failed parsing address from gRPC listener name %s: %v", name, err)
+ log.Errorf("failed parsing address from gRPC listener name %s: %v", name, err)
continue
}
listenPort, err := strconv.Atoi(listenPortStr)
if err != nil {
- klog.Errorf("failed parsing port from gRPC listener name %s: %v", name, err)
+ log.Errorf("failed parsing port from gRPC listener name %s: %v", name, err)
continue
}
si, ok := serviceInstancesByPort[uint32(listenPort)]
@@ -390,7 +392,7 @@ func buildInboundListeners(node *model.Proxy, push *model.PushContext, names []s
// If no service target found for this port, don't create a listener
// This prevents creating invalid listeners that would cause SERVING/NOT_SERVING cycles
// The client should only request listeners for ports that are actually exposed by the service
- klog.Warningf("%s has no service instance for port %s, skipping listener %s. "+
+ log.Warnf("%s has no service instance for port %s, skipping listener %s. "+
"This usually means the requested port doesn't match any service port in the pod's ServiceTargets.",
node.ID, listenPortStr, name)
continue
diff --git a/sail/pkg/networking/grpcgen/rds.go b/dubbod/planet/pkg/networking/grpcgen/rds.go
similarity index 96%
rename from sail/pkg/networking/grpcgen/rds.go
rename to dubbod/planet/pkg/networking/grpcgen/rds.go
index e91b645f..ab74238e 100644
--- a/sail/pkg/networking/grpcgen/rds.go
+++ b/dubbod/planet/pkg/networking/grpcgen/rds.go
@@ -22,8 +22,8 @@ import (
"strconv"
"strings"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
- "github.com/apache/dubbo-kubernetes/sail/pkg/util/protoconv"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/util/protoconv"
route "github.com/envoyproxy/go-control-plane/envoy/config/route/v3"
discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
"k8s.io/klog/v2"
diff --git a/sail/pkg/networking/networking.go b/dubbod/planet/pkg/networking/networking.go
similarity index 100%
rename from sail/pkg/networking/networking.go
rename to dubbod/planet/pkg/networking/networking.go
diff --git a/sail/pkg/networking/util/util.go b/dubbod/planet/pkg/networking/util/util.go
similarity index 95%
rename from sail/pkg/networking/util/util.go
rename to dubbod/planet/pkg/networking/util/util.go
index e7c2d960..86c3f76b 100644
--- a/sail/pkg/networking/util/util.go
+++ b/dubbod/planet/pkg/networking/util/util.go
@@ -22,8 +22,8 @@ import (
"strings"
"github.com/apache/dubbo-kubernetes/pkg/config/constants"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
- dubbonetworking "github.com/apache/dubbo-kubernetes/sail/pkg/networking"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
+ dubbonetworking "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/networking"
core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
listener "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3"
)
diff --git a/sail/pkg/security/model/authentication.go b/dubbod/planet/pkg/security/model/authentication.go
similarity index 100%
rename from sail/pkg/security/model/authentication.go
rename to dubbod/planet/pkg/security/model/authentication.go
diff --git a/sail/pkg/server/instance.go b/dubbod/planet/pkg/server/instance.go
similarity index 100%
rename from sail/pkg/server/instance.go
rename to dubbod/planet/pkg/server/instance.go
diff --git a/sail/pkg/serviceregistry/aggregate/controller.go b/dubbod/planet/pkg/serviceregistry/aggregate/controller.go
similarity index 97%
rename from sail/pkg/serviceregistry/aggregate/controller.go
rename to dubbod/planet/pkg/serviceregistry/aggregate/controller.go
index 871b70f4..01a705c5 100644
--- a/sail/pkg/serviceregistry/aggregate/controller.go
+++ b/dubbod/planet/pkg/serviceregistry/aggregate/controller.go
@@ -25,9 +25,9 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/config/host"
"github.com/apache/dubbo-kubernetes/pkg/config/mesh"
"github.com/apache/dubbo-kubernetes/pkg/slices"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
- "github.com/apache/dubbo-kubernetes/sail/pkg/serviceregistry"
- "github.com/apache/dubbo-kubernetes/sail/pkg/serviceregistry/provider"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/serviceregistry"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/serviceregistry/provider"
"k8s.io/klog/v2"
)
diff --git a/sail/pkg/serviceregistry/instance.go b/dubbod/planet/pkg/serviceregistry/instance.go
similarity index 90%
rename from sail/pkg/serviceregistry/instance.go
rename to dubbod/planet/pkg/serviceregistry/instance.go
index 9125c0f7..65224bd0 100644
--- a/sail/pkg/serviceregistry/instance.go
+++ b/dubbod/planet/pkg/serviceregistry/instance.go
@@ -19,8 +19,8 @@ package serviceregistry
import (
"github.com/apache/dubbo-kubernetes/pkg/cluster"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
- "github.com/apache/dubbo-kubernetes/sail/pkg/serviceregistry/provider"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/serviceregistry/provider"
)
// Instance of a service registry. A single service registry combines the capabilities of service discovery
diff --git a/sail/pkg/serviceregistry/kube/controller/controller.go b/dubbod/planet/pkg/serviceregistry/kube/controller/controller.go
similarity index 98%
rename from sail/pkg/serviceregistry/kube/controller/controller.go
rename to dubbod/planet/pkg/serviceregistry/kube/controller/controller.go
index 1cece128..595eceb4 100644
--- a/sail/pkg/serviceregistry/kube/controller/controller.go
+++ b/dubbod/planet/pkg/serviceregistry/kube/controller/controller.go
@@ -37,11 +37,11 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/ptr"
"github.com/apache/dubbo-kubernetes/pkg/queue"
"github.com/apache/dubbo-kubernetes/pkg/slices"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
- "github.com/apache/dubbo-kubernetes/sail/pkg/serviceregistry"
- "github.com/apache/dubbo-kubernetes/sail/pkg/serviceregistry/aggregate"
- "github.com/apache/dubbo-kubernetes/sail/pkg/serviceregistry/kube"
- "github.com/apache/dubbo-kubernetes/sail/pkg/serviceregistry/provider"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/serviceregistry"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/serviceregistry/aggregate"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/serviceregistry/kube"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/serviceregistry/provider"
"github.com/hashicorp/go-multierror"
"go.uber.org/atomic"
"istio.io/api/label"
diff --git a/sail/pkg/serviceregistry/kube/controller/endpoint_builder.go b/dubbod/planet/pkg/serviceregistry/kube/controller/endpoint_builder.go
similarity index 89%
rename from sail/pkg/serviceregistry/kube/controller/endpoint_builder.go
rename to dubbod/planet/pkg/serviceregistry/kube/controller/endpoint_builder.go
index a97e23d4..82e971b3 100644
--- a/sail/pkg/serviceregistry/kube/controller/endpoint_builder.go
+++ b/dubbod/planet/pkg/serviceregistry/kube/controller/endpoint_builder.go
@@ -20,9 +20,9 @@ package controller
import (
"github.com/apache/dubbo-kubernetes/pkg/config/labels"
"github.com/apache/dubbo-kubernetes/pkg/network"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
- "github.com/apache/dubbo-kubernetes/sail/pkg/serviceregistry/kube"
- labelutil "github.com/apache/dubbo-kubernetes/sail/pkg/serviceregistry/util/label"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/serviceregistry/kube"
+ labelutil "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/serviceregistry/util/label"
v1 "k8s.io/api/core/v1"
)
@@ -81,10 +81,10 @@ func (b *EndpointBuilder) buildDubboEndpoint(
}
// in case pod is not found when init EndpointBuilder.
- networkID := network.ID(b.labels["topology.dubbo.io/network"])
+ networkID := network.ID(b.labels["topology.dubbo.apache.org/network"])
if networkID == "" {
networkID = b.endpointNetwork(endpointAddress)
- b.labels["topology.dubbo.io/network"] = string(networkID)
+ b.labels["topology.dubbo.apache.org/network"] = string(networkID)
}
return &model.DubboEndpoint{
diff --git a/sail/pkg/serviceregistry/kube/controller/endpointslice.go b/dubbod/planet/pkg/serviceregistry/kube/controller/endpointslice.go
similarity index 99%
rename from sail/pkg/serviceregistry/kube/controller/endpointslice.go
rename to dubbod/planet/pkg/serviceregistry/kube/controller/endpointslice.go
index 4e574ef0..b1a5b022 100644
--- a/sail/pkg/serviceregistry/kube/controller/endpointslice.go
+++ b/dubbod/planet/pkg/serviceregistry/kube/controller/endpointslice.go
@@ -29,7 +29,7 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/config/visibility"
"github.com/apache/dubbo-kubernetes/pkg/kube/kclient"
"github.com/apache/dubbo-kubernetes/pkg/util/sets"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
"github.com/hashicorp/go-multierror"
"istio.io/api/annotation"
corev1 "k8s.io/api/core/v1"
diff --git a/sail/pkg/serviceregistry/kube/controller/multicluster.go b/dubbod/planet/pkg/serviceregistry/kube/controller/multicluster.go
similarity index 89%
rename from sail/pkg/serviceregistry/kube/controller/multicluster.go
rename to dubbod/planet/pkg/serviceregistry/kube/controller/multicluster.go
index 4659c1be..5b1123df 100644
--- a/sail/pkg/serviceregistry/kube/controller/multicluster.go
+++ b/dubbod/planet/pkg/serviceregistry/kube/controller/multicluster.go
@@ -20,13 +20,13 @@ package controller
import (
"github.com/apache/dubbo-kubernetes/pkg/kube/multicluster"
"github.com/apache/dubbo-kubernetes/pkg/log"
- "github.com/apache/dubbo-kubernetes/sail/pkg/config/kube/clustertrustbundle"
- "github.com/apache/dubbo-kubernetes/sail/pkg/features"
- "github.com/apache/dubbo-kubernetes/sail/pkg/keycertbundle"
- "github.com/apache/dubbo-kubernetes/sail/pkg/leaderelection"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
- "github.com/apache/dubbo-kubernetes/sail/pkg/server"
- "github.com/apache/dubbo-kubernetes/sail/pkg/serviceregistry/aggregate"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/config/kube/clustertrustbundle"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/features"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/keycertbundle"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/leaderelection"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/server"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/serviceregistry/aggregate"
"k8s.io/klog/v2"
)
@@ -41,7 +41,7 @@ func (k *kubeController) Close() {
}
type Multicluster struct {
- // serverID of this sail instance used for leader election
+ // serverID of this planet instance used for leader election
serverID string
// options to use when creating kube controllers
@@ -149,7 +149,7 @@ func (m *Multicluster) initializeCluster(cluster *multicluster.Cluster, kubeCont
nc := NewNamespaceController(client, m.caBundleWatcher)
// Start informers again. This fixes the case where informers for namespace do not start,
// as we create them only after acquiring the leader lock
- // Note: stop here should be the overall sail stop, NOT the leader election stop. We are
+ // Note: stop here should be the overall planet stop, NOT the leader election stop. We are
// basically lazy loading the informer, if we stop it when we lose the lock we will never
// recreate it again.
client.RunAndWait(clusterStopCh)
diff --git a/sail/pkg/serviceregistry/kube/controller/namespacecontroller.go b/dubbod/planet/pkg/serviceregistry/kube/controller/namespacecontroller.go
similarity index 96%
rename from sail/pkg/serviceregistry/kube/controller/namespacecontroller.go
rename to dubbod/planet/pkg/serviceregistry/kube/controller/namespacecontroller.go
index 94e65623..cc187992 100644
--- a/sail/pkg/serviceregistry/kube/controller/namespacecontroller.go
+++ b/dubbod/planet/pkg/serviceregistry/kube/controller/namespacecontroller.go
@@ -18,7 +18,7 @@
package controller
import (
- "github.com/apache/dubbo-kubernetes/security/pkg/k8s"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/k8s"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
@@ -31,8 +31,8 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/kube/inject"
"github.com/apache/dubbo-kubernetes/pkg/kube/kclient"
"github.com/apache/dubbo-kubernetes/pkg/util/sets"
- "github.com/apache/dubbo-kubernetes/sail/pkg/features"
- "github.com/apache/dubbo-kubernetes/sail/pkg/keycertbundle"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/features"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/keycertbundle"
)
const (
@@ -51,7 +51,7 @@ var (
// CACertNamespaceConfigMap is the name of the ConfigMap in each namespace storing the root cert of non-Kube CA.
CACertNamespaceConfigMap = features.CACertConfigMapName
- configMapLabel = map[string]string{"dubbo.io/config": "true"}
+ configMapLabel = map[string]string{"dubbo.apache.org/config": "true"}
)
// NamespaceController manages reconciles a configmap in each namespace with a desired set of data.
diff --git a/sail/pkg/serviceregistry/kube/controller/network.go b/dubbod/planet/pkg/serviceregistry/kube/controller/network.go
similarity index 97%
rename from sail/pkg/serviceregistry/kube/controller/network.go
rename to dubbod/planet/pkg/serviceregistry/kube/controller/network.go
index 5128e0cf..731517a6 100644
--- a/sail/pkg/serviceregistry/kube/controller/network.go
+++ b/dubbod/planet/pkg/serviceregistry/kube/controller/network.go
@@ -65,7 +65,7 @@ func (n *networkManager) HasSynced() bool {
}
func (n *networkManager) setNetworkFromNamespace(ns *v1.Namespace) bool {
- nw := ns.Labels["topology.dubbo.io/network"]
+ nw := ns.Labels["topology.dubbo.apache.org/network"]
n.Lock()
defer n.Unlock()
oldDefaultNetwork := n.network
diff --git a/sail/pkg/serviceregistry/kube/controller/pod.go b/dubbod/planet/pkg/serviceregistry/kube/controller/pod.go
similarity index 99%
rename from sail/pkg/serviceregistry/kube/controller/pod.go
rename to dubbod/planet/pkg/serviceregistry/kube/controller/pod.go
index b7db365f..62a79172 100644
--- a/sail/pkg/serviceregistry/kube/controller/pod.go
+++ b/dubbod/planet/pkg/serviceregistry/kube/controller/pod.go
@@ -24,7 +24,7 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/kube/kclient"
"github.com/apache/dubbo-kubernetes/pkg/maps"
"github.com/apache/dubbo-kubernetes/pkg/util/sets"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
"istio.io/api/annotation"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
diff --git a/sail/pkg/serviceregistry/kube/controller/util.go b/dubbod/planet/pkg/serviceregistry/kube/controller/util.go
similarity index 100%
rename from sail/pkg/serviceregistry/kube/controller/util.go
rename to dubbod/planet/pkg/serviceregistry/kube/controller/util.go
diff --git a/sail/pkg/serviceregistry/kube/conversion.go b/dubbod/planet/pkg/serviceregistry/kube/conversion.go
similarity index 97%
rename from sail/pkg/serviceregistry/kube/conversion.go
rename to dubbod/planet/pkg/serviceregistry/kube/conversion.go
index e7fa2b5d..faffd7ca 100644
--- a/sail/pkg/serviceregistry/kube/conversion.go
+++ b/dubbod/planet/pkg/serviceregistry/kube/conversion.go
@@ -27,8 +27,8 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/config/visibility"
"github.com/apache/dubbo-kubernetes/pkg/spiffe"
"github.com/apache/dubbo-kubernetes/pkg/util/sets"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
- "github.com/apache/dubbo-kubernetes/sail/pkg/serviceregistry/provider"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/serviceregistry/provider"
"istio.io/api/annotation"
meshconfig "istio.io/api/mesh/v1alpha1"
corev1 "k8s.io/api/core/v1"
diff --git a/sail/pkg/serviceregistry/provider/provider.go b/dubbod/planet/pkg/serviceregistry/provider/provider.go
similarity index 100%
rename from sail/pkg/serviceregistry/provider/provider.go
rename to dubbod/planet/pkg/serviceregistry/provider/provider.go
diff --git a/sail/pkg/serviceregistry/util/label/label.go b/dubbod/planet/pkg/serviceregistry/util/label/label.go
similarity index 97%
rename from sail/pkg/serviceregistry/util/label/label.go
rename to dubbod/planet/pkg/serviceregistry/util/label/label.go
index a478879f..d133b61a 100644
--- a/sail/pkg/serviceregistry/util/label/label.go
+++ b/dubbod/planet/pkg/serviceregistry/util/label/label.go
@@ -30,7 +30,7 @@ const (
LabelHostname = "kubernetes.io/hostname"
LabelTopologyZone = "topology.kubernetes.io/zone"
- LabelTopologySubzone = "topology.dubbo.io/subzone"
+ LabelTopologySubzone = "topology.dubbo.apache.org/subzone"
LabelTopologyRegion = "topology.kubernetes.io/region"
)
diff --git a/sail/pkg/trustbundle/trustbundle.go b/dubbod/planet/pkg/trustbundle/trustbundle.go
similarity index 100%
rename from sail/pkg/trustbundle/trustbundle.go
rename to dubbod/planet/pkg/trustbundle/trustbundle.go
diff --git a/sail/pkg/util/network/ip.go b/dubbod/planet/pkg/util/network/ip.go
similarity index 100%
rename from sail/pkg/util/network/ip.go
rename to dubbod/planet/pkg/util/network/ip.go
diff --git a/sail/pkg/util/protoconv/protoconv.go b/dubbod/planet/pkg/util/protoconv/protoconv.go
similarity index 96%
rename from sail/pkg/util/protoconv/protoconv.go
rename to dubbod/planet/pkg/util/protoconv/protoconv.go
index d9cab2b6..fe27eb0a 100644
--- a/sail/pkg/util/protoconv/protoconv.go
+++ b/dubbod/planet/pkg/util/protoconv/protoconv.go
@@ -18,7 +18,7 @@
package protoconv
import (
- "github.com/apache/dubbo-kubernetes/sail/pkg/features"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/features"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/anypb"
)
diff --git a/sail/pkg/xds/ads.go b/dubbod/planet/pkg/xds/ads.go
similarity index 89%
rename from sail/pkg/xds/ads.go
rename to dubbod/planet/pkg/xds/ads.go
index 0d566fc3..eb66ca30 100644
--- a/sail/pkg/xds/ads.go
+++ b/dubbod/planet/pkg/xds/ads.go
@@ -24,19 +24,21 @@ import (
"sync/atomic"
"time"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
+ v3 "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/xds/v3"
"github.com/apache/dubbo-kubernetes/pkg/util/sets"
"github.com/apache/dubbo-kubernetes/pkg/xds"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
- v3 "github.com/apache/dubbo-kubernetes/sail/pkg/xds/v3"
core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/peer"
"google.golang.org/grpc/status"
- "k8s.io/klog/v2"
)
-var connectionNumber = int64(0)
+var (
+ connectionNumber = int64(0)
+ log = xds.Log
+)
type (
DiscoveryStream = xds.DiscoveryStream
@@ -84,11 +86,11 @@ func (s *DiscoveryServer) StartPush(req *model.PushRequest) {
func (s *DiscoveryServer) AdsPushAll(req *model.PushRequest) {
if !req.Full {
- klog.Infof("XDS: :%d Version:%s",
+ log.Infof("XDS: :%d Version:%s",
s.adsClientCount(), req.Push.PushVersion)
} else {
totalService := len(req.Push.GetAllServices())
- klog.Infof("XDS: Pushing Services:%d ConnectedEndpoints:%d Version:%s",
+ log.Infof("XDS: Pushing Services:%d ConnectedEndpoints:%d Version:%s",
totalService, s.adsClientCount(), req.Push.PushVersion)
if req.ConfigsUpdated == nil {
@@ -162,7 +164,7 @@ func (s *DiscoveryServer) initConnection(node *core.Node, con *Connection, ident
s.addCon(con.ID(), con)
currentCount := s.adsClientCount()
- klog.Infof("ADS: new connection for node:%s (total connections: %d)", con.ID(), currentCount)
+ log.Infof("new connection for node:%s (total connections: %d)", con.ID(), currentCount)
defer con.MarkInitialized()
if err := s.initializeProxy(con); err != nil {
@@ -231,7 +233,7 @@ func (s *DiscoveryServer) removeCon(conID string) {
defer s.adsClientsMutex.Unlock()
if _, exist := s.adsClients[conID]; !exist {
- klog.Errorf("ADS: Removing connection for non-existing node:%v.", conID)
+ log.Errorf("Removing connection for non-existing node:%v.", conID)
} else {
delete(s.adsClients, conID)
}
@@ -249,7 +251,7 @@ func (s *DiscoveryServer) Stream(stream DiscoveryStream) error {
}
if err := s.WaitForRequestLimit(stream.Context()); err != nil {
- klog.Warningf("ADS: %q exceeded rate limit: %v", peerAddr, err)
+ log.Warnf("%q exceeded rate limit: %v", peerAddr, err)
return status.Errorf(codes.ResourceExhausted, "request rate limit exceeded: %v", err)
}
@@ -259,9 +261,9 @@ func (s *DiscoveryServer) Stream(stream DiscoveryStream) error {
}
if ids != nil {
- klog.V(2).Infof("Authenticated XDS: %v with identity %v", peerAddr, ids)
+ log.Debugf("Authenticated XDS: %v with identity %v", peerAddr, ids)
} else {
- klog.V(2).Infof("Unauthenticated XDS: %s", peerAddr)
+ log.Debugf("Unauthenticated XDS: %s", peerAddr)
}
s.globalPushContext().InitContext(s.Env, nil, nil)
@@ -276,13 +278,13 @@ func (s *DiscoveryServer) pushConnection(con *Connection, pushEv *Event) error {
if con.proxy == nil {
// Connection is not yet initialized, skip this push
// The push will happen after initialization completes
- klog.V(2).Infof("Skipping push to %v, connection not yet initialized", con.ID())
+ log.Debugf("Skipping push to %v, connection not yet initialized", con.ID())
return nil
}
pushRequest := pushEv.pushRequest
if pushRequest == nil {
- klog.Warningf("Skipping push to %v, pushRequest is nil", con.ID())
+ log.Warnf("Skipping push to %v, pushRequest is nil", con.ID())
return nil
}
@@ -300,7 +302,7 @@ func (s *DiscoveryServer) pushConnection(con *Connection, pushEv *Event) error {
needsPush = true
}
if !needsPush {
- klog.V(2).Infof("Skipping push to %v, no updates required", con.ID())
+ log.Debugf("Skipping push to %v, no updates required", con.ID())
return nil
}
@@ -317,13 +319,6 @@ func (s *DiscoveryServer) pushConnection(con *Connection, pushEv *Event) error {
func (s *DiscoveryServer) processRequest(req *discovery.DiscoveryRequest, con *Connection) error {
stype := v3.GetShortType(req.TypeUrl)
- // Log requested resource names
- resourceNamesStr := ""
- if len(req.ResourceNames) > 0 {
- resourceNamesStr = fmt.Sprintf(" [%s]", strings.Join(req.ResourceNames, ", "))
- }
- klog.Infof("ADS:%s: REQ %s resources:%d nonce:%s%s", stype,
- con.ID(), len(req.ResourceNames), req.ResponseNonce, resourceNamesStr)
if req.TypeUrl == v3.HealthInfoType {
return nil
}
@@ -335,10 +330,21 @@ func (s *DiscoveryServer) processRequest(req *discovery.DiscoveryRequest, con *C
}
shouldRespond, delta := xds.ShouldRespond(con.proxy, con.ID(), req)
+
if !shouldRespond {
+ // Don't log ACK/ignored/expired nonce requests to reduce noise
+ // These are normal and expected, logging them creates too much noise
return nil
}
+ // Log requested resource names only for requests that will be processed
+ resourceNamesStr := ""
+ if len(req.ResourceNames) > 0 {
+ resourceNamesStr = fmt.Sprintf(" [%s]", strings.Join(req.ResourceNames, ", "))
+ }
+ log.Infof("%s: REQ %s resources:%d nonce:%s%s", stype,
+ con.ID(), len(req.ResourceNames), req.ResponseNonce, resourceNamesStr)
+
// CRITICAL FIX: For proxyless gRPC, if client sends wildcard (empty ResourceNames) after receiving specific resources,
// this is likely an ACK and we should NOT push all resources again
// Check if this is a wildcard request after specific resources were sent
@@ -347,7 +353,7 @@ func (s *DiscoveryServer) processRequest(req *discovery.DiscoveryRequest, con *C
// This is a wildcard ACK after specific resources were sent
// ShouldRespond should have returned false, but we check here as safety net
// Update the WatchedResource to reflect the ACK, but don't push
- klog.V(2).Infof("%s: proxyless gRPC wildcard ACK after specific resources (prev: %d resources, nonce: %s), skipping push",
+ log.Debugf("%s: proxyless gRPC wildcard ACK after specific resources (prev: %d resources, nonce: %s), skipping push",
stype, len(watchedResource.ResourceNames), watchedResource.NonceSent)
// ShouldRespond should have already handled this, but we ensure no push happens
return nil
@@ -355,9 +361,9 @@ func (s *DiscoveryServer) processRequest(req *discovery.DiscoveryRequest, con *C
// Log PUSH request BEFORE calling pushXds
if len(req.ResourceNames) > 0 {
- klog.Infof("%s: PUSH request for node:%s resources:%d", stype, con.ID(), len(req.ResourceNames))
+ log.Infof("%s: PUSH request for node:%s resources:%d", stype, con.ID(), len(req.ResourceNames))
} else {
- klog.Infof("%s: PUSH request for node:%s", stype, con.ID())
+ log.Infof("%s: PUSH request for node:%s", stype, con.ID())
}
// Don't set Forced=true for regular proxy requests to avoid unnecessary ServiceTargets recomputation
@@ -378,7 +384,7 @@ func (s *DiscoveryServer) processRequest(req *discovery.DiscoveryRequest, con *C
w := con.proxy.GetWatchedResource(req.TypeUrl)
if w == nil {
// This should not happen if ShouldRespond returned true, but handle it gracefully
- klog.Warningf("%s: WatchedResource is nil for %s after ShouldRespond returned true, creating it", stype, con.ID())
+ log.Warnf("%s: WatchedResource is nil for %s after ShouldRespond returned true, creating it", stype, con.ID())
con.proxy.NewWatchedResource(req.TypeUrl, req.ResourceNames)
w = con.proxy.GetWatchedResource(req.TypeUrl)
}
diff --git a/sail/pkg/xds/auth.go b/dubbod/planet/pkg/xds/auth.go
similarity index 100%
rename from sail/pkg/xds/auth.go
rename to dubbod/planet/pkg/xds/auth.go
diff --git a/sail/pkg/xds/cds.go b/dubbod/planet/pkg/xds/cds.go
similarity index 94%
rename from sail/pkg/xds/cds.go
rename to dubbod/planet/pkg/xds/cds.go
index 9e127353..b2b158ef 100644
--- a/sail/pkg/xds/cds.go
+++ b/dubbod/planet/pkg/xds/cds.go
@@ -18,8 +18,8 @@
package xds
import (
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
- "github.com/apache/dubbo-kubernetes/sail/pkg/networking/core"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/networking/core"
)
type CdsGenerator struct {
diff --git a/sail/pkg/xds/delta.go b/dubbod/planet/pkg/xds/delta.go
similarity index 84%
rename from sail/pkg/xds/delta.go
rename to dubbod/planet/pkg/xds/delta.go
index 3e3c3215..d986c5a7 100644
--- a/sail/pkg/xds/delta.go
+++ b/dubbod/planet/pkg/xds/delta.go
@@ -22,22 +22,21 @@ import (
"strings"
"time"
+ dubbogrpc "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/grpc"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
+ v3 "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/xds/v3"
"github.com/apache/dubbo-kubernetes/pkg/util/sets"
"github.com/apache/dubbo-kubernetes/pkg/xds"
- dubbogrpc "github.com/apache/dubbo-kubernetes/sail/pkg/grpc"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
- v3 "github.com/apache/dubbo-kubernetes/sail/pkg/xds/v3"
discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
"github.com/google/uuid"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/peer"
"google.golang.org/grpc/status"
- "k8s.io/klog/v2"
)
func (s *DiscoveryServer) processDeltaRequest(req *discovery.DeltaDiscoveryRequest, con *Connection) error {
stype := v3.GetShortType(req.TypeUrl)
- klog.Infof("ADS:%s: REQ %s resources sub:%d unsub:%d nonce:%s", stype,
+ log.Infof("%s: REQ %s resources sub:%d unsub:%d nonce:%s", stype,
con.ID(), len(req.ResourceNamesSubscribe), len(req.ResourceNamesUnsubscribe), req.ResponseNonce)
if req.TypeUrl == v3.HealthInfoType {
@@ -86,7 +85,7 @@ func (s *DiscoveryServer) forceEDSPush(con *Connection) error {
Start: con.proxy.LastPushTime,
Forced: true,
}
- klog.Infof("ADS:%s: FORCE %s PUSH for warming.", v3.GetShortType(v3.EndpointType), con.ID())
+ log.Infof("%s: FORCE %s PUSH for warming.", v3.GetShortType(v3.EndpointType), con.ID())
return s.pushDeltaXds(con, dwr, request)
}
return nil
@@ -104,7 +103,7 @@ func (s *DiscoveryServer) StreamDeltas(stream DeltaDiscoveryStream) error {
}
if err := s.WaitForRequestLimit(stream.Context()); err != nil {
- klog.Warningf("ADS: %q exceeded rate limit: %v", peerAddr, err)
+ log.Warnf("%q exceeded rate limit: %v", peerAddr, err)
return status.Errorf(codes.ResourceExhausted, "request rate limit exceeded: %v", err)
}
@@ -113,9 +112,9 @@ func (s *DiscoveryServer) StreamDeltas(stream DeltaDiscoveryStream) error {
return status.Error(codes.Unauthenticated, err.Error())
}
if ids != nil {
- klog.V(2).Infof("Authenticated XDS: %v with identity %v", peerAddr, ids)
+ log.Debugf("Authenticated XDS: %v with identity %v", peerAddr, ids)
} else {
- klog.V(2).Infof("Unauthenticated XDS: %v", peerAddr)
+ log.Debugf("Unauthenticated XDS: %v", peerAddr)
}
s.globalPushContext().InitContext(s.Env, nil, nil)
@@ -177,17 +176,17 @@ func (s *DiscoveryServer) receiveDelta(con *Connection, identities []string) {
req, err := con.deltaStream.Recv()
if err != nil {
if dubbogrpc.GRPCErrorType(err) != dubbogrpc.UnexpectedError {
- klog.Infof("ADS: %q %s terminated", con.Peer(), con.ID())
+ log.Infof("%q %s terminated", con.Peer(), con.ID())
return
}
con.ErrorCh() <- err
- klog.Errorf("ADS: %q %s terminated with error: %v", con.Peer(), con.ID(), err)
+ log.Errorf("%q %s terminated with error: %v", con.Peer(), con.ID(), err)
return
}
if firstRequest {
// probe happens before envoy sends first xDS request
if req.TypeUrl == v3.HealthInfoType {
- klog.Warningf("ADS: %q %s send health check probe before normal xDS request", con.Peer(), con.ID())
+ log.Warnf("%q %s send health check probe before normal xDS request", con.Peer(), con.ID())
continue
}
firstRequest = false
@@ -200,13 +199,13 @@ func (s *DiscoveryServer) receiveDelta(con *Connection, identities []string) {
return
}
defer s.closeConnection(con)
- klog.Infof("ADS: new delta connection for node:%s", con.ID())
+ log.Infof("new delta connection for node:%s", con.ID())
}
select {
case con.deltaReqChan <- req:
case <-con.deltaStream.Context().Done():
- klog.Infof("ADS: %q %s terminated with stream closed", con.Peer(), con.ID())
+ log.Infof("%q %s terminated with stream closed", con.Peer(), con.ID())
return
}
}
@@ -217,13 +216,13 @@ func (s *DiscoveryServer) pushConnectionDelta(con *Connection, pushEv *Event) er
if con.proxy == nil {
// Connection is not yet initialized, skip this push
// The push will happen after initialization completes
- klog.V(2).Infof("Skipping push to %v, connection not yet initialized", con.ID())
+ log.Debugf("Skipping push to %v, connection not yet initialized", con.ID())
return nil
}
pushRequest := pushEv.pushRequest
if pushRequest == nil {
- klog.Warningf("Skipping push to %v, pushRequest is nil", con.ID())
+ log.Warnf("Skipping push to %v, pushRequest is nil", con.ID())
return nil
}
@@ -241,7 +240,7 @@ func (s *DiscoveryServer) pushConnectionDelta(con *Connection, pushEv *Event) er
needsPush = true
}
if !needsPush {
- klog.V(2).Infof("Skipping push to %v, no updates required", con.ID())
+ log.Debugf("Skipping push to %v, no updates required", con.ID())
return nil
}
@@ -302,7 +301,7 @@ func (s *DiscoveryServer) pushDeltaXds(con *Connection, w *model.WatchedResource
}
var newResourceNames sets.String
if len(resp.RemovedResources) > 0 {
- klog.Infof("ADS:%v REMOVE for node:%s %v", v3.GetShortType(w.TypeUrl), con.ID(), resp.RemovedResources)
+ log.Infof("%v REMOVE for node:%s %v", v3.GetShortType(w.TypeUrl), con.ID(), resp.RemovedResources)
}
ptype := "PUSH"
@@ -324,7 +323,7 @@ func (s *DiscoveryServer) pushDeltaXds(con *Connection, w *model.WatchedResource
switch {
case !req.Full:
default:
- klog.Infof("%s: %s%s for node:%s resources:%d removed:%d%s",
+ log.Infof("%s: %s%s for node:%s resources:%d removed:%d%s",
v3.GetShortType(w.TypeUrl), ptype, req.PushReason(), con.proxy.ID, len(res), len(resp.RemovedResources), info)
}
@@ -368,7 +367,7 @@ func shouldRespondDelta(con *Connection, request *discovery.DeltaDiscoveryReques
if request.ErrorDetail != nil {
errCode := codes.Code(request.ErrorDetail.Code)
- klog.Warningf("ADS:%s: ACK ERROR %s %s:%s", stype, con.ID(), errCode.String(), request.ErrorDetail.GetMessage())
+ log.Warnf("%s: ACK ERROR %s %s:%s", stype, con.ID(), errCode.String(), request.ErrorDetail.GetMessage())
con.proxy.UpdateWatchedResource(request.TypeUrl, func(wr *model.WatchedResource) *model.WatchedResource {
wr.LastError = request.ErrorDetail.GetMessage()
return wr
@@ -376,7 +375,7 @@ func shouldRespondDelta(con *Connection, request *discovery.DeltaDiscoveryReques
return false
}
- klog.Infof("ADS:%s REQUEST %v: sub:%v unsub:%v initial:%v", stype, con.ID(),
+ log.Infof("%s REQUEST %v: sub:%v unsub:%v initial:%v", stype, con.ID(),
request.ResourceNamesSubscribe, request.ResourceNamesUnsubscribe, request.InitialResourceVersions)
previousInfo := con.proxy.GetWatchedResource(request.TypeUrl)
@@ -385,9 +384,9 @@ func shouldRespondDelta(con *Connection, request *discovery.DeltaDiscoveryReques
defer con.proxy.Unlock()
if len(request.InitialResourceVersions) > 0 {
- klog.Infof("ADS:%s: RECONNECT %s %s resources:%v", stype, con.ID(), request.ResponseNonce, len(request.InitialResourceVersions))
+ log.Infof("%s: RECONNECT %s %s resources:%v", stype, con.ID(), request.ResponseNonce, len(request.InitialResourceVersions))
} else {
- klog.Infof("ADS:%s: INIT %s %s", stype, con.ID(), request.ResponseNonce)
+ log.Infof("%s: INIT %s %s", stype, con.ID(), request.ResponseNonce)
}
res, wildcard, _ := deltaWatchedResources(nil, request)
@@ -404,7 +403,7 @@ func shouldRespondDelta(con *Connection, request *discovery.DeltaDiscoveryReques
}
if request.ResponseNonce != "" && request.ResponseNonce != previousInfo.NonceSent {
- klog.Infof("ADS:%s: REQ %s Expired nonce received %s, sent %s", stype,
+ log.Infof("%s: REQ %s Expired nonce received %s, sent %s", stype,
con.ID(), request.ResponseNonce, previousInfo.NonceSent)
return false
}
@@ -426,19 +425,19 @@ func shouldRespondDelta(con *Connection, request *discovery.DeltaDiscoveryReques
})
if spontaneousReq && !subChanged || !spontaneousReq && subChanged {
- klog.Infof("ADS:%s: Subscribed resources check mismatch: %v vs %v", stype, spontaneousReq, subChanged)
+ log.Infof("%s: Subscribed resources check mismatch: %v vs %v", stype, spontaneousReq, subChanged)
}
if !subChanged {
if alwaysRespond {
- klog.Infof("ADS:%s: FORCE RESPONSE %s for warming.", stype, con.ID())
+ log.Infof("%s: FORCE RESPONSE %s for warming.", stype, con.ID())
return true
}
- klog.Infof("ADS:%s: ACK %s %s", stype, con.ID(), request.ResponseNonce)
+ log.Infof("%s: ACK %s %s", stype, con.ID(), request.ResponseNonce)
return false
}
- klog.Infof("ADS:%s: RESOURCE CHANGE %s %s", stype, con.ID(), request.ResponseNonce)
+ log.Infof("%s: RESOURCE CHANGE %s %s", stype, con.ID(), request.ResponseNonce)
return true
}
@@ -477,7 +476,7 @@ func (conn *Connection) sendDelta(res *discovery.DeltaDiscoveryResponse, newReso
})
}
} else if status.Convert(err).Code() == codes.DeadlineExceeded {
- klog.Infof("Timeout writing %s: %v", conn.ID(), v3.GetShortType(res.TypeUrl))
+ log.Infof("Timeout writing %s: %v", conn.ID(), v3.GetShortType(res.TypeUrl))
}
return err
}
diff --git a/sail/pkg/xds/discovery.go b/dubbod/planet/pkg/xds/discovery.go
similarity index 98%
rename from sail/pkg/xds/discovery.go
rename to dubbod/planet/pkg/xds/discovery.go
index 02d39324..ac2523b5 100644
--- a/sail/pkg/xds/discovery.go
+++ b/dubbod/planet/pkg/xds/discovery.go
@@ -20,7 +20,6 @@ package xds
import (
"context"
"fmt"
- "github.com/apache/dubbo-kubernetes/pkg/log"
"strconv"
"sync"
"time"
@@ -28,11 +27,11 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/maps"
"github.com/apache/dubbo-kubernetes/pkg/security"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/features"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
"github.com/apache/dubbo-kubernetes/pkg/cluster"
"github.com/apache/dubbo-kubernetes/pkg/config/schema/kind"
"github.com/apache/dubbo-kubernetes/pkg/kube/krt"
- "github.com/apache/dubbo-kubernetes/sail/pkg/features"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
"go.uber.org/atomic"
"golang.org/x/time/rate"
@@ -206,7 +205,7 @@ func (s *DiscoveryServer) ProxyUpdate(clusterID cluster.ID, ip string) {
}
}
- // It is possible that the envoy has not connected to this sail, maybe connected to another sail
+ // It is possible that the envoy has not connected to this planet, maybe connected to another planet
if connection == nil {
return
}
diff --git a/sail/pkg/xds/eds.go b/dubbod/planet/pkg/xds/eds.go
similarity index 95%
rename from sail/pkg/xds/eds.go
rename to dubbod/planet/pkg/xds/eds.go
index 922bca50..e9c1665c 100644
--- a/sail/pkg/xds/eds.go
+++ b/dubbod/planet/pkg/xds/eds.go
@@ -20,14 +20,13 @@ package xds
import (
"fmt"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/util/protoconv"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/xds/endpoints"
"github.com/apache/dubbo-kubernetes/pkg/config/schema/kind"
"github.com/apache/dubbo-kubernetes/pkg/util/sets"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
- "github.com/apache/dubbo-kubernetes/sail/pkg/util/protoconv"
- "github.com/apache/dubbo-kubernetes/sail/pkg/xds/endpoints"
endpoint "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3"
discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
- "k8s.io/klog/v2"
)
var _ model.XdsDeltaResourceGenerator = &EdsGenerator{}
@@ -58,9 +57,9 @@ func (s *DiscoveryServer) EDSUpdate(shard model.ShardKey, serviceName string, na
}
func (s *DiscoveryServer) EDSCacheUpdate(shard model.ShardKey, serviceName string, namespace string,
- istioEndpoints []*model.DubboEndpoint,
+ dubboEndpoints []*model.DubboEndpoint,
) {
- s.Env.EndpointIndex.UpdateServiceEndpoints(shard, serviceName, namespace, istioEndpoints, false)
+ s.Env.EndpointIndex.UpdateServiceEndpoints(shard, serviceName, namespace, dubboEndpoints, false)
}
var skippedEdsConfigs = sets.New(
@@ -125,7 +124,7 @@ func (eds *EdsGenerator) buildEndpoints(proxy *model.Proxy,
if !req.Full || canSendPartialFullPushes(req) {
edsUpdatedServices = model.ConfigNamesOfKind(req.ConfigsUpdated, kind.ServiceEntry)
if len(edsUpdatedServices) > 0 {
- klog.V(3).Infof("buildEndpoints: edsUpdatedServices count=%d (Full=%v)", len(edsUpdatedServices), req.Full)
+ log.Debugf("buildEndpoints: edsUpdatedServices count=%d (Full=%v)", len(edsUpdatedServices), req.Full)
}
}
var resources model.Resources
@@ -147,7 +146,7 @@ func (eds *EdsGenerator) buildEndpoints(proxy *model.Proxy,
// Both should be FQDN (e.g., "consumer.grpc-proxyless.svc.cluster.local")
if ckey.Name == hostname {
serviceWasUpdated = true
- klog.V(2).Infof("buildEndpoints: service %s was updated, forcing regeneration", hostname)
+ log.Debugf("buildEndpoints: service %s was updated, forcing regeneration", hostname)
break
}
}
diff --git a/sail/pkg/xds/endpoints/endpoint_builder.go b/dubbod/planet/pkg/xds/endpoints/endpoint_builder.go
similarity index 89%
rename from sail/pkg/xds/endpoints/endpoint_builder.go
rename to dubbod/planet/pkg/xds/endpoints/endpoint_builder.go
index aa5a870d..e21f2f09 100644
--- a/sail/pkg/xds/endpoints/endpoint_builder.go
+++ b/dubbod/planet/pkg/xds/endpoints/endpoint_builder.go
@@ -18,20 +18,22 @@
package endpoints
import (
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/networking/util"
"github.com/apache/dubbo-kubernetes/pkg/config/host"
"github.com/apache/dubbo-kubernetes/pkg/config/labels"
"github.com/apache/dubbo-kubernetes/pkg/config/schema/kind"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
- "github.com/apache/dubbo-kubernetes/sail/pkg/networking/util"
+ dubbolog "github.com/apache/dubbo-kubernetes/pkg/log"
"github.com/cespare/xxhash/v2"
core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
endpoint "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3"
"google.golang.org/protobuf/types/known/wrapperspb"
- "k8s.io/klog/v2"
)
var _ model.XdsCacheEntry = &EndpointBuilder{}
+var log = dubbolog.RegisterScope("ads", "ads debugging")
+
// EndpointBuilder builds Envoy endpoints from Dubbo endpoints
type EndpointBuilder struct {
clusterName string
@@ -83,7 +85,7 @@ func (b *EndpointBuilder) BuildClusterLoadAssignment(endpointIndex *model.Endpoi
// Get endpoints from the endpoint index
shards, ok := endpointIndex.ShardsForService(string(b.hostname), b.service.Attributes.Namespace)
if !ok {
- klog.Warningf("BuildClusterLoadAssignment: no shards found for service %s in namespace %s (cluster=%s, port=%d, svcPort.Name='%s', svcPort.Port=%d)",
+ log.Warnf("BuildClusterLoadAssignment: no shards found for service %s in namespace %s (cluster=%s, port=%d, svcPort.Name='%s', svcPort.Port=%d)",
b.hostname, b.service.Attributes.Namespace, b.clusterName, b.port, svcPort.Name, svcPort.Port)
return buildEmptyClusterLoadAssignment(b.clusterName)
}
@@ -96,7 +98,7 @@ func (b *EndpointBuilder) BuildClusterLoadAssignment(endpointIndex *model.Endpoi
totalEndpointsInShards += len(eps)
}
shards.RUnlock()
- klog.V(3).Infof("BuildClusterLoadAssignment: found shards for service %s (cluster=%s, port=%d, shardCount=%d, totalEndpointsInShards=%d)",
+ log.Debugf("BuildClusterLoadAssignment: found shards for service %s (cluster=%s, port=%d, shardCount=%d, totalEndpointsInShards=%d)",
b.hostname, b.clusterName, b.port, shardCount, totalEndpointsInShards)
// Build port map for filtering
@@ -124,7 +126,7 @@ func (b *EndpointBuilder) BuildClusterLoadAssignment(endpointIndex *model.Endpoi
// Filter by port name
if ep.ServicePortName != svcPort.Name {
filteredCount++
- klog.V(3).Infof("BuildClusterLoadAssignment: filtering out endpoint %s (port name mismatch: '%s' != '%s')",
+ log.Debugf("BuildClusterLoadAssignment: filtering out endpoint %s (port name mismatch: '%s' != '%s')",
ep.FirstAddressOrNil(), ep.ServicePortName, svcPort.Name)
continue
}
@@ -143,7 +145,7 @@ func (b *EndpointBuilder) BuildClusterLoadAssignment(endpointIndex *model.Endpoi
// as the client will handle connection failures. However, this is controlled by the service
// configuration (publishNotReadyAddresses).
if !b.service.SupportsUnhealthyEndpoints() && ep.HealthStatus == model.UnHealthy {
- klog.V(3).Infof("BuildClusterLoadAssignment: filtering out unhealthy endpoint %s", ep.FirstAddressOrNil())
+ log.Debugf("BuildClusterLoadAssignment: filtering out unhealthy endpoint %s", ep.FirstAddressOrNil())
filteredCount++
continue
}
@@ -151,7 +153,7 @@ func (b *EndpointBuilder) BuildClusterLoadAssignment(endpointIndex *model.Endpoi
// Build LbEndpoint
lbEp := b.buildLbEndpoint(ep)
if lbEp == nil {
- klog.V(3).Infof("BuildClusterLoadAssignment: buildLbEndpoint returned nil for endpoint %s", ep.FirstAddressOrNil())
+ log.Debugf("BuildClusterLoadAssignment: buildLbEndpoint returned nil for endpoint %s", ep.FirstAddressOrNil())
filteredCount++
continue
}
@@ -160,7 +162,7 @@ func (b *EndpointBuilder) BuildClusterLoadAssignment(endpointIndex *model.Endpoi
}
if len(lbEndpoints) == 0 {
- klog.V(2).Infof("BuildClusterLoadAssignment: no endpoints found for cluster %s (hostname=%s, port=%d, totalEndpoints=%d, filteredCount=%d)",
+ log.Debugf("BuildClusterLoadAssignment: no endpoints found for cluster %s (hostname=%s, port=%d, totalEndpoints=%d, filteredCount=%d)",
b.clusterName, b.hostname, b.port, totalEndpoints, filteredCount)
return buildEmptyClusterLoadAssignment(b.clusterName)
}
diff --git a/sail/pkg/xds/lds.go b/dubbod/planet/pkg/xds/lds.go
similarity index 91%
rename from sail/pkg/xds/lds.go
rename to dubbod/planet/pkg/xds/lds.go
index 8b950c8f..9b6d7651 100644
--- a/sail/pkg/xds/lds.go
+++ b/dubbod/planet/pkg/xds/lds.go
@@ -18,9 +18,9 @@
package xds
import (
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
- "github.com/apache/dubbo-kubernetes/sail/pkg/networking/core"
- "github.com/apache/dubbo-kubernetes/sail/pkg/util/protoconv"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/networking/core"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/util/protoconv"
discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
)
diff --git a/sail/pkg/xds/pushqueue.go b/dubbod/planet/pkg/xds/pushqueue.go
similarity index 97%
rename from sail/pkg/xds/pushqueue.go
rename to dubbod/planet/pkg/xds/pushqueue.go
index 56c822b8..33df1680 100644
--- a/sail/pkg/xds/pushqueue.go
+++ b/dubbod/planet/pkg/xds/pushqueue.go
@@ -20,7 +20,7 @@ package xds
import (
"sync"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
)
type PushQueue struct {
diff --git a/sail/pkg/xds/rds.go b/dubbod/planet/pkg/xds/rds.go
similarity index 93%
rename from sail/pkg/xds/rds.go
rename to dubbod/planet/pkg/xds/rds.go
index a329a3de..dbbc87c2 100644
--- a/sail/pkg/xds/rds.go
+++ b/dubbod/planet/pkg/xds/rds.go
@@ -20,8 +20,8 @@ package xds
import (
"github.com/apache/dubbo-kubernetes/pkg/config/schema/kind"
"github.com/apache/dubbo-kubernetes/pkg/util/sets"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
- "github.com/apache/dubbo-kubernetes/sail/pkg/networking/core"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/networking/core"
)
type RdsGenerator struct {
diff --git a/sail/pkg/xds/statusgen.go b/dubbod/planet/pkg/xds/statusgen.go
similarity index 86%
rename from sail/pkg/xds/statusgen.go
rename to dubbod/planet/pkg/xds/statusgen.go
index f96cd12d..b832d219 100644
--- a/sail/pkg/xds/statusgen.go
+++ b/dubbod/planet/pkg/xds/statusgen.go
@@ -18,8 +18,8 @@
package xds
import (
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
- v3 "github.com/apache/dubbo-kubernetes/sail/pkg/xds/v3"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
+ v3 "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/xds/v3"
)
const (
@@ -29,9 +29,6 @@ const (
type StatusGen struct {
Server *DiscoveryServer
-
- // TODO: track last N Nacks and connection events, with 'version' based on timestamp.
- // On new connect, use version to send recent events since last update.
}
func NewStatusGen(s *DiscoveryServer) *StatusGen {
diff --git a/sail/pkg/xds/v3/model.go b/dubbod/planet/pkg/xds/v3/model.go
similarity index 100%
rename from sail/pkg/xds/v3/model.go
rename to dubbod/planet/pkg/xds/v3/model.go
diff --git a/sail/pkg/xds/xdsgen.go b/dubbod/planet/pkg/xds/xdsgen.go
similarity index 88%
rename from sail/pkg/xds/xdsgen.go
rename to dubbod/planet/pkg/xds/xdsgen.go
index e2552dc8..58971e8f 100644
--- a/sail/pkg/xds/xdsgen.go
+++ b/dubbod/planet/pkg/xds/xdsgen.go
@@ -23,19 +23,18 @@ import (
"strconv"
"strings"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/networking/util"
+ v3 "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/xds/v3"
"github.com/apache/dubbo-kubernetes/pkg/config/host"
"github.com/apache/dubbo-kubernetes/pkg/env"
"github.com/apache/dubbo-kubernetes/pkg/lazy"
"github.com/apache/dubbo-kubernetes/pkg/util/sets"
dubboversion "github.com/apache/dubbo-kubernetes/pkg/version"
"github.com/apache/dubbo-kubernetes/pkg/xds"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
- "github.com/apache/dubbo-kubernetes/sail/pkg/networking/util"
- v3 "github.com/apache/dubbo-kubernetes/sail/pkg/xds/v3"
cluster "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3"
core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
- "k8s.io/klog/v2"
)
type DubboControlPlaneInstance struct {
@@ -52,7 +51,7 @@ var controlPlane = lazy.New(func() (*core.ControlPlane, error) {
Info: dubboversion.Info,
})
if err != nil {
- klog.Warningf("XDS: Could not serialize control plane id: %v", err)
+ log.Warnf("XDS: Could not serialize control plane id: %v", err)
}
return &core.ControlPlane{Identifier: string(byVersion)}, nil
})
@@ -98,7 +97,7 @@ func (s *DiscoveryServer) pushXds(con *Connection, w *model.WatchedResource, req
useLastSentResources = true
// Get the last sent resource names from WatchedResource
// We'll populate this from the last sent resources after generation
- klog.V(2).Infof("pushXds: proxyless gRPC wildcard request with NonceSent=%s, will use last sent resources", w.NonceSent)
+ log.Debugf("pushXds: proxyless gRPC wildcard request with NonceSent=%s, will use last sent resources", w.NonceSent)
} else if len(w.ResourceNames) == 0 && w.NonceSent == "" {
// CRITICAL FIX: Initial wildcard request - need to extract resource names from parent resources
// For CDS: extract cluster names from LDS
@@ -110,7 +109,7 @@ func (s *DiscoveryServer) pushXds(con *Connection, w *model.WatchedResource, req
// LDS has been sent, extract cluster names from it
// We need to regenerate LDS to extract cluster names, or store them
// For now, let's extract from the proxy's ServiceTargets or from LDS generation
- klog.V(2).Infof("pushXds: CDS wildcard request, extracting cluster names from LDS")
+ log.Debugf("pushXds: CDS wildcard request, extracting cluster names from LDS")
// Create a temporary request to generate LDS and extract cluster names
ldsReq := &model.PushRequest{
Full: true,
@@ -128,7 +127,7 @@ func (s *DiscoveryServer) pushXds(con *Connection, w *model.WatchedResource, req
w.ResourceNames = sets.New(clusterNames...)
requestedResourceNames = sets.New[string]()
requestedResourceNames.InsertAll(clusterNames...)
- klog.V(2).Infof("pushXds: extracted %d cluster names from LDS: %v", len(clusterNames), clusterNames)
+ log.Debugf("pushXds: extracted %d cluster names from LDS: %v", len(clusterNames), clusterNames)
}
}
}
@@ -138,7 +137,7 @@ func (s *DiscoveryServer) pushXds(con *Connection, w *model.WatchedResource, req
cdsWatched := con.proxy.GetWatchedResource(v3.ClusterType)
if cdsWatched != nil && cdsWatched.NonceSent != "" {
// CDS has been sent, extract EDS cluster names from it
- klog.V(2).Infof("pushXds: EDS wildcard request, extracting cluster names from CDS")
+ log.Debugf("pushXds: EDS wildcard request, extracting cluster names from CDS")
// Create a temporary request to generate CDS and extract EDS cluster names
cdsReq := &model.PushRequest{
Full: true,
@@ -156,7 +155,7 @@ func (s *DiscoveryServer) pushXds(con *Connection, w *model.WatchedResource, req
w.ResourceNames = sets.New(edsClusterNames...)
requestedResourceNames = sets.New[string]()
requestedResourceNames.InsertAll(edsClusterNames...)
- klog.V(2).Infof("pushXds: extracted %d EDS cluster names from CDS: %v", len(edsClusterNames), edsClusterNames)
+ log.Debugf("pushXds: extracted %d EDS cluster names from CDS: %v", len(edsClusterNames), edsClusterNames)
}
}
}
@@ -212,7 +211,7 @@ func (s *DiscoveryServer) pushXds(con *Connection, w *model.WatchedResource, req
// This is a wildcard ACK - client is acknowledging previous push
// We should NOT push again, as the client already has the resources
// The ShouldRespond logic should have prevented this, but we handle it here as safety
- klog.V(2).Infof("pushXds: proxyless gRPC wildcard ACK with NonceSent=%s, skipping push (client already has resources from previous push)", w.NonceSent)
+ log.Debugf("pushXds: proxyless gRPC wildcard ACK with NonceSent=%s, skipping push (client already has resources from previous push)", w.NonceSent)
return nil
}
@@ -231,7 +230,7 @@ func (s *DiscoveryServer) pushXds(con *Connection, w *model.WatchedResource, req
if requestedResourceNames.Contains(r.Name) {
filteredRes = append(filteredRes, r)
} else {
- klog.V(2).Infof("pushXds: filtering out unrequested resource %s for proxyless gRPC (requested: %v)", r.Name, requestedResourceNames.UnsortedList())
+ log.Debugf("pushXds: filtering out unrequested resource %s for proxyless gRPC (requested: %v)", r.Name, requestedResourceNames.UnsortedList())
}
}
if len(filteredRes) != len(res) {
@@ -242,21 +241,21 @@ func (s *DiscoveryServer) pushXds(con *Connection, w *model.WatchedResource, req
// this means the requested resources don't exist. Don't send empty response to avoid loop.
// Instead, log and return nil to prevent push.
if len(res) == 0 && len(requestedResourceNames) > 0 {
- klog.Warningf("pushXds: proxyless gRPC requested %d resources but none matched after filtering (requested: %v, generated before filter: %d). Skipping push to avoid loop.",
+ log.Warnf("pushXds: proxyless gRPC requested %d resources but none matched after filtering (requested: %v, generated before filter: %d). Skipping push to avoid loop.",
len(requestedResourceNames), requestedResourceNames.UnsortedList(), len(filteredRes)+len(res))
return nil
}
} else if len(w.ResourceNames) == 0 {
// Wildcard request without previous NonceSent - this is initial request
// Allow generating all resources for initial connection
- klog.V(2).Infof("pushXds: proxyless gRPC initial wildcard request, generating all resources")
+ log.Debugf("pushXds: proxyless gRPC initial wildcard request, generating all resources")
}
}
// CRITICAL: Never send empty response for proxyless gRPC - this causes push loops
// If we have no resources to send, return nil instead of sending empty response
if len(res) == 0 {
- klog.V(2).Infof("pushXds: no resources to send for %s (proxy: %s), skipping push", w.TypeUrl, con.proxy.ID)
+ log.Debugf("pushXds: no resources to send for %s (proxy: %s), skipping push", w.TypeUrl, con.proxy.ID)
return nil
}
@@ -327,7 +326,7 @@ func (s *DiscoveryServer) pushXds(con *Connection, w *model.WatchedResource, req
}
resourceNamesStr = fmt.Sprintf(" [%s]", strings.Join(names, ", "))
}
- klog.Infof("%s: %s for node:%s resources:%d size:%s%s%s", v3.GetShortType(w.TypeUrl), ptype, con.proxy.ID, len(res),
+ log.Infof("%s: %s for node:%s resources:%d size:%s%s%s", v3.GetShortType(w.TypeUrl), ptype, con.proxy.ID, len(res),
util.ByteCount(ResourceSize(res)), info, resourceNamesStr)
}
@@ -349,7 +348,7 @@ func (s *DiscoveryServer) pushXds(con *Connection, w *model.WatchedResource, req
if cdsWatched == nil || cdsWatched.ResourceNames == nil || len(cdsWatched.ResourceNames) == 0 {
// Client hasn't requested CDS yet, auto-push to ensure client gets the cluster config
con.proxy.NewWatchedResource(v3.ClusterType, clusterNames)
- klog.V(2).Infof("pushXds: LDS push completed, auto-pushing CDS for clusters: %v", clusterNames)
+ log.Debugf("pushXds: LDS push completed, auto-pushing CDS for clusters: %v", clusterNames)
// Trigger CDS push directly without going through pushConnection to avoid loops
cdsReq := &model.PushRequest{
Full: true,
@@ -359,11 +358,11 @@ func (s *DiscoveryServer) pushXds(con *Connection, w *model.WatchedResource, req
Forced: false,
}
if err := s.pushXds(con, con.proxy.GetWatchedResource(v3.ClusterType), cdsReq); err != nil {
- klog.Warningf("pushXds: failed to push CDS after LDS: %v", err)
+ log.Warnf("pushXds: failed to push CDS after LDS: %v", err)
}
} else {
// Client has already requested CDS, let the client's request handle it
- klog.V(2).Infof("pushXds: LDS push completed, client already requested CDS, skipping auto-push")
+ log.Debugf("pushXds: LDS push completed, client already requested CDS, skipping auto-push")
}
}
}
@@ -382,7 +381,7 @@ func (s *DiscoveryServer) pushXds(con *Connection, w *model.WatchedResource, req
// EDS not watched yet, create watched resource
con.proxy.NewWatchedResource(v3.EndpointType, edsClusterNames)
shouldPushEDS = true
- klog.V(2).Infof("pushXds: CDS push completed, auto-pushing EDS for clusters: %v", edsClusterNames)
+ log.Debugf("pushXds: CDS push completed, auto-pushing EDS for clusters: %v", edsClusterNames)
} else {
// Check if any cluster names are missing from the watched set
existingNames := edsWatched.ResourceNames
@@ -413,9 +412,9 @@ func (s *DiscoveryServer) pushXds(con *Connection, w *model.WatchedResource, req
return wr
})
shouldPushEDS = true
- klog.V(2).Infof("pushXds: CDS push completed, updating EDS watched resource with new clusters: %v", edsClusterNames)
+ log.Debugf("pushXds: CDS push completed, updating EDS watched resource with new clusters: %v", edsClusterNames)
} else {
- klog.V(2).Infof("pushXds: CDS push completed, EDS clusters already watched: %v", edsClusterNames)
+ log.Debugf("pushXds: CDS push completed, EDS clusters already watched: %v", edsClusterNames)
}
}
@@ -430,7 +429,7 @@ func (s *DiscoveryServer) pushXds(con *Connection, w *model.WatchedResource, req
Forced: true, // Force EDS push to ensure endpoints are available for load balancing
}
if err := s.pushXds(con, con.proxy.GetWatchedResource(v3.EndpointType), edsReq); err != nil {
- klog.Warningf("pushXds: failed to push EDS after CDS: %v", err)
+ log.Warnf("pushXds: failed to push EDS after CDS: %v", err)
}
}
}
@@ -447,7 +446,7 @@ func extractEDSClusterNamesFromCDS(clusters model.Resources) []string {
// Unmarshal the cluster resource to check its type
cl := &cluster.Cluster{}
if err := r.Resource.UnmarshalTo(cl); err != nil {
- klog.V(2).Infof("extractEDSClusterNamesFromCDS: failed to unmarshal cluster %s: %v", r.Name, err)
+ log.Debugf("extractEDSClusterNamesFromCDS: failed to unmarshal cluster %s: %v", r.Name, err)
continue
}
// Check if this is an EDS cluster
@@ -468,9 +467,9 @@ func extractClusterNamesFromLDS(listeners model.Resources) []string {
for _, r := range listeners {
// Parse listener name to extract cluster name
// Outbound listener format: "hostname:port" -> cluster: "outbound|port||hostname"
- // Inbound listener format: "xds.dubbo.io/grpc/lds/inbound/[::]:port" -> no cluster
+ // Inbound listener format: "xds.dubbo.apache.org/grpc/lds/inbound/[::]:port" -> no cluster
listenerName := r.Name
- if strings.Contains(listenerName, ":") && !strings.HasPrefix(listenerName, "xds.dubbo.io/grpc/lds/inbound/") {
+ if strings.Contains(listenerName, ":") && !strings.HasPrefix(listenerName, "xds.dubbo.apache.org/grpc/lds/inbound/") {
// This is an outbound listener
parts := strings.Split(listenerName, ":")
if len(parts) == 2 {
diff --git a/security/pkg/cmd/constants.go b/dubbod/security/pkg/cmd/constants.go
similarity index 100%
rename from security/pkg/cmd/constants.go
rename to dubbod/security/pkg/cmd/constants.go
diff --git a/security/pkg/credentialfetcher/fetcher.go b/dubbod/security/pkg/credentialfetcher/fetcher.go
similarity index 93%
rename from security/pkg/credentialfetcher/fetcher.go
rename to dubbod/security/pkg/credentialfetcher/fetcher.go
index fcd50386..4f393a54 100644
--- a/security/pkg/credentialfetcher/fetcher.go
+++ b/dubbod/security/pkg/credentialfetcher/fetcher.go
@@ -21,7 +21,7 @@ import (
"fmt"
"github.com/apache/dubbo-kubernetes/pkg/security"
- "github.com/apache/dubbo-kubernetes/security/pkg/credentialfetcher/plugin"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/credentialfetcher/plugin"
)
func NewCredFetcher(credtype string) (security.CredFetcher, error) {
diff --git a/security/pkg/credentialfetcher/plugin/token.go b/dubbod/security/pkg/credentialfetcher/plugin/token.go
similarity index 100%
rename from security/pkg/credentialfetcher/plugin/token.go
rename to dubbod/security/pkg/credentialfetcher/plugin/token.go
diff --git a/security/pkg/k8s/chiron/utils.go b/dubbod/security/pkg/k8s/chiron/utils.go
similarity index 99%
rename from security/pkg/k8s/chiron/utils.go
rename to dubbod/security/pkg/k8s/chiron/utils.go
index d6253a19..ff5d10ab 100644
--- a/security/pkg/k8s/chiron/utils.go
+++ b/dubbod/security/pkg/k8s/chiron/utils.go
@@ -33,7 +33,7 @@ import (
clientset "k8s.io/client-go/kubernetes"
"github.com/apache/dubbo-kubernetes/pkg/ptr"
- "github.com/apache/dubbo-kubernetes/security/pkg/pki/util"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/pki/util"
)
const (
diff --git a/security/pkg/k8s/configutil.go b/dubbod/security/pkg/k8s/configutil.go
similarity index 100%
rename from security/pkg/k8s/configutil.go
rename to dubbod/security/pkg/k8s/configutil.go
diff --git a/security/pkg/k8s/controller/casecret.go b/dubbod/security/pkg/k8s/controller/casecret.go
similarity index 100%
rename from security/pkg/k8s/controller/casecret.go
rename to dubbod/security/pkg/k8s/controller/casecret.go
diff --git a/security/pkg/nodeagent/cache/secretcache.go b/dubbod/security/pkg/nodeagent/cache/secretcache.go
similarity index 90%
rename from security/pkg/nodeagent/cache/secretcache.go
rename to dubbod/security/pkg/nodeagent/cache/secretcache.go
index 4a3c27e9..9db42493 100644
--- a/security/pkg/nodeagent/cache/secretcache.go
+++ b/dubbod/security/pkg/nodeagent/cache/secretcache.go
@@ -33,14 +33,16 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/spiffe"
"github.com/apache/dubbo-kubernetes/pkg/util/sets"
+ nodeagentutil "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/nodeagent/util"
+ pkiutil "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/pki/util"
+ dubbolog "github.com/apache/dubbo-kubernetes/pkg/log"
"github.com/apache/dubbo-kubernetes/pkg/queue"
"github.com/apache/dubbo-kubernetes/pkg/security"
- nodeagentutil "github.com/apache/dubbo-kubernetes/security/pkg/nodeagent/util"
- pkiutil "github.com/apache/dubbo-kubernetes/security/pkg/pki/util"
"github.com/fsnotify/fsnotify"
- "k8s.io/klog/v2"
)
+var cacheLog = dubbolog.RegisterScope("cache", "cache debugging")
+
type FileCert struct {
ResourceName string
Filename string
@@ -118,7 +120,7 @@ func NewSecretManagerClient(caClient security.Client, options *security.Options)
}
func (sc *SecretManagerClient) GenerateSecret(resourceName string) (secret *security.SecretItem, err error) {
- klog.V(2).InfoS("generate secret %q", resourceName)
+ cacheLog.Debugf("generate secret %q", resourceName)
defer func() {
if secret == nil || err != nil {
return
@@ -128,9 +130,9 @@ func (sc *SecretManagerClient) GenerateSecret(resourceName string) (secret *secu
if resourceName == security.RootCertReqResourceName || resourceName == security.WorkloadKeyCertResourceName {
if err := nodeagentutil.OutputKeyCertToDir(sc.configOptions.OutputKeyCertToDir, secret.PrivateKey,
secret.CertificateChain, secret.RootCert); err != nil {
- klog.Errorf("error when output the resource: %v", err)
+ cacheLog.Errorf("error when output the resource: %v", err)
} else if sc.configOptions.OutputKeyCertToDir != "" {
- klog.V(2).Infof("Output the resource %v to %v", resourceName, sc.configOptions.OutputKeyCertToDir)
+ cacheLog.Debugf("Output the resource %v to %v", resourceName, sc.configOptions.OutputKeyCertToDir)
}
}
}()
@@ -158,7 +160,7 @@ func (sc *SecretManagerClient) GenerateSecret(resourceName string) (secret *secu
}
if ts := time.Since(t0); ts > time.Second {
- klog.Warningf("slow generate secret lock: %v", ts)
+ cacheLog.Warnf("slow generate secret lock: %v", ts)
}
if resourceName == security.RootCertReqResourceName {
@@ -194,7 +196,7 @@ func (sc *SecretManagerClient) GenerateSecret(resourceName string) (secret *secu
// If periodic cert refresh resulted in discovery of a new root, trigger a ROOTCA request to refresh trust anchor
oldRoot := sc.cache.GetRoot()
if !bytes.Equal(oldRoot, ns.RootCert) {
- klog.Info("Root cert has changed, start rotating root cert")
+ cacheLog.Info("Root cert has changed, start rotating root cert")
// We store the oldRoot only for comparison and not for serving
sc.cache.SetRoot(ns.RootCert)
sc.OnSecretUpdate(security.RootCertReqResourceName)
@@ -214,7 +216,7 @@ func (sc *SecretManagerClient) getCachedSecret(resourceName string) (secret *sec
ResourceName: resourceName,
RootCert: rootCertBundle,
}
- klog.Infof("returned workload trust anchor from cache (ttl=%v)", time.Until(c.ExpireTime))
+ cacheLog.Infof("returned workload trust anchor from cache (ttl=%v)", time.Until(c.ExpireTime))
} else {
ns = &security.SecretItem{
ResourceName: resourceName,
@@ -223,7 +225,7 @@ func (sc *SecretManagerClient) getCachedSecret(resourceName string) (secret *sec
ExpireTime: c.ExpireTime,
CreatedTime: c.CreatedTime,
}
- klog.Infof("returned workload certificate from cache (ttl=%v)", time.Until(c.ExpireTime))
+ cacheLog.Infof("returned workload certificate from cache (ttl=%v)", time.Until(c.ExpireTime))
}
return ns
@@ -247,7 +249,7 @@ func (sc *SecretManagerClient) generateNewSecret(resourceName string) (*security
ServiceAccount: sc.configOptions.ServiceAccount,
}
- klog.V(2).InfoS("constructed host name for CSR: %s", csrHostName.String())
+ cacheLog.Debugf("constructed host name for CSR: %s", csrHostName.String())
options := pkiutil.CertOptions{
Host: csrHostName.String(),
RSAKeySize: sc.configOptions.WorkloadRSAKeySize,
@@ -259,7 +261,7 @@ func (sc *SecretManagerClient) generateNewSecret(resourceName string) (*security
// Generate the cert/key, send CSR to CA.
csrPEM, keyPEM, err := pkiutil.GenCSR(options)
if err != nil {
- klog.Errorf(" %s failed to generate key and certificate for CSR: %v", resourceName, err)
+ cacheLog.Errorf(" %s failed to generate key and certificate for CSR: %v", resourceName, err)
return nil, err
}
@@ -268,7 +270,7 @@ func (sc *SecretManagerClient) generateNewSecret(resourceName string) (*security
trustBundlePEM, err = sc.caClient.GetRootCertBundle()
}
if err != nil {
- klog.Errorf("%s failed to sign: %v", resourceName, err)
+ cacheLog.Errorf("%s failed to sign: %v", resourceName, err)
return nil, err
}
@@ -276,17 +278,15 @@ func (sc *SecretManagerClient) generateNewSecret(resourceName string) (*security
var expireTime time.Time
if expireTime, err = nodeagentutil.ParseCertAndGetExpiryTimestamp(certChain); err != nil {
- klog.Errorf("failed to extract expire time from server certificate in CSR response %+v: %v",
+ cacheLog.Errorf("failed to extract expire time from server certificate in CSR response %+v: %v",
certChainPEM, err)
return nil, fmt.Errorf("failed to extract expire time from server certificate in CSR response: %v", err)
}
- klog.InfoS(
- "Generated new workload certificate",
- "resourceName", resourceName,
+ cacheLog.WithLabels("resourceName", resourceName,
"latency", time.Since(t0),
- "ttl", time.Until(expireTime),
- )
+ "ttl", time.Until(expireTime)).
+ Info("generated new workload certificate")
if len(trustBundlePEM) > 0 {
rootCertPEM = concatCerts(trustBundlePEM)
@@ -329,14 +329,14 @@ func (sc *SecretManagerClient) registerSecret(item security.SecretItem) {
item.ResourceName = security.WorkloadKeyCertResourceName
// In case there are two calls to GenerateSecret at once, we don't want both to be concurrently registered
if sc.cache.GetWorkload() != nil {
- klog.V(2).InfoS(
+ cacheLog.Debugf(
"Skip scheduling certificate rotation, already scheduled",
"resource", item.ResourceName,
)
return
}
sc.cache.SetWorkload(&item)
- klog.V(2).InfoS(
+ cacheLog.Debugf(
"Scheduled certificate for rotation",
"resource", item.ResourceName,
)
@@ -345,7 +345,7 @@ func (sc *SecretManagerClient) registerSecret(item security.SecretItem) {
// Check if this is a stale scheduled rotating task.
if cached := sc.cache.GetWorkload(); cached != nil {
if cached.CreatedTime == item.CreatedTime {
- klog.V(2).InfoS(
+ cacheLog.Debugf(
"Rotating certificate",
"resource", item.ResourceName,
)
@@ -433,10 +433,10 @@ func (sc *SecretManagerClient) generateFileSecret(resourceName string) (bool, *s
if sdsFromFile {
if err != nil {
- klog.Errorf("failed to generate secret for proxy from file: %v", err)
+ cacheLog.Errorf("failed to generate secret for proxy from file: %v", err)
return sdsFromFile, nil, err
}
- klog.V(2).InfoS(
+ cacheLog.Debugf(
"Read certificate from file",
"resource", resourceName,
)
@@ -501,7 +501,7 @@ func (sc *SecretManagerClient) keyCertSecretItem(cert, key, resource string) (*s
now := time.Now()
var certExpireTime time.Time
if certExpireTime, err = nodeagentutil.ParseCertAndGetExpiryTimestamp(certChain); err != nil {
- klog.Errorf("failed to extract expiration time in the certificate loaded from file: %v", err)
+ cacheLog.Errorf("failed to extract expiration time in the certificate loaded from file: %v", err)
return nil, fmt.Errorf("failed to extract expiration time in the certificate loaded from file: %v", err)
}
@@ -590,7 +590,7 @@ func (sc *SecretManagerClient) tryAddFileWatcher(file string, resourceName strin
defer sc.certMutex.Unlock()
file, err := filepath.Abs(file)
if err != nil {
- klog.Errorf("%v: error finding absolute path of %s, retrying watches: %v", resourceName, file, err)
+ cacheLog.Errorf("%v: error finding absolute path of %s, retrying watches: %v", resourceName, file, err)
return err
}
key := FileCert{
@@ -598,15 +598,15 @@ func (sc *SecretManagerClient) tryAddFileWatcher(file string, resourceName strin
Filename: file,
}
if _, alreadyWatching := sc.fileCerts[key]; alreadyWatching {
- klog.Infof("already watching file for %s", file)
+ cacheLog.Infof("already watching file for %s", file)
// Already watching, no need to do anything
return nil
}
sc.fileCerts[key] = struct{}{}
// File is not being watched, start watching now and trigger key push.
- klog.Infof("adding watcher for file certificate %s", file)
+ cacheLog.Infof("adding watcher for file certificate %s", file)
if err := sc.certWatcher.Add(file); err != nil {
- klog.Errorf("%v: error adding watcher for file %v, retrying watches: %v", resourceName, file, err)
+ cacheLog.Errorf("%v: error adding watcher for file %v, retrying watches: %v", resourceName, file, err)
return err
}
return nil
@@ -644,7 +644,7 @@ func (sc *SecretManagerClient) handleFileWatch() {
resources[k] = v
}
sc.certMutex.RUnlock()
- klog.Infof("event for file certificate %s : %s, pushing to proxy", event.Name, event.Op.String())
+ cacheLog.Infof("event for file certificate %s : %s, pushing to proxy", event.Name, event.Op.String())
// If it is remove event - cleanup from file certs so that if it is added again, we can watch.
// The cleanup should happen first before triggering callbacks, as the callbacks are async and
// we may get generate call before cleanup is done and we will end up not watching the file.
@@ -652,7 +652,7 @@ func (sc *SecretManagerClient) handleFileWatch() {
sc.certMutex.Lock()
for fc := range sc.fileCerts {
if fc.Filename == event.Name {
- klog.V(2).Infof("removing file %s from file certs", event.Name)
+ cacheLog.Debugf("removing file %s from file certs", event.Name)
delete(sc.fileCerts, fc)
break
}
@@ -672,7 +672,7 @@ func (sc *SecretManagerClient) handleFileWatch() {
return
}
// TODO numFileSecretFailures
- klog.Errorf("certificate watch error: %v", err)
+ cacheLog.Errorf("certificate watch error: %v", err)
}
}
}
@@ -688,13 +688,13 @@ func (sc *SecretManagerClient) OnSecretUpdate(resourceName string) {
func (sc *SecretManagerClient) UpdateConfigTrustBundle(trustBundle []byte) error {
sc.configTrustBundleMutex.Lock()
if bytes.Equal(sc.configTrustBundle, trustBundle) {
- klog.Info("skip for same trust bundle")
+ cacheLog.Info("skip for same trust bundle")
sc.configTrustBundleMutex.Unlock()
return nil
}
sc.configTrustBundle = trustBundle
sc.configTrustBundleMutex.Unlock()
- klog.Info("update new trust bundle")
+ cacheLog.Info("update new trust bundle")
sc.OnSecretUpdate(security.RootCertReqResourceName)
sc.OnSecretUpdate(security.WorkloadKeyCertResourceName)
return nil
diff --git a/security/pkg/nodeagent/caclient/credentials.go b/dubbod/security/pkg/nodeagent/caclient/credentials.go
similarity index 100%
rename from security/pkg/nodeagent/caclient/credentials.go
rename to dubbod/security/pkg/nodeagent/caclient/credentials.go
diff --git a/security/pkg/nodeagent/caclient/providers/aegis/client.go b/dubbod/security/pkg/nodeagent/caclient/providers/aegis/client.go
similarity index 88%
rename from security/pkg/nodeagent/caclient/providers/aegis/client.go
rename to dubbod/security/pkg/nodeagent/caclient/providers/aegis/client.go
index 5a2e1adc..f19be0c8 100644
--- a/security/pkg/nodeagent/caclient/providers/aegis/client.go
+++ b/dubbod/security/pkg/nodeagent/caclient/providers/aegis/client.go
@@ -21,18 +21,20 @@ import (
"context"
"errors"
"fmt"
+ "github.com/apache/dubbo-kubernetes/pkg/log"
+ dubbogrpc "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/grpc"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/nodeagent/caclient"
"github.com/apache/dubbo-kubernetes/pkg/security"
- dubbogrpc "github.com/apache/dubbo-kubernetes/sail/pkg/grpc"
- "github.com/apache/dubbo-kubernetes/security/pkg/nodeagent/caclient"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/metadata"
"google.golang.org/protobuf/types/known/structpb"
pb "istio.io/api/security/v1alpha1"
- "k8s.io/klog/v2"
)
+var aegisClientLog = log.RegisterScope("aegisclient", "aegis client debugging")
+
type AegisClient struct {
// It means enable tls connection to Citadel if this is not nil.
tlsOpts *TLSOptions
@@ -57,7 +59,7 @@ func NewAegisClient(opts *security.Options, tlsOpts *TLSOptions) (*AegisClient,
conn, err := c.buildConnection()
if err != nil {
- klog.Errorf("Failed to connect to endpoint %s: %v", opts.CAEndpoint, err)
+ aegisClientLog.Errorf("Failed to connect to endpoint %s: %v", opts.CAEndpoint, err)
return nil, fmt.Errorf("failed to connect to endpoint %s", opts.CAEndpoint)
}
c.conn = conn
@@ -104,9 +106,9 @@ func (c *AegisClient) CSRSign(csrPEM []byte, certValidTTLInSec int64) (res []str
// So here we need to rebuild the caClient in order to use the new root cert.
defer func() {
if err != nil {
- klog.Errorf("failed to sign CSR: %v", err)
+ aegisClientLog.Errorf("failed to sign CSR: %v", err)
if err := c.reconnect(); err != nil {
- klog.Errorf("failed reconnect: %v", err)
+ aegisClientLog.Errorf("failed reconnect: %v", err)
}
}
}()
@@ -144,7 +146,7 @@ func (c *AegisClient) buildConnection() (*grpc.ClientConn, error) {
)
conn, err := grpc.Dial(c.opts.CAEndpoint, opts...)
if err != nil {
- klog.Errorf("Failed to connect to endpoint %s: %v", c.opts.CAEndpoint, err)
+ aegisClientLog.Errorf("Failed to connect to endpoint %s: %v", c.opts.CAEndpoint, err)
return nil, fmt.Errorf("failed to connect to endpoint %s", c.opts.CAEndpoint)
}
@@ -162,6 +164,6 @@ func (c *AegisClient) reconnect() error {
}
c.conn = conn
c.client = pb.NewIstioCertificateServiceClient(conn)
- klog.Info("recreated connection")
+ aegisClientLog.Info("recreated connection")
return nil
}
diff --git a/security/pkg/nodeagent/cafile/cafile.go b/dubbod/security/pkg/nodeagent/cafile/cafile.go
similarity index 100%
rename from security/pkg/nodeagent/cafile/cafile.go
rename to dubbod/security/pkg/nodeagent/cafile/cafile.go
diff --git a/security/pkg/nodeagent/sds/sdsservice.go b/dubbod/security/pkg/nodeagent/sds/sdsservice.go
similarity index 96%
rename from security/pkg/nodeagent/sds/sdsservice.go
rename to dubbod/security/pkg/nodeagent/sds/sdsservice.go
index 16edb125..8a919998 100644
--- a/security/pkg/nodeagent/sds/sdsservice.go
+++ b/dubbod/security/pkg/nodeagent/sds/sdsservice.go
@@ -19,6 +19,7 @@ package sds
import (
"context"
+ "github.com/apache/dubbo-kubernetes/pkg/log"
"strconv"
"sync"
"sync/atomic"
@@ -34,9 +35,10 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
mesh "istio.io/api/mesh/v1alpha1"
- "k8s.io/klog/v2"
)
+var sdsServiceLog = log.RegisterScope("sds", "SDS service debugging")
+
type sdsservice struct {
st security.SecretManager
@@ -88,13 +90,13 @@ func newSDSService(st security.SecretManager, options *security.Options, pkpConf
_ = b.RetryWithContext(ctx, func() error {
_, err := st.GenerateSecret(security.WorkloadKeyCertResourceName)
if err != nil {
- klog.Warningf("failed to warm certificate: %v", err)
+ sdsServiceLog.Warnf("failed to warm certificate: %v", err)
return err
}
_, err = st.GenerateSecret(security.RootCertReqResourceName)
if err != nil {
- klog.Warningf("failed to warm root certificate: %v", err)
+ sdsServiceLog.Warnf("failed to warm root certificate: %v", err)
return err
}
diff --git a/security/pkg/nodeagent/sds/server.go b/dubbod/security/pkg/nodeagent/sds/server.go
similarity index 100%
rename from security/pkg/nodeagent/sds/server.go
rename to dubbod/security/pkg/nodeagent/sds/server.go
diff --git a/security/pkg/nodeagent/util/util.go b/dubbod/security/pkg/nodeagent/util/util.go
similarity index 100%
rename from security/pkg/nodeagent/util/util.go
rename to dubbod/security/pkg/nodeagent/util/util.go
diff --git a/security/pkg/pki/ca/ca.go b/dubbod/security/pkg/pki/ca/ca.go
similarity index 97%
rename from security/pkg/pki/ca/ca.go
rename to dubbod/security/pkg/pki/ca/ca.go
index 9d2d16bb..bfefa7d1 100644
--- a/security/pkg/pki/ca/ca.go
+++ b/dubbod/security/pkg/pki/ca/ca.go
@@ -23,24 +23,25 @@ import (
"crypto/x509"
"encoding/pem"
"fmt"
+ "os"
+ "time"
+
"github.com/apache/dubbo-kubernetes/pkg/backoff"
"github.com/apache/dubbo-kubernetes/pkg/log"
- "github.com/apache/dubbo-kubernetes/security/pkg/cmd"
- caerror "github.com/apache/dubbo-kubernetes/security/pkg/pki/error"
- "github.com/apache/dubbo-kubernetes/security/pkg/pki/util"
- certutil "github.com/apache/dubbo-kubernetes/security/pkg/util"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/cmd"
+ caerror "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/pki/error"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/pki/util"
+ certutil "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/util"
v1 "k8s.io/api/core/v1"
apierror "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
- "os"
- "time"
)
var pkiCaLog = log.RegisterScope("pkica", "Aegis CA log")
const (
- dubboCASecretType = "dubbo.io/ca-root"
+ dubboCASecretType = "dubbo.apache.org/ca-root"
CACertFile = "ca-cert.pem"
CAPrivateKeyFile = "ca-key.pem"
CACRLFile = "ca-crl.pem"
diff --git a/security/pkg/pki/ca/selfsignedcarootcertrotator.go b/dubbod/security/pkg/pki/ca/selfsignedcarootcertrotator.go
similarity index 79%
rename from security/pkg/pki/ca/selfsignedcarootcertrotator.go
rename to dubbod/security/pkg/pki/ca/selfsignedcarootcertrotator.go
index f124432f..f749dfcc 100644
--- a/security/pkg/pki/ca/selfsignedcarootcertrotator.go
+++ b/dubbod/security/pkg/pki/ca/selfsignedcarootcertrotator.go
@@ -18,14 +18,16 @@
package ca
import (
- "github.com/apache/dubbo-kubernetes/security/pkg/k8s/controller"
- certutil "github.com/apache/dubbo-kubernetes/security/pkg/util"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/k8s/controller"
+ certutil "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/util"
+ "github.com/apache/dubbo-kubernetes/pkg/log"
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
- "k8s.io/klog/v2"
"math/rand"
"time"
)
+var rootCertRotatorLog = log.RegisterScope("rootcertrotator", "Self-signed CA root cert rotator log")
+
type SelfSignedCARootCertRotatorConfig struct {
certInspector certutil.CertUtil
caStorageNamespace string
@@ -62,7 +64,7 @@ func NewSelfSignedCARootCertRotator(config *SelfSignedCARootCertRotatorConfig, c
randBackOff := rand.New(randSource)
backOffSeconds := int(time.Duration(randBackOff.Int63n(int64(rotator.config.CheckInterval))).Seconds())
rotator.backOffTime = time.Duration(backOffSeconds) * time.Second
- klog.Infof("Set up back off time %s to start rotator.", rotator.backOffTime.String())
+ rootCertRotatorLog.Infof("Set up back off time %s to start rotator.", rotator.backOffTime.String())
} else {
rotator.backOffTime = time.Duration(0)
}
@@ -71,13 +73,13 @@ func NewSelfSignedCARootCertRotator(config *SelfSignedCARootCertRotatorConfig, c
func (rotator *SelfSignedCARootCertRotator) Run(stopCh chan struct{}) {
if rotator.config.enableJitter {
- klog.Infof("Jitter is enabled, wait %s before "+
+ rootCertRotatorLog.Infof("Jitter is enabled, wait %s before "+
"starting root cert rotator.", rotator.backOffTime.String())
select {
case <-time.After(rotator.backOffTime):
- klog.Infof("Jitter complete, start rotator.")
+ rootCertRotatorLog.Infof("Jitter complete, start rotator.")
case <-stopCh:
- klog.Info("Received stop signal, so stop the root cert rotator.")
+ rootCertRotatorLog.Info("Received stop signal, so stop the root cert rotator.")
return
}
}
@@ -85,11 +87,11 @@ func (rotator *SelfSignedCARootCertRotator) Run(stopCh chan struct{}) {
for {
select {
case <-ticker.C:
- klog.Info("Check and rotate root cert.")
+ rootCertRotatorLog.Info("Check and rotate root cert.")
// TODO rotator.checkAndRotateRootCert()
case _, ok := <-stopCh:
if !ok {
- klog.Info("Received stop signal, so stop the root cert rotator.")
+ rootCertRotatorLog.Info("Received stop signal, so stop the root cert rotator.")
if ticker != nil {
ticker.Stop()
}
diff --git a/security/pkg/pki/error/error.go b/dubbod/security/pkg/pki/error/error.go
similarity index 100%
rename from security/pkg/pki/error/error.go
rename to dubbod/security/pkg/pki/error/error.go
diff --git a/security/pkg/pki/ra/common.go b/dubbod/security/pkg/pki/ra/common.go
similarity index 94%
rename from security/pkg/pki/ra/common.go
rename to dubbod/security/pkg/pki/ra/common.go
index 41e6da3e..97bcfc35 100644
--- a/security/pkg/pki/ra/common.go
+++ b/dubbod/security/pkg/pki/ra/common.go
@@ -22,14 +22,13 @@ import (
"crypto/x509"
"encoding/asn1"
"fmt"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/pki/ca"
+ raerror "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/pki/error"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/pki/util"
+ caserver "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/server/ca"
"github.com/apache/dubbo-kubernetes/pkg/slices"
- "github.com/apache/dubbo-kubernetes/security/pkg/pki/ca"
- raerror "github.com/apache/dubbo-kubernetes/security/pkg/pki/error"
- "github.com/apache/dubbo-kubernetes/security/pkg/pki/util"
- caserver "github.com/apache/dubbo-kubernetes/security/pkg/server/ca"
meshconfig "istio.io/api/mesh/v1alpha1"
clientset "k8s.io/client-go/kubernetes"
- "k8s.io/klog/v2"
"strings"
"time"
)
@@ -87,11 +86,11 @@ func (r *KubernetesRA) SignWithCertChain(csrPEM []byte, certOpts ca.CertOpts) ([
if len(r.GetCAKeyCertBundle().GetRootCertPem()) == 0 {
rootCertFromCertChain, err = util.FindRootCertFromCertificateChainBytes(cert)
if err != nil {
- klog.Infof("failed to find root cert from signed cert-chain (%v)", err.Error())
+ pkiRaLog.Infof("failed to find root cert from signed cert-chain (%v)", err.Error())
}
rootCertFromMeshConfig, err = r.GetRootCertFromMeshConfig(certSigner)
if err != nil {
- klog.Infof("failed to find root cert from mesh config (%v)", err.Error())
+ pkiRaLog.Infof("failed to find root cert from mesh config (%v)", err.Error())
}
if rootCertFromMeshConfig != nil {
possibleRootCert = rootCertFromMeshConfig
diff --git a/security/pkg/pki/ra/ra.go b/dubbod/security/pkg/pki/ra/k8s_ra.go
similarity index 89%
rename from security/pkg/pki/ra/ra.go
rename to dubbod/security/pkg/pki/ra/k8s_ra.go
index d7689288..f78ddf20 100644
--- a/security/pkg/pki/ra/ra.go
+++ b/dubbod/security/pkg/pki/ra/k8s_ra.go
@@ -19,16 +19,19 @@ package ra
import (
"fmt"
- "github.com/apache/dubbo-kubernetes/security/pkg/k8s/chiron"
- "github.com/apache/dubbo-kubernetes/security/pkg/pki/ca"
- raerror "github.com/apache/dubbo-kubernetes/security/pkg/pki/error"
- "github.com/apache/dubbo-kubernetes/security/pkg/pki/util"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/k8s/chiron"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/pki/ca"
+ raerror "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/pki/error"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/pki/util"
+ "github.com/apache/dubbo-kubernetes/pkg/log"
cert "k8s.io/api/certificates/v1"
clientset "k8s.io/client-go/kubernetes"
"sync"
"time"
)
+var pkiRaLog = log.RegisterScope("pkira", "Dubbod RA log")
+
// KubernetesRA integrated with an external CA using Kubernetes CSR API
type KubernetesRA struct {
csrInterface clientset.Interface
diff --git a/security/pkg/pki/util/crypto.go b/dubbod/security/pkg/pki/util/crypto.go
similarity index 100%
rename from security/pkg/pki/util/crypto.go
rename to dubbod/security/pkg/pki/util/crypto.go
diff --git a/security/pkg/pki/util/dual_use.go b/dubbod/security/pkg/pki/util/dual_use.go
similarity index 100%
rename from security/pkg/pki/util/dual_use.go
rename to dubbod/security/pkg/pki/util/dual_use.go
diff --git a/security/pkg/pki/util/generate_cert.go b/dubbod/security/pkg/pki/util/generate_cert.go
similarity index 100%
rename from security/pkg/pki/util/generate_cert.go
rename to dubbod/security/pkg/pki/util/generate_cert.go
diff --git a/security/pkg/pki/util/generate_csr.go b/dubbod/security/pkg/pki/util/generate_csr.go
similarity index 100%
rename from security/pkg/pki/util/generate_csr.go
rename to dubbod/security/pkg/pki/util/generate_csr.go
diff --git a/security/pkg/pki/util/keycertbundle.go b/dubbod/security/pkg/pki/util/keycertbundle.go
similarity index 100%
rename from security/pkg/pki/util/keycertbundle.go
rename to dubbod/security/pkg/pki/util/keycertbundle.go
diff --git a/security/pkg/pki/util/san.go b/dubbod/security/pkg/pki/util/san.go
similarity index 100%
rename from security/pkg/pki/util/san.go
rename to dubbod/security/pkg/pki/util/san.go
diff --git a/security/pkg/pki/util/verify_cert.go b/dubbod/security/pkg/pki/util/verify_cert.go
similarity index 100%
rename from security/pkg/pki/util/verify_cert.go
rename to dubbod/security/pkg/pki/util/verify_cert.go
diff --git a/security/pkg/server/ca/authenticate/cert_authenticator.go b/dubbod/security/pkg/server/ca/authenticate/cert_authenticator.go
similarity index 97%
rename from security/pkg/server/ca/authenticate/cert_authenticator.go
rename to dubbod/security/pkg/server/ca/authenticate/cert_authenticator.go
index c55f3489..57926b0a 100644
--- a/security/pkg/server/ca/authenticate/cert_authenticator.go
+++ b/dubbod/security/pkg/server/ca/authenticate/cert_authenticator.go
@@ -23,7 +23,7 @@ import (
"net/http"
"github.com/apache/dubbo-kubernetes/pkg/security"
- "github.com/apache/dubbo-kubernetes/security/pkg/pki/util"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/pki/util"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/peer"
)
diff --git a/security/pkg/server/ca/authenticate/oidc.go b/dubbod/security/pkg/server/ca/authenticate/oidc.go
similarity index 100%
rename from security/pkg/server/ca/authenticate/oidc.go
rename to dubbod/security/pkg/server/ca/authenticate/oidc.go
diff --git a/security/pkg/server/ca/server.go b/dubbod/security/pkg/server/ca/server.go
similarity index 86%
rename from security/pkg/server/ca/server.go
rename to dubbod/security/pkg/server/ca/server.go
index 120ee35f..bcdce523 100644
--- a/security/pkg/server/ca/server.go
+++ b/dubbod/security/pkg/server/ca/server.go
@@ -19,19 +19,21 @@ package ca
import (
"context"
+ "github.com/apache/dubbo-kubernetes/pkg/log"
"time"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/pki/ca"
+ caerror "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/pki/error"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/pki/util"
"github.com/apache/dubbo-kubernetes/pkg/security"
- "github.com/apache/dubbo-kubernetes/security/pkg/pki/ca"
- caerror "github.com/apache/dubbo-kubernetes/security/pkg/pki/error"
- "github.com/apache/dubbo-kubernetes/security/pkg/pki/util"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
pb "istio.io/api/security/v1alpha1"
- "k8s.io/klog/v2"
)
+var serverCaLog = log.RegisterScope("serverca", "Aegis server log")
+
type Server struct {
pb.UnimplementedIstioCertificateServiceServer
Authenticators []security.Authenticator
@@ -72,14 +74,13 @@ func (s *Server) Register(grpcServer *grpc.Server) {
// the subject public key is the public key in the CSR.
// the validity duration is the ValidityDuration in request, or default value if the given duration is invalid.
// it is signed by the CA signing key.
-func (s *Server) CreateCertificate(ctx context.Context, request *pb.IstioCertificateRequest) (
- *pb.IstioCertificateResponse, error,
-) {
+func (s *Server) CreateCertificate(ctx context.Context, request *pb.IstioCertificateRequest) (*pb.IstioCertificateResponse, error) {
caller, err := s.authenticate(ctx)
if err != nil {
return nil, status.Error(codes.Unauthenticated, "request authenticate failure")
}
+ serverCaLog := serverCaLog.WithLabels("client", security.GetConnectionAddress(ctx))
// By default, we will use the callers identity for the certificate
var sans []string
if caller != nil {
@@ -100,10 +101,11 @@ func (s *Server) CreateCertificate(ctx context.Context, request *pb.IstioCertifi
if certSigner == "" {
cert, signErr = s.ca.Sign([]byte(request.Csr), certOpts)
} else {
+ serverCaLog.Debugf("signing CSR with cert chain")
respCertChain, signErr = s.ca.SignWithCertChain([]byte(request.Csr), certOpts)
}
if signErr != nil {
- klog.Errorf("CSR signing error: %v", signErr.Error())
+ serverCaLog.Errorf("CSR signing error: %v", signErr.Error())
if caErr, ok := signErr.(*caerror.Error); ok {
return nil, status.Errorf(caErr.HTTPErrorCode(), "CSR signing error (%v)", caErr)
}
@@ -127,8 +129,9 @@ func (s *Server) CreateCertificate(ctx context.Context, request *pb.IstioCertifi
if len(rootCertBytes) != 0 {
response.CertChain = append(response.CertChain, string(rootCertBytes))
}
-
- klog.V(2).Infof("CSR successfully signed, sans %v.", sans)
+ serverCaLog.Debugf("Responding with cert chain, %q", response.CertChain)
+ // TODO Inc
+ serverCaLog.Debugf("CSR successfully signed, sans %v.", sans)
return response, nil
}
diff --git a/security/pkg/util/certutil.go b/dubbod/security/pkg/util/certutil.go
similarity index 96%
rename from security/pkg/util/certutil.go
rename to dubbod/security/pkg/util/certutil.go
index 48c8f578..6269ee4c 100644
--- a/security/pkg/util/certutil.go
+++ b/dubbod/security/pkg/util/certutil.go
@@ -19,7 +19,7 @@ package util
import (
"fmt"
- "github.com/apache/dubbo-kubernetes/security/pkg/pki/util"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/pki/util"
"time"
)
diff --git a/security/pkg/util/jwtutil.go b/dubbod/security/pkg/util/jwtutil.go
similarity index 100%
rename from security/pkg/util/jwtutil.go
rename to dubbod/security/pkg/util/jwtutil.go
diff --git a/tools/generate_cert/main.go b/dubbod/security/tools/generate_cert/main.go
similarity index 97%
rename from tools/generate_cert/main.go
rename to dubbod/security/tools/generate_cert/main.go
index 61803d74..82ec713a 100644
--- a/tools/generate_cert/main.go
+++ b/dubbod/security/tools/generate_cert/main.go
@@ -32,8 +32,8 @@ import (
k8s "k8s.io/api/core/v1"
- "github.com/apache/dubbo-kubernetes/security/pkg/pki/ca"
- "github.com/apache/dubbo-kubernetes/security/pkg/pki/util"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/pki/ca"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/pki/util"
)
const (
diff --git a/tools/generate_csr/main.go b/dubbod/security/tools/generate_csr/main.go
similarity index 97%
rename from tools/generate_csr/main.go
rename to dubbod/security/tools/generate_csr/main.go
index a9ff6a2b..d7b23438 100644
--- a/tools/generate_csr/main.go
+++ b/dubbod/security/tools/generate_csr/main.go
@@ -22,7 +22,7 @@ package main
import (
"flag"
"fmt"
- "github.com/apache/dubbo-kubernetes/security/pkg/pki/util"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/pki/util"
"k8s.io/klog/v2"
"os"
)
diff --git a/manifests/charts/admin/templates/clusterrole.yaml b/manifests/charts/admin/templates/clusterrole.yaml
index 7ac80b7d..1f7c3c6f 100644
--- a/manifests/charts/admin/templates/clusterrole.yaml
+++ b/manifests/charts/admin/templates/clusterrole.yaml
@@ -4,9 +4,9 @@ metadata:
name: admin-clusterrole
labels:
app: admin
- dubbo.io/rev: {{ default "default" | quote }}
- install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
- operator.dubbo.io/component: "Admin"
+ dubbo.apache.org/rev: {{ default "default" | quote }}
+ install.operator.dubbo.apache.org/owning-resource: {{ default "unknown" }}
+ operator.dubbo.apache.org/component: "Admin"
dubbo: admin
release: {{ .Release.Name }}
app.kubernetes.io/name: "dashboard"
diff --git a/manifests/charts/admin/templates/clusterrolebinding.yaml b/manifests/charts/admin/templates/clusterrolebinding.yaml
index afd6b696..d69221fb 100644
--- a/manifests/charts/admin/templates/clusterrolebinding.yaml
+++ b/manifests/charts/admin/templates/clusterrolebinding.yaml
@@ -4,9 +4,9 @@ metadata:
name: admin-clusterrolebinding
labels:
app: admin
- dubbo.io/rev: {{ default "default" | quote }}
- install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
- operator.dubbo.io/component: "Admin"
+ dubbo.apache.org/rev: {{ default "default" | quote }}
+ install.operator.dubbo.apache.org/owning-resource: {{ default "unknown" }}
+ operator.dubbo.apache.org/component: "Admin"
dubbo: admin
release: {{ .Release.Name }}
app.kubernetes.io/name: "dashboard"
diff --git a/manifests/charts/admin/templates/deployment.yaml b/manifests/charts/admin/templates/deployment.yaml
index 375c304e..91a86079 100644
--- a/manifests/charts/admin/templates/deployment.yaml
+++ b/manifests/charts/admin/templates/deployment.yaml
@@ -6,9 +6,9 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
app: admin
- dubbo.io/rev: {{ default "default" | quote }}
- install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
- operator.dubbo.io/component: "Admin"
+ dubbo.apache.org/rev: {{ default "default" | quote }}
+ install.operator.dubbo.apache.org/owning-resource: {{ default "unknown" }}
+ operator.dubbo.apache.org/component: "Admin"
dubbo: admin
release: {{ .Release.Name }}
app.kubernetes.io/name: "dashboard"
@@ -21,15 +21,15 @@ spec:
selector:
matchLabels:
app: admin
- dubbo.io/rev: {{ default "default" | quote }}
+ dubbo.apache.org/rev: {{ default "default" | quote }}
dubbo: admin
template:
metadata:
labels:
app: admin
- dubbo.io/rev: {{ default "default" | quote }}
- install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
- operator.dubbo.io/component: "Admin"
+ dubbo.apache.org/rev: {{ default "default" | quote }}
+ install.operator.dubbo.apache.org/owning-resource: {{ default "unknown" }}
+ operator.dubbo.apache.org/component: "Admin"
dubbo: admin
release: {{ .Release.Name }}
app.kubernetes.io/name: "dashboard"
diff --git a/manifests/charts/admin/templates/service.yaml b/manifests/charts/admin/templates/service.yaml
index d295f69e..fb7713ed 100644
--- a/manifests/charts/admin/templates/service.yaml
+++ b/manifests/charts/admin/templates/service.yaml
@@ -5,9 +5,9 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
app: admin
- dubbo.io/rev: {{ default "default" | quote }}
- install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
- operator.dubbo.io/component: "Admin"
+ dubbo.apache.org/rev: {{ default "default" | quote }}
+ install.operator.dubbo.apache.org/owning-resource: {{ default "unknown" }}
+ operator.dubbo.apache.org/component: "Admin"
dubbo: admin
release: {{ .Release.Name }}
app.kubernetes.io/name: "dashboard"
diff --git a/manifests/charts/admin/templates/serviceaccount.yaml b/manifests/charts/admin/templates/serviceaccount.yaml
index 2a507712..d4131588 100644
--- a/manifests/charts/admin/templates/serviceaccount.yaml
+++ b/manifests/charts/admin/templates/serviceaccount.yaml
@@ -5,9 +5,9 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
app: admin
- dubbo.io/rev: {{ default "default" | quote }}
- install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
- operator.dubbo.io/component: "Admin"
+ dubbo.apache.org/rev: {{ default "default" | quote }}
+ install.operator.dubbo.apache.org/owning-resource: {{ default "unknown" }}
+ operator.dubbo.apache.org/component: "Admin"
dubbo: admin
release: {{ .Release.Name }}
app.kubernetes.io/name: "dashboard"
\ No newline at end of file
diff --git a/manifests/charts/dubbo-control/dubbo-discovery/files/grpc-agent.yaml b/manifests/charts/dubbo-control/dubbo-discovery/files/grpc-agent.yaml
index efb0e79f..4d6a5f64 100644
--- a/manifests/charts/dubbo-control/dubbo-discovery/files/grpc-agent.yaml
+++ b/manifests/charts/dubbo-control/dubbo-discovery/files/grpc-agent.yaml
@@ -13,16 +13,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-{{- $containers := list }}
-{{- range $index, $container := .Spec.Containers }}{{ if not (eq $container.Name "dubbo-proxy") }}{{ $containers = append $containers $container.Name }}{{end}}{{- end}}
metadata:
annotations:
- dubbo.io/rev: default
+ dubbo.apache.org/rev: default
spec:
containers:
- name: dubbo-proxy
image: "{{ $.ProxyImage }}"
- imagePullPolicy: Always # test
+ imagePullPolicy: Always
ports:
- containerPort: 15020
protocol: TCP
@@ -35,7 +33,7 @@ spec:
postStart:
exec:
command:
- - sail-agent
+ - planet-agent
- wait
- --url=http://localhost:15020/healthz/ready
readinessProbe:
@@ -55,7 +53,7 @@ spec:
value: /etc/dubbo/proxy/grpc-bootstrap.json
- name: OUTPUT_CERTS
value: /var/lib/dubbo/data
- - name: SAIL_CERT_PROVIDER
+ - name: PLANET_CERT_PROVIDER
value: dubbod
- name: DUBBO_META_CLUSTER_ID
value: Kubernetes
@@ -114,17 +112,16 @@ spec:
- downwardAPI:
defaultMode: 420
items:
- - fieldRef:
- apiVersion: v1
- fieldPath: metadata.labels
- path: labels
- - fieldRef:
- apiVersion: v1
- fieldPath: metadata.annotations
- path: annotations
+ - fieldRef:
+ apiVersion: v1
+ fieldPath: metadata.labels
+ path: labels
+ - fieldRef:
+ apiVersion: v1
+ fieldPath: metadata.annotations
+ path: annotations
name: dubbo-podinfo
- configMap:
defaultMode: 420
name: dubbo-ca-root-cert
name: dubbod-ca-cert
-
diff --git a/manifests/charts/dubbo-control/dubbo-discovery/templates/clusterrole.yaml b/manifests/charts/dubbo-control/dubbo-discovery/templates/clusterrole.yaml
index d3836eb1..63928447 100644
--- a/manifests/charts/dubbo-control/dubbo-discovery/templates/clusterrole.yaml
+++ b/manifests/charts/dubbo-control/dubbo-discovery/templates/clusterrole.yaml
@@ -9,11 +9,10 @@ rules:
verbs: ["get", "list", "watch", "update", "patch"]
- apiGroups: ["admissionregistration.k8s.io"]
resources: ["validatingwebhookconfigurations"]
- verbs: ["get", "list", "watch", "update"]
- resources: [ "authorizationpolicies/status" ]
+ verbs: ["get", "list", "watch", "update", "patch"]
- apiGroups: [""]
- verbs: [ "get", "watch", "list", "update", "patch", "create", "delete" ]
resources: [ "services/status" ]
+ verbs: [ "get", "watch", "list", "update", "patch", "create", "delete" ]
- apiGroups: ["apiextensions.k8s.io"]
resources: ["customresourcedefinitions"]
verbs: ["get", "list", "watch"]
diff --git a/manifests/charts/dubbo-control/dubbo-discovery/templates/configmap-values.yaml b/manifests/charts/dubbo-control/dubbo-discovery/templates/configmap-values.yaml
index c97ed34b..11f18751 100644
--- a/manifests/charts/dubbo-control/dubbo-discovery/templates/configmap-values.yaml
+++ b/manifests/charts/dubbo-control/dubbo-discovery/templates/configmap-values.yaml
@@ -5,7 +5,7 @@ metadata:
namespace: dubbo-system
labels:
app: dubbod
- dubbo.io/rev: default
+ dubbo.apache.org/rev: default
data:
merged-values: |-
original-values: |-
\ No newline at end of file
diff --git a/manifests/charts/dubbo-control/dubbo-discovery/templates/configmap.yaml b/manifests/charts/dubbo-control/dubbo-discovery/templates/configmap.yaml
index 58944292..e75ed565 100644
--- a/manifests/charts/dubbo-control/dubbo-discovery/templates/configmap.yaml
+++ b/manifests/charts/dubbo-control/dubbo-discovery/templates/configmap.yaml
@@ -5,7 +5,7 @@ metadata:
namespace: dubbo-system
labels:
app: dubbod
- dubbo.io/rev: default
+ dubbo.apache.org/rev: default
data:
mesh: |-
defaultConfig:
diff --git a/manifests/charts/dubbo-control/dubbo-discovery/templates/deployment.yaml b/manifests/charts/dubbo-control/dubbo-discovery/templates/deployment.yaml
index 2180b76d..4b88fc6e 100644
--- a/manifests/charts/dubbo-control/dubbo-discovery/templates/deployment.yaml
+++ b/manifests/charts/dubbo-control/dubbo-discovery/templates/deployment.yaml
@@ -6,7 +6,7 @@ metadata:
namespace: dubbo-system
labels:
app: dubbod
- dubbo.io/rev: default
+ dubbo.apache.org/rev: default
spec:
selector:
matchLabels:
@@ -19,7 +19,7 @@ spec:
serviceAccountName: dubbod
containers:
- name: discovery
- image: "mfordjody/sail-discovery:test"
+ image: "mfordjody/planet:0.3.0-debug"
imagePullPolicy: Always
args:
- "discovery"
@@ -41,7 +41,7 @@ spec:
env:
- name: REVISION
value: default
- - name: SAIL_CERT_PROVIDER
+ - name: PLANET_CERT_PROVIDER
value: dubbod
- name: CLUSTER_ID
value: "Kubernetes"
diff --git a/manifests/charts/dubbo-control/dubbo-discovery/templates/dubbd-injector-configmap.yaml b/manifests/charts/dubbo-control/dubbo-discovery/templates/dubbd-injector-configmap.yaml
index c9324c42..026e0f12 100644
--- a/manifests/charts/dubbo-control/dubbo-discovery/templates/dubbd-injector-configmap.yaml
+++ b/manifests/charts/dubbo-control/dubbo-discovery/templates/dubbd-injector-configmap.yaml
@@ -5,7 +5,7 @@ metadata:
namespace: dubbo-system
labels:
app: dubbod
- dubbo.io/rev: default
+ dubbo.apache.org/rev: default
data:
config: |-
defaultTemplates: [grpc-agent]
diff --git a/manifests/charts/dubbo-control/dubbo-discovery/templates/mutatingwebhook.yaml b/manifests/charts/dubbo-control/dubbo-discovery/templates/mutatingwebhook.yaml
index 025a2243..727b64a9 100644
--- a/manifests/charts/dubbo-control/dubbo-discovery/templates/mutatingwebhook.yaml
+++ b/manifests/charts/dubbo-control/dubbo-discovery/templates/mutatingwebhook.yaml
@@ -6,7 +6,7 @@ metadata:
namespace: default
labels:
app: dubbod
- dubbo.io/rev: default
+ dubbo.apache.org/rev: default
webhooks:
- admissionReviewVersions:
- v1
@@ -17,10 +17,10 @@ webhooks:
path: /inject
port: 443
failurePolicy: Fail
- name: rev.namespace.sidecar-injector.dubbo.io
+ name: rev.namespace.sidecar-injector.dubbo.apache.org
namespaceSelector:
matchExpressions:
- - key: dubbo.io/rev
+ - key: dubbo.apache.org/rev
operator: In
values:
- default
@@ -28,7 +28,7 @@ webhooks:
operator: DoesNotExist
objectSelector:
matchExpressions:
- - key: proxyless.dubbo.io/inject
+ - key: proxyless.dubbo.apache.org/inject
operator: NotIn
values:
- "false"
@@ -52,20 +52,20 @@ webhooks:
path: /inject
port: 443
failurePolicy: Fail
- name: rev.object.proxyless-injector.dubbo.io
+ name: rev.object.proxyless-injector.dubbo.apache.org
namespaceSelector:
matchExpressions:
- - key: dubbo.io/rev
+ - key: dubbo.apache.org/rev
operator: DoesNotExist
- key: dubbo-injection
operator: DoesNotExist
objectSelector:
matchExpressions:
- - key: proxyless.dubbo.io/inject
+ - key: proxyless.dubbo.apache.org/inject
operator: NotIn
values:
- "false"
- - key: dubbo.io/rev
+ - key: dubbo.apache.org/rev
operator: In
values:
- default
@@ -88,7 +88,7 @@ webhooks:
namespace: dubbo-system
path: /inject
port: 443
- name: namespace.proxyless-injector.dubbo.io
+ name: namespace.proxyless-injector.dubbo.apache.org
namespaceSelector:
matchExpressions:
- key: dubbo-injection
@@ -97,7 +97,7 @@ webhooks:
- enabled
objectSelector:
matchExpressions:
- - key: proxyless.dubbo.io/inject
+ - key: proxyless.dubbo.apache.org/inject
operator: NotIn
values:
- "false"
@@ -120,14 +120,14 @@ webhooks:
namespace: dubbo-system
path: /inject
port: 443
- name: object.proxyless-injector.dubbo.io
+ name: object.proxyless-injector.dubbo.apache.org
namespaceSelector:
matchExpressions:
- key: dubbo-injection
operator: DoesNotExist
objectSelector:
matchExpressions:
- - key: proxyless.dubbo.io/inject
+ - key: proxyless.dubbo.apache.org/inject
operator: In
values:
- "true"
diff --git a/manifests/charts/dubbo-control/dubbo-discovery/templates/validatingwebhookconfiguration.yaml b/manifests/charts/dubbo-control/dubbo-discovery/templates/validatingwebhookconfiguration.yaml
index 1445f3b2..f843bc91 100644
--- a/manifests/charts/dubbo-control/dubbo-discovery/templates/validatingwebhookconfiguration.yaml
+++ b/manifests/charts/dubbo-control/dubbo-discovery/templates/validatingwebhookconfiguration.yaml
@@ -5,7 +5,7 @@ metadata:
name: dubbo-validator-dubbo-system
namespace: default
webhooks:
- - name: validation.dubbo.io
+ - name: validation.dubbo.apache.org
clientConfig:
service:
name: dubbod
@@ -16,8 +16,8 @@ webhooks:
- CREATE
- UPDATE
apiGroups:
- - security.dubbo.io
- - networking.dubbo.io
+ - security.dubbo.apache.org
+ - networking.dubbo.apache.org
apiVersions:
- "*"
resources:
diff --git a/manifests/charts/dubbo-control/register-discovery/nacos/templates/configmap.yaml b/manifests/charts/dubbo-control/register-discovery/nacos/templates/configmap.yaml
index 99df9b04..f2f60be1 100644
--- a/manifests/charts/dubbo-control/register-discovery/nacos/templates/configmap.yaml
+++ b/manifests/charts/dubbo-control/register-discovery/nacos/templates/configmap.yaml
@@ -7,9 +7,9 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
app: nacos
- dubbo.io/rev: {{ default "default" | quote }}
- install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
- operator.dubbo.io/component: "Nacos"
+ dubbo.apache.org/rev: {{ default "default" | quote }}
+ install.operator.dubbo.apache.org/owning-resource: {{ default "unknown" }}
+ operator.dubbo.apache.org/component: "Nacos"
dubbo: nacos
release: {{ .Release.Name }}
app.kubernetes.io/name: "register"
diff --git a/manifests/charts/dubbo-control/register-discovery/nacos/templates/mysql.yaml b/manifests/charts/dubbo-control/register-discovery/nacos/templates/mysql.yaml
index 7bf67a68..42644f62 100644
--- a/manifests/charts/dubbo-control/register-discovery/nacos/templates/mysql.yaml
+++ b/manifests/charts/dubbo-control/register-discovery/nacos/templates/mysql.yaml
@@ -7,9 +7,9 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
app: nacos-mysql
- dubbo.io/rev: {{ default "default" | quote }}
- install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
- operator.dubbo.io/component: "Nacos"
+ dubbo.apache.org/rev: {{ default "default" | quote }}
+ install.operator.dubbo.apache.org/owning-resource: {{ default "unknown" }}
+ operator.dubbo.apache.org/component: "Nacos"
dubbo: nacos
release: {{ .Release.Name }}
app.kubernetes.io/name: "register"
@@ -19,15 +19,15 @@ spec:
selector:
matchLabels:
app: nacos-mysql
- dubbo.io/rev: {{ default "default" | quote }}
+ dubbo.apache.org/rev: {{ default "default" | quote }}
dubbo: nacos
template:
metadata:
labels:
app: nacos-mysql
- dubbo.io/rev: {{ default "default" | quote }}
- install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
- operator.dubbo.io/component: "Nacos"
+ dubbo.apache.org/rev: {{ default "default" | quote }}
+ install.operator.dubbo.apache.org/owning-resource: {{ default "unknown" }}
+ operator.dubbo.apache.org/component: "Nacos"
dubbo: nacos
release: {{ .Release.Name }}
app.kubernetes.io/name: "register"
@@ -82,9 +82,9 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
app: nacos-mysql
- dubbo.io/rev: {{ default "default" | quote }}
- install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
- operator.dubbo.io/component: "Nacos"
+ dubbo.apache.org/rev: {{ default "default" | quote }}
+ install.operator.dubbo.apache.org/owning-resource: {{ default "unknown" }}
+ operator.dubbo.apache.org/component: "Nacos"
dubbo: nacos
release: {{ .Release.Name }}
app.kubernetes.io/name: "register"
@@ -104,9 +104,9 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
app: nacos-mysql
- dubbo.io/rev: {{ default "default" | quote }}
- install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
- operator.dubbo.io/component: "Nacos"
+ dubbo.apache.org/rev: {{ default "default" | quote }}
+ install.operator.dubbo.apache.org/owning-resource: {{ default "unknown" }}
+ operator.dubbo.apache.org/component: "Nacos"
dubbo: nacos
release: {{ .Release.Name }}
app.kubernetes.io/name: "register"
@@ -128,9 +128,9 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
app: nacos
- dubbo.io/rev: {{ default "default" | quote }}
- install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
- operator.dubbo.io/component: "Nacos"
+ dubbo.apache.org/rev: {{ default "default" | quote }}
+ install.operator.dubbo.apache.org/owning-resource: {{ default "unknown" }}
+ operator.dubbo.apache.org/component: "Nacos"
dubbo: nacos
release: {{ .Release.Name }}
app.kubernetes.io/name: "register"
diff --git a/manifests/charts/dubbo-control/register-discovery/nacos/templates/poddisruptionbudget.yaml b/manifests/charts/dubbo-control/register-discovery/nacos/templates/poddisruptionbudget.yaml
index 9347eda3..28ec1110 100644
--- a/manifests/charts/dubbo-control/register-discovery/nacos/templates/poddisruptionbudget.yaml
+++ b/manifests/charts/dubbo-control/register-discovery/nacos/templates/poddisruptionbudget.yaml
@@ -5,9 +5,9 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
app: nacos
- dubbo.io/rev: {{ default "default" | quote }}
- install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
- operator.dubbo.io/component: "Nacos"
+ dubbo.apache.org/rev: {{ default "default" | quote }}
+ install.operator.dubbo.apache.org/owning-resource: {{ default "unknown" }}
+ operator.dubbo.apache.org/component: "Nacos"
dubbo: nacos
release: {{ .Release.Name }}
app.kubernetes.io/name: "register"
@@ -16,5 +16,5 @@ spec:
selector:
matchLabels:
app: nacos
- dubbo.io/rev: {{ default "default" | quote }}
+ dubbo.apache.org/rev: {{ default "default" | quote }}
dubbo: nacos
diff --git a/manifests/charts/dubbo-control/register-discovery/nacos/templates/service.yaml b/manifests/charts/dubbo-control/register-discovery/nacos/templates/service.yaml
index 75364616..27fd5bbe 100644
--- a/manifests/charts/dubbo-control/register-discovery/nacos/templates/service.yaml
+++ b/manifests/charts/dubbo-control/register-discovery/nacos/templates/service.yaml
@@ -7,9 +7,9 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
app: nacos
- dubbo.io/rev: {{ default "default" | quote }}
- install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
- operator.dubbo.io/component: "Nacos"
+ dubbo.apache.org/rev: {{ default "default" | quote }}
+ install.operator.dubbo.apache.org/owning-resource: {{ default "unknown" }}
+ operator.dubbo.apache.org/component: "Nacos"
dubbo: nacos
release: {{ .Release.Name }}
app.kubernetes.io/name: "register"
@@ -38,9 +38,9 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
app: nacos
- dubbo.io/rev: {{ default "default" | quote }}
- install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
- operator.dubbo.io/component: "Nacos"
+ dubbo.apache.org/rev: {{ default "default" | quote }}
+ install.operator.dubbo.apache.org/owning-resource: {{ default "unknown" }}
+ operator.dubbo.apache.org/component: "Nacos"
dubbo: nacos
release: {{ .Release.Name }}
app.kubernetes.io/name: "register"
diff --git a/manifests/charts/dubbo-control/register-discovery/nacos/templates/statefulset.yaml b/manifests/charts/dubbo-control/register-discovery/nacos/templates/statefulset.yaml
index 5bb79881..3bde1d9f 100644
--- a/manifests/charts/dubbo-control/register-discovery/nacos/templates/statefulset.yaml
+++ b/manifests/charts/dubbo-control/register-discovery/nacos/templates/statefulset.yaml
@@ -7,9 +7,9 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
app: nacos
- dubbo.io/rev: {{ default "default" | quote }}
- install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
- operator.dubbo.io/component: "Nacos"
+ dubbo.apache.org/rev: {{ default "default" | quote }}
+ install.operator.dubbo.apache.org/owning-resource: {{ default "unknown" }}
+ operator.dubbo.apache.org/component: "Nacos"
dubbo: nacos
release: {{ .Release.Name }}
app.kubernetes.io/name: "register"
@@ -23,7 +23,7 @@ spec:
selector:
matchLabels:
app: nacos
- dubbo.io/rev: {{ default "default" | quote }}
+ dubbo.apache.org/rev: {{ default "default" | quote }}
dubbo: nacos
updateStrategy:
type: RollingUpdate
@@ -33,9 +33,9 @@ spec:
metadata:
labels:
app: nacos
- dubbo.io/rev: {{ default "default" | quote }}
- install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
- operator.dubbo.io/component: "Nacos"
+ dubbo.apache.org/rev: {{ default "default" | quote }}
+ install.operator.dubbo.apache.org/owning-resource: {{ default "unknown" }}
+ operator.dubbo.apache.org/component: "Nacos"
dubbo: nacos
release: {{ .Release.Name }}
app.kubernetes.io/name: "register"
diff --git a/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/configmap.yaml b/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/configmap.yaml
index 5eb900a5..e6db9bca 100644
--- a/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/configmap.yaml
+++ b/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/configmap.yaml
@@ -6,9 +6,9 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
app: zookeeper
- dubbo.io/rev: {{ default "default" | quote }}
- install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
- operator.dubbo.io/component: "Zookeeper"
+ dubbo.apache.org/rev: {{ default "default" | quote }}
+ install.operator.dubbo.apache.org/owning-resource: {{ default "unknown" }}
+ operator.dubbo.apache.org/component: "Zookeeper"
dubbo: zookeeper
release: {{ .Release.Name }}
app.kubernetes.io/name: "register"
diff --git a/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/poddisruptionbudget.yaml b/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/poddisruptionbudget.yaml
index bb1239f2..76c21b31 100644
--- a/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/poddisruptionbudget.yaml
+++ b/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/poddisruptionbudget.yaml
@@ -5,9 +5,9 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
app: zookeeper
- dubbo.io/rev: {{ default "default" | quote }}
- install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
- operator.dubbo.io/component: "Zookeeper"
+ dubbo.apache.org/rev: {{ default "default" | quote }}
+ install.operator.dubbo.apache.org/owning-resource: {{ default "unknown" }}
+ operator.dubbo.apache.org/component: "Zookeeper"
dubbo: zookeeper
release: {{ .Release.Name }}
app.kubernetes.io/name: "register"
@@ -16,5 +16,5 @@ spec:
selector:
matchLabels:
app: zookeeper
- dubbo.io/rev: {{ default "default" | quote }}
+ dubbo.apache.org/rev: {{ default "default" | quote }}
dubbo: zookeeper
diff --git a/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/service.yaml b/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/service.yaml
index dee0a29c..3516ebcd 100644
--- a/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/service.yaml
+++ b/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/service.yaml
@@ -5,9 +5,9 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
app: zookeeper
- dubbo.io/rev: {{ default "default" | quote }}
- install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
- operator.dubbo.io/component: "Zookeeper"
+ dubbo.apache.org/rev: {{ default "default" | quote }}
+ install.operator.dubbo.apache.org/owning-resource: {{ default "unknown" }}
+ operator.dubbo.apache.org/component: "Zookeeper"
dubbo: zookeeper
release: {{ .Release.Name }}
app.kubernetes.io/name: "register"
@@ -32,9 +32,9 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
app: zookeeper
- dubbo.io/rev: {{ default "default" | quote }}
- install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
- operator.dubbo.io/component: "Zookeeper"
+ dubbo.apache.org/rev: {{ default "default" | quote }}
+ install.operator.dubbo.apache.org/owning-resource: {{ default "unknown" }}
+ operator.dubbo.apache.org/component: "Zookeeper"
dubbo: zookeeper
release: {{ .Release.Name }}
app.kubernetes.io/name: "register"
diff --git a/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/statefulset.yaml b/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/statefulset.yaml
index 62978598..e00d214a 100644
--- a/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/statefulset.yaml
+++ b/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/statefulset.yaml
@@ -7,9 +7,9 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
app: zookeeper
- dubbo.io/rev: {{ default "default" | quote }}
- install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
- operator.dubbo.io/component: "Zookeeper"
+ dubbo.apache.org/rev: {{ default "default" | quote }}
+ install.operator.dubbo.apache.org/owning-resource: {{ default "unknown" }}
+ operator.dubbo.apache.org/component: "Zookeeper"
dubbo: zookeeper
release: {{ .Release.Name }}
app.kubernetes.io/name: "register"
@@ -17,7 +17,7 @@ spec:
selector:
matchLabels:
app: zookeeper
- dubbo.io/rev: {{ default "default" | quote }}
+ dubbo.apache.org/rev: {{ default "default" | quote }}
dubbo: zookeeper
replicas: {{ $zookeeper.replicas }}
serviceName: zookeeper
@@ -29,9 +29,9 @@ spec:
metadata:
labels:
app: zookeeper
- dubbo.io/rev: {{ default "default" | quote }}
- install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
- operator.dubbo.io/component: "Zookeeper"
+ dubbo.apache.org/rev: {{ default "default" | quote }}
+ install.operator.dubbo.apache.org/owning-resource: {{ default "unknown" }}
+ operator.dubbo.apache.org/component: "Zookeeper"
dubbo: zookeeper
release: {{ .Release.Name }}
app.kubernetes.io/name: "register"
diff --git a/manifests/profiles/default.yaml b/manifests/profiles/default.yaml
index 964755e5..94ff4627 100644
--- a/manifests/profiles/default.yaml
+++ b/manifests/profiles/default.yaml
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-apiVersion: install.dubbo.io/v1alpha1
+apiVersion: install.dubbo.apache.org/v1alpha1
kind: DubboOperator
metadata:
namespace: dubbo-system
diff --git a/manifests/profiles/demo.yaml b/manifests/profiles/demo.yaml
index 821a30cb..8a8a0594 100644
--- a/manifests/profiles/demo.yaml
+++ b/manifests/profiles/demo.yaml
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-apiVersion: install.dubbo.io/v1alpha1
+apiVersion: install.dubbo.apache.org/v1alpha1
kind: DubboOperator
metadata:
namespace: dubbo-system
diff --git a/manifests/profiles/empty.yaml b/manifests/profiles/empty.yaml
index 0c4650a5..9f934ca0 100644
--- a/manifests/profiles/empty.yaml
+++ b/manifests/profiles/empty.yaml
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-apiVersion: install.dubbo.io/v1alpha1
+apiVersion: install.dubbo.apache.org/v1alpha1
kind: DubboOperator
spec:
components:
diff --git a/operator/cmd/cluster/uninstall.go b/operator/cmd/cluster/uninstall.go
index 56b17eff..af12406a 100644
--- a/operator/cmd/cluster/uninstall.go
+++ b/operator/cmd/cluster/uninstall.go
@@ -19,6 +19,8 @@ package cluster
import (
"fmt"
+ "os"
+
"github.com/apache/dubbo-kubernetes/dubboctl/pkg/cli"
"github.com/apache/dubbo-kubernetes/operator/pkg/render"
"github.com/apache/dubbo-kubernetes/operator/pkg/uninstall"
@@ -26,7 +28,6 @@ import (
"github.com/apache/dubbo-kubernetes/operator/pkg/util/progress"
"github.com/apache/dubbo-kubernetes/pkg/kube"
"github.com/spf13/cobra"
- "os"
)
type uninstallArgs struct {
@@ -83,8 +84,7 @@ func UninstallCmd(ctx cli.Context) *cobra.Command {
func Uninstall(cmd *cobra.Command, ctx cli.Context, rootArgs *RootArgs, uiArgs *uninstallArgs) error {
cl := clog.NewConsoleLogger(cmd.OutOrStdout(), cmd.ErrOrStderr())
var kubeClient kube.CLIClient
- var err error
- kubeClient, err = ctx.CLIClientWithRevision("")
+ kubeClient, err := ctx.CLIClientWithRevision("")
if err != nil {
return err
}
diff --git a/operator/pkg/apis/proto/values_types.proto b/operator/pkg/apis/proto/values_types.proto
index 0372a984..23178537 100644
--- a/operator/pkg/apis/proto/values_types.proto
+++ b/operator/pkg/apis/proto/values_types.proto
@@ -22,7 +22,7 @@ package dubbo.operator.v1alpha1;
import "google/protobuf/wrappers.proto";
// Package-wide variables from generator "generated".
-option go_package = "dubbo.io/dubbo/operator/pkg/apis";
+option go_package = "dubbo.apache.org/dubbo/operator/pkg/apis";
// Global Configuration for Dubbo components.
message GlobalConfig {}
diff --git a/operator/pkg/apis/register.go b/operator/pkg/apis/register.go
index 3b10b8b1..e6dc0698 100644
--- a/operator/pkg/apis/register.go
+++ b/operator/pkg/apis/register.go
@@ -23,11 +23,11 @@ import (
// Package v1alpha1 contains API Schema definitions for the dubbo v1alpha1 API group
// +k8s:deepcopy-gen=package,register
-// +groupName=install.dubbo.io
+// +groupName=install.dubbo.apache.org
// DubboOperatorGVK is the GVK for DubboOperator.
var DubboOperatorGVK = schema.GroupVersionKind{
Version: "v1alpha1",
- Group: "install.dubbo.io",
+ Group: "install.dubbo.apache.org",
Kind: "DubboOperator",
}
diff --git a/operator/pkg/apis/types.go b/operator/pkg/apis/types.go
index e9810caa..32e25501 100644
--- a/operator/pkg/apis/types.go
+++ b/operator/pkg/apis/types.go
@@ -19,13 +19,14 @@ package apis
import (
"encoding/json"
+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// DubboOperator defines the custom API.
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubetype-gen
-// +kubetype-gen:groupVersion=install.dubbo.io/v1alpha1
+// +kubetype-gen:groupVersion=install.dubbo.apache.org/v1alpha1
// +k8s:deepcopy-gen=true
type DubboOperator struct {
metav1.TypeMeta `json:",inline"`
diff --git a/operator/pkg/manifest/name.go b/operator/pkg/manifest/name.go
index f0ed4174..1f3da9d0 100644
--- a/operator/pkg/manifest/name.go
+++ b/operator/pkg/manifest/name.go
@@ -19,12 +19,12 @@ package manifest
const (
// OwningResourceName represents the name of the owner to which the resource relates.
- OwningResourceName = "install.operator.dubbo.io/owning-resource"
+ OwningResourceName = "install.operator.dubbo.apache.org/owning-resource"
// OwningResourceNamespace represents the namespace of the owner to which the resource relates.
- OwningResourceNamespace = "install.operator.dubbo.io/owning-resource-namespace"
+ OwningResourceNamespace = "install.operator.dubbo.apache.org/owning-resource-namespace"
// DubboComponentLabel indicates which Dubbo component a resource belongs to.
- DubboComponentLabel = "operator.dubbo.io/component"
+ DubboComponentLabel = "operator.dubbo.apache.org/component"
// OwningResourceNotPruned indicates that the resource should not be pruned during reconciliation cycles,
// note this will not prevent the resource from being deleted if the owning resource is deleted.
- OwningResourceNotPruned = "install.operator.dubbo.io/owning-resource-not-pruned"
+ OwningResourceNotPruned = "install.operator.dubbo.apache.org/owning-resource-not-pruned"
)
diff --git a/operator/pkg/render/manifest.go b/operator/pkg/render/manifest.go
index 8a54221d..8a65b85f 100644
--- a/operator/pkg/render/manifest.go
+++ b/operator/pkg/render/manifest.go
@@ -19,6 +19,10 @@ package render
import (
"fmt"
+ "io"
+ "os"
+ "strings"
+
"github.com/apache/dubbo-kubernetes/manifests"
"github.com/apache/dubbo-kubernetes/operator/cmd/validation"
"github.com/apache/dubbo-kubernetes/operator/pkg/apis"
@@ -29,9 +33,6 @@ import (
"github.com/apache/dubbo-kubernetes/operator/pkg/util/clog"
"github.com/apache/dubbo-kubernetes/operator/pkg/values"
"github.com/apache/dubbo-kubernetes/pkg/kube"
- "io"
- "os"
- "strings"
)
// MergeInputs merges the various configuration inputs into one single DubboOperator.
@@ -43,7 +44,7 @@ func MergeInputs(filenames []string, flags []string) (values.Map, error) {
// then apply them on top of the base once we determine which base to use.
// Initial base values.
ConfigBase, err := values.MapFromJSON([]byte(`{
- "apiVersion": "install.dubbo.io/v1alpha1",
+ "apiVersion": "install.dubbo.apache.org/v1alpha1",
"kind": "DubboOperator",
"metadata": {},
"spec": {}
diff --git a/pkg/adsc/adsc.go b/pkg/adsc/adsc.go
index 44206a41..3575d0c9 100644
--- a/pkg/adsc/adsc.go
+++ b/pkg/adsc/adsc.go
@@ -36,9 +36,9 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/security"
"github.com/apache/dubbo-kubernetes/pkg/util/protomarshal"
"github.com/apache/dubbo-kubernetes/pkg/wellknown"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
- "github.com/apache/dubbo-kubernetes/sail/pkg/networking/util"
- v3 "github.com/apache/dubbo-kubernetes/sail/pkg/xds/v3"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/networking/util"
+ v3 "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/xds/v3"
cluster "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3"
core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
endpoint "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3"
@@ -514,11 +514,11 @@ func tlsConfig(config *Config) (*tls.Config, error) {
}
func ConfigInitialRequests() []*discovery.DiscoveryRequest {
- out := make([]*discovery.DiscoveryRequest, 0, len(collections.Sail.All())+1)
+ out := make([]*discovery.DiscoveryRequest, 0, len(collections.Planet.All())+1)
out = append(out, &discovery.DiscoveryRequest{
TypeUrl: gvk.MeshConfig.String(),
})
- for _, sch := range collections.Sail.All() {
+ for _, sch := range collections.Planet.All() {
out = append(out, &discovery.DiscoveryRequest{
TypeUrl: sch.GroupVersionKind().String(),
})
@@ -587,7 +587,7 @@ func (a *ADSC) handleMCP(groupVersionKind config.GroupVersionKind, resources []*
klog.Errorf("Error unmarshalling received MCP config %v", err)
continue
}
- newCfg, err := a.mcpToSail(m)
+ newCfg, err := a.mcpToPlanet(m)
if err != nil {
klog.Errorf("Invalid data: %v (%v)", err, string(rsc.Value))
continue
@@ -627,7 +627,7 @@ func (a *ADSC) handleMCP(groupVersionKind config.GroupVersionKind, resources []*
}
}
-func (a *ADSC) mcpToSail(m *mcp.Resource) (*config.Config, error) {
+func (a *ADSC) mcpToPlanet(m *mcp.Resource) (*config.Config, error) {
if m == nil || m.Metadata == nil {
return &config.Config{}, nil
}
diff --git a/pkg/adsc/util.go b/pkg/adsc/util.go
index 025ca64e..482aea5b 100644
--- a/pkg/adsc/util.go
+++ b/pkg/adsc/util.go
@@ -66,7 +66,7 @@ func convertTypeURLToMCPGVK(typeURL string) (config.GroupVersionKind, bool) {
Kind: parts[2],
}
- _, isMCP := collections.Sail.FindByGroupVersionKind(gvk)
+ _, isMCP := collections.Planet.FindByGroupVersionKind(gvk)
if isMCP {
return gvk, true
}
diff --git a/pkg/bootstrap/config.go b/pkg/bootstrap/config.go
index 1ca77f90..3e4f0bc8 100644
--- a/pkg/bootstrap/config.go
+++ b/pkg/bootstrap/config.go
@@ -43,7 +43,7 @@ type MetadataOptions struct {
InstanceIPs []string
StsPort int
ProxyConfig *meshAPI.ProxyConfig
- SailSubjectAltName []string
+ PlanetSubjectAltName []string
CredentialSocketExists bool
XDSRootCert string
annotationFilePath string
@@ -154,7 +154,7 @@ func GetNodeMetaData(options MetadataOptions) (*model.Node, error) {
}
meta.ProxyConfig = (*model.NodeMetaProxyConfig)(options.ProxyConfig)
- meta.SailSubjectAltName = options.SailSubjectAltName
+ meta.PlanetSubjectAltName = options.PlanetSubjectAltName
meta.XDSRootCert = options.XDSRootCert
if options.CredentialSocketExists {
untypedMeta[security.CredentialMetaDataName] = "true"
diff --git a/pkg/config/constants/constants.go b/pkg/config/constants/constants.go
index a2cbbdfc..95457668 100644
--- a/pkg/config/constants/constants.go
+++ b/pkg/config/constants/constants.go
@@ -25,7 +25,7 @@ const (
DefaultClusterName = "Kubernetes"
ServiceClusterName = "dubbo-proxy"
ConfigPathDir = "./etc/dubbo/proxy"
- BinaryPathFilename = "/usr/local/bin/sail-agent"
+ BinaryPathFilename = "/usr/local/bin/planet-agent"
KeyFilename = "key.pem"
CertChainFilename = "cert-chain.pem"
CertProviderDubbod = "dubbod"
@@ -39,15 +39,15 @@ const (
StatPrefixDelimiter = ";"
- SailWellKnownDNSCertPath = "./var/run/secrets/dubbod/tls/"
- SailWellKnownDNSCaCertPath = "./var/run/secrets/dubbod/ca/"
+ PlanetWellKnownDNSCertPath = "./var/run/secrets/dubbod/tls/"
+ PlanetWellKnownDNSCaCertPath = "./var/run/secrets/dubbod/ca/"
- DefaultSailTLSCert = SailWellKnownDNSCertPath + "tls.crt"
- DefaultSailTLSKey = SailWellKnownDNSCertPath + "tls.key"
- DefaultSailTLSCaCert = SailWellKnownDNSCaCertPath + "root-cert.pem"
- DefaultSailTLSCaCertAlternatePath = SailWellKnownDNSCertPath + "ca.crt"
+ DefaultPlanetTLSCert = PlanetWellKnownDNSCertPath + "tls.crt"
+ DefaultPlanetTLSKey = PlanetWellKnownDNSCertPath + "tls.key"
+ DefaultPlanetTLSCaCert = PlanetWellKnownDNSCaCertPath + "root-cert.pem"
+ DefaultPlanetTLSCaCertAlternatePath = PlanetWellKnownDNSCertPath + "ca.crt"
- AlwaysReject = "internal.dubbo.io/webhook-always-reject"
+ AlwaysReject = "internal.dubbo.apache.org/webhook-always-reject"
KubeSystemNamespace string = "kube-system"
diff --git a/pkg/config/model.go b/pkg/config/model.go
index 71ad19d5..27960120 100644
--- a/pkg/config/model.go
+++ b/pkg/config/model.go
@@ -21,10 +21,11 @@ import (
"bytes"
"encoding/json"
"fmt"
- "github.com/apache/dubbo-kubernetes/pkg/slices"
"reflect"
"time"
+ "github.com/apache/dubbo-kubernetes/pkg/slices"
+
gogojsonpb "github.com/gogo/protobuf/jsonpb" // nolint: depguard
gogoproto "github.com/gogo/protobuf/proto" // nolint: depguard
gogotypes "github.com/gogo/protobuf/types" // nolint: depguard
@@ -43,7 +44,7 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/util/gogoprotomarshal"
"github.com/apache/dubbo-kubernetes/pkg/util/protomarshal"
"github.com/apache/dubbo-kubernetes/pkg/util/sets"
- "github.com/apache/dubbo-kubernetes/sail/pkg/util/protoconv"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/util/protoconv"
)
// Meta is metadata attached to each configuration unit.
@@ -131,7 +132,7 @@ func (o ObjectWithCluster[T]) GetObjectKeyable() any {
}
func LabelsInRevision(lbls map[string]string, rev string) bool {
- configEnv, f := lbls["dubbo.io/rev"]
+ configEnv, f := lbls["dubbo.apache.org/rev"]
if !f {
// This is a global object, and always included
return true
@@ -149,7 +150,7 @@ func LabelsInRevisionOrTags(lbls map[string]string, rev string, tags sets.Set[st
if LabelsInRevision(lbls, rev) {
return true
}
- configEnv := lbls["dubbo.io/rev"]
+ configEnv := lbls["dubbo.apache.org/rev"]
// Otherwise, only return true if revisions equal
return tags.Contains(configEnv)
}
diff --git a/pkg/config/schema/collections/collections.agent.go b/pkg/config/schema/collections/collections.agent.go
index e98bc25f..3a2f9d44 100644
--- a/pkg/config/schema/collections/collections.agent.go
+++ b/pkg/config/schema/collections/collections.agent.go
@@ -133,7 +133,7 @@ var (
MustAdd(ValidatingWebhookConfiguration).
Build()
- Sail = collection.NewSchemasBuilder().
+ Planet = collection.NewSchemasBuilder().
MustAdd(PeerAuthentication).
MustAdd(RequestAuthentication).
MustAdd(DestinationRule).
diff --git a/pkg/config/schema/collections/collections.go b/pkg/config/schema/collections/collections.go
index b91f5056..39030806 100644
--- a/pkg/config/schema/collections/collections.go
+++ b/pkg/config/schema/collections/collections.go
@@ -35,7 +35,7 @@ import (
var (
PeerAuthentication = collection.Builder{
Identifier: "PeerAuthentication",
- Group: "security.dubbo.io",
+ Group: "security.dubbo.apache.org",
Kind: "PeerAuthentication",
Plural: "peerauthentications",
Version: "v1",
@@ -51,7 +51,7 @@ var (
}.MustBuild()
RequestAuthentication = collection.Builder{
Identifier: "RequestAuthentication",
- Group: "security.dubbo.io",
+ Group: "security.dubbo.apache.org",
Kind: "RequestAuthentication",
Plural: "requestauthentications",
Version: "v1",
@@ -67,7 +67,7 @@ var (
}.MustBuild()
DestinationRule = collection.Builder{
Identifier: "DestinationRule",
- Group: "networking.dubbo.io",
+ Group: "networking.dubbo.apache.org",
Kind: "DestinationRule",
Plural: "destinationrules",
Version: "v1",
@@ -84,7 +84,7 @@ var (
}.MustBuild()
VirtualService = collection.Builder{
Identifier: "VirtualService",
- Group: "networking.dubbo.io",
+ Group: "networking.dubbo.apache.org",
Kind: "VirtualService",
Plural: "virtualservices",
Version: "v1",
@@ -178,7 +178,7 @@ var (
MustAdd(ValidatingWebhookConfiguration).
Build()
- Sail = collection.NewSchemasBuilder().
+ Planet = collection.NewSchemasBuilder().
MustAdd(PeerAuthentication).
MustAdd(RequestAuthentication).
MustAdd(DestinationRule).
diff --git a/pkg/config/schema/gvk/resources.go b/pkg/config/schema/gvk/resources.go
index b093fc04..2c1ad403 100644
--- a/pkg/config/schema/gvk/resources.go
+++ b/pkg/config/schema/gvk/resources.go
@@ -38,11 +38,11 @@ var (
Pod = config.GroupVersionKind{Group: "", Version: "v1", Kind: "Pod"}
ServiceAccount = config.GroupVersionKind{Group: "", Version: "v1", Kind: "ServiceAccount"}
MeshConfig = config.GroupVersionKind{Group: "", Version: "v1alpha1", Kind: "MeshConfig"}
- RequestAuthentication = config.GroupVersionKind{Group: "security.dubbo.io", Version: "v1", Kind: "RequestAuthentication"}
- PeerAuthentication = config.GroupVersionKind{Group: "security.dubbo.io", Version: "v1", Kind: "PeerAuthentication"}
- AuthorizationPolicy = config.GroupVersionKind{Group: "security.dubbo.io", Version: "v1", Kind: "AuthorizationPolicy"}
- DestinationRule = config.GroupVersionKind{Group: "networking.dubbo.io", Version: "v1", Kind: "DestinationRule"}
- VirtualService = config.GroupVersionKind{Group: "networking.dubbo.io", Version: "v1", Kind: "VirtualService"}
+ RequestAuthentication = config.GroupVersionKind{Group: "security.dubbo.apache.org", Version: "v1", Kind: "RequestAuthentication"}
+ PeerAuthentication = config.GroupVersionKind{Group: "security.dubbo.apache.org", Version: "v1", Kind: "PeerAuthentication"}
+ AuthorizationPolicy = config.GroupVersionKind{Group: "security.dubbo.apache.org", Version: "v1", Kind: "AuthorizationPolicy"}
+ DestinationRule = config.GroupVersionKind{Group: "networking.dubbo.apache.org", Version: "v1", Kind: "DestinationRule"}
+ VirtualService = config.GroupVersionKind{Group: "networking.dubbo.apache.org", Version: "v1", Kind: "VirtualService"}
EndpointSlice = config.GroupVersionKind{Group: "discovery.k8s.io", Version: "v1", Kind: "EndpointSlice"}
Endpoints = config.GroupVersionKind{Group: "", Version: "v1", Kind: "Endpoints"}
)
diff --git a/pkg/config/schema/gvr/resources.go b/pkg/config/schema/gvr/resources.go
index 48d27b81..a14d1205 100644
--- a/pkg/config/schema/gvr/resources.go
+++ b/pkg/config/schema/gvr/resources.go
@@ -35,11 +35,11 @@ var (
Service = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "services"}
ServiceAccount = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "serviceaccounts"}
MeshConfig = schema.GroupVersionResource{Group: "", Version: "v1alpha1", Resource: "meshconfigs"}
- RequestAuthentication = schema.GroupVersionResource{Group: "security.dubbo.io", Version: "v1", Resource: "requestauthentications"}
- PeerAuthentication = schema.GroupVersionResource{Group: "security.dubbo.io", Version: "v1", Resource: "peerauthentications"}
- AuthorizationPolicy = schema.GroupVersionResource{Group: "security.dubbo.io", Version: "v1", Resource: "authorizationpolicies"}
- DestinationRule = schema.GroupVersionResource{Group: "networking.dubbo.io", Version: "v1", Resource: "destinationrules"}
- VirtualService = schema.GroupVersionResource{Group: "networking.dubbo.io", Version: "v1", Resource: "virtualservices"}
+ RequestAuthentication = schema.GroupVersionResource{Group: "security.dubbo.apache.org", Version: "v1", Resource: "requestauthentications"}
+ PeerAuthentication = schema.GroupVersionResource{Group: "security.dubbo.apache.org", Version: "v1", Resource: "peerauthentications"}
+ AuthorizationPolicy = schema.GroupVersionResource{Group: "security.dubbo.apache.org", Version: "v1", Resource: "authorizationpolicies"}
+ DestinationRule = schema.GroupVersionResource{Group: "networking.dubbo.apache.org", Version: "v1", Resource: "destinationrules"}
+ VirtualService = schema.GroupVersionResource{Group: "networking.dubbo.apache.org", Version: "v1", Resource: "virtualservices"}
EndpointSlice = schema.GroupVersionResource{Group: "discovery.k8s.io", Version: "v1", Resource: "endpointslices"}
Endpoints = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "endpoints"}
Pod = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "pods"}
diff --git a/pkg/dubbo-agent/agent.go b/pkg/dubbo-agent/agent.go
index 914f1c32..0727b7e8 100644
--- a/pkg/dubbo-agent/agent.go
+++ b/pkg/dubbo-agent/agent.go
@@ -21,6 +21,7 @@ import (
"context"
"encoding/json"
"fmt"
+ "github.com/apache/dubbo-kubernetes/pkg/log"
"net/http"
"os"
"path"
@@ -29,21 +30,20 @@ import (
"sync"
"time"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/cmd/planet-agent/config"
"github.com/apache/dubbo-kubernetes/pkg/model"
- "github.com/apache/dubbo-kubernetes/sail/cmd/sail-agent/config"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/nodeagent/cache"
"github.com/apache/dubbo-kubernetes/pkg/bootstrap"
"github.com/apache/dubbo-kubernetes/pkg/config/constants"
"github.com/apache/dubbo-kubernetes/pkg/dubbo-agent/grpcxds"
"github.com/apache/dubbo-kubernetes/pkg/filewatcher"
"github.com/apache/dubbo-kubernetes/pkg/security"
- "github.com/apache/dubbo-kubernetes/security/pkg/nodeagent/cache"
core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/protobuf/types/known/structpb"
mesh "istio.io/api/mesh/v1alpha1"
- "k8s.io/klog/v2"
)
const (
@@ -125,13 +125,13 @@ func (a *Agent) Run(ctx context.Context) (func(), error) {
return nil, fmt.Errorf("failed to check SDS socket: %v", err)
}
if socketExists {
- klog.Infof("Existing workload SDS socket found at %s. Default Dubbo SDS Server will only serve files", configuredAgentSocketPath)
+ log.Infof("Existing workload SDS socket found at %s. Default Dubbo SDS Server will only serve files", configuredAgentSocketPath)
a.secOpts.ServeOnlyFiles = true
} else if !isDubboSDS {
return nil, fmt.Errorf("agent configured for non-default SDS socket path: %s but no socket found", configuredAgentSocketPath)
}
- klog.Info("Starting default Dubbo SDS Server")
+ log.Info("Starting default Dubbo SDS Server")
err = a.initSdsServer()
if err != nil {
return nil, fmt.Errorf("failed to start default Dubbo SDS server: %v", err)
@@ -145,7 +145,7 @@ func (a *Agent) Run(ctx context.Context) (func(), error) {
// because we need the UDS path to be converted to absolute path
var bootstrapNode *core.Node
if a.cfg.GRPCBootstrapPath != "" {
- klog.Infof("Starting sail-agent with GRPC bootstrap path: %s", a.cfg.GRPCBootstrapPath)
+ log.Infof("Starting planet-agent with GRPC bootstrap path: %s", a.cfg.GRPCBootstrapPath)
node, err := a.generateGRPCBootstrapWithNode()
if err != nil {
return nil, fmt.Errorf("failed generating gRPC XDS bootstrap: %v", err)
@@ -168,7 +168,7 @@ func (a *Agent) Run(ctx context.Context) (func(), error) {
}
}
} else {
- klog.Warning("GRPC_XDS_BOOTSTRAP not set, bootstrap file will not be generated")
+ log.Warn("GRPC_XDS_BOOTSTRAP not set, bootstrap file will not be generated")
}
// Watch for certificate changes to update dial options
// Note: dial options are already initialized in initXdsProxy, this is only for updates
@@ -179,16 +179,16 @@ func (a *Agent) Run(ctx context.Context) (func(), error) {
}
go a.startFileWatcher(ctx, rootCAForXDS, func() {
if err := a.xdsProxy.initDubbodDialOptions(a); err != nil {
- klog.Warningf("Failed to update xds proxy dial options: %v", err)
+ log.Warnf("Failed to update xds proxy dial options: %v", err)
} else {
- klog.Info("Updated xds proxy dial options after certificate change")
+ log.Info("Updated xds proxy dial options after certificate change")
}
})
// also watch CA root for CA client; rebuild SDS/CA client when it changes
if caRoot, err := a.FindRootCAForCA(); err == nil && caRoot != "" {
go a.startFileWatcher(ctx, caRoot, func() {
- klog.Info("CA root changed, rebuilding CA client and SDS server")
+ log.Info("CA root changed, rebuilding CA client and SDS server")
a.rebuildSDSWithNewCAClient()
})
}
@@ -204,9 +204,9 @@ func (a *Agent) Run(ctx context.Context) (func(), error) {
a.wg.Add(1)
go func() {
defer a.wg.Done()
- klog.Infof("Opening status port %d", a.proxyConfig.StatusPort)
+ log.Infof("Opening status port %d", a.proxyConfig.StatusPort)
if err := a.statusSrv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
- klog.Errorf("status server error: %v", err)
+ log.Errorf("status server error: %v", err)
}
}()
@@ -277,7 +277,7 @@ func (a *Agent) FindRootCAForXDS() (string, error) {
} else if a.secOpts.FileMountedCerts {
// FileMountedCerts - Load it from Proxy Metadata.
rootCAPath = a.proxyConfig.ProxyMetadata[MetadataClientRootCert]
- } else if a.secOpts.SailCertProvider == constants.CertProviderNone {
+ } else if a.secOpts.PlanetCertProvider == constants.CertProviderNone {
return "", fmt.Errorf("root CA file for XDS required but configured provider as none")
} else {
rootCAPath = path.Join(AegisCACertPath, constants.CACertNamespaceConfigMapDataName)
@@ -317,7 +317,7 @@ func (a *Agent) FindRootCAForCA() (string, error) {
return "", nil
} else if a.cfg.CARootCerts != "" {
rootCAPath = a.cfg.CARootCerts
- } else if a.secOpts.SailCertProvider == constants.CertProviderCustom {
+ } else if a.secOpts.PlanetCertProvider == constants.CertProviderCustom {
rootCAPath = security.DefaultRootCertFilePath // ./etc/certs/root-cert.pem
} else if a.secOpts.ProvCert != "" {
// This was never completely correct - PROV_CERT are only intended for auth with CA_ADDR,
@@ -325,7 +325,7 @@ func (a *Agent) FindRootCAForCA() (string, error) {
// For VMs, the root cert file used to auth may be populated afterwards.
// Thus, return directly here and skip checking for existence.
return a.secOpts.ProvCert + "/root-cert.pem", nil
- } else if a.secOpts.SailCertProvider == constants.CertProviderNone {
+ } else if a.secOpts.PlanetCertProvider == constants.CertProviderNone {
return "", fmt.Errorf("root CA file for CA required but configured provider as none")
} else {
rootCAPath = path.Join(AegisCACertPath, constants.CACertNamespaceConfigMapDataName)
@@ -341,14 +341,14 @@ func (a *Agent) FindRootCAForCA() (string, error) {
func (a *Agent) startFileWatcher(ctx context.Context, filePath string, handler func()) {
absPath, err := filepath.Abs(filePath)
if err != nil {
- klog.Warningf("Failed to get absolute path for %s: %v", filePath, err)
+ log.Warnf("Failed to get absolute path for %s: %v", filePath, err)
return
}
// Ensure parent directory exists for filewatcher
parentDir := filepath.Dir(absPath)
if _, err := os.Stat(parentDir); os.IsNotExist(err) {
if err := os.MkdirAll(parentDir, 0755); err != nil {
- klog.Warningf("Failed to create parent directory %s for file watcher: %v", parentDir, err)
+ log.Warnf("Failed to create parent directory %s for file watcher: %v", parentDir, err)
return
}
}
@@ -357,21 +357,21 @@ func (a *Agent) startFileWatcher(ctx context.Context, filePath string, handler f
// If the file is already being watched, this is expected and should be silently skipped
// Only log as warning if it's a different error
if strings.Contains(err.Error(), "is already being watched") {
- klog.V(2).Infof("File watcher already exists for %s, skipping", absPath)
+ log.Debugf("File watcher already exists for %s, skipping", absPath)
return
}
- klog.Warningf("Failed to add file watcher %s: %v", absPath, err)
+ log.Warnf("Failed to add file watcher %s: %v", absPath, err)
return
}
- klog.V(2).Infof("Add file %s watcher", absPath)
+ log.Debugf("Add file %s watcher", absPath)
for {
select {
case gotEvent := <-a.fileWatcher.Events(absPath):
- klog.V(2).Infof("Receive file %s event %v", absPath, gotEvent)
+ log.Debugf("Receive file %s event %v", absPath, gotEvent)
handler()
case err := <-a.fileWatcher.Errors(absPath):
- klog.Warningf("Watch file %s error: %v", absPath, err)
+ log.Warnf("Watch file %s error: %v", absPath, err)
case <-ctx.Done():
return
}
@@ -381,7 +381,7 @@ func (a *Agent) startFileWatcher(ctx context.Context, filePath string, handler f
func (a *Agent) initSdsServer() error {
var err error
if security.CheckWorkloadCertificate(security.WorkloadIdentityCertChainPath, security.WorkloadIdentityKeyPath, security.WorkloadIdentityRootCertPath) {
- klog.Info("workload certificate files detected, creating secret manager without caClient")
+ log.Info("workload certificate files detected, creating secret manager without caClient")
a.secOpts.RootCertFilePath = security.WorkloadIdentityRootCertPath
a.secOpts.CertChainFilePath = security.WorkloadIdentityCertChainPath
a.secOpts.KeyFilePath = security.WorkloadIdentityKeyPath
@@ -405,24 +405,24 @@ func (a *Agent) rebuildSDSWithNewCAClient() {
a.sdsMu.Lock()
defer a.sdsMu.Unlock()
if a.sdsServer != nil {
- klog.Info("Stopping existing SDS server for CA client rebuild")
+ log.Info("Stopping existing SDS server for CA client rebuild")
a.sdsServer.Stop()
}
if a.secretCache != nil {
- klog.Info("Closing existing SecretManagerClient")
+ log.Info("Closing existing SecretManagerClient")
a.secretCache.Close()
}
// recreate secret manager with CA client enabled
sc, err := a.newSecretManager(true)
if err != nil {
- klog.Errorf("failed to recreate secret manager with new CA client: %v", err)
+ log.Errorf("failed to recreate secret manager with new CA client: %v", err)
return
}
a.secretCache = sc
pkpConf := a.proxyConfig.GetPrivateKeyProvider()
a.sdsServer = a.cfg.SDSFactory(a.secOpts, a.secretCache, pkpConf)
a.secretCache.RegisterSecretHandler(a.sdsServer.OnSecretUpdate)
- klog.Info("SDS server and CA client rebuilt successfully")
+ log.Info("SDS server and CA client rebuilt successfully")
}
func (a *Agent) generateGRPCBootstrapWithNode() (*model.Node, error) {
@@ -432,7 +432,7 @@ func (a *Agent) generateGRPCBootstrapWithNode() (*model.Node, error) {
if err != nil {
return nil, fmt.Errorf("failed to resolve absolute path for bootstrap file: %v", err)
}
- klog.Infof("Generating gRPC bootstrap file at: %s (absolute: %s)", bootstrapPath, absBootstrapPath)
+ log.Infof("Generating gRPC bootstrap file at: %s (absolute: %s)", bootstrapPath, absBootstrapPath)
// generate metadata
node, err := a.generateNodeMetadata()
@@ -460,7 +460,7 @@ func (a *Agent) generateGRPCBootstrapWithNode() (*model.Node, error) {
if err != nil {
return nil, err
}
- klog.Infof("gRPC bootstrap file generated successfully at: %s", absBootstrapPath)
+ log.Infof("gRPC bootstrap file generated successfully at: %s", absBootstrapPath)
return node, nil
}
@@ -471,10 +471,10 @@ func (a *Agent) generateGRPCBootstrap() error {
func (a *Agent) newSecretManager(createCaClient bool) (*cache.SecretManagerClient, error) {
if !createCaClient {
- klog.Info("Workload is using file mounted certificates. Skipping connecting to CA")
+ log.Info("Workload is using file mounted certificates. Skipping connecting to CA")
return cache.NewSecretManagerClient(nil, a.secOpts)
}
- klog.Infof("CA Endpoint %s, provider %s", a.secOpts.CAEndpoint, a.secOpts.CAProviderName)
+ log.Infof("CA Endpoint %s, provider %s", a.secOpts.CAEndpoint, a.secOpts.CAProviderName)
caClient, err := createCAClient(a.secOpts, a)
if err != nil {
@@ -484,9 +484,9 @@ func (a *Agent) newSecretManager(createCaClient bool) (*cache.SecretManagerClien
}
func (a *Agent) generateNodeMetadata() (*model.Node, error) {
- var sailSAN []string
+ var planetSAN []string
if a.proxyConfig.ControlPlaneAuthPolicy == mesh.AuthenticationPolicy_MUTUAL_TLS {
- sailSAN = []string{config.GetSailSan(a.proxyConfig.DiscoveryAddress)}
+ planetSAN = []string{config.GetPlanetSan(a.proxyConfig.DiscoveryAddress)}
}
credentialSocketExists, err := checkSocket(context.TODO(), security.CredentialNameSocketPath)
@@ -494,7 +494,7 @@ func (a *Agent) generateNodeMetadata() (*model.Node, error) {
return nil, fmt.Errorf("failed to check credential SDS socket: %v", err)
}
if credentialSocketExists {
- klog.Info("Credential SDS socket found")
+ log.Info("Credential SDS socket found")
}
return bootstrap.GetNodeMetaData(bootstrap.MetadataOptions{
@@ -503,7 +503,7 @@ func (a *Agent) generateNodeMetadata() (*model.Node, error) {
InstanceIPs: a.cfg.ProxyIPAddresses,
StsPort: a.secOpts.STSPort,
ProxyConfig: a.proxyConfig,
- SailSubjectAltName: sailSAN,
+ PlanetSubjectAltName: planetSAN,
CredentialSocketExists: credentialSocketExists,
XDSRootCert: a.cfg.XDSRootCerts,
MetadataDiscovery: a.cfg.MetadataDiscovery,
@@ -537,7 +537,7 @@ func checkSocket(ctx context.Context, socketPath string) (bool, error) {
err := socketHealthCheck(ctx, socketPath)
if err != nil {
- klog.V(2).Infof("SDS socket detected but not healthy: %v", err)
+ log.Debugf("SDS socket detected but not healthy: %v", err)
err = os.Remove(socketPath)
if err != nil {
return false, fmt.Errorf("existing SDS socket could not be removed: %v", err)
@@ -563,7 +563,7 @@ func socketHealthCheck(ctx context.Context, socketPath string) error {
}
err = conn.Close()
if err != nil {
- klog.Infof("connection is not closed: %v", err)
+ log.Infof("connection is not closed: %v", err)
}
return nil
diff --git a/pkg/dubbo-agent/config/config.go b/pkg/dubbo-agent/config/config.go
index 841a74cb..d05d5729 100644
--- a/pkg/dubbo-agent/config/config.go
+++ b/pkg/dubbo-agent/config/config.go
@@ -20,15 +20,11 @@ package config
import (
"fmt"
"os"
- "strconv"
- "strings"
"github.com/apache/dubbo-kubernetes/pkg/bootstrap"
"github.com/apache/dubbo-kubernetes/pkg/config/mesh"
- "github.com/apache/dubbo-kubernetes/pkg/env"
- "istio.io/api/annotation"
+ "github.com/apache/dubbo-kubernetes/pkg/log"
meshconfig "istio.io/api/mesh/v1alpha1"
- "k8s.io/klog/v2"
)
// ConstructProxyConfig returns proxyConfig
@@ -36,9 +32,9 @@ func ConstructProxyConfig(meshConfigFile, proxyConfigEnv string) (*meshconfig.Pr
annotations, err := bootstrap.ReadPodAnnotations("")
if err != nil {
if os.IsNotExist(err) {
- klog.V(2).Infof("failed to read pod annotations: %v", err)
+ log.Debugf("failed to read pod annotations: %v", err)
} else {
- klog.V(2).Infof("failed to read pod annotations: %v", err)
+ log.Warnf("failed to read pod annotations: %v", err)
}
}
var fileMeshContents string
@@ -49,7 +45,7 @@ func ConstructProxyConfig(meshConfigFile, proxyConfigEnv string) (*meshconfig.Pr
}
fileMeshContents = string(contents)
}
- meshConfig, err := getMeshConfig(fileMeshContents, annotations["proxy.dubbo.io/config"], proxyConfigEnv)
+ meshConfig, err := getMeshConfig(fileMeshContents, annotations["proxy.dubbo.apache.org/config"], proxyConfigEnv)
if err != nil {
return nil, err
}
@@ -59,13 +55,13 @@ func ConstructProxyConfig(meshConfigFile, proxyConfigEnv string) (*meshconfig.Pr
}
// TODO ResolveAddr
// TODO ValidateMeshConfigProxyConfig
- return applyAnnotations(proxyConfig, annotations), nil
+ return proxyConfig, nil
}
func getMeshConfig(fileOverride, annotationOverride, proxyConfigEnv string) (*meshconfig.MeshConfig, error) {
mc := mesh.DefaultMeshConfig()
if fileOverride != "" {
- klog.Infof("Apply mesh config from file %v", fileOverride)
+ log.Infof("Apply mesh config from file %v", fileOverride)
fileMesh, err := mesh.ApplyMeshConfig(fileOverride, mc)
if err != nil || fileMesh == nil {
return nil, fmt.Errorf("failed to unmarshal mesh config from file [%v]: %v", fileOverride, err)
@@ -75,7 +71,7 @@ func getMeshConfig(fileOverride, annotationOverride, proxyConfigEnv string) (*me
// Original order: env first, then annotation
if proxyConfigEnv != "" {
- klog.Infof("Apply proxy config from env %v", proxyConfigEnv)
+ log.Infof("Apply proxy config from env %v", proxyConfigEnv)
envMesh, err := mesh.ApplyProxyConfig(proxyConfigEnv, mc)
if err != nil || envMesh == nil {
return nil, fmt.Errorf("failed to unmarshal mesh config from environment [%v]: %v", proxyConfigEnv, err)
@@ -84,7 +80,7 @@ func getMeshConfig(fileOverride, annotationOverride, proxyConfigEnv string) (*me
}
if annotationOverride != "" {
- klog.Infof("Apply proxy config from annotation %v", annotationOverride)
+ log.Infof("Apply proxy config from annotation %v", annotationOverride)
annotationMesh, err := mesh.ApplyProxyConfig(annotationOverride, mc)
if err != nil || annotationMesh == nil {
return nil, fmt.Errorf("failed to unmarshal mesh config from annotation [%v]: %v", annotationOverride, err)
@@ -95,39 +91,9 @@ func getMeshConfig(fileOverride, annotationOverride, proxyConfigEnv string) (*me
return mc, nil
}
-// Apply any overrides to proxy config from annotations
-func applyAnnotations(config *meshconfig.ProxyConfig, annos map[string]string) *meshconfig.ProxyConfig {
- if v, f := annos[annotation.SidecarDiscoveryAddress.Name]; f {
- config.DiscoveryAddress = v
- }
- if v, f := annos[annotation.SidecarStatusPort.Name]; f {
- p, err := strconv.Atoi(v)
- if err != nil {
- klog.Errorf("Invalid annotation %v=%v: %v", annotation.SidecarStatusPort.Name, v, err)
- }
- config.StatusPort = int32(p)
- }
- return config
-}
-
-func GetSailSan(discoveryAddress string) string {
- discHost := strings.Split(discoveryAddress, ":")[0]
- // For local debugging - the discoveryAddress is set to localhost, but the cert issued for normal SA.
- if discHost == "localhost" {
- discHost = "dubbod.istio-system.svc"
- }
- return discHost
-}
-
func fileExists(path string) bool {
if _, err := os.Stat(path); os.IsNotExist(err) {
return false
}
return true
}
-
-var CPULimit = env.Register(
- "DUBBO_CPU_LIMIT",
- 0,
- "CPU limit for the current process. Expressed as an integer value, rounded up.",
-).Get()
diff --git a/pkg/dubbo-agent/grpcxds/grpc_bootstrap.go b/pkg/dubbo-agent/grpcxds/grpc_bootstrap.go
index ab8c4e27..a926880b 100644
--- a/pkg/dubbo-agent/grpcxds/grpc_bootstrap.go
+++ b/pkg/dubbo-agent/grpcxds/grpc_bootstrap.go
@@ -35,7 +35,7 @@ import (
)
const (
- ServerListenerNamePrefix = "xds.dubbo.io/grpc/lds/inbound/"
+ ServerListenerNamePrefix = "xds.dubbo.apache.org/grpc/lds/inbound/"
ServerListenerNameTemplate = ServerListenerNamePrefix + "%s"
FileWatcherCertProviderName = "file_watcher"
)
@@ -215,7 +215,7 @@ func extractMeta(node *model.Node) (*structpb.Struct, error) {
}
// Fix ClusterName oneof field in PROXY_CONFIG to be a string instead of object
- // This is needed because sail-discovery expects ClusterName as a string, not a oneof object
+ // This is needed because planet-discovery expects ClusterName as a string, not a oneof object
if proxyConfigRaw, ok := rawMeta["PROXY_CONFIG"].(map[string]any); ok {
if clusterNameRaw, ok := proxyConfigRaw["ClusterName"].(map[string]any); ok {
// Convert {"ServiceCluster": "dubbo-proxy"} to just "dubbo-proxy"
diff --git a/pkg/dubbo-agent/plugins.go b/pkg/dubbo-agent/plugins.go
index d3382eba..e70e1d2c 100644
--- a/pkg/dubbo-agent/plugins.go
+++ b/pkg/dubbo-agent/plugins.go
@@ -19,11 +19,11 @@ package dubboagent
import (
"fmt"
+ "github.com/apache/dubbo-kubernetes/pkg/log"
"strings"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/nodeagent/caclient/providers/aegis"
"github.com/apache/dubbo-kubernetes/pkg/security"
- "github.com/apache/dubbo-kubernetes/security/pkg/nodeagent/caclient/providers/aegis"
- "k8s.io/klog/v2"
)
type RootCertProvider interface {
@@ -42,7 +42,7 @@ func createAegis(opts *security.Options, a RootCertProvider) (security.Client, e
var err error
if strings.HasSuffix(opts.CAEndpoint, ":15010") {
- klog.Warning("Debug mode or IP-secure network")
+ log.Warn("Debug mode or IP-secure network")
} else {
tlsOpts = &aegis.TLSOptions{}
tlsOpts.RootCert, err = a.FindRootCAForCA()
@@ -51,11 +51,11 @@ func createAegis(opts *security.Options, a RootCertProvider) (security.Client, e
}
if tlsOpts.RootCert == "" {
- klog.Infof("Using CA %s cert with system certs", opts.CAEndpoint)
+ log.Infof("Using CA %s cert with system certs", opts.CAEndpoint)
} else if !fileExists(tlsOpts.RootCert) {
- klog.Fatalf("invalid config - %s missing a root certificate %s", opts.CAEndpoint, tlsOpts.RootCert)
+ log.Fatalf("invalid config - %s missing a root certificate %s", opts.CAEndpoint, tlsOpts.RootCert)
} else {
- klog.Infof("Using CA %s cert with certs: %s", opts.CAEndpoint, tlsOpts.RootCert)
+ log.Infof("Using CA %s cert with certs: %s", opts.CAEndpoint, tlsOpts.RootCert)
}
tlsOpts.Key, tlsOpts.Cert = a.GetKeyCertsForCA()
diff --git a/pkg/dubbo-agent/xds_proxy.go b/pkg/dubbo-agent/xds_proxy.go
index 715d52bf..2dc92f68 100644
--- a/pkg/dubbo-agent/xds_proxy.go
+++ b/pkg/dubbo-agent/xds_proxy.go
@@ -26,13 +26,15 @@ import (
"sync"
"time"
+ "github.com/apache/dubbo-kubernetes/pkg/log"
+
+ dubbogrpc "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/grpc"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/nodeagent/caclient"
+ "github.com/apache/dubbo-kubernetes/dubbod/security/pkg/pki/util"
"github.com/apache/dubbo-kubernetes/pkg/channels"
dubbokeepalive "github.com/apache/dubbo-kubernetes/pkg/keepalive"
"github.com/apache/dubbo-kubernetes/pkg/model"
"github.com/apache/dubbo-kubernetes/pkg/uds"
- dubbogrpc "github.com/apache/dubbo-kubernetes/sail/pkg/grpc"
- "github.com/apache/dubbo-kubernetes/security/pkg/nodeagent/caclient"
- "github.com/apache/dubbo-kubernetes/security/pkg/pki/util"
core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
"go.uber.org/atomic"
@@ -44,9 +46,10 @@ import (
"google.golang.org/grpc/reflection"
"google.golang.org/protobuf/types/known/anypb"
meshconfig "istio.io/api/mesh/v1alpha1"
- "k8s.io/klog/v2"
)
+var proxyLog = log.RegisterScope("xdsproxy", "XDS Proxy in Dubbo Agent")
+
type (
DiscoveryStream = discovery.AggregatedDiscoveryService_StreamAggregatedResourcesServer
DeltaDiscoveryStream = discovery.AggregatedDiscoveryService_DeltaAggregatedResourcesServer
@@ -114,7 +117,7 @@ var connectionNumber = atomic.NewUint32(0)
func (p *XdsProxy) handleStream(downstream adsStream) error {
conID := connectionNumber.Inc()
- klog.Infof("XDS proxy: new downstream connection #%d", conID)
+ proxyLog.Infof("new downstream connection #%d", conID)
con := &ProxyConnection{
conID: conID,
upstreamError: make(chan error), // can be produced by recv and send
@@ -127,18 +130,18 @@ func (p *XdsProxy) handleStream(downstream adsStream) error {
p.registerStream(con)
defer p.unregisterStream(con)
- defer klog.Infof("XDS proxy: downstream connection #%d closed", conID)
+ defer proxyLog.Infof("downstream connection #%d closed", conID)
ctx, cancel := context.WithTimeout(context.Background(), time.Second*30)
defer cancel()
- klog.Infof("XDS proxy: connection #%d building upstream connection to %s", conID, p.dubbodAddress)
+ proxyLog.Infof("connection #%d building upstream connection to %s", conID, p.dubbodAddress)
upstreamConn, err := p.buildUpstreamConn(ctx)
if err != nil {
- klog.Errorf("XDS proxy: connection #%d failed to connect to upstream %s: %v", conID, p.dubbodAddress, err)
+ proxyLog.Errorf("connection #%d failed to connect to upstream %s: %v", conID, p.dubbodAddress, err)
return err
}
- klog.Infof("XDS proxy: connection #%d successfully built upstream connection", conID)
+ proxyLog.Infof("connection #%d successfully built upstream connection", conID)
defer upstreamConn.Close()
xds := discovery.NewAggregatedDiscoveryServiceClient(upstreamConn)
@@ -155,14 +158,14 @@ const (
)
func (p *XdsProxy) handleUpstream(ctx context.Context, con *ProxyConnection, xds discovery.AggregatedDiscoveryServiceClient) error {
- klog.Infof("XDS proxy: connection #%d connecting to upstream: %s", con.conID, p.dubbodAddress)
+ proxyLog.Infof("connection #%d connecting to upstream: %s", con.conID, p.dubbodAddress)
upstream, err := xds.StreamAggregatedResources(ctx,
grpc.MaxCallRecvMsgSize(defaultClientMaxReceiveMessageSize))
if err != nil {
- klog.Errorf("xDS proxy: connection #%d failed to create stream to upstream %s: %v", con.conID, p.dubbodAddress, err)
+ proxyLog.Errorf("connection #%d failed to create stream to upstream %s: %v", con.conID, p.dubbodAddress, err)
return err
}
- klog.Infof("xDS proxy: connected to upstream XDS server: %s id=%d", p.dubbodAddress, con.conID)
+ proxyLog.Infof("connected to upstream XDS server: %s id=%d", p.dubbodAddress, con.conID)
// Log when we start receiving responses
go func() {
@@ -171,17 +174,17 @@ func (p *XdsProxy) handleUpstream(ctx context.Context, con *ProxyConnection, xds
resp, err := upstream.Recv()
if err != nil {
if firstResponse {
- klog.Warningf("XDS proxy: connection #%d upstream Recv failed before first response: %v", con.conID, err)
+ proxyLog.Warnf("connection #%d upstream Recv failed before first response: %v", con.conID, err)
}
upstreamErr(con, err)
return
}
if firstResponse {
- klog.Infof("XDS proxy: connection #%d received first response from upstream: TypeUrl=%s, Resources=%d",
+ proxyLog.Infof("connection #%d received first response from upstream: TypeUrl=%s, Resources=%d",
con.conID, model.GetShortType(resp.TypeUrl), len(resp.Resources))
firstResponse = false
} else {
- klog.V(3).Infof("XDS proxy: connection #%d received response from upstream: TypeUrl=%s, Resources=%d, VersionInfo=%s",
+ proxyLog.Debugf("connection #%d received response from upstream: TypeUrl=%s, Resources=%d, VersionInfo=%s",
con.conID, model.GetShortType(resp.TypeUrl), len(resp.Resources), resp.VersionInfo)
}
select {
@@ -217,12 +220,12 @@ func (p *XdsProxy) handleUpstreamRequest(con *ProxyConnection) {
// recv xds requests from envoy
req, err := con.downstream.Recv()
if err != nil {
- klog.Warningf("XDS proxy: connection #%d downstream Recv error: %v", con.conID, err)
+ proxyLog.Warnf("connection #%d downstream Recv error: %v", con.conID, err)
downstreamErr(con, err)
return
}
- klog.V(3).Infof("XDS proxy: connection #%d received request: TypeUrl=%s, Node=%v, ResourceNames=%d",
+ proxyLog.Debugf("connection #%d received request: TypeUrl=%s, Node=%v, ResourceNames=%d",
con.conID, model.GetShortType(req.TypeUrl), req.Node != nil, len(req.ResourceNames))
// Save Node from first request that contains it
@@ -236,7 +239,7 @@ func (p *XdsProxy) handleUpstreamRequest(con *ProxyConnection) {
Locality: req.Node.Locality,
Metadata: req.Node.Metadata,
}
- klog.Infof("XDS proxy: connection #%d saved Node: %s", con.conID, req.Node.Id)
+ proxyLog.Infof("connection #%d saved Node: %s", con.conID, req.Node.Id)
nodeReceived.Store(true)
}
con.nodeMutex.Unlock()
@@ -244,7 +247,7 @@ func (p *XdsProxy) handleUpstreamRequest(con *ProxyConnection) {
// Skip health check probes that don't have Node information (before we've received any Node)
if req.TypeUrl == model.HealthInfoType && !nodeReceived.Load() {
- klog.V(2).Infof("XDS proxy: connection #%d skipping health check probe without Node", con.conID)
+ proxyLog.Debugf("connection #%d skipping health check probe without Node", con.conID)
continue
}
@@ -255,9 +258,9 @@ func (p *XdsProxy) handleUpstreamRequest(con *ProxyConnection) {
con.nodeMutex.RUnlock()
// For XDS, any first request (not just LDS) without Node should wait
- // because sail-discovery needs Node in the first request to initialize connection
+ // because planet-discovery needs Node in the first request to initialize connection
if !nodeReceived.Load() && req.Node == nil && req.TypeUrl != model.HealthInfoType {
- klog.V(2).Infof("XDS proxy: connection #%d received first request without Node (TypeUrl=%s), waiting for Node information", con.conID, model.GetShortType(req.TypeUrl))
+ proxyLog.Debugf("connection #%d received first request without Node (TypeUrl=%s), waiting for Node information", con.conID, model.GetShortType(req.TypeUrl))
continue
}
@@ -273,21 +276,21 @@ func (p *XdsProxy) handleUpstreamRequest(con *ProxyConnection) {
Locality: con.node.Locality,
Metadata: con.node.Metadata,
}
- klog.V(2).Infof("XDS proxy: connection #%d added saved Node to request", con.conID)
+ proxyLog.Debugf("connection #%d added saved Node to request", con.conID)
} else if req.Node.Id == "" {
// If Node exists but Id is empty, copy from saved node
req.Node.Id = con.node.Id
if req.Node.Metadata == nil {
req.Node.Metadata = con.node.Metadata
}
- klog.V(2).Infof("XDS proxy: connection #%d filled empty Node.Id in request", con.conID)
+ proxyLog.Debugf("connection #%d filled empty Node.Id in request", con.conID)
}
}
con.nodeMutex.RUnlock()
// Final check: for initialization, we must have Node
if !hasNode && req.Node == nil && req.TypeUrl != model.HealthInfoType {
- klog.Warningf("XDS proxy: connection #%d cannot forward request without Node: TypeUrl=%s", con.conID, model.GetShortType(req.TypeUrl))
+ proxyLog.Warnf("connection #%d cannot forward request without Node: TypeUrl=%s", con.conID, model.GetShortType(req.TypeUrl))
continue
}
@@ -373,11 +376,12 @@ func (p *XdsProxy) handleUpstreamRequest(con *ProxyConnection) {
// Final safety check: don't send if still no Node
if req.Node == nil || req.Node.Id == "" {
- klog.Warningf("XDS proxy: connection #%d cannot send request without Node: TypeUrl=%s", con.conID, model.GetShortType(req.TypeUrl))
+ proxyLog.Warnf("connection #%d cannot send request without Node: TypeUrl=%s", con.conID, model.GetShortType(req.TypeUrl))
continue
}
- klog.Infof("XDS proxy: connection #%d forwarding request: TypeUrl=%s, Node=%v",
+ // Only log at debug level to reduce noise - these are normal operations
+ proxyLog.Debugf("connection #%d forwarding request: TypeUrl=%s, Node=%v",
con.conID, model.GetShortType(req.TypeUrl), req.Node != nil && req.Node.Id != "")
if req.TypeUrl == model.ExtensionConfigurationType {
if req.VersionInfo != "" {
@@ -386,13 +390,14 @@ func (p *XdsProxy) handleUpstreamRequest(con *ProxyConnection) {
p.ecdsLastNonce.Store(req.ResponseNonce)
}
if err := con.upstream.Send(req); err != nil {
- klog.Errorf("XDS proxy: connection #%d failed to send request upstream: TypeUrl=%s, error=%v",
+ proxyLog.Errorf("connection #%d failed to send request upstream: TypeUrl=%s, error=%v",
con.conID, model.GetShortType(req.TypeUrl), err)
err = fmt.Errorf("send error for type url %s: %v", req.TypeUrl, err)
upstreamErr(con, err)
return
}
- klog.V(2).Infof("XDS proxy: connection #%d successfully sent request upstream: TypeUrl=%s",
+ // Only log at debug level to reduce noise - successful sends are normal
+ proxyLog.Debugf("connection #%d successfully sent request upstream: TypeUrl=%s",
con.conID, model.GetShortType(req.TypeUrl))
case <-con.stopChan:
return
@@ -406,9 +411,9 @@ func downstreamErr(con *ProxyConnection, err error) {
err = nil
fallthrough
case dubbogrpc.ExpectedError:
- klog.Errorf("downstream terminated with status %v", err)
+ proxyLog.Errorf("downstream terminated with status %v", err)
default:
- klog.Errorf("downstream terminated with unexpected error %v", err)
+ proxyLog.Errorf("downstream terminated with unexpected error %v", err)
}
select {
case con.downstreamError <- err:
@@ -421,12 +426,10 @@ func (p *XdsProxy) handleUpstreamResponse(con *ProxyConnection) {
select {
case resp := <-con.responsesChan:
// TODO: separate upstream response handling from requests sending, which are both time costly
- klog.V(2).InfoS(
- "Upstream response",
- "id", con.conID,
- "type", model.GetShortType(resp.TypeUrl),
- "resources", len(resp.Resources),
- )
+ proxyLog.Debugf("Upstream response id=%d type=%s resources=%d",
+ con.conID,
+ model.GetShortType(resp.TypeUrl),
+ len(resp.Resources))
// Handle internal types (e.g., ProxyConfig) that need special processing
hasHandler := false
if h, f := p.handlers[resp.TypeUrl]; f {
@@ -463,14 +466,14 @@ func (p *XdsProxy) handleUpstreamResponse(con *ProxyConnection) {
}
// Forward all non-internal responses to downstream (gRPC client)
- klog.V(3).Infof("XDS proxy: connection #%d forwarding response to downstream: TypeUrl=%s, Resources=%d, VersionInfo=%s",
+ proxyLog.Debugf("connection #%d forwarding response to downstream: TypeUrl=%s, Resources=%d, VersionInfo=%s",
con.conID, model.GetShortType(resp.TypeUrl), len(resp.Resources), resp.VersionInfo)
if err := con.downstream.Send(resp); err != nil {
- klog.Errorf("XDS proxy: connection #%d failed to send response to downstream: %v", con.conID, err)
+ proxyLog.Errorf("connection #%d failed to send response to downstream: %v", con.conID, err)
downstreamErr(con, err)
return
}
- klog.V(3).Infof("XDS proxy: connection #%d successfully forwarded response to downstream: TypeUrl=%s, Resources=%d",
+ proxyLog.Debugf("connection #%d successfully forwarded response to downstream: TypeUrl=%s, Resources=%d",
con.conID, model.GetShortType(resp.TypeUrl), len(resp.Resources))
// Send ACK for normal XDS responses (if not already sent by handler)
@@ -504,9 +507,9 @@ func upstreamErr(con *ProxyConnection, err error) {
err = nil
fallthrough
case dubbogrpc.ExpectedError:
- klog.Errorf("upstream terminated with status %v", err)
+ proxyLog.Errorf("upstream terminated with status %v", err)
default:
- klog.Errorf("upstream terminated with unexpected error %v", err)
+ proxyLog.Errorf("upstream terminated with unexpected error %v", err)
}
select {
case con.upstreamError <- err:
@@ -520,10 +523,10 @@ func (p *XdsProxy) buildUpstreamConn(ctx context.Context) (*grpc.ClientConn, err
p.optsMutex.RUnlock()
if len(opts) == 0 {
- klog.Warningf("XDS proxy: dialOptions is empty, connection may fail. Address: %s", p.dubbodAddress)
+ proxyLog.Warnf("dialOptions is empty, connection may fail. Address: %s", p.dubbodAddress)
}
- klog.V(2).Infof("XDS proxy: dialing %s with %d options", p.dubbodAddress, len(opts))
+ proxyLog.Debugf("dialing %s with %d options", p.dubbodAddress, len(opts))
conn, err := grpc.DialContext(ctx, p.dubbodAddress, opts...)
if err != nil {
return nil, fmt.Errorf("grpc.DialContext failed for %s: %w", p.dubbodAddress, err)
@@ -574,11 +577,11 @@ func initXdsProxy(ia *Agent) (*XdsProxy, error) {
proxy.handlers[model.ProxyConfigType] = func(resp *anypb.Any) error {
pc := &meshconfig.ProxyConfig{}
if err := resp.UnmarshalTo(pc); err != nil {
- klog.Errorf("failed to unmarshal proxy config: %v", err)
+ proxyLog.Errorf("failed to unmarshal proxy config: %v", err)
return err
}
caCerts := pc.GetCaCertificatesPem()
- klog.Infof("received new certificates to add to mesh trust domain: %v", caCerts)
+ proxyLog.Infof("received new certificates to add to mesh trust domain: %v", caCerts)
trustBundle := []byte{}
for _, cert := range caCerts {
trustBundle = util.AppendCertByte(trustBundle, []byte(cert))
@@ -587,7 +590,7 @@ func initXdsProxy(ia *Agent) (*XdsProxy, error) {
}
}
- klog.Infof("Initializing with upstream address %q and cluster %q", proxy.dubbodAddress, proxy.clusterID)
+ proxyLog.Infof("Initializing with upstream address %q and cluster %q", proxy.dubbodAddress, proxy.clusterID)
if err = proxy.initDownstreamServer(); err != nil {
return nil, err
@@ -596,12 +599,12 @@ func initXdsProxy(ia *Agent) (*XdsProxy, error) {
ia.wg.Add(1)
go func() {
defer ia.wg.Done()
- klog.Infof("Starting XDS proxy server listening on UDS: %s", proxy.xdsUdsPath)
- klog.Infof("XDS proxy server ready to accept connections on UDS: %s", proxy.xdsUdsPath)
+ proxyLog.Infof("Starting XDS proxy server listening on UDS: %s", proxy.xdsUdsPath)
+ proxyLog.Infof("XDS proxy server ready to accept connections on UDS: %s", proxy.xdsUdsPath)
if err := proxy.downstreamGrpcServer.Serve(proxy.downstreamListener); err != nil {
- klog.Errorf("XDS proxy server stopped accepting connections: %v", err)
+ proxyLog.Errorf("XDS proxy server stopped accepting connections: %v", err)
}
- klog.Warningf("XDS proxy server stopped serving on UDS: %s", proxy.xdsUdsPath)
+ proxyLog.Warnf("XDS proxy server stopped serving on UDS: %s", proxy.xdsUdsPath)
}()
// For proxyless mode, establish a preemptive connection to upstream using bootstrap Node
@@ -629,7 +632,7 @@ func initXdsProxy(ia *Agent) (*XdsProxy, error) {
nodeReady := proxy.bootstrapNode != nil
proxy.preemptiveConnMutex.RUnlock()
if !nodeReady {
- klog.Warningf("Bootstrap Node not set after 5 seconds, proceeding anyway")
+ proxyLog.Warnf("Bootstrap Node not set after 5 seconds, proceeding anyway")
}
maxBackoff := 30 * time.Second
@@ -646,7 +649,7 @@ func initXdsProxy(ia *Agent) (*XdsProxy, error) {
connDone, err := proxy.establishPreemptiveConnection(ia)
if err != nil {
// Connection failed, log and retry with exponential backoff
- klog.Warningf("Failed to establish preemptive upstream connection: %v, retrying in %v", err, backoff)
+ proxyLog.Warnf("Failed to establish preemptive upstream connection: %v, retrying in %v", err, backoff)
select {
case <-proxy.stopChan:
@@ -662,13 +665,13 @@ func initXdsProxy(ia *Agent) (*XdsProxy, error) {
// Connection successful, reset backoff
backoff = time.Second
- klog.Infof("Preemptive upstream connection established successfully")
+ proxyLog.Infof("Preemptive upstream connection established successfully")
// Wait for connection to terminate (connDone will be closed when connection dies)
select {
case <-proxy.stopChan:
return
case <-connDone:
- klog.Warningf("Preemptive connection terminated, will retry")
+ proxyLog.Warnf("Preemptive connection terminated, will retry")
}
}
}()
@@ -696,7 +699,7 @@ func (p *XdsProxy) initDownstreamServer() error {
reflection.Register(grpcs)
p.downstreamGrpcServer = grpcs
p.downstreamListener = l
- klog.Infof("XDS proxy server initialized, listening on UDS socket: %s", p.xdsUdsPath)
+ proxyLog.Infof("XDS proxy server initialized, listening on UDS socket: %s", p.xdsUdsPath)
return nil
}
@@ -776,7 +779,7 @@ func (p *XdsProxy) establishPreemptiveConnection(ia *Agent) (<-chan struct{}, er
return nil, fmt.Errorf("bootstrap node not available")
}
- klog.Infof("xDS proxy: Establishing preemptive upstream connection for proxyless mode with Node: %s", node.Id)
+ proxyLog.Infof("Establishing preemptive upstream connection for proxyless mode with Node: %s", node.Id)
ctx, cancel := context.WithTimeout(context.Background(), time.Second*30)
defer cancel()
@@ -802,7 +805,7 @@ func (p *XdsProxy) establishPreemptiveConnection(ia *Agent) (<-chan struct{}, er
upstreamConn.Close()
return nil, fmt.Errorf("failed to create upstream stream: %w", err)
}
- klog.Infof("xDS proxy: connected to upstream XDS server (preemptive): %s", p.dubbodAddress)
+ proxyLog.Infof("connected to upstream XDS server (preemptive): %s", p.dubbodAddress)
conID := connectionNumber.Inc()
con := &ProxyConnection{
@@ -836,12 +839,12 @@ func (p *XdsProxy) establishPreemptiveConnection(ia *Agent) (<-chan struct{}, er
}()
// Send initial LDS request with bootstrap Node to initialize connection
- // This is critical for sail-discovery to recognize the connection and count it in ConnectedEndpoints
+ // This is critical for planet-discovery to recognize the connection and count it in ConnectedEndpoints
ldsReq := &discovery.DiscoveryRequest{
TypeUrl: model.ListenerType,
Node: node,
}
- klog.Infof("XDS proxy: preemptive connection sending initial LDS request with Node: %s", node.Id)
+ proxyLog.Infof("preemptive connection sending initial LDS request with Node: %s", node.Id)
if err := upstream.Send(ldsReq); err != nil {
upstreamConn.Close()
p.preemptiveConnMutex.Lock()
@@ -876,7 +879,7 @@ func (p *XdsProxy) establishPreemptiveConnection(ia *Agent) (<-chan struct{}, er
upstreamErr(con, err)
return
}
- klog.V(2).Infof("XDS proxy: preemptive connection received response: TypeUrl=%s, Resources=%d",
+ proxyLog.Debugf("preemptive connection received response: TypeUrl=%s, Resources=%d",
model.GetShortType(resp.TypeUrl), len(resp.Resources))
// Send ACK
ackReq := &discovery.DiscoveryRequest{
diff --git a/pkg/dubbo-agent/xds_proxy_delta.go b/pkg/dubbo-agent/xds_proxy_delta.go
index 42ab2b52..3c974da5 100644
--- a/pkg/dubbo-agent/xds_proxy_delta.go
+++ b/pkg/dubbo-agent/xds_proxy_delta.go
@@ -31,12 +31,11 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
- "k8s.io/klog/v2"
)
func (p *XdsProxy) DeltaAggregatedResources(downstream DeltaDiscoveryStream) error {
conID := connectionNumber.Inc()
- klog.Infof("XDS proxy: new delta downstream connection #%d", conID)
+ proxyLog.Infof("new delta downstream connection #%d", conID)
con := &ProxyConnection{
conID: conID,
upstreamError: make(chan error), // can be produced by recv and send
@@ -49,18 +48,18 @@ func (p *XdsProxy) DeltaAggregatedResources(downstream DeltaDiscoveryStream) err
}
p.registerStream(con)
defer p.unregisterStream(con)
- defer klog.Infof("XDS proxy: delta downstream connection #%d closed", conID)
+ defer proxyLog.Infof("delta downstream connection #%d closed", conID)
ctx, cancel := context.WithTimeout(context.Background(), time.Second*30)
defer cancel()
- klog.Infof("XDS proxy: delta connection #%d building upstream connection to %s", conID, p.dubbodAddress)
+ proxyLog.Infof("delta connection #%d building upstream connection to %s", conID, p.dubbodAddress)
upstreamConn, err := p.buildUpstreamConn(ctx)
if err != nil {
- klog.Errorf("XDS proxy: delta connection #%d failed to connect to upstream %s: %v", conID, p.dubbodAddress, err)
+ proxyLog.Errorf("delta connection #%d failed to connect to upstream %s: %v", conID, p.dubbodAddress, err)
return err
}
- klog.Infof("XDS proxy: delta connection #%d successfully built upstream connection", conID)
+ proxyLog.Infof("delta connection #%d successfully built upstream connection", conID)
defer upstreamConn.Close()
xds := discovery.NewAggregatedDiscoveryServiceClient(upstreamConn)
@@ -73,15 +72,15 @@ func (p *XdsProxy) DeltaAggregatedResources(downstream DeltaDiscoveryStream) err
}
func (p *XdsProxy) handleDeltaUpstream(ctx context.Context, con *ProxyConnection, xds discovery.AggregatedDiscoveryServiceClient) error {
- klog.Infof("XDS proxy: delta connection #%d connecting to upstream: %s", con.conID, p.dubbodAddress)
+ proxyLog.Infof("delta connection #%d connecting to upstream: %s", con.conID, p.dubbodAddress)
deltaUpstream, err := xds.DeltaAggregatedResources(ctx,
grpc.MaxCallRecvMsgSize(defaultClientMaxReceiveMessageSize))
if err != nil {
- klog.Errorf("XDS proxy: delta connection #%d failed to create stream to upstream %s: %v", con.conID, p.dubbodAddress, err)
+ proxyLog.Errorf("delta connection #%d failed to create stream to upstream %s: %v", con.conID, p.dubbodAddress, err)
return err
}
- klog.Infof("xdsproxy connected to delta upstream XDS server: %s id=%d", p.dubbodAddress, con.conID)
- defer klog.Infof("xdsproxy disconnected from delta XDS server: %s id=%d", p.dubbodAddress, con.conID)
+ proxyLog.Infof("xdsproxy connected to delta upstream XDS server: %s id=%d", p.dubbodAddress, con.conID)
+ defer proxyLog.Infof("xdsproxy disconnected from delta XDS server: %s id=%d", p.dubbodAddress, con.conID)
con.upstreamDeltas = deltaUpstream
@@ -138,7 +137,7 @@ func (p *XdsProxy) handleUpstreamDeltaRequest(con *ProxyConnection) {
Locality: req.Node.Locality,
Metadata: req.Node.Metadata,
}
- klog.V(2).Infof("XDS proxy: delta connection #%d saved Node: %s", con.conID, req.Node.Id)
+ proxyLog.Debugf("delta connection #%d saved Node: %s", con.conID, req.Node.Id)
nodeReceived.Store(true)
}
con.nodeMutex.Unlock()
@@ -146,7 +145,7 @@ func (p *XdsProxy) handleUpstreamDeltaRequest(con *ProxyConnection) {
// Skip health check probes that don't have Node information (before we've received any Node)
if req.TypeUrl == model.HealthInfoType && !nodeReceived.Load() {
- klog.V(2).Infof("XDS proxy: delta connection #%d skipping health check probe without Node", con.conID)
+ proxyLog.Debugf("delta connection #%d skipping health check probe without Node", con.conID)
continue
}
@@ -157,9 +156,9 @@ func (p *XdsProxy) handleUpstreamDeltaRequest(con *ProxyConnection) {
con.nodeMutex.RUnlock()
// For Delta XDS, any first request (not just LDS) without Node should wait
- // because sail-discovery needs Node in the first request to initialize connection
+ // because planet-discovery needs Node in the first request to initialize connection
if !nodeReceived.Load() && req.Node == nil && req.TypeUrl != model.HealthInfoType {
- klog.V(2).Infof("XDS proxy: delta connection #%d received first request without Node (TypeUrl=%s), waiting for Node information", con.conID, model.GetShortType(req.TypeUrl))
+ proxyLog.Debugf("delta connection #%d received first request without Node (TypeUrl=%s), waiting for Node information", con.conID, model.GetShortType(req.TypeUrl))
continue
}
@@ -172,7 +171,7 @@ func (p *XdsProxy) handleUpstreamDeltaRequest(con *ProxyConnection) {
// Final check: for initialization, we must have Node
if !hasNode && req.Node == nil && req.TypeUrl != model.HealthInfoType {
- klog.Warningf("XDS proxy: delta connection #%d cannot forward request without Node: TypeUrl=%s", con.conID, model.GetShortType(req.TypeUrl))
+ proxyLog.Debugf("delta connection #%d cannot forward request without Node: TypeUrl=%s", con.conID, model.GetShortType(req.TypeUrl))
continue
}
@@ -245,18 +244,16 @@ func (p *XdsProxy) handleUpstreamDeltaRequest(con *ProxyConnection) {
// Final safety check: don't send if still no Node
if req.Node == nil || req.Node.Id == "" {
- klog.Warningf("XDS proxy: delta connection #%d cannot send request without Node: TypeUrl=%s", con.conID, model.GetShortType(req.TypeUrl))
+ proxyLog.Warnf("delta connection #%d cannot send request without Node: TypeUrl=%s", con.conID, model.GetShortType(req.TypeUrl))
continue
}
- klog.V(2).InfoS(
- "Delta request",
- "type", model.GetShortType(req.TypeUrl),
- "sub", len(req.ResourceNamesSubscribe),
- "unsub", len(req.ResourceNamesUnsubscribe),
- "nonce", req.ResponseNonce,
- "initial", len(req.InitialResourceVersions),
- )
+ proxyLog.Debugf("Delta request type=%s sub=%d unsub=%d nonce=%s initial=%d",
+ model.GetShortType(req.TypeUrl),
+ len(req.ResourceNamesSubscribe),
+ len(req.ResourceNamesUnsubscribe),
+ req.ResponseNonce,
+ len(req.InitialResourceVersions))
if req.TypeUrl == model.ExtensionConfigurationType {
p.ecdsLastNonce.Store(req.ResponseNonce)
}
@@ -277,7 +274,7 @@ func (p *XdsProxy) handleUpstreamDeltaResponse(con *ProxyConnection) {
select {
case resp := <-con.deltaResponsesChan:
// TODO: separate upstream response handling from requests sending, which are both time costly
- klog.V(2).Infof(
+ proxyLog.Debugf(
"Upstream delta response id=%d type=%s nonce=%s resources=%d removes=%d",
con.conID,
model.GetShortType(resp.TypeUrl),
@@ -317,7 +314,7 @@ func (p *XdsProxy) handleUpstreamDeltaResponse(con *ProxyConnection) {
// Forward all delta responses to downstream (gRPC client)
// This is critical for proxyless gRPC clients to receive XDS configuration
if err := con.downstreamDeltas.Send(resp); err != nil {
- klog.Errorf("XDS proxy: delta connection #%d failed to send response to downstream: %v", con.conID, err)
+ proxyLog.Errorf("delta connection #%d failed to send response to downstream: %v", con.conID, err)
downstreamErr(con, err)
return
}
diff --git a/pkg/kube/inject/inject.go b/pkg/kube/inject/inject.go
index 2a83c908..3d34cb71 100644
--- a/pkg/kube/inject/inject.go
+++ b/pkg/kube/inject/inject.go
@@ -141,8 +141,8 @@ func injectRequired(ignored []string, config *Config, podSpec *corev1.PodSpec, m
var useDefault bool
var inject bool
- objectSelector := annos["proxyless.dubbo.io/inject"]
- if lbl, labelPresent := metadata.GetLabels()["proxyless.dubbo.io/inject"]; labelPresent {
+ objectSelector := annos["proxyless.dubbo.apache.org/inject"]
+ if lbl, labelPresent := metadata.GetLabels()["proxyless.dubbo.apache.org/inject"]; labelPresent {
// The label is the new API; if both are present we prefer the label
objectSelector = lbl
}
@@ -155,7 +155,7 @@ func injectRequired(ignored []string, config *Config, podSpec *corev1.PodSpec, m
useDefault = true
default:
klog.Warningf("Invalid value for %s: %q. Only 'true' and 'false' are accepted. Falling back to default injection policy.",
- "proxyless.dubbo.io/inject", objectSelector)
+ "proxyless.dubbo.apache.org/inject", objectSelector)
useDefault = true
}
@@ -215,7 +215,7 @@ func RunTemplate(params InjectionParameters) (mergedPod *corev1.Pod, templatePod
MeshConfig: meshConfig,
Values: params.valuesConfig.asMap,
Revision: params.revision,
- ProxyImage: "mfordjody/proxyadapter:test",
+ ProxyImage: "mfordjody/proxyadapter:0.3.0-debug", // TODO ProxyImage
InboundTrafficPolicyMode: InboundTrafficPolicyMode(meshConfig),
CompliancePolicy: common_features.CompliancePolicy,
}
diff --git a/pkg/kube/inject/webhook.go b/pkg/kube/inject/webhook.go
index b7b7fa43..dd5785da 100644
--- a/pkg/kube/inject/webhook.go
+++ b/pkg/kube/inject/webhook.go
@@ -21,6 +21,7 @@ import (
"encoding/json"
"errors"
"fmt"
+ "github.com/apache/dubbo-kubernetes/pkg/log"
"net/http"
"os"
"strings"
@@ -28,12 +29,12 @@ import (
"text/template"
"time"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
opconfig "github.com/apache/dubbo-kubernetes/operator/pkg/apis"
"github.com/apache/dubbo-kubernetes/pkg/config/mesh"
"github.com/apache/dubbo-kubernetes/pkg/kube"
"github.com/apache/dubbo-kubernetes/pkg/kube/multicluster"
"github.com/apache/dubbo-kubernetes/pkg/util/protomarshal"
- "github.com/apache/dubbo-kubernetes/sail/pkg/model"
"gomodules.xyz/jsonpatch/v2"
"istio.io/api/annotation"
meshconfig "istio.io/api/mesh/v1alpha1"
@@ -46,7 +47,6 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/mergepatch"
"k8s.io/apimachinery/pkg/util/strategicpatch"
- "k8s.io/klog/v2"
"sigs.k8s.io/yaml"
)
@@ -130,7 +130,7 @@ func loadConfig(injectFile, valuesFile string) (*Config, string, error) {
}
var c *Config
if c, err = unmarshalConfig(data); err != nil {
- klog.Warningf("Failed to parse injectFile %s", string(data))
+ log.Warnf("Failed to parse injectFile %s", string(data))
return nil, "", err
}
@@ -237,7 +237,7 @@ func (wh *Webhook) serveInject(w http.ResponseWriter, r *http.Request) {
return
}
if _, err := w.Write(resp); err != nil {
- klog.Errorf("Could not write response: %v", err)
+ log.Errorf("Could not write response: %v", err)
http.Error(w, fmt.Sprintf("could not write response: %v", err), http.StatusInternalServerError)
return
}
@@ -351,7 +351,7 @@ func addApplicationContainerConfig(pod *corev1.Pod) {
Name: "GRPC_XDS_BOOTSTRAP",
Value: grpcBootstrapPath,
})
- klog.Infof("Injection: Added GRPC_XDS_BOOTSTRAP=%s env to application container %s", grpcBootstrapPath, container.Name)
+ log.Infof("Injection: Added GRPC_XDS_BOOTSTRAP=%s env to application container %s", grpcBootstrapPath, container.Name)
}
// Add volume mount for /etc/dubbo/proxy if not already present
@@ -368,7 +368,7 @@ func addApplicationContainerConfig(pod *corev1.Pod) {
MountPath: proxyVolumeMountPath,
ReadOnly: false,
})
- klog.Infof("Injection: Added /etc/dubbo/proxy volume mount to application container %s", container.Name)
+ log.Infof("Injection: Added /etc/dubbo/proxy volume mount to application container %s", container.Name)
}
}
}
@@ -516,7 +516,7 @@ func parseInjectEnvs(path string) map[string]string {
for i := 0; i < len(res); i += 2 {
k := res[i]
if i == len(res)-1 { // ignore the last key without value
- klog.Warningf("Odd number of inject env entries, ignore the last key %s\n", k)
+ log.Warnf("Add number of inject env entries, ignore the last key %s\n", k)
break
}
}
@@ -525,10 +525,11 @@ func parseInjectEnvs(path string) map[string]string {
}
func (wh *Webhook) inject(ar *kube.AdmissionReview, path string) *kube.AdmissionResponse {
+ log := log.WithLabels("path", path)
req := ar.Request
var pod corev1.Pod
if err := json.Unmarshal(req.Object.Raw, &pod); err != nil {
- klog.Errorf("Could not unmarshal raw object: %v %s", err, string(req.Object.Raw))
+ log.Errorf("Could not unmarshal raw object: %v %s", err, string(req.Object.Raw))
return toAdmissionResponse(err)
}
@@ -538,12 +539,13 @@ func (wh *Webhook) inject(ar *kube.AdmissionReview, path string) *kube.Admission
if pod.ObjectMeta.Namespace == "" {
pod.ObjectMeta.Namespace = req.Namespace
}
- klog.Info(pod.Namespace + "/" + podName)
- klog.Infof("path=%s Process proxyless injection request", path)
+
+ log = log.WithLabels("pod", pod.Namespace+"/"+podName)
+ log.Infof("Process proxyless injection request")
wh.mu.RLock()
if !injectRequired(IgnoredNamespaces.UnsortedList(), wh.Config, &pod.Spec, pod.ObjectMeta) {
- klog.Infof("Skipping due to policy check")
+ log.Infof("Skipping due to policy check")
wh.mu.RUnlock()
return &kube.AdmissionResponse{
Allowed: true,
@@ -568,15 +570,15 @@ func (wh *Webhook) inject(ar *kube.AdmissionReview, path string) *kube.Admission
wh.mu.RUnlock()
- klog.Infof("Injecting pod with templates: %v, defaultTemplate: %v", len(params.templates), params.defaultTemplate)
- klog.Infof("Pod labels: %v, annotations: %v", params.pod.Labels, params.pod.Annotations)
+ log.Infof("Injecting pod with templates: %v, defaultTemplate: %v", len(params.templates), params.defaultTemplate)
+ log.Infof("Pod labels: %v, annotations: %v", params.pod.Labels, params.pod.Annotations)
patchBytes, err := injectPod(params)
if err != nil {
- klog.Errorf("Pod injection failed: %v", err)
+ log.Errorf("Pod injection failed: %v", err)
return toAdmissionResponse(err)
}
- klog.Infof("Injection successful, patch size: %d bytes", len(patchBytes))
+ log.Infof("Injection successful, patch size: %d bytes", len(patchBytes))
reviewResponse := kube.AdmissionResponse{
Allowed: true,
Patch: patchBytes,
diff --git a/pkg/kube/kclient/client.go b/pkg/kube/kclient/client.go
index 2423cd8d..e6f5ca0d 100644
--- a/pkg/kube/kclient/client.go
+++ b/pkg/kube/kclient/client.go
@@ -30,7 +30,7 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/ptr"
"github.com/apache/dubbo-kubernetes/pkg/slices"
"github.com/apache/dubbo-kubernetes/pkg/util/sets"
- "github.com/apache/dubbo-kubernetes/sail/pkg/features"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/features"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
klabels "k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime/schema"
diff --git a/pkg/kube/krt/files/files.go b/pkg/kube/krt/files/files.go
index 743b8ce5..9f6d2b4e 100644
--- a/pkg/kube/krt/files/files.go
+++ b/pkg/kube/krt/files/files.go
@@ -18,7 +18,11 @@
package files
import (
- "fmt"
+ "os"
+ "path/filepath"
+ "sync"
+ "time"
+
"github.com/apache/dubbo-kubernetes/pkg/filewatcher"
"github.com/apache/dubbo-kubernetes/pkg/kube/krt"
"github.com/apache/dubbo-kubernetes/pkg/slices"
@@ -26,10 +30,6 @@ import (
"github.com/fsnotify/fsnotify"
"go.uber.org/atomic"
"k8s.io/klog/v2"
- "os"
- "path/filepath"
- "sync"
- "time"
)
type FileSingleton[T any] struct {
@@ -54,7 +54,7 @@ func NewFileSingleton[T any](fileWatcher filewatcher.FileWatcher, filename strin
watchFile(fileWatcher, filename, stop, func() {
cfg, err := readFile(filename)
if err != nil {
- fmt.Errorf("failed to update: %v", err)
+ klog.Errorf("failed to update: %v", err)
return
}
cur.Store(&cfg)
@@ -235,8 +235,8 @@ func (f *FolderWatch[T]) fileTrigger(events chan struct{}, stop <-chan struct{})
case err := <-watcher.Errors:
klog.Errorf("Error watching file trigger: %v %v", f.root, err)
return
- case signal := <-stop:
- klog.Infof("Shutting down file watcher: %v %v", f.root, signal)
+ case <-stop:
+ klog.Infof("Shutting down file watcher: %v", f.root)
return
}
}
diff --git a/pkg/kube/util.go b/pkg/kube/util.go
index b8d7dbde..eda174ed 100644
--- a/pkg/kube/util.go
+++ b/pkg/kube/util.go
@@ -19,7 +19,7 @@ package kube
import (
"fmt"
- "github.com/apache/dubbo-kubernetes/sail/pkg/features"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/features"
"io"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
diff --git a/pkg/log/deduplicator.go b/pkg/log/deduplicator.go
index a5e73fed..aced6f55 100644
--- a/pkg/log/deduplicator.go
+++ b/pkg/log/deduplicator.go
@@ -1,3 +1,20 @@
+/*
+ * 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 log
import (
diff --git a/pkg/log/formatter.go b/pkg/log/formatter.go
index 7d6e0fa9..e2d81943 100644
--- a/pkg/log/formatter.go
+++ b/pkg/log/formatter.go
@@ -1,3 +1,20 @@
+/*
+ * 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 log
import (
diff --git a/pkg/log/interceptor.go b/pkg/log/interceptor.go
index 500e8b49..98a53ec9 100644
--- a/pkg/log/interceptor.go
+++ b/pkg/log/interceptor.go
@@ -1,3 +1,20 @@
+/*
+ * 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 log
import (
diff --git a/pkg/log/klog_formatter.go b/pkg/log/klog_formatter.go
index 51bcb8e8..8d3e9ebe 100644
--- a/pkg/log/klog_formatter.go
+++ b/pkg/log/klog_formatter.go
@@ -1,3 +1,20 @@
+/*
+ * 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 log
import (
diff --git a/pkg/log/klog_interceptor.go b/pkg/log/klog_interceptor.go
index efcda848..e262040f 100644
--- a/pkg/log/klog_interceptor.go
+++ b/pkg/log/klog_interceptor.go
@@ -1,6 +1,23 @@
//go:build !noklog
// +build !noklog
+/*
+ * 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 log
import (
diff --git a/pkg/log/log.go b/pkg/log/log.go
index eaef284d..b6c5fefe 100644
--- a/pkg/log/log.go
+++ b/pkg/log/log.go
@@ -1,3 +1,20 @@
+/*
+ * 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 log
import (
@@ -34,6 +51,10 @@ type Scope struct {
outputLevel Level
mu sync.RWMutex
output io.Writer
+ // labels data - key slice to preserve ordering
+ labelKeys []string
+ labels map[string]interface{}
+ labelsMu sync.RWMutex
}
// Logger provides logging methods for a scope
@@ -46,6 +67,76 @@ func (l *Logger) Scope() *Scope {
return l.scope
}
+// copy creates a copy of the scope with copied labels
+func (s *Scope) copy() *Scope {
+ s.mu.RLock()
+ s.labelsMu.RLock()
+ defer s.mu.RUnlock()
+ defer s.labelsMu.RUnlock()
+
+ out := &Scope{
+ name: s.name,
+ description: s.description,
+ outputLevel: s.outputLevel,
+ output: s.output,
+ labels: copyStringInterfaceMap(s.labels),
+ labelKeys: make([]string, len(s.labelKeys)),
+ }
+ copy(out.labelKeys, s.labelKeys)
+ return out
+}
+
+// copyStringInterfaceMap creates a copy of a map[string]interface{}
+func copyStringInterfaceMap(m map[string]interface{}) map[string]interface{} {
+ if m == nil {
+ return make(map[string]interface{})
+ }
+ out := make(map[string]interface{}, len(m))
+ for k, v := range m {
+ out[k] = v
+ }
+ return out
+}
+
+// WithLabels adds key-value pairs to the labels. The key must be a string, while the value may be any type.
+// It returns a new Logger with a copy of the scope, with the labels added.
+// e.g. newLogger := oldLogger.WithLabels("foo", "bar", "baz", 123, "qux", 0.123)
+func (l *Logger) WithLabels(kvlist ...interface{}) *Logger {
+ newScope := l.scope.copy()
+
+ if len(kvlist)%2 != 0 {
+ newScope.labelsMu.Lock()
+ if newScope.labels == nil {
+ newScope.labels = make(map[string]interface{})
+ }
+ newScope.labels["WithLabels error"] = fmt.Sprintf("even number of parameters required, got %d", len(kvlist))
+ newScope.labelsMu.Unlock()
+ return &Logger{scope: newScope}
+ }
+
+ newScope.labelsMu.Lock()
+ if newScope.labels == nil {
+ newScope.labels = make(map[string]interface{})
+ }
+ for i := 0; i < len(kvlist); i += 2 {
+ keyi := kvlist[i]
+ key, ok := keyi.(string)
+ if !ok {
+ newScope.labels["WithLabels error"] = fmt.Sprintf("label name %v must be a string, got %T", keyi, keyi)
+ newScope.labelsMu.Unlock()
+ return &Logger{scope: newScope}
+ }
+ _, override := newScope.labels[key]
+ newScope.labels[key] = kvlist[i+1]
+ if !override {
+ // Key not set before, add to labelKeys to preserve order
+ newScope.labelKeys = append(newScope.labelKeys, key)
+ }
+ }
+ newScope.labelsMu.Unlock()
+ return &Logger{scope: newScope}
+}
+
var (
scopes = make(map[string]*Scope)
scopesMu sync.RWMutex
@@ -64,6 +155,15 @@ func RegisterScope(name, description string) *Logger {
defer scopesMu.Unlock()
if scope, exists := scopes[name]; exists {
+ // Ensure labels are initialized for existing scope
+ scope.labelsMu.Lock()
+ if scope.labels == nil {
+ scope.labels = make(map[string]interface{})
+ }
+ if scope.labelKeys == nil {
+ scope.labelKeys = make([]string, 0)
+ }
+ scope.labelsMu.Unlock()
return &Logger{scope: scope}
}
@@ -72,6 +172,8 @@ func RegisterScope(name, description string) *Logger {
description: description,
outputLevel: InfoLevel,
output: defaultOut,
+ labels: make(map[string]interface{}),
+ labelKeys: make([]string, 0),
}
scopes[name] = scope
@@ -170,6 +272,23 @@ func (l *Logger) log(level Level, format string, args ...interface{}) {
}
msg := formatMessage(format, args...)
+
+ // Append labels to message if present
+ l.scope.labelsMu.RLock()
+ if len(l.scope.labels) > 0 {
+ var labelParts []string
+ for _, k := range l.scope.labelKeys {
+ if k != "WithLabels error" {
+ v := l.scope.labels[k]
+ labelParts = append(labelParts, formatLabelValue(k, v))
+ }
+ }
+ if len(labelParts) > 0 {
+ msg = msg + " " + strings.Join(labelParts, " ")
+ }
+ }
+ l.scope.labelsMu.RUnlock()
+
levelName := levelNames[level]
scopeName := l.scope.Name()
@@ -274,6 +393,35 @@ func (l *Logger) Debugf(format string, args ...interface{}) {
l.log(DebugLevel, format, args...)
}
+// Fatal logs a fatal error message and exits the program with status code 1
+func (l *Logger) Fatal(args ...interface{}) {
+ l.log(ErrorLevel, "%v", args...)
+ os.Exit(1)
+}
+
+// Fatalf logs a formatted fatal error message and exits the program with status code 1
+func (l *Logger) Fatalf(format string, args ...interface{}) {
+ l.log(ErrorLevel, format, args...)
+ os.Exit(1)
+}
+
+// formatLabelValue formats a label key-value pair for output
+func formatLabelValue(key string, value interface{}) string {
+ // Handle slices and arrays specially for better readability
+ switch v := value.(type) {
+ case []string:
+ return fmt.Sprintf("%s=[%s]", key, strings.Join(v, ","))
+ case []interface{}:
+ var parts []string
+ for _, item := range v {
+ parts = append(parts, fmt.Sprintf("%v", item))
+ }
+ return fmt.Sprintf("%s=[%s]", key, strings.Join(parts, ","))
+ default:
+ return fmt.Sprintf("%s=%v", key, value)
+ }
+}
+
// formatMessage formats the message with arguments
// Removes any trailing newlines to prevent blank lines in output
func formatMessage(format string, args ...interface{}) string {
@@ -380,3 +528,20 @@ func Error(args ...interface{}) {
func Errorf(format string, args ...interface{}) {
getDefaultLogger().Errorf(format, args...)
}
+
+// Fatal logs a fatal error message using the default scope and exits the program with status code 1
+func Fatal(args ...interface{}) {
+ getDefaultLogger().Fatal(args...)
+}
+
+// Fatalf logs a formatted fatal error message using the default scope and exits the program with status code 1
+func Fatalf(format string, args ...interface{}) {
+ getDefaultLogger().Fatalf(format, args...)
+}
+
+// WithLabels adds key-value pairs to the labels using the default logger.
+// It returns a new Logger with labels added, allowing chained calls.
+// e.g. log.WithLabels("key1", "value1", "key2", 123).Info("message")
+func WithLabels(kvlist ...interface{}) *Logger {
+ return getDefaultLogger().WithLabels(kvlist...)
+}
diff --git a/pkg/log/pretty.go b/pkg/log/pretty.go
index fd02c7ff..cc8a4056 100644
--- a/pkg/log/pretty.go
+++ b/pkg/log/pretty.go
@@ -1,3 +1,20 @@
+/*
+ * 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 log
import (
diff --git a/pkg/model/proxy.go b/pkg/model/proxy.go
index 68cd6acc..ae191269 100644
--- a/pkg/model/proxy.go
+++ b/pkg/model/proxy.go
@@ -24,7 +24,7 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/cluster"
"github.com/apache/dubbo-kubernetes/pkg/util/protomarshal"
- networkutil "github.com/apache/dubbo-kubernetes/sail/pkg/util/network"
+ networkutil "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/util/network"
core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
meshconfig "istio.io/api/mesh/v1alpha1"
)
@@ -81,14 +81,14 @@ func (n *NodeMetaProxyConfig) UnmarshalJSON(data []byte) error {
}
type NodeMetadata struct {
- Generator string `json:"GENERATOR,omitempty"`
- ClusterID cluster.ID `json:"CLUSTER_ID,omitempty"`
- Namespace string `json:"NAMESPACE,omitempty"`
- StsPort string `json:"STS_PORT,omitempty"`
- MetadataDiscovery *StringBool `json:"METADATA_DISCOVERY,omitempty"`
- ProxyConfig *NodeMetaProxyConfig `json:"PROXY_CONFIG,omitempty"`
- SailSubjectAltName []string `json:"SAIL_SAN,omitempty"`
- XDSRootCert string `json:"-"`
+ Generator string `json:"GENERATOR,omitempty"`
+ ClusterID cluster.ID `json:"CLUSTER_ID,omitempty"`
+ Namespace string `json:"NAMESPACE,omitempty"`
+ StsPort string `json:"STS_PORT,omitempty"`
+ MetadataDiscovery *StringBool `json:"METADATA_DISCOVERY,omitempty"`
+ ProxyConfig *NodeMetaProxyConfig `json:"PROXY_CONFIG,omitempty"`
+ PlanetSubjectAltName []string `json:"PLANET_SAN,omitempty"`
+ XDSRootCert string `json:"-"`
}
type Node struct {
// ID of the Envoy node
diff --git a/pkg/model/xds.go b/pkg/model/xds.go
index c1d25fcd..bccc3d31 100644
--- a/pkg/model/xds.go
+++ b/pkg/model/xds.go
@@ -29,7 +29,7 @@ const (
NameTableType = APITypePrefix + "dubbo.networking.nds.v1.NameTable"
HealthInfoType = APITypePrefix + "dubbo.v1.HealthInformation"
ProxyConfigType = APITypePrefix + "dubbo.mesh.v1alpha1.ProxyConfig"
- DebugType = "dubbo.io/debug"
+ DebugType = "dubbo.apache.org/debug"
AddressType = APITypePrefix + "dubbo.workload.Address"
WorkloadType = APITypePrefix + "dubbo.workload.Workload"
)
diff --git a/pkg/security/security.go b/pkg/security/security.go
index d2c21eab..ff0b3912 100644
--- a/pkg/security/security.go
+++ b/pkg/security/security.go
@@ -20,13 +20,15 @@ package security
import (
"context"
"fmt"
- "google.golang.org/grpc/metadata"
- "k8s.io/klog/v2"
"net/http"
"os"
"path/filepath"
"strings"
"time"
+
+ "google.golang.org/grpc/metadata"
+ "google.golang.org/grpc/peer"
+ "k8s.io/klog/v2"
)
const (
@@ -115,7 +117,7 @@ type Options struct {
ServeOnlyFiles bool
ProvCert string
FileMountedCerts bool
- SailCertProvider string
+ PlanetCertProvider string
OutputKeyCertToDir string
CertChainFilePath string
KeyFilePath string
@@ -266,3 +268,14 @@ func ExtractRequestToken(req *http.Request) (string, error) {
return "", fmt.Errorf("no bearer token exists in HTTP authorization header")
}
+
+// GetConnectionAddress extracts the peer address from the gRPC context.
+// It returns "unknown" if the peer information is not available.
+func GetConnectionAddress(ctx context.Context) string {
+ peerInfo, ok := peer.FromContext(ctx)
+ peerAddr := "unknown"
+ if ok {
+ peerAddr = peerInfo.Addr.String()
+ }
+ return peerAddr
+}
diff --git a/pkg/uds/listener.go b/pkg/uds/listener.go
index 6b0acac3..eae0437d 100644
--- a/pkg/uds/listener.go
+++ b/pkg/uds/listener.go
@@ -19,11 +19,10 @@ package uds
import (
"fmt"
+ "github.com/apache/dubbo-kubernetes/pkg/log"
"net"
"os"
"path/filepath"
-
- "k8s.io/klog/v2"
)
func NewListener(path string) (net.Listener, error) {
@@ -36,7 +35,7 @@ func NewListener(path string) (net.Listener, error) {
// Attempt to create the folder in case it doesn't exist
if err := os.MkdirAll(filepath.Dir(path), 0o750); err != nil {
// If we cannot create it, just warn here - we will fail later if there is a real error
- klog.Warningf("Failed to create directory for %v: %v", path, err)
+ log.Warnf("Failed to create directory for %v: %v", path, err)
}
var err error
diff --git a/pkg/webhooks/server/server.go b/pkg/webhooks/server/server.go
index 8ada8559..89b522a7 100644
--- a/pkg/webhooks/server/server.go
+++ b/pkg/webhooks/server/server.go
@@ -28,7 +28,7 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/config/schema/collection"
"github.com/apache/dubbo-kubernetes/pkg/config/validation"
"github.com/apache/dubbo-kubernetes/pkg/kube"
- "github.com/apache/dubbo-kubernetes/sail/pkg/config/kube/crd"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/config/kube/crd"
"github.com/hashicorp/go-multierror"
admissionv1 "k8s.io/api/admission/v1"
kubeApiAdmissionv1beta1 "k8s.io/api/admission/v1beta1"
diff --git a/pkg/webhooks/util/util.go b/pkg/webhooks/util/util.go
index 43733f75..9ff8c7c7 100644
--- a/pkg/webhooks/util/util.go
+++ b/pkg/webhooks/util/util.go
@@ -23,7 +23,7 @@ import (
"errors"
"fmt"
- "github.com/apache/dubbo-kubernetes/sail/pkg/keycertbundle"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/keycertbundle"
)
type ConfigError struct {
diff --git a/pkg/webhooks/validation/controller/controller.go b/pkg/webhooks/validation/controller/controller.go
index b71e8d29..0ac69479 100644
--- a/pkg/webhooks/validation/controller/controller.go
+++ b/pkg/webhooks/validation/controller/controller.go
@@ -28,7 +28,7 @@ import (
"github.com/apache/dubbo-kubernetes/pkg/kube/kclient"
"github.com/apache/dubbo-kubernetes/pkg/ptr"
"github.com/apache/dubbo-kubernetes/pkg/webhooks/util"
- "github.com/apache/dubbo-kubernetes/sail/pkg/keycertbundle"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/keycertbundle"
kubeApiAdmission "k8s.io/api/admissionregistration/v1"
klabels "k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/types"
@@ -169,7 +169,7 @@ func newController(o Options, client kube.Client) *Controller {
controllers.WithRateLimiter(workqueue.NewTypedItemExponentialFailureRateLimiter[any](100*time.Millisecond, 1*time.Minute)))
c.webhooks = kclient.NewFiltered[*kubeApiAdmission.ValidatingWebhookConfiguration](client, kclient.Filter{
- LabelSelector: fmt.Sprintf("%s=%s", "dubbo.io/rev", o.Revision),
+ LabelSelector: fmt.Sprintf("%s=%s", "dubbo.apache.org/rev", o.Revision),
})
c.webhooks.AddEventHandler(controllers.ObjectHandler(c.queue.AddObject))
diff --git a/pkg/webhooks/webhookpatch.go b/pkg/webhooks/webhookpatch.go
index 2fed1483..0e431ed4 100644
--- a/pkg/webhooks/webhookpatch.go
+++ b/pkg/webhooks/webhookpatch.go
@@ -20,21 +20,21 @@ package webhooks
import (
"bytes"
"errors"
+ "github.com/apache/dubbo-kubernetes/pkg/log"
"math"
"strings"
"time"
+ "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/keycertbundle"
kubelib "github.com/apache/dubbo-kubernetes/pkg/kube"
"github.com/apache/dubbo-kubernetes/pkg/kube/controllers"
"github.com/apache/dubbo-kubernetes/pkg/kube/kclient"
"github.com/apache/dubbo-kubernetes/pkg/webhooks/util"
- "github.com/apache/dubbo-kubernetes/sail/pkg/keycertbundle"
v1 "k8s.io/api/admissionregistration/v1"
kerrors "k8s.io/apimachinery/pkg/api/errors"
klabels "k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/util/workqueue"
- "k8s.io/klog/v2"
)
var (
@@ -88,7 +88,7 @@ func (w *WebhookCertPatcher) webhookPatchTask(o types.NamespacedName) error {
}
if err != nil {
- klog.Errorf("patching webhook %s failed: %v", o.Name, err)
+ log.Errorf("patching webhook %s failed: %v", o.Name, err)
}
return err
@@ -100,11 +100,11 @@ func (w *WebhookCertPatcher) patchMutatingWebhookConfig(webhookConfigName string
return errNotFound
}
// prevents a race condition between multiple istiods when the revision is changed or modified
- v, ok := config.Labels["dubbo.io/rev"]
+ v, ok := config.Labels["dubbo.apache.org/rev"]
if !ok {
return nil
}
- klog.Infof("This is webhook label: %v", v)
+ log.Infof("This is webhook label: %v", v)
if v != w.revision {
return errWrongRevision
@@ -114,7 +114,7 @@ func (w *WebhookCertPatcher) patchMutatingWebhookConfig(webhookConfigName string
updated := false
caCertPem, err := util.LoadCABundle(w.CABundleWatcher)
if err != nil {
- klog.Errorf("Failed to load CA bundle: %v", err)
+ log.Errorf("Failed to load CA bundle: %v", err)
return err
}
for i, wh := range config.Webhooks {
diff --git a/pkg/xds/monitoring.go b/pkg/xds/monitoring.go
new file mode 100644
index 00000000..6ebbe581
--- /dev/null
+++ b/pkg/xds/monitoring.go
@@ -0,0 +1,8 @@
+package xds
+
+import dubbolog "github.com/apache/dubbo-kubernetes/pkg/log"
+
+var (
+ Log = dubbolog.RegisterScope("ads", "ads debugging")
+ log = Log
+)
diff --git a/pkg/xds/server.go b/pkg/xds/server.go
index b3282211..9350865a 100644
--- a/pkg/xds/server.go
+++ b/pkg/xds/server.go
@@ -21,9 +21,9 @@ import (
"strings"
"time"
+ dubbogrpc "github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/grpc"
"github.com/apache/dubbo-kubernetes/pkg/model"
"github.com/apache/dubbo-kubernetes/pkg/util/sets"
- dubbogrpc "github.com/apache/dubbo-kubernetes/sail/pkg/grpc"
core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
"google.golang.org/grpc/codes"
@@ -163,16 +163,16 @@ func Receive(ctx ConnectionContext) {
req, err := con.stream.Recv()
if err != nil {
if dubbogrpc.GRPCErrorType(err) != dubbogrpc.UnexpectedError {
- klog.Infof("ADS: %q %s terminated", con.peerAddr, con.conID)
+ klog.Infof("%q %s terminated", con.peerAddr, con.conID)
return
}
con.errorChan <- err
- klog.Errorf("ADS: %q %s terminated with error: %v", con.peerAddr, con.conID, err)
+ klog.Errorf("%q %s terminated with error: %v", con.peerAddr, con.conID, err)
return
}
if firstRequest {
if req.TypeUrl == model.HealthInfoType {
- klog.Warningf("ADS: %q %s send health check probe before normal xDS request", con.peerAddr, con.conID)
+ klog.Warningf("%q %s send health check probe before normal xDS request", con.peerAddr, con.conID)
continue
}
firstRequest = false
@@ -191,7 +191,7 @@ func Receive(ctx ConnectionContext) {
select {
case con.reqChan <- req:
case <-con.stream.Context().Done():
- klog.Infof("ADS: %q %s terminated with stream closed", con.peerAddr, con.conID)
+ klog.Infof("%q %s terminated with stream closed", con.peerAddr, con.conID)
return
}
}
@@ -261,7 +261,7 @@ func ShouldRespond(w Watcher, id string, request *discovery.DiscoveryRequest) (b
if request.ErrorDetail != nil {
errCode := codes.Code(request.ErrorDetail.Code)
- klog.Warningf("ADS:%s: ACK ERROR %s %s:%s", stype, id, errCode.String(), request.ErrorDetail.GetMessage())
+ klog.Warningf("%s: ACK ERROR %s %s:%s", stype, id, errCode.String(), request.ErrorDetail.GetMessage())
w.UpdateWatchedResource(request.TypeUrl, func(wr *WatchedResource) *WatchedResource {
wr.LastError = request.ErrorDetail.GetMessage()
return wr
@@ -270,7 +270,7 @@ func ShouldRespond(w Watcher, id string, request *discovery.DiscoveryRequest) (b
}
if shouldUnsubscribe(request) {
- klog.V(2).Infof("ADS:%s: UNSUBSCRIBE %s %s %s", stype, id, request.VersionInfo, request.ResponseNonce)
+ log.Debugf("%s: UNSUBSCRIBE %s %s %s", stype, id, request.VersionInfo, request.ResponseNonce)
w.DeleteWatchedResource(request.TypeUrl)
return false, emptyResourceDelta
}
@@ -281,8 +281,29 @@ func ShouldRespond(w Watcher, id string, request *discovery.DiscoveryRequest) (b
// 2. When Envoy reconnects to a new Istiod that does not have information about this typeUrl
// i.e. non empty response nonce.
// We should always respond with the current resource names.
- if request.ResponseNonce == "" || previousInfo == nil {
- klog.V(2).Infof("ADS:%s: INIT/RECONNECT %s %s %s", stype, id, request.VersionInfo, request.ResponseNonce)
+ if previousInfo == nil {
+ // No previous info - this is a new request
+ if request.ResponseNonce == "" {
+ // Initial request with no nonce
+ log.Debugf("%s: INIT %s %s", stype, id, request.VersionInfo)
+ w.NewWatchedResource(request.TypeUrl, request.ResourceNames)
+ return true, emptyResourceDelta
+ }
+ // Client sent a nonce but we have no previous info
+ // This could be a reconnect, but if we're getting many requests with different nonces,
+ // they're likely stale/expired requests that should be ignored
+ // Only treat as reconnect if this is the first request we see with a nonce
+ // For subsequent requests with nonces we don't recognize, treat as expired
+ log.Debugf("%s: REQ %s Unknown nonce (no previous info): %s, treating as expired/stale", stype, id, request.ResponseNonce)
+ // Create the watched resource but don't respond - let the client retry with empty nonce
+ w.NewWatchedResource(request.TypeUrl, request.ResourceNames)
+ return false, emptyResourceDelta
+ }
+
+ // We have previous info - check nonce match
+ if request.ResponseNonce == "" {
+ // Client sent empty nonce but we have previous info - this is a new request
+ log.Debugf("%s: INIT (empty nonce) %s %s", stype, id, request.VersionInfo)
w.NewWatchedResource(request.TypeUrl, request.ResourceNames)
return true, emptyResourceDelta
}
@@ -291,13 +312,16 @@ func ShouldRespond(w Watcher, id string, request *discovery.DiscoveryRequest) (b
// A nonce becomes stale following a newer nonce being sent to Envoy.
// previousInfo.NonceSent can be empty if we previously had shouldRespond=true but didn't send any resources.
if request.ResponseNonce != previousInfo.NonceSent {
+ // Expired/stale nonce - don't respond, just log at debug level
if previousInfo.NonceSent == "" {
- // Assert we do not end up in an invalid state
- klog.V(2).Infof("ADS:%s: REQ %s Expired nonce received %s, but we never sent any nonce", stype,
+ // We never sent a nonce, but client sent one - this is unusual but treat as expired
+ log.Debugf("%s: REQ %s Expired nonce received %s, but we never sent any nonce", stype,
id, request.ResponseNonce)
+ } else {
+ // Normal case: client sent stale nonce
+ log.Debugf("%s: REQ %s Expired nonce received %s, sent %s", stype,
+ id, request.ResponseNonce, previousInfo.NonceSent)
}
- klog.V(2).Infof("ADS:%s: REQ %s Expired nonce received %s, sent %s", stype,
- id, request.ResponseNonce, previousInfo.NonceSent)
return false, emptyResourceDelta
}
@@ -332,7 +356,7 @@ func ShouldRespond(w Watcher, id string, request *discovery.DiscoveryRequest) (b
// Check if this is proxyless by attempting to get the proxy from watcher
// For now, we'll check if this is a proxyless scenario by the context
// If previous resources existed and client sends empty names with matching nonce, it's an ACK
- klog.V(2).Infof("ADS:%s: wildcard request after specific resources (prev: %d resources, nonce: %s), treating as ACK",
+ log.Debugf("%s: wildcard request after specific resources (prev: %d resources, nonce: %s), treating as ACK",
stype, len(previousResources), previousInfo.NonceSent)
// Update ResourceNames to keep previous resources (don't clear them)
w.UpdateWatchedResource(request.TypeUrl, func(wr *WatchedResource) *WatchedResource {
@@ -350,15 +374,15 @@ func ShouldRespond(w Watcher, id string, request *discovery.DiscoveryRequest) (b
// We should always respond "alwaysRespond" marked requests to let Envoy finish warming
// even though Nonce match and it looks like an ACK.
if alwaysRespond {
- klog.Infof("ADS:%s: FORCE RESPONSE %s for warming.", stype, id)
+ klog.Infof("%s: FORCE RESPONSE %s for warming.", stype, id)
return true, emptyResourceDelta
}
if len(removed) == 0 && len(added) == 0 {
- klog.V(2).Infof("ADS:%s: ACK %s %s %s", stype, id, request.VersionInfo, request.ResponseNonce)
+ log.Debugf("%s: ACK %s %s %s", stype, id, request.VersionInfo, request.ResponseNonce)
return false, emptyResourceDelta
}
- klog.V(2).Infof("ADS:%s: RESOURCE CHANGE added %v removed %v %s %s %s", stype,
+ log.Debugf("%s: RESOURCE CHANGE added %v removed %v %s %s %s", stype,
added, removed, id, request.VersionInfo, request.ResponseNonce)
// For non wildcard resource, if no new resources are subscribed, it means we do not need to push.
diff --git a/samples/addons/README.md b/samples/addons/README.md
index 9610128d..70c25b6d 100644
--- a/samples/addons/README.md
+++ b/samples/addons/README.md
@@ -10,10 +10,4 @@ To quickly deploy all addons:
```shell script
kubectl apply -f samples/addons
-```
-
-Alternatively, you can deploy individual addons:
-
-```shell script
-kubectl apply -f samples/addons/prometheus.yaml
```
\ No newline at end of file
diff --git a/samples/addons/prometheus.yaml b/samples/addons/prometheus.yaml
index bcadb985..08293b82 100644
--- a/samples/addons/prometheus.yaml
+++ b/samples/addons/prometheus.yaml
@@ -493,7 +493,7 @@ spec:
helm.sh/chart: prometheus-27.8.0
app.kubernetes.io/part-of: prometheus
- sidecar.dubbo.io/inject: "false"
+ sidecar.dubbo.apache.org/inject: "false"
spec:
enableServiceLinks: true
serviceAccountName: prometheus
diff --git a/samples/grpc-proxyless/README.md b/samples/grpc-proxyless/README.md
new file mode 100644
index 00000000..8fc685a5
--- /dev/null
+++ b/samples/grpc-proxyless/README.md
@@ -0,0 +1,137 @@
+# gRPC Proxyless Example
+
+This example demonstrates how to deploy gRPC applications with proxyless service mesh support using Dubbo Kubernetes.
+
+## Overview
+
+This sample includes:
+- **Consumer**: A gRPC server that receives requests (port 17070)
+- **Producer**: A gRPC client that sends requests to the consumer service
+
+Both services use native gRPC xDS clients to connect to the Dubbo control plane through the `dubbo-proxy` sidecar, enabling service discovery, load balancing, and traffic management without requiring Envoy proxy for application traffic.
+
+## Prerequisites
+
+1. Kubernetes cluster with Dubbo Kubernetes control plane installed
+2. `kubectl` configured to access the cluster
+3. `grpcurl` (optional, for testing)
+
+## Deployment
+
+### 1. Create Namespace
+
+```bash
+kubectl create ns grpc-proxyless
+kubectl label namespace grpc-proxyless dubbo-injection=enabled
+```
+
+### 2. Deploy Services
+
+```bash
+kubectl apply -f grpc-proxyless.yaml
+```
+
+### 3. Verify Deployment
+
+```bash
+# Check pods are running
+kubectl get pods -n grpc-proxyless
+
+# Check services
+kubectl get svc -n grpc-proxyless
+```
+
+## Configuration
+
+### Key Annotations
+
+- `proxyless.dubbo.apache.org/inject: "true"` - Enables proxyless injection
+- `inject.dubbo.apache.org/templates: grpc-agent` - Uses the grpc-agent template
+- `proxy.dubbo.apache.org/config: '{"holdApplicationUntilProxyStarts": true}'` - Ensures proxy starts before application
+
+### Environment Variables
+
+The `dubbo-proxy` sidecar automatically:
+- Creates `/etc/dubbo/proxy/grpc-bootstrap.json` bootstrap file
+- Exposes xDS proxy via Unix Domain Socket
+- Sets `GRPC_XDS_BOOTSTRAP` environment variable for application containers
+
+## Testing
+
+### Test with grpcurl
+
+1. Port forward to producer service:
+
+```bash
+kubectl port-forward -n grpc-proxyless \
+ $(kubectl get pod -l app=producer -n grpc-proxyless -o jsonpath='{.items[0].metadata.name}') \
+ 17171:17171 &
+```
+
+2. Send test request:
+
+```bash
+grpcurl -plaintext -d '{
+ "url": "xds:///consumer.grpc-proxyless.svc.cluster.local:7070",
+ "count": 5
+}' localhost:17171 echo.EchoTestService/ForwardEcho
+```
+
+Expected output:
+```json
+{
+ "output": [
+ "[0 body] Hostname=consumer-xxx",
+ "[1 body] Hostname=consumer-yyy",
+ "[2 body] Hostname=consumer-xxx",
+ "[3 body] Hostname=consumer-yyy",
+ "[4 body] Hostname=consumer-xxx"
+ ]
+}
+```
+
+### Check Logs
+
+```bash
+# Consumer logs
+kubectl logs -f -l app=consumer -n grpc-proxyless -c app
+
+# Producer logs
+kubectl logs -f -l app=producer -n grpc-proxyless -c app
+
+# Proxy sidecar logs
+kubectl logs -f -l app=consumer -n grpc-proxyless -c dubbo-proxy
+```
+
+## Troubleshooting
+
+### Application fails to start
+
+If the application fails with "grpc-bootstrap.json: no such file or directory":
+- The `dubbo-proxy` sidecar may not have generated the bootstrap file yet
+- Check proxy logs: `kubectl logs <pod-name> -c dubbo-proxy -n grpc-proxyless`
+- Ensure `holdApplicationUntilProxyStarts: true` is set in annotations
+
+### Connection issues
+
+1. Verify xDS proxy is running:
+```bash
+kubectl exec <pod-name> -c dubbo-proxy -n grpc-proxyless -- ls -la /etc/dubbo/proxy/
+```
+
+2. Check bootstrap file:
+```bash
+kubectl exec <pod-name> -c app -n grpc-proxyless -- cat /etc/dubbo/proxy/grpc-bootstrap.json
+```
+
+3. Verify control plane connectivity:
+```bash
+kubectl logs <pod-name> -c dubbo-proxy -n grpc-proxyless | grep -i xds
+```
+
+## Cleanup
+
+```bash
+kubectl delete -f grpc-proxyless.yaml
+kubectl delete ns grpc-proxyless
+```
diff --git a/samples/grpc-proxyless/grpc-proxyless.yaml b/samples/grpc-proxyless/grpc-proxyless.yaml
index 3d3f9c3c..0f53f3a5 100644
--- a/samples/grpc-proxyless/grpc-proxyless.yaml
+++ b/samples/grpc-proxyless/grpc-proxyless.yaml
@@ -42,9 +42,9 @@ spec:
template:
metadata:
annotations:
- proxyless.dubbo.io/inject: "true"
- inject.dubbo.io/templates: grpc-agent
- proxy.dubbo.io/config: '{"holdApplicationUntilProxyStarts": true}'
+ proxyless.dubbo.apache.org/inject: "true"
+ inject.dubbo.apache.org/templates: grpc-agent
+ proxy.dubbo.apache.org/config: '{"holdApplicationUntilProxyStarts": true}'
labels:
app: consumer
spec:
@@ -52,8 +52,6 @@ spec:
- name: app
image: mfordjody/grpc-consumer:latest
imagePullPolicy: Always
- args:
- - --port=17070
ports:
- containerPort: 17070
protocol: TCP
@@ -94,9 +92,9 @@ spec:
template:
metadata:
annotations:
- proxyless.dubbo.io/inject: "true"
- inject.dubbo.io/templates: grpc-agent
- proxy.dubbo.io/config: '{"holdApplicationUntilProxyStarts": true}'
+ proxyless.dubbo.apache.org/inject: "true"
+ inject.dubbo.apache.org/templates: grpc-agent
+ proxy.dubbo.apache.org/config: '{"holdApplicationUntilProxyStarts": true}'
labels:
app: producer
spec:
@@ -105,8 +103,6 @@ spec:
# Replace with your own image containing the producer binary
image: mfordjody/grpc-producer:latest
imagePullPolicy: Always
- args:
- - --port=17171
# Optional: uncomment to test direct connection
# - --target=xds:///consumer.grpc-proxyless.svc.cluster.local:7070
# - --count=10
@@ -119,4 +115,4 @@ spec:
valueFrom:
fieldRef:
apiVersion: v1
- fieldPath: status.podIP
+ fieldPath: status.podIP
\ No newline at end of file
diff --git a/tests/grpc-proxyless/consumer/main.go b/tests/grpc-proxyless/consumer/main.go
index 361449b6..5e3e665d 100644
--- a/tests/grpc-proxyless/consumer/main.go
+++ b/tests/grpc-proxyless/consumer/main.go
@@ -25,11 +25,13 @@ import (
"net"
"os"
"os/signal"
+ "strings"
"syscall"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
xdscreds "google.golang.org/grpc/credentials/xds"
+ "google.golang.org/grpc/grpclog"
"google.golang.org/grpc/reflection"
"google.golang.org/grpc/xds"
@@ -103,9 +105,98 @@ func (s *echoServer) ForwardEcho(ctx context.Context, req *pb.ForwardEchoRequest
}, nil
}
+// grpcLogger filters out xDS informational logs that are incorrectly marked as ERROR
+type grpcLogger struct {
+ logger *log.Logger
+}
+
+func (l *grpcLogger) Info(args ...interface{}) {
+ msg := fmt.Sprint(args...)
+ // Filter out xDS "entering mode: SERVING" logs
+ if strings.Contains(msg, "entering mode") && strings.Contains(msg, "SERVING") {
+ return
+ }
+ l.logger.Print("INFO: ", msg)
+}
+
+func (l *grpcLogger) Infoln(args ...interface{}) {
+ msg := fmt.Sprintln(args...)
+ if strings.Contains(msg, "entering mode") && strings.Contains(msg, "SERVING") {
+ return
+ }
+ l.logger.Print("INFO: ", msg)
+}
+
+func (l *grpcLogger) Infof(format string, args ...interface{}) {
+ msg := fmt.Sprintf(format, args...)
+ if strings.Contains(msg, "entering mode") && strings.Contains(msg, "SERVING") {
+ return
+ }
+ l.logger.Printf("INFO: %s", msg)
+}
+
+func (l *grpcLogger) Warning(args ...interface{}) {
+ l.logger.Print("WARNING: ", fmt.Sprint(args...))
+}
+
+func (l *grpcLogger) Warningln(args ...interface{}) {
+ l.logger.Print("WARNING: ", fmt.Sprintln(args...))
+}
+
+func (l *grpcLogger) Warningf(format string, args ...interface{}) {
+ l.logger.Printf("WARNING: %s", fmt.Sprintf(format, args...))
+}
+
+func (l *grpcLogger) Error(args ...interface{}) {
+ msg := fmt.Sprint(args...)
+ // Filter out xDS "entering mode: SERVING" logs that are incorrectly marked as ERROR
+ if strings.Contains(msg, "entering mode") && strings.Contains(msg, "SERVING") {
+ return
+ }
+ l.logger.Print("ERROR: ", msg)
+}
+
+func (l *grpcLogger) Errorln(args ...interface{}) {
+ msg := fmt.Sprintln(args...)
+ if strings.Contains(msg, "entering mode") && strings.Contains(msg, "SERVING") {
+ return
+ }
+ l.logger.Print("ERROR: ", msg)
+}
+
+func (l *grpcLogger) Errorf(format string, args ...interface{}) {
+ msg := fmt.Sprintf(format, args...)
+ if strings.Contains(msg, "entering mode") && strings.Contains(msg, "SERVING") {
+ return
+ }
+ l.logger.Printf("ERROR: %s", msg)
+}
+
+func (l *grpcLogger) Fatal(args ...interface{}) {
+ l.logger.Fatal(args...)
+}
+
+func (l *grpcLogger) Fatalln(args ...interface{}) {
+ l.logger.Fatal(args...)
+}
+
+func (l *grpcLogger) Fatalf(format string, args ...interface{}) {
+ l.logger.Fatalf(format, args...)
+}
+
+func (l *grpcLogger) V(level int) bool {
+ return level <= 0
+}
+
func main() {
flag.Parse()
+ // Set custom gRPC logger to filter out xDS informational logs
+ // The "ERROR: [xds] Listener entering mode: SERVING" is actually an informational log
+ grpclog.SetLoggerV2(&grpcLogger{
+ logger: log.New(os.Stderr, "", log.LstdFlags),
+ })
+
hostname, _ := os.Hostname()
if hostname == "" {
hostname = "unknown"
diff --git a/tests/grpc-proxyless/Dockerfile.consumer b/tests/grpc-proxyless/docker/dockerfile.consumer
similarity index 100%
rename from tests/grpc-proxyless/Dockerfile.consumer
rename to tests/grpc-proxyless/docker/dockerfile.consumer
diff --git a/tests/grpc-proxyless/Dockerfile.producer b/tests/grpc-proxyless/docker/dockerfile.producer
similarity index 100%
rename from tests/grpc-proxyless/Dockerfile.producer
rename to tests/grpc-proxyless/docker/dockerfile.producer
diff --git a/tests/grpc-proxyless/producer/main.go b/tests/grpc-proxyless/producer/main.go
index a23dc863..acc17116 100644
--- a/tests/grpc-proxyless/producer/main.go
+++ b/tests/grpc-proxyless/producer/main.go
@@ -35,6 +35,7 @@ import (
"google.golang.org/grpc/connectivity"
"google.golang.org/grpc/credentials/insecure"
xdscreds "google.golang.org/grpc/credentials/xds"
+ "google.golang.org/grpc/grpclog"
"google.golang.org/grpc/reflection"
_ "google.golang.org/grpc/xds"
@@ -48,9 +49,96 @@ var (
testServer *grpc.Server
)
+// grpcLogger filters out xDS informational logs that are incorrectly marked as ERROR
+type grpcLogger struct {
+ logger *log.Logger
+}
+
+func (l *grpcLogger) Info(args ...interface{}) {
+ msg := fmt.Sprint(args...)
+ if strings.Contains(msg, "entering mode") && strings.Contains(msg, "SERVING") {
+ return
+ }
+ l.logger.Print("INFO: ", msg)
+}
+
+func (l *grpcLogger) Infoln(args ...interface{}) {
+ msg := fmt.Sprintln(args...)
+ if strings.Contains(msg, "entering mode") && strings.Contains(msg, "SERVING") {
+ return
+ }
+ l.logger.Print("INFO: ", msg)
+}
+
+func (l *grpcLogger) Infof(format string, args ...interface{}) {
+ msg := fmt.Sprintf(format, args...)
+ if strings.Contains(msg, "entering mode") && strings.Contains(msg, "SERVING") {
+ return
+ }
+ l.logger.Printf("INFO: %s", msg)
+}
+
+func (l *grpcLogger) Warning(args ...interface{}) {
+ l.logger.Print("WARNING: ", fmt.Sprint(args...))
+}
+
+func (l *grpcLogger) Warningln(args ...interface{}) {
+ l.logger.Print("WARNING: ", fmt.Sprintln(args...))
+}
+
+func (l *grpcLogger) Warningf(format string, args ...interface{}) {
+ l.logger.Printf("WARNING: %s", fmt.Sprintf(format, args...))
+}
+
+func (l *grpcLogger) Error(args ...interface{}) {
+ msg := fmt.Sprint(args...)
+ if strings.Contains(msg, "entering mode") && strings.Contains(msg, "SERVING") {
+ return
+ }
+ l.logger.Print("ERROR: ", msg)
+}
+
+func (l *grpcLogger) Errorln(args ...interface{}) {
+ msg := fmt.Sprintln(args...)
+ if strings.Contains(msg, "entering mode") && strings.Contains(msg, "SERVING") {
+ return
+ }
+ l.logger.Print("ERROR: ", msg)
+}
+
+func (l *grpcLogger) Errorf(format string, args ...interface{}) {
+ msg := fmt.Sprintf(format, args...)
+ if strings.Contains(msg, "entering mode") && strings.Contains(msg, "SERVING") {
+ return
+ }
+ l.logger.Printf("ERROR: %s", msg)
+}
+
+func (l *grpcLogger) Fatal(args ...interface{}) {
+ l.logger.Fatal(args...)
+}
+
+func (l *grpcLogger) Fatalln(args ...interface{}) {
+ l.logger.Fatal(args...)
+}
+
+func (l *grpcLogger) Fatalf(format string, args ...interface{}) {
+ l.logger.Fatalf(format, args...)
+}
+
+func (l *grpcLogger) V(level int) bool {
+ return level <= 0
+}
+
func main() {
flag.Parse()
+ // Set custom gRPC logger to filter out xDS informational logs
+ // The "ERROR: [xds] Listener entering mode: SERVING" is actually an informational log
+ grpclog.SetLoggerV2(&grpcLogger{
+ logger: log.New(os.Stderr, "", log.LstdFlags),
+ })
+
go startTestServer(*port)
if *target != "" {
diff --git a/tests/grpc-proxyless/test-commands.sh b/tests/grpc-proxyless/test-commands.sh
deleted file mode 100755
index d78b8d46..00000000
--- a/tests/grpc-proxyless/test-commands.sh
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/bin/bash
-set -e
-
-NAMESPACE="grpc-proxyless"
-
-echo "=== gRPC Proxyless 测试命令 ==="
-echo ""
-
-echo "=== 快速测试步骤 ==="
-echo ""
-echo "# 1. 重新构建 producer 镜像(代码已修改)"
-echo "cd test/grpc-proxyless"
-echo "docker build -f Dockerfile.producer -t mfordjody/grpc-producer:latest ."
-echo "docker push mfordjody/grpc-producer:latest # 如果需要推送到 registry"
-echo ""
-echo "# 2. 重启 producer deployment"
-echo "kubectl rollout restart deployment/producer -n grpc-proxyless"
-echo "kubectl rollout status deployment/producer -n grpc-proxyless"
-echo ""
-echo "# 3. 等待 pod 就绪"
-echo "kubectl wait --for=condition=ready pod -l app=producer -n grpc-proxyless --timeout=60s"
-echo ""
-echo "# 4. 查看 producer 应用日志(观察连接状态和 RPC 调用)"
-echo "kubectl logs -f -l app=producer -c app -n grpc-proxyless --tail=100"
-echo ""
-echo "# 5. 查看 producer xDS proxy 日志(观察 EDS 响应)"
-echo "kubectl logs -f -l app=producer -c dubbo-proxy -n grpc-proxyless --tail=100 | grep -i 'xds\|eds\|connection'"
-echo ""
-echo "# 6. 测试 ForwardEcho(需要先启动 port-forward)"
-echo "# 在另一个终端执行:"
-echo "kubectl port-forward -n grpc-proxyless \$(kubectl get pod -l app=producer -n grpc-proxyless -o jsonpath='{.items[0].metadata.name}') 17171:17171"
-echo ""
-echo "# 然后执行测试(注意:-d 参数必须在地址之前!):"
-echo ""
-echo "# 方法1: 直接使用 -d 参数(推荐)"
-echo "grpcurl -plaintext -d '{\"url\": \"xds:///consumer.grpc-proxyless.svc.cluster.local:7070\", \"count\": 5}' localhost:17171 echo.EchoTestService/ForwardEcho"
-echo ""
-echo "# 方法2: 使用标准输入(如果方法1不行)"
-echo "echo '{\"url\": \"xds:///consumer.grpc-proxyless.svc.cluster.local:7070\", \"count\": 5}' | grpcurl -plaintext -d @ localhost:17171 echo.EchoTestService/ForwardEcho"
-echo ""
-echo "# 方法3: 使用文件"
-echo "cat > /tmp/request.json << 'JSON'"
-echo "{\"url\": \"xds:///consumer.grpc-proxyless.svc.cluster.local:7070\", \"count\": 5}"
-echo "JSON"
-echo "grpcurl -plaintext -d @ /tmp/request.json localhost:17171 echo.EchoTestService/ForwardEcho"
-echo ""
-echo "# 7. 查看控制平面日志(检查 EDS 推送)"
-echo "kubectl logs -f -l app=dubbod -n dubbo-system --tail=100 | grep -i 'eds\|endpoint\|consumer'"
-echo ""
diff --git a/tests/grpc-proxyless/test.sh b/tests/grpc-proxyless/test.sh
deleted file mode 100755
index 1c20b2c9..00000000
--- a/tests/grpc-proxyless/test.sh
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/bin/bash
-set -e
-
-NAMESPACE="grpc-proxyless"
-
-echo "=== 测试 gRPC Proxyless 死循环修复 ==="
-echo ""
-
-# 1. 检查控制平面日志(确认死循环已解决)
-echo "1. 检查控制平面日志(观察 10 秒,确认不再出现死循环)..."
-echo " 运行: kubectl logs -f <dubbod-pod-name> -n <namespace> | grep -E 'LDS.*PUSH|resources:'"
-echo " 期望: 不再出现 resources:1 和 resources:13 的快速交替"
-echo ""
-
-# 2. 检查 xDS proxy 日志
-echo "2. 检查 xDS proxy 日志(确认不再频繁转发)..."
-CONSUMER_POD=$(kubectl get pods -n $NAMESPACE -l app=consumer -o jsonpath='{.items[0].metadata.name}' 2>/dev/null || echo "")
-if [ -n "$CONSUMER_POD" ]; then
- echo " 检查 pod: $CONSUMER_POD"
- echo " 运行: kubectl logs $CONSUMER_POD -c dubbo-proxy -n $NAMESPACE | grep -E 'forwarding request.*LDS' | wc -l"
- echo " 期望: 数量很少,不再频繁转发"
-else
- echo " 未找到 consumer pod"
-fi
-echo ""
-
-# 3. 获取服务信息
-echo "3. 获取服务信息..."
-kubectl get svc -n $NAMESPACE
-echo ""
-
-# 4. 使用 grpcurl 测试
-echo "4. 使用 grpcurl 测试服务功能..."
-echo ""
-
-# 测试 ForwardEcho(通过 producer)
-PRODUCER_POD=$(kubectl get pods -n $NAMESPACE -l app=producer -o jsonpath='{.items[0].metadata.name}' 2>/dev/null || echo "")
-if [ -n "$PRODUCER_POD" ]; then
- echo " 测试 ForwardEcho(通过 producer pod):"
- echo " kubectl port-forward -n $NAMESPACE $PRODUCER_POD 17171:17171 &"
- echo " grpcurl -plaintext localhost:17171 echo.EchoTestService/ForwardEcho -d '{\"url\": \"xds:///consumer.grpc-proxyless.svc.cluster.local:7070\", \"count\": 1, \"headers\": {}, \"timeout\": 5}'"
- echo ""
-fi
-
-# 测试 Echo(直接访问 consumer)
-CONSUMER_POD=$(kubectl get pods -n $NAMESPACE -l app=consumer -o jsonpath='{.items[0].metadata.name}' 2>/dev/null || echo "")
-if [ -n "$CONSUMER_POD" ]; then
- echo " 测试 Echo(直接访问 consumer pod):"
- echo " kubectl port-forward -n $NAMESPACE $CONSUMER_POD 17070:17070 &"
- echo " grpcurl -plaintext localhost:17070 echo.EchoService/Echo -d '{\"message\": \"test\"}'"
- echo ""
-fi
-
-echo "=== 测试完成 ==="
-
-