Use names with dash for k8s, but not for directories.

This commit is contained in:
Michael Lipp 2023-08-09 21:56:30 +02:00
parent eea4afac72
commit 5d5b0c07c5
3 changed files with 7 additions and 7 deletions

View file

@ -24,7 +24,7 @@ package org.jdrupes.vmoperator.manager;
public class Constants {
/** The Constant VM_OP_NAME. */
public static final String VM_OP_NAME = "vmoperator";
public static final String VM_OP_NAME = "vm-operator";
/** The Constant VM_OP_GROUP. */
public static final String VM_OP_GROUP = "vmoperator.jdrupes.org";
@ -33,7 +33,7 @@ public class Constants {
public static final String VM_OP_KIND_VM = "VirtualMachine";
/** The Constant APP_NAME. */
public static final String APP_NAME = "vmrunner";
public static final String APP_NAME = "vm-runner";
/** The Constant STATE_RUNNING. */
public static final String STATE_RUNNING = "Running";

View file

@ -63,7 +63,7 @@ public class Manager extends Component {
// Configuration store with file in /etc/opt (default)
File config = new File(cmdLine.getOptionValue('c',
"/etc/opt/" + VM_OP_NAME + "/config.yaml"));
"/etc/opt/" + VM_OP_NAME.replace("-", "") + "/config.yaml"));
// Don't rely on night config to produce a good exception
// for this simple case
if (!Files.isReadable(config.toPath())) {
@ -86,8 +86,8 @@ public class Manager extends Component {
static {
try {
InputStream props;
var path
= FsdUtils.findConfigFile(VM_OP_NAME, "logging.properties");
var path = FsdUtils.findConfigFile(VM_OP_NAME.replace("-", ""),
"logging.properties");
if (path.isPresent()) {
props = Files.newInputStream(path.get());
} else {

View file

@ -118,8 +118,8 @@ public class VmWatcher extends Component {
ListOptions opts = new ListOptions();
opts.setLabelSelector(
"app.kubernetes.io/managed-by=vmoperator,"
+ "app.kubernetes.io/name=vmrunner");
"app.kubernetes.io/managed-by=" + Constants.VM_OP_NAME + ","
+ "app.kubernetes.io/name=" + Constants.APP_NAME);
for (String resource : List.of("apps/v1/statefulsets",
"v1/configmaps", "v1/secrets")) {
var resParts = new LinkedList<>(List.of(resource.split("/")));