|
| 1 | +<!-- |
| 2 | +Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 | +contributor license agreements. See the NOTICE file distributed with |
| 4 | +this work for additional information regarding copyright ownership. |
| 5 | +The ASF licenses this file to You under the Apache License, Version 2.0 |
| 6 | +(the "License"); you may not use this file except in compliance with |
| 7 | +the License. You may obtain a copy of the License at |
| 8 | +
|
| 9 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +
|
| 11 | +Unless required by applicable law or agreed to in writing, software |
| 12 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +See the License for the specific language governing permissions and |
| 15 | +limitations under the License. |
| 16 | +--> |
| 17 | +# Apollo plugin-store migration |
| 18 | + |
| 19 | +## Status and deprecation cycle |
| 20 | + |
| 21 | +Apollo is currently an optional, supported in-tree integration. Issue [#7599](https://github.com/apache/shenyu/issues/7599) |
| 22 | +proposes transferring its registry, data-sync, Admin listener and gateway starter to |
| 23 | +[plugin-store](https://github.com/apache/shenyu-plugin-store), extending [#7306](https://github.com/apache/shenyu/issues/7306). |
| 24 | +This guide is the advance deprecation notice: the in-tree modules remain available |
| 25 | +for the release carrying this notice. No removal release has been selected. |
| 26 | +The separate removal PR is a draft and must not be merged in that deprecation release. |
| 27 | + |
| 28 | +| Stage | Required action | |
| 29 | +| --- | --- | |
| 30 | +| Agreement | Obtain and link the dev-list decision approving Apollo externalization. | |
| 31 | +| Deprecation release | Ship this notice and migration guide in a core release while retaining all four in-tree modules. Record that released version publicly. | |
| 32 | +| Receiving parity | Build/test all four modules together in plugin-store, verify external SPI loading and unchanged sync/registry configuration. | |
| 33 | +| Publication | Announce compatible core/store versions, publish external artifacts before cutover, and reserve one publisher per Maven group/artifact/version. | |
| 34 | +| Later core release | After the deprecation release has shipped, merge the separate removal, update the release inventory, and announce the rollback window. | |
| 35 | + |
| 36 | +Do not treat creating PRs, merging documentation, or producing local snapshot JARs |
| 37 | +as completing the dev-list decision, a released deprecation cycle, or artifact publication. |
| 38 | +Keep the issue open until all stages and their release evidence are complete. |
| 39 | + |
| 40 | +## Artifact ownership and installation |
| 41 | + |
| 42 | +The receiving `shenyu-extension-apollo` reactor owns these artifacts together: |
| 43 | + |
| 44 | +- `shenyu-admin-listener-apollo` |
| 45 | +- `shenyu-sync-data-apollo` |
| 46 | +- `shenyu-registry-apollo` |
| 47 | +- `shenyu-spring-boot-starter-sync-data-apollo` |
| 48 | + |
| 49 | +The preparation branch uses store `2.7.1-SNAPSHOT` against core `2.7.2-SNAPSHOT`. |
| 50 | +These are development coordinates, not an announced release compatibility matrix. |
| 51 | +For deployment, select the published store release declared compatible with your core release. |
| 52 | +Use the core version for retained APIs and the store version for **all four** Apollo artifacts. |
| 53 | +Keep exactly one provider version on each runtime classpath; the in-tree and external |
| 54 | +implementations retain identical packages and must not coexist. |
| 55 | + |
| 56 | +Admin needs: |
| 57 | + |
| 58 | +```xml |
| 59 | +<dependency> |
| 60 | + <groupId>org.apache.shenyu</groupId> |
| 61 | + <artifactId>shenyu-admin-listener-apollo</artifactId> |
| 62 | + <version>${store.version}</version> |
| 63 | +</dependency> |
| 64 | +``` |
| 65 | + |
| 66 | +Gateway data synchronization needs: |
| 67 | + |
| 68 | +```xml |
| 69 | +<dependency> |
| 70 | + <groupId>org.apache.shenyu</groupId> |
| 71 | + <artifactId>shenyu-spring-boot-starter-sync-data-apollo</artifactId> |
| 72 | + <version>${store.version}</version> |
| 73 | +</dependency> |
| 74 | +``` |
| 75 | + |
| 76 | +Applications using Apollo instance registration or SDK instance discovery additionally need: |
| 77 | + |
| 78 | +```xml |
| 79 | +<dependency> |
| 80 | + <groupId>org.apache.shenyu</groupId> |
| 81 | + <artifactId>shenyu-registry-apollo</artifactId> |
| 82 | + <version>${store.version}</version> |
| 83 | +</dependency> |
| 84 | +``` |
| 85 | + |
| 86 | +Gateway registration also requires the retained core `shenyu-spring-boot-starter-registry`; |
| 87 | +SDK discovery requires the appropriate SDK starter. Apollo was never included in the |
| 88 | +compatibility registry starter, so it remains an explicit provider dependency. |
| 89 | +For binary distributions, resolve the complete runtime dependency closure into `lib/`, |
| 90 | +replace old Apollo JARs, and retain the extension's licensing information and dependency notices. |
| 91 | + |
| 92 | +Shading continues to package Apollo client dependencies, but excludes retained ShenYu |
| 93 | +API artifacts and sibling extension modules. API classes come from the application's core artifacts, preserving |
| 94 | +class identity for external SPI loading. The published POM retains runtime dependencies. |
| 95 | + |
| 96 | +## Enable Admin and gateway synchronization |
| 97 | + |
| 98 | +Admin keeps its existing property prefix and portal publishing settings: |
| 99 | + |
| 100 | +```yaml |
| 101 | +shenyu: |
| 102 | + sync: |
| 103 | + websocket: |
| 104 | + enabled: false |
| 105 | + apollo: |
| 106 | + appId: shenyu |
| 107 | + meta: http://apollo-config-service:8080 |
| 108 | + portalUrl: http://apollo-portal:8070 |
| 109 | + env: DEV |
| 110 | + clusterName: default |
| 111 | + namespace: application |
| 112 | + token: ${APOLLO_OPENAPI_TOKEN} |
| 113 | + operatorUser: apollo |
| 114 | +``` |
| 115 | +
|
| 116 | +Gateway keeps the same reading settings; remove or disable the previous sync channel: |
| 117 | +
|
| 118 | +```yaml |
| 119 | +shenyu: |
| 120 | + namespace: 649330b6-c2d7-4edc-be8e-8a54df9eb385 |
| 121 | + sync: |
| 122 | + websocket: |
| 123 | + urls: false |
| 124 | + apollo: |
| 125 | + appId: shenyu |
| 126 | + meta: http://apollo-config-service:8080 |
| 127 | + env: DEV |
| 128 | + clusterName: default |
| 129 | + namespace: application |
| 130 | + accessKey: ${APOLLO_ACCESS_KEY:} |
| 131 | +``` |
| 132 | +
|
| 133 | +The portal OpenAPI token and config-service access key serve different APIs. |
| 134 | +Ensure the publishing app, environment, cluster and Apollo namespace match the reader. |
| 135 | +The preserved reader calls Apollo `ConfigService.getAppConfig()`, so the example uses |
| 136 | +`application`. This migration does not add arbitrary namespace selection. |
| 137 | +The ShenYu namespace ID is a separate tenant prefix inside Apollo item keys. |
| 138 | +The Apollo client sets JVM-wide app/meta/cluster properties; preserve the existing |
| 139 | +process-level configuration when using sync and registry together. |
| 140 | + |
| 141 | +## Registry and SPI contract |
| 142 | + |
| 143 | +The external JAR continues to publish: |
| 144 | + |
| 145 | +```text |
| 146 | +META-INF/shenyu/org.apache.shenyu.registry.api.ShenyuInstanceRegisterRepository |
| 147 | +apollo=org.apache.shenyu.registry.apollo.ApolloInstanceRegisterRepository |
| 148 | +``` |
| 149 | + |
| 150 | +`ShenyuInstanceRegisterRepositoryFactory.loadRepository("apollo")` resolves that |
| 151 | +resource without any factory or core runtime change, and preserves the non-singleton provider. |
| 152 | +Registry configuration remains: |
| 153 | + |
| 154 | +```yaml |
| 155 | +shenyu: |
| 156 | + register: |
| 157 | + enabled: true |
| 158 | + registerType: apollo |
| 159 | + serverLists: http://apollo-config-service:8080 |
| 160 | + props: |
| 161 | + appId: shenyu |
| 162 | + portalUrl: http://apollo-portal:8070 |
| 163 | + token: ${APOLLO_OPENAPI_TOKEN} |
| 164 | + env: DEV |
| 165 | + clusterName: default |
| 166 | + namespace: application |
| 167 | +``` |
| 168 | + |
| 169 | +SDK discovery uses the same `apollo` type and registry settings via its existing SDK |
| 170 | +configuration; it does not replace backend HTTP annotation/API registration. |
| 171 | +Instance registration writes persistent portal items and publishes the namespace. |
| 172 | +Existing shutdown removes listeners; it does not deregister persistent instance items. |
| 173 | +Preserve that behavior during migration and apply your existing instance-removal procedure. |
| 174 | + |
| 175 | +## Stored keys and shared compatibility shim |
| 176 | + |
| 177 | +| Data | Existing Apollo item key | |
| 178 | +| --- | --- | |
| 179 | +| Plugin | `<shenyuNamespace>.plugin.<pluginName>` | |
| 180 | +| Selector | `<shenyuNamespace>.selector.<pluginName>.<selectorId>` | |
| 181 | +| Rule | `<shenyuNamespace>.rule.<pluginName>.<selectorId>.<ruleId>` | |
| 182 | +| Authentication | `<shenyuNamespace>.auth.<appKey>` | |
| 183 | +| Metadata | `<shenyuNamespace>.meta.<metadataId>` | |
| 184 | +| Proxy selector | `<shenyuNamespace>.proxy.selector.<pluginName>.<selectorId>` | |
| 185 | +| Discovery upstream | `<shenyuNamespace>.discovery.<pluginName>.<selectorId>` | |
| 186 | +| Instance | `/shenyu/register/instance/<appName>/<host>:<port>` | |
| 187 | + |
| 188 | +The existing `.list` index items under each category/group are retained alongside the data keys. |
| 189 | +JSON DTOs, key prefixes, namespace IDs and the `apollo` type remain unchanged. |
| 190 | +`org.apache.shenyu.common.constant.ApolloPathConstants` stays in core as a small |
| 191 | +constants/path compatibility shim with no Apollo SDK dependency. Do not duplicate that |
| 192 | +class in store JARs or migrate/delete existing keyspaces as part of this transfer. |
| 193 | + |
| 194 | +The client versions remain `apollo-client`, `apollo-openapi` and `apollo-core` `2.1.0`. |
| 195 | +Source and the Apollo clients are Apache-2.0; preserve licenses when assembling custom packages. |
| 196 | +Existing unit tests, real Apollo `DefaultConfig` listener filtering tests and starter |
| 197 | +configuration tests move with their modules. Those tests do not claim a full live Apollo |
| 198 | +portal/config-service deployment; validate your staging deployment before production cutover. |
| 199 | + |
| 200 | +## Upgrade and rollback |
| 201 | + |
| 202 | +1. After publication and release gates pass, back up the Admin database and Apollo |
| 203 | + application/namespace configuration, recording exact core/store versions and deployed JARs. |
| 204 | +2. Verify the external artifacts in staging using unchanged namespace, endpoints, tokens, |
| 205 | + keys and registry properties. Check initial sync, create/update/delete and instance updates. |
| 206 | +3. Roll Admin and gateways with complete external dependency closures, then confirm |
| 207 | + subsequent changes propagate and existing instance discovery still works. |
| 208 | +4. Retain the last in-tree release for the announced rollback window. To roll back, |
| 209 | + restore its images/JARs and configuration and remove the external Apollo versions. |
| 210 | + Reuse the same Admin database and Apollo keyspace; do not clear either during rollback. |
0 commit comments