Skip to content

OWLS-84881 better handle long domainUID #1979

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 28 commits into from
Oct 15, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a7f808b
add limits to generated resource names
doxiao Oct 5, 2020
efc37f9
work in progress
doxiao Oct 6, 2020
ba0b808
get server and cluster info from introspector's results
doxiao Oct 7, 2020
a8f993f
new configuration, validation, and unit tests
doxiao Oct 8, 2020
f70ee23
minor change
doxiao Oct 8, 2020
8eac0f0
Merge remote-tracking branch 'origin/develop' into OWLS-84661-long-do…
doxiao Oct 8, 2020
92ba856
fix operator chart validation
doxiao Oct 9, 2020
6cfb6ad
fix chart validation
doxiao Oct 9, 2020
c33dc78
fix hard-coded external service name suffix in integration tests
doxiao Oct 12, 2020
356a9ea
fix more integration test failures
doxiao Oct 12, 2020
7a7dd1f
clean up
doxiao Oct 12, 2020
56b5656
minor doc fixwq
doxiao Oct 12, 2020
8cc643f
Revert "minor doc fixwq"
doxiao Oct 12, 2020
2b8ef85
minor doc fix
doxiao Oct 12, 2020
489b83f
minor fix to test
doxiao Oct 13, 2020
3ffb51f
clean up test constants
doxiao Oct 13, 2020
fe5c03f
minor doc edits based on review comments
doxiao Oct 13, 2020
d305fc4
improve error msg and remove hard-coded suffixes from doc and samples
doxiao Oct 13, 2020
13f69bc
cleanup
doxiao Oct 13, 2020
acdaef1
change the legal checks based on Ryan's suggestion
doxiao Oct 14, 2020
2a61b85
add cluster size padding validation
doxiao Oct 15, 2020
1913258
minor changes to helm validation
doxiao Oct 15, 2020
a6c0a97
only reserve spaces for cluster size wqsmaller than 100
doxiao Oct 15, 2020
ae8afad
one more unit test case
doxiao Oct 15, 2020
65b2bd1
minor changes
doxiao Oct 15, 2020
8e06863
Merge remote-tracking branch 'origin/develop' into OWLS-84661-long-do…
doxiao Oct 15, 2020
20b6964
minor doc change
doxiao Oct 15, 2020
cb14ac4
change a method name
doxiao Oct 15, 2020
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
Prev Previous commit
Next Next commit
clean up
  • Loading branch information
doxiao committed Oct 12, 2020
commit 7a7dd1fba5ad29fc6dc0254e51e7709c97bed7ff
4 changes: 2 additions & 2 deletions operator/src/main/java/oracle/kubernetes/operator/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ private static boolean isDeprecatedDedicated() {
public static String getIntrospectorJobNameSuffix() {
return Optional.ofNullable(tuningAndConfig()
.get(LegalNames.INTROSPECTOR_JOB_NAME_SUFFIX_PARAM))
.orElse(LegalNames.DOMAIN_INTROSPECTOR_JOB_SUFFIX);
.orElse(LegalNames.DEFAULT_INTROSPECTOR_JOB_NAME_SUFFIX);
}

/**
Expand All @@ -580,7 +580,7 @@ public static String getIntrospectorJobNameSuffix() {
public static String getExternalServiceNameSuffix() {
return Optional.ofNullable(tuningAndConfig()
.get(LegalNames.EXTERNAL_SERVICE_NAME_SUFFIX_PARAM))
.orElse(LegalNames.EXTERNAL_SERVICE_SUFFIX);
.orElse(LegalNames.DEFAULT_EXTERNAL_SERVICE_NAME_SUFFIX);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
import oracle.kubernetes.operator.watcher.WatchListener;
import oracle.kubernetes.operator.work.Step;

import static oracle.kubernetes.operator.helpers.LegalNames.DOMAIN_INTROSPECTOR_JOB_SUFFIX;

/**
* Watches for changes to pods.
*/
Expand Down Expand Up @@ -163,7 +161,7 @@ public void receivedResponse(Watch.Response<V1Pod> item) {
switch (item.type) {
case "ADDED":
case "MODIFIED":
if (getPodName(pod).contains(DOMAIN_INTROSPECTOR_JOB_SUFFIX) && isFailed(pod)) {
if (getPodName(pod).contains(Main.Namespaces.getIntrospectorJobNameSuffix()) && isFailed(pod)) {
LOGGER.info(MessageKeys.INTROSPECTOR_POD_FAILED, getPodName(pod), getPodNamespace(pod), pod.getStatus());
}
copyOf(getOnModifiedCallbacks(getPodName(pod))).forEach(c -> c.accept(pod));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
/** A class to create DNS-1123 legal names for Kubernetes objects. */
public class LegalNames {

public static final String EXTERNAL_SERVICE_SUFFIX = "-ext";
public static final String DEFAULT_EXTERNAL_SERVICE_NAME_SUFFIX = "-ext";
private static final String SERVER_PATTERN = "%s-%s";
private static final String CLUSTER_SERVICE_PATTERN = "%s-cluster-%s";
public static final String DOMAIN_INTROSPECTOR_JOB_SUFFIX = "-introspector";
public static final String DEFAULT_INTROSPECTOR_JOB_NAME_SUFFIX = "-introspector";
private static final String DOMAIN_INTROSPECTOR_JOB_PATTERN = "%s%s";
private static final String EXTERNAL_SERVICE_PATTERN = "%s-%s%s";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
import oracle.kubernetes.operator.ProcessingConstants;
import oracle.kubernetes.operator.helpers.LegalNames;
import oracle.kubernetes.operator.helpers.SecretType;
import oracle.kubernetes.operator.logging.LoggingFacade;
import oracle.kubernetes.operator.logging.LoggingFactory;
import oracle.kubernetes.operator.wlsconfig.WlsDomainConfig;
import oracle.kubernetes.operator.wlsconfig.WlsServerConfig;
import oracle.kubernetes.operator.work.Packet;
Expand Down Expand Up @@ -116,8 +114,6 @@ public class Domain implements KubernetesObject {
@Description("The current status of the operation of the WebLogic domain. Updated automatically by the operator.")
private DomainStatus status;

private static final LoggingFacade LOGGER = LoggingFactory.getLogger("Operator", "Operator");

@SuppressWarnings({"rawtypes"})
static List sortOrNull(List list) {
return sortOrNull(list, null);
Expand Down Expand Up @@ -664,9 +660,6 @@ List<String> getValidationFailures(KubernetesResourceLookup kubernetesResources)

private void verifyIntrospectorJobName() {
// K8S adds a 5 character suffix to an introspector job name
LOGGER.fine("XXX verifyIntrospectorJobName: domain UID = " + getDomainUid()
+ " spec = " + getSpec()
+ "generatedName = " + LegalNames.toJobIntrospectorName(getDomainUid()));
if (LegalNames.toJobIntrospectorName(getDomainUid()).length()
> LegalNames.LEGAL_DNS_LABEL_NAME_MAX_LENGTH - 5) {
failures.add(DomainValidationMessages.exceedMaxIntrospectorJobName(getDomainUid()));
Expand Down Expand Up @@ -706,19 +699,13 @@ private void checkGeneratedExternalServiceName(String adminServerName) {
}

private void checkGeneratedServerServiceName(String serverName) {
LOGGER.fine("XXX checkGeneratedServerServiceName: domain UID = " + getDomainUid()
+ " serverName = " + serverName
+ "generatedName = " + LegalNames.toServerServiceName(getDomainUid(), serverName));
if (LegalNames.toServerServiceName(getDomainUid(), serverName).length()
> LegalNames.LEGAL_DNS_LABEL_NAME_MAX_LENGTH) {
failures.add(DomainValidationMessages.exceedMaxServerServiceName(getDomainUid(), serverName));
}
}

private void checkGeneratedClusterServiceName(String clusterName) {
LOGGER.fine("XXX checkGeneratedServerServiceName: domain UID = " + getDomainUid()
+ " clusterName = " + clusterName
+ "generatedName = " + LegalNames.toServerServiceName(getDomainUid(), clusterName));
if (LegalNames.toClusterServiceName(getDomainUid(), clusterName).length()
> LegalNames.LEGAL_DNS_LABEL_NAME_MAX_LENGTH) {
failures.add(DomainValidationMessages.exceedMaxClusterServiceName(getDomainUid(), clusterName));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

import static oracle.kubernetes.operator.LabelConstants.CREATEDBYOPERATOR_LABEL;
import static oracle.kubernetes.operator.LabelConstants.DOMAINUID_LABEL;
import static oracle.kubernetes.operator.helpers.LegalNames.DOMAIN_INTROSPECTOR_JOB_SUFFIX;
import static oracle.kubernetes.operator.helpers.LegalNames.DEFAULT_INTROSPECTOR_JOB_NAME_SUFFIX;
import static oracle.kubernetes.operator.logging.MessageKeys.INTROSPECTOR_POD_FAILED;
import static oracle.kubernetes.utils.LogMatcher.containsInfo;
import static org.hamcrest.Matchers.both;
Expand Down Expand Up @@ -123,7 +123,7 @@ private V1Pod createPod() {
}

private V1Pod createIntrospectorPod() {
return new V1Pod().metadata(new V1ObjectMeta().namespace(NS).name(NAME + DOMAIN_INTROSPECTOR_JOB_SUFFIX));
return new V1Pod().metadata(new V1ObjectMeta().namespace(NS).name(NAME + DEFAULT_INTROSPECTOR_JOB_NAME_SUFFIX));
}

@Test
Expand Down