refactor(kubernetes): add missing to non-generated code
* refactor(kubernetes): add missing to non-generated code
We cannot yet enable the error-prone warnings as there are a few dozen classes with Lombok-generated getter overrides that I'll handle in a followup PR.
* fix(kubernetes): run spotlessApply
MODIFY
clouddriver-kubernetes/src/main/java/com/netflix/spinnaker/clouddriver/kubernetes/caching/agent/KubernetesCoreCachingAgent.java
clouddriver-kubernetes/src/main/java/com/netflix/spinnaker/clouddriver/kubernetes/caching/agent/KubernetesCoreCachingAgent.java
@@ -41,6 +41,7 @@ public class KubernetesCoreCachingAgent extends KubernetesV2OnDemandCachingAgent
super(namedAccountCredentials, objectMapper, registry, agentIndex, agentCount, agentInterval);
}
+ @Override
public Collection<AgentDataType> getProvidedDataTypes() {
// The ARTIFACT kind is deprecated; no new entries of this type will be created. We are leaving
// it in the authoritative types for now so that existing entries get evicted.
@@ -72,6 +73,7 @@ public class KubernetesCoreCachingAgent extends KubernetesV2OnDemandCachingAgent
* these requests, and have it return all pending on-demand refresh requests (not just ones
* related to its slice of namespaces).
*/
+ @Override
protected boolean handlePendingOnDemandRequests() {
return agentIndex == 0;
}

MODIFY
clouddriver-kubernetes/src/main/java/com/netflix/spinnaker/clouddriver/kubernetes/caching/agent/KubernetesUnregisteredCustomResourceCachingAgent.java
clouddriver-kubernetes/src/main/java/com/netflix/spinnaker/clouddriver/kubernetes/caching/agent/KubernetesUnregisteredCustomResourceCachingAgent.java
@@ -40,6 +40,7 @@ public class KubernetesUnregisteredCustomResourceCachingAgent
super(namedAccountCredentials, objectMapper, registry, agentIndex, agentCount, agentInterval);
}
+ @Override
public ImmutableSet<AgentDataType> getProvidedDataTypes() {
return primaryKinds().stream()
.map(k -> AUTHORITATIVE.forType(k.toString()))

MODIFY
clouddriver-kubernetes/src/main/java/com/netflix/spinnaker/clouddriver/kubernetes/caching/view/model/KubernetesV2Application.java
clouddriver-kubernetes/src/main/java/com/netflix/spinnaker/clouddriver/kubernetes/caching/view/model/KubernetesV2Application.java
@@ -28,6 +28,7 @@ public final class KubernetesV2Application implements Application {
private final String name;
private final Map<String, Set<String>> clusterNames;
+ @Override
public Map<String, String> getAttributes() {
return new ImmutableMap.Builder<String, String>().put("name", name).build();
}

MODIFY
clouddriver-kubernetes/src/main/java/com/netflix/spinnaker/clouddriver/kubernetes/model/KubernetesV2JobStatus.java
clouddriver-kubernetes/src/main/java/com/netflix/spinnaker/clouddriver/kubernetes/model/KubernetesV2JobStatus.java
@@ -57,6 +57,7 @@ public class KubernetesV2JobStatus implements JobStatus {
this.createdTime = job.getMetadata().getCreationTimestamp().getMillis();
}
+ @Override
public Map<String, String> getCompletionDetails() {
Map<String, String> details = new HashMap<>();
details.put("exitCode", this.exitCode != null ? this.exitCode.toString() : "");
@@ -66,6 +67,7 @@ public class KubernetesV2JobStatus implements JobStatus {
return details;
}
+ @Override
public JobState getJobState() {
V1JobStatus status = job.getStatus();
if (status == null) {

MODIFY
clouddriver-kubernetes/src/main/java/com/netflix/spinnaker/clouddriver/kubernetes/op/handler/CanUndoRollout.java
clouddriver-kubernetes/src/main/java/com/netflix/spinnaker/clouddriver/kubernetes/op/handler/CanUndoRollout.java
@@ -21,6 +21,7 @@ import com.netflix.spinnaker.clouddriver.kubernetes.description.manifest.Kuberne
import com.netflix.spinnaker.clouddriver.kubernetes.security.KubernetesCredentials;
public interface CanUndoRollout extends CanRollout {
+ @Override
KubernetesKind kind();
default void undoRollout(

MODIFY
clouddriver-kubernetes/src/main/java/com/netflix/spinnaker/clouddriver/kubernetes/op/handler/KubernetesHandler.java
clouddriver-kubernetes/src/main/java/com/netflix/spinnaker/clouddriver/kubernetes/op/handler/KubernetesHandler.java
@@ -51,6 +51,7 @@ public abstract class KubernetesHandler implements CanDeploy, CanDelete, CanPatc
public abstract int deployPriority();
+ @Override
@Nonnull
public abstract KubernetesKind kind();

MODIFY
clouddriver-kubernetes/src/main/java/com/netflix/spinnaker/clouddriver/kubernetes/op/job/KubernetesRunJobOperation.java
clouddriver-kubernetes/src/main/java/com/netflix/spinnaker/clouddriver/kubernetes/op/job/KubernetesRunJobOperation.java
@@ -55,6 +55,7 @@ public class KubernetesRunJobOperation
return TaskRepository.threadLocalTask.get();
}
+ @Override
public KubernetesRunJobDeploymentResult operate(List<KubernetesRunJobDeploymentResult> _unused) {
getTask().updateStatus(OP_NAME, "Running Kubernetes job...");
KubernetesManifest jobSpec = this.description.getManifest();

MODIFY
clouddriver-kubernetes/src/main/java/com/netflix/spinnaker/clouddriver/kubernetes/provider/view/KubernetesV2JobProvider.java
clouddriver-kubernetes/src/main/java/com/netflix/spinnaker/clouddriver/kubernetes/provider/view/KubernetesV2JobProvider.java
@@ -54,6 +54,7 @@ public class KubernetesV2JobProvider implements JobProvider<KubernetesV2JobStatu
this.manifestProvider = manifestProvider;
}
+ @Override
@Nullable
public KubernetesV2JobStatus collectJob(String account, String location, String id) {
Optional<V1Job> optionalJob = getKubernetesJob(account, location, id);
@@ -84,6 +85,7 @@ public class KubernetesV2JobProvider implements JobProvider<KubernetesV2JobStatu
return jobStatus;
}
+ @Override
@Nullable
public Map<String, Object> getFileContents(
String account, String location, String id, String containerName) {
@@ -104,6 +106,7 @@ public class KubernetesV2JobProvider implements JobProvider<KubernetesV2JobStatu
.orElse(null);
}
+ @Override
public void cancelJob(String account, String location, String id) {
throw new NotImplementedException(
"cancelJob is not implemented for the V2 Kubernetes provider");

MODIFY
clouddriver-kubernetes/src/main/java/com/netflix/spinnaker/clouddriver/kubernetes/security/KubernetesCredentials.java
clouddriver-kubernetes/src/main/java/com/netflix/spinnaker/clouddriver/kubernetes/security/KubernetesCredentials.java
@@ -212,6 +212,7 @@ public class KubernetesCredentials {
.build(key -> supplier.get());
}
+ @Override
public T get() {
return cache.get(CACHE_KEY);
}

refactor(kubernetes): add missing @Overrides to non-generated code (#4852)

* refactor(kubernetes): add missing @Overrides to non-generated code

We cannot yet enable the error-prone warnings as there are a few dozen classes with Lombok-generated getter overrides that I'll handle in a followup PR.

* fix(kubernetes): run spotlessApply

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>