|
9 | 9 | import io.fabric8.kubernetes.client.Watch;
|
10 | 10 | import io.fabric8.kubernetes.client.Watcher;
|
11 | 11 | import io.fabric8.kubernetes.client.WatcherException;
|
| 12 | +import lombok.extern.slf4j.Slf4j; |
| 13 | +import org.bouncycastle.util.io.pem.PemObject; |
| 14 | +import org.bouncycastle.util.io.pem.PemReader; |
| 15 | +import org.springframework.lang.NonNull; |
| 16 | +import org.springframework.scheduling.TaskScheduler; |
| 17 | +import org.springframework.stereotype.Service; |
| 18 | +import reactor.core.publisher.Flux; |
| 19 | +import reactor.core.publisher.Mono; |
| 20 | + |
12 | 21 | import java.io.ByteArrayInputStream;
|
13 | 22 | import java.io.Closeable;
|
14 | 23 | import java.io.IOException;
|
|
19 | 28 | import java.security.cert.X509Certificate;
|
20 | 29 | import java.time.Duration;
|
21 | 30 | import java.time.Instant;
|
22 |
| -import java.util.Base64; |
| 31 | +import java.util.*; |
23 | 32 | import java.util.Base64.Decoder;
|
24 |
| -import java.util.Collections; |
25 |
| -import java.util.HashSet; |
26 |
| -import java.util.Map; |
27 |
| -import java.util.Objects; |
28 |
| -import java.util.Set; |
29 | 33 | import java.util.concurrent.ConcurrentHashMap;
|
30 | 34 | import java.util.concurrent.ScheduledFuture;
|
31 |
| -import lombok.extern.slf4j.Slf4j; |
32 |
| -import org.bouncycastle.util.io.pem.PemObject; |
33 |
| -import org.bouncycastle.util.io.pem.PemReader; |
34 |
| -import org.springframework.lang.NonNull; |
35 |
| -import org.springframework.scheduling.TaskScheduler; |
36 |
| -import org.springframework.stereotype.Service; |
37 |
| -import reactor.core.publisher.Flux; |
38 |
| -import reactor.core.publisher.Mono; |
39 | 35 |
|
40 | 36 | @Service
|
41 | 37 | @Slf4j
|
@@ -142,9 +138,16 @@ public void checkCertRenewalsForSecret(@NonNull String secretName) {
|
142 | 138 | .anyMatch(ingressTLS -> Objects.equals(ingressTLS.getSecretName(), secretName)))
|
143 | 139 | )
|
144 | 140 | .flatMap(this::reconcileIngress)
|
| 141 | + .switchIfEmpty(Mono.error(MissingResourceException::new)) |
145 | 142 | .subscribe(secret -> {
|
146 |
| - }, throwable -> |
147 |
| - log.error("Failed to process cert renewals for secret={}", secretName, throwable) |
| 143 | + }, throwable -> { |
| 144 | + if (throwable instanceof MissingResourceException) { |
| 145 | + log.warn("No ingress(es) found using secret: {}", secretName); |
| 146 | + } |
| 147 | + else { |
| 148 | + log.error("Failed to process cert renewals for secret={}", secretName, throwable); |
| 149 | + } |
| 150 | + } |
148 | 151 | );
|
149 | 152 |
|
150 | 153 | }
|
|
0 commit comments