|
2 | 2 |
|
3 | 3 | import java.net.ConnectException;
|
4 | 4 | import java.util.ArrayList;
|
5 |
| -import java.util.Collections; |
6 | 5 | import java.util.HashMap;
|
7 | 6 | import java.util.List;
|
8 | 7 | import java.util.Map;
|
@@ -168,10 +167,6 @@ static class ControllerManager implements LifecycleAware {
|
168 | 167 | private final Map<String, ConfiguredController> controllers = new HashMap<>();
|
169 | 168 | private boolean started = false;
|
170 | 169 |
|
171 |
| - synchronized Map<String, ConfiguredController> getControllers() { |
172 |
| - return Collections.unmodifiableMap(controllers); |
173 |
| - } |
174 |
| - |
175 | 170 | public synchronized void shouldStart() {
|
176 | 171 | if (started) {
|
177 | 172 | return;
|
@@ -202,15 +197,13 @@ public synchronized void stop() {
|
202 | 197 | public synchronized void add(ConfiguredController configuredController) {
|
203 | 198 | final var configuration = configuredController.getConfiguration();
|
204 | 199 | final var crdName = configuration.getCRDName();
|
205 |
| - final var version = configuration.getCustomResourceVersion(); |
206 |
| - final var key = crdName + "/" + version; |
207 |
| - final var existing = controllers.get(key); |
| 200 | + final var existing = controllers.get(crdName); |
208 | 201 | if (existing != null) {
|
209 | 202 | throw new OperatorException("Cannot register controller '" + configuration.getName()
|
210 |
| - + "': another controller (" + existing.getConfiguration().getName() |
211 |
| - + ") is already registered for CRD '" + crdName + "' (version: " + version + ")"); |
| 203 | + + "': another controller named '" + existing.getConfiguration().getName() |
| 204 | + + "' is already registered for CRD '" + crdName + "'"); |
212 | 205 | }
|
213 |
| - this.controllers.put(key, configuredController); |
| 206 | + this.controllers.put(crdName, configuredController); |
214 | 207 | if (started) {
|
215 | 208 | configuredController.start();
|
216 | 209 | }
|
|
0 commit comments