Fix warnings.
Some checks failed
ci/woodpecker/push/build Pipeline was successful
CodeQL / Analyze (push) Has been cancelled
Java CI with Gradle / build (push) Has been cancelled
Deploy Jekyll site to Pages / build (push) Has been cancelled
Deploy Jekyll site to Pages / deploy (push) Has been cancelled
Some checks failed
ci/woodpecker/push/build Pipeline was successful
CodeQL / Analyze (push) Has been cancelled
Java CI with Gradle / build (push) Has been cancelled
Deploy Jekyll site to Pages / build (push) Has been cancelled
Deploy Jekyll site to Pages / deploy (push) Has been cancelled
This commit is contained in:
parent
470c266157
commit
c6c6358426
74 changed files with 56 additions and 215 deletions
|
|
@ -51,7 +51,6 @@ import org.jgrapes.util.events.ConfigurationUpdate;
|
|||
* @param <O> the object type for the context
|
||||
* @param <L> the object list type for the context
|
||||
*/
|
||||
@SuppressWarnings({ "PMD.DataflowAnomalyAnalysis" })
|
||||
public abstract class AbstractMonitor<O extends KubernetesObject,
|
||||
L extends KubernetesListObject, C extends Channel> extends Component {
|
||||
|
||||
|
|
@ -181,7 +180,6 @@ public abstract class AbstractMonitor<O extends KubernetesObject,
|
|||
* @param event the event
|
||||
*/
|
||||
@Handler(priority = 10)
|
||||
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
|
||||
public void onStart(Start event) {
|
||||
try {
|
||||
// Get namespace
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ import org.yaml.snakeyaml.constructor.SafeConstructor;
|
|||
/**
|
||||
* Delegee for reconciling the config map
|
||||
*/
|
||||
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
|
||||
/* default */ class ConfigMapReconciler {
|
||||
|
||||
protected final Logger logger = Logger.getLogger(getClass().getName());
|
||||
|
|
@ -81,7 +80,6 @@ import org.yaml.snakeyaml.constructor.SafeConstructor;
|
|||
* @throws TemplateException the template exception
|
||||
* @throws ApiException the API exception
|
||||
*/
|
||||
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
|
||||
public void reconcile(Map<String, Object> model, VmChannel channel,
|
||||
boolean modelChanged)
|
||||
throws IOException, TemplateException, ApiException {
|
||||
|
|
@ -189,7 +187,6 @@ import org.yaml.snakeyaml.constructor.SafeConstructor;
|
|||
private final TemplateMethodModelEx adjustCloudInitMetaModel
|
||||
= new TemplateMethodModelEx() {
|
||||
@Override
|
||||
@SuppressWarnings("PMD.PreserveStackTrace")
|
||||
public Object exec(@SuppressWarnings("rawtypes") List arguments)
|
||||
throws TemplateModelException {
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ package org.jdrupes.vmoperator.manager;
|
|||
/**
|
||||
* Some constants.
|
||||
*/
|
||||
@SuppressWarnings("PMD.DataClass")
|
||||
public class Constants extends org.jdrupes.vmoperator.common.Constants {
|
||||
|
||||
/** The Constant STATE_RUNNING. */
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ import org.jgrapes.core.Channel;
|
|||
* of the pod running the VM in response to force an update of the files
|
||||
* in the pod that reflect the information from the secret.
|
||||
*/
|
||||
@SuppressWarnings({ "PMD.DataflowAnomalyAnalysis", "PMD.TooManyStaticImports" })
|
||||
public class DisplaySecretMonitor
|
||||
extends AbstractMonitor<V1Secret, V1SecretList, VmChannel> {
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@ import org.yaml.snakeyaml.constructor.SafeConstructor;
|
|||
/**
|
||||
* Delegee for reconciling the service
|
||||
*/
|
||||
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
|
||||
/* default */ class LoadBalancerReconciler {
|
||||
|
||||
private static final String LOAD_BALANCER_SERVICE = "loadBalancerService";
|
||||
|
|
@ -86,7 +85,7 @@ import org.yaml.snakeyaml.constructor.SafeConstructor;
|
|||
}
|
||||
|
||||
// Check if to be generated
|
||||
@SuppressWarnings({ "PMD.AvoidDuplicateLiterals", "unchecked" })
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
var lbsDef = Optional.of(model)
|
||||
.map(m -> (Map<String, Object>) m.get("reconciler"))
|
||||
.map(c -> c.get(LOAD_BALANCER_SERVICE)).orElse(Boolean.FALSE);
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ import org.jgrapes.webconsole.vuejs.VueJsConsoleWeblet;
|
|||
/**
|
||||
* The application class.
|
||||
*/
|
||||
@SuppressWarnings({ "PMD.DataflowAnomalyAnalysis", "PMD.ExcessiveImports" })
|
||||
@SuppressWarnings({ "PMD.ExcessiveImports" })
|
||||
public class Manager extends Component {
|
||||
|
||||
private static String version;
|
||||
|
|
@ -97,8 +97,8 @@ public class Manager extends Component {
|
|||
* @throws IOException Signals that an I/O exception has occurred.
|
||||
* @throws URISyntaxException
|
||||
*/
|
||||
@SuppressWarnings({ "PMD.TooFewBranchesForASwitchStatement",
|
||||
"PMD.NcssCount", "PMD.ConstructorCallsOverridableMethod" })
|
||||
@SuppressWarnings({ "PMD.NcssCount",
|
||||
"PMD.ConstructorCallsOverridableMethod" })
|
||||
public Manager(CommandLine cmdLine) throws IOException, URISyntaxException {
|
||||
super(new NamedChannel("manager"));
|
||||
// Prepare component tree
|
||||
|
|
@ -217,7 +217,6 @@ public class Manager extends Component {
|
|||
* @param event the event
|
||||
*/
|
||||
@Handler
|
||||
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
|
||||
public void onConfigurationUpdate(ConfigurationUpdate event) {
|
||||
event.structured(componentPath()).ifPresent(c -> {
|
||||
if (c.containsKey("clusterName")) {
|
||||
|
|
@ -291,7 +290,6 @@ public class Manager extends Component {
|
|||
* @param args the arguments
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
// Instance logger is not available yet.
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ import org.yaml.snakeyaml.constructor.SafeConstructor;
|
|||
/**
|
||||
* Delegee for reconciling the pod.
|
||||
*/
|
||||
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
|
||||
/* default */ class PodReconciler {
|
||||
|
||||
protected final Logger logger = Logger.getLogger(getClass().getName());
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ import org.jgrapes.core.events.Attached;
|
|||
* {@link VmPoolChanged} events fired on a special pipeline to
|
||||
* avoid concurrent change informations.
|
||||
*/
|
||||
@SuppressWarnings({ "PMD.DataflowAnomalyAnalysis", "PMD.ExcessiveImports" })
|
||||
public class PoolMonitor extends
|
||||
AbstractMonitor<K8sDynamicModel, K8sDynamicModels, Channel> {
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ import org.yaml.snakeyaml.constructor.SafeConstructor;
|
|||
/**
|
||||
* Delegee for reconciling the stateful set (effectively the pod).
|
||||
*/
|
||||
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
|
||||
/* default */ class PvcReconciler {
|
||||
|
||||
protected final Logger logger = Logger.getLogger(getClass().getName());
|
||||
|
|
@ -75,7 +74,7 @@ import org.yaml.snakeyaml.constructor.SafeConstructor;
|
|||
* @throws TemplateException the template exception
|
||||
* @throws ApiException the api exception
|
||||
*/
|
||||
@SuppressWarnings({ "PMD.AvoidDuplicateLiterals", "unchecked" })
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
public void reconcile(VmDefinition vmDef, Map<String, Object> model,
|
||||
VmChannel channel, boolean specChanged)
|
||||
throws IOException, TemplateException, ApiException {
|
||||
|
|
|
|||
|
|
@ -137,15 +137,13 @@ import org.jgrapes.util.events.ConfigurationUpdate;
|
|||
*
|
||||
* @see org.jdrupes.vmoperator.manager.DisplaySecretReconciler
|
||||
*/
|
||||
@SuppressWarnings({ "PMD.DataflowAnomalyAnalysis",
|
||||
"PMD.AvoidDuplicateLiterals" })
|
||||
@SuppressWarnings({ "PMD.AvoidDuplicateLiterals" })
|
||||
public class Reconciler extends Component {
|
||||
|
||||
/** The Constant mapper. */
|
||||
@SuppressWarnings("PMD.FieldNamingConventions")
|
||||
protected static final ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
@SuppressWarnings("PMD.SingularField")
|
||||
private final Configuration fmConfig;
|
||||
private final ConfigMapReconciler cmReconciler;
|
||||
private final DisplaySecretReconciler dsReconciler;
|
||||
|
|
@ -203,7 +201,6 @@ public class Reconciler extends Component {
|
|||
* @throws IOException Signals that an I/O exception has occurred.
|
||||
*/
|
||||
@Handler
|
||||
@SuppressWarnings("PMD.ConfusingTernary")
|
||||
public void onVmResourceChanged(VmResourceChanged event, VmChannel channel)
|
||||
throws ApiException, TemplateException, IOException {
|
||||
// Ownership relationships takes care of deletions
|
||||
|
|
@ -338,7 +335,6 @@ public class Reconciler extends Component {
|
|||
private final TemplateMethodModelEx formatMemoryModel
|
||||
= new TemplateMethodModelEx() {
|
||||
@Override
|
||||
@SuppressWarnings("PMD.PreserveStackTrace")
|
||||
public Object exec(@SuppressWarnings("rawtypes") List arguments)
|
||||
throws TemplateModelException {
|
||||
var arg = arguments.get(0);
|
||||
|
|
@ -368,8 +364,7 @@ public class Reconciler extends Component {
|
|||
private final TemplateMethodModelEx imgageLocationModel
|
||||
= new TemplateMethodModelEx() {
|
||||
@Override
|
||||
@SuppressWarnings({ "PMD.PreserveStackTrace",
|
||||
"PMD.AvoidLiteralsInIfCondition" })
|
||||
@SuppressWarnings({ "PMD.AvoidLiteralsInIfCondition" })
|
||||
public Object exec(@SuppressWarnings("rawtypes") List arguments)
|
||||
throws TemplateModelException {
|
||||
var image = ((SimpleScalar) arguments.get(0)).getAsString();
|
||||
|
|
@ -394,7 +389,6 @@ public class Reconciler extends Component {
|
|||
private final TemplateMethodModelEx toJsonModel
|
||||
= new TemplateMethodModelEx() {
|
||||
@Override
|
||||
@SuppressWarnings("PMD.PreserveStackTrace")
|
||||
public Object exec(@SuppressWarnings("rawtypes") List arguments)
|
||||
throws TemplateModelException {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -71,7 +71,6 @@ import org.jgrapes.core.annotation.Handler;
|
|||
* event pipeline should be used for all events related to changes of
|
||||
* a particular VM.
|
||||
*/
|
||||
@SuppressWarnings({ "PMD.DataflowAnomalyAnalysis", "PMD.ExcessiveImports" })
|
||||
public class VmMonitor extends
|
||||
AbstractMonitor<VmDefinition, VmDefinitions, VmChannel> {
|
||||
|
||||
|
|
@ -107,7 +106,6 @@ public class VmMonitor extends
|
|||
purge();
|
||||
}
|
||||
|
||||
@SuppressWarnings("PMD.CognitiveComplexity")
|
||||
private void purge() throws ApiException {
|
||||
// Get existing CRs (VMs)
|
||||
var known = K8sDynamicStub.list(client(), context(), namespace())
|
||||
|
|
@ -192,7 +190,6 @@ public class VmMonitor extends
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
|
||||
private void addExtraData(VmDefinition vmDef, VmDefinition prevState) {
|
||||
var extra = new VmExtraData(vmDef);
|
||||
var prevExtra = Optional.ofNullable(prevState).map(VmDefinition::extra);
|
||||
|
|
@ -241,7 +238,6 @@ public class VmMonitor extends
|
|||
.ofNullable(pod.getSpec().getNodeName()).orElse("");
|
||||
logger.finer(() -> "Adding node name " + nodeName
|
||||
+ " to VM info for " + vmDef.name());
|
||||
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
|
||||
var addrs = new ArrayList<String>();
|
||||
Optional.ofNullable(pod.getStatus().getPodIPs())
|
||||
.orElse(Collections.emptyList()).stream()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue