Skip to content

Split MII zips across Config Maps #2095

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,8 @@ when `spec.logHome` is configured and `spec.logHomeEnabled` is true.
* The operator runtime:
* Reads the expanded configuration overrides files or errors from the introspector.
* And, if the introspector reported no errors, it:
* Puts configuration overrides files in a ConfigMap named `DOMAIN_UID-weblogic-domain-introspect-cm`.
* Mounts this ConfigMap into the WebLogic Server instance Pods.
* Puts configuration overrides files in one or more ConfigMaps whose names start with `DOMAIN_UID-weblogic-domain-introspect-cm`.
* Mounts these ConfigMaps into the WebLogic Server instance Pods.
* Otherwise, if the introspector reported errors, it:
* Logs warning, error, or severe messages.
* Will not start WebLogic Server instance Pods; however, any already running Pods are preserved.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ When you deploy a Model in Image Domain YAML file:
- Packages the domain home and passes it to the operator.

- After the introspector job completes:
- The operator creates a ConfigMap named `DOMAIN_UID-weblogic-domain-introspect-cm` and puts the packaged domain home in it.
- The operator creates a ConfigMap named `DOMAIN_UID-weblogic-domain-introspect-cm` (possibly with some additional maps distinguished serial names) and puts the packaged domain home in it.
- The operator subsequently boots your domain's WebLogic Server pods.
- The pods will obtain their domain home from the ConfigMap.

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<version>3.2.0</version>
</parent>

<artifactId>jsonschema-maven-plugin</artifactId>
<artifactId>operator-build-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
<name>jsonschema-maven-plugin Maven Mojo</name>
<name>Operator Build Maven Plugin</name>

<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.util.Map;
import java.util.Optional;

import oracle.kubernetes.mojosupport.FileSystem;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
Expand All @@ -26,12 +27,21 @@
public class JsonSchemaMojo extends AbstractMojo {

private static final String DOT = "\\.";

@SuppressWarnings("FieldMayBeFinal") // must be non-final so unit tests can set it
private static Main main = new MainImpl();

@SuppressWarnings("FieldMayBeFinal") // must be non-final so unit tests can set it
private static FileSystem fileSystem = FileSystem.LIVE_FILE_SYSTEM;

@SuppressWarnings("unused") // set by Maven
@Parameter(defaultValue = "${project.compileClasspathElements}", readonly = true, required = true)
private List<String> compileClasspathElements;

@SuppressWarnings("unused") // set by Maven
@Parameter(defaultValue = "${project.build.outputDirectory}/schema")
private String targetDir;

@Parameter private String kubernetesVersion;
@Parameter private final List<ExternalSchema> externalSchemas = Collections.emptyList();
@Parameter(required = true)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Copyright (c) 2020, Oracle Corporation and/or its affiliates.
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.

package oracle.kubernetes.mojo.shunit2;

import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
* Utilities related to ANSI-formatting of strings sent to a terminal.
*/
class AnsiUtils {

private static final Pattern ANSI_ESCAPE_CHARS = Pattern.compile("(\\x9B|\\x1B\\[)[0-?]*[ -\\/]*[@-~]");

static String withoutAnsiEscapeChars(String input) {
final Matcher matcher = ANSI_ESCAPE_CHARS.matcher(input);
return matcher.replaceAll("");
}

public static AnsiFormatter createFormatter(Format... formats) {
return new AnsiFormatter(formats);
}

static class AnsiFormatter {

private final Format[] formats;

AnsiFormatter(Format... formats) {
this.formats = formats;
}

String format(String string) {
return startCodes() + string + endCodes();
}

private String startCodes() {
return formats.length == 0 ? "" : sequence(Arrays.stream(formats).map(Format::getFormat).toArray(String[]::new));
}

private String endCodes() {
return formats.length == 0 ? "" : sequence("0");
}

String sequence(String... formatCodes) {
return "\u001B[" + String.join(";", formatCodes) + "m";
}
}

static enum Format {
BOLD(1), RED_FG(31), BLUE_FG(34), GREEN_FG(32);

private final String format;
Format(int format) {
this.format = Integer.toString(format);
}

public String getFormat() {
return format;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// Copyright (c) 2020, Oracle Corporation and/or its affiliates.
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.

package oracle.kubernetes.mojo.shunit2;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.function.BiFunction;
import javax.annotation.Nonnull;

/**
* A wrapper for ProcessBuilder, in order to allow unit testing.
*/
class BashProcessBuilder {

private final String commands;
private final Map<String,String> environmentVariables = new HashMap<>();
private final BiFunction<String,Map<String,String>,Process> processBiFunction;

/**
* Constructs a builder.
* @param commands the commands to be issued to a new bash process
*/
BashProcessBuilder(String commands) {
this(BashProcessBuilder::createProcess, commands);
}

BashProcessBuilder(BiFunction<String, Map<String, String>, Process> processBiFunction, String commands) {
this.commands = commands;
this.processBiFunction = processBiFunction;
}

/**
* Updates the builder by adding an environment variable to be set in the process.
* @param name the environment variable name
* @param value the environment variable value
*/
void addEnvironmentVariable(String name, String value) {
environmentVariables.put(name, value);
}

/**
* Starts the specified process and returns a Process object to control it.
*/
public Process build() {
return processBiFunction.apply(commands, environmentVariables);
}

@Nonnull
protected static Process createProcess(String command, Map<String, String> environmentVariables) {
try {
ProcessBuilder pb = new ProcessBuilder("bash", command);
pb.environment().putAll(environmentVariables);
return pb.start();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
Loading