Skip to content

Commit a3d2491

Browse files
authored
Owls 105610 - Provide ability to specify the resources and java options for the introspector pod (#3914)
* Provide the ability to configure introspector server pod attributes.
1 parent ae1a51e commit a3d2491

33 files changed

+1007
-774
lines changed

common/src/main/java/oracle/kubernetes/common/logging/MessageKeys.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ public class MessageKeys {
276276
public static final String DOMAIN_REPLICAS_CANNOT_BE_HONORED_MULTIPLE_CLUSTERS = "WLSWH-0020";
277277
public static final String DOMAIN_REPLICAS_TOO_HIGH_MULTIPLE_CLUSTERS = "WLSWH-0021";
278278
public static final String CLUSTER_SCALE_REPLICAS_TOO_HIGH = "WLSWH-0022";
279+
public static final String UNSUPPORTED_INTRO_ENV_VARIABLES = "WLSWH-0023";
279280

280281
private MessageKeys() {
281282
}

common/src/main/resources/Operator.properties

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,4 +325,7 @@ WLSWH-0020=Change request to domain resource ''{0}'' cannot be honored because t
325325
WLSWH-0021=Change request to domain resource ''{0}'' causes the replica count of each cluster in ''{1}'' to exceed its cluster \
326326
size ''{2}'' respectively
327327
WLSWH-0022=Scale request to cluster resource ''{0}'' cannot be honored because the replica count would exceed the \
328-
cluster size ''{1}''
328+
cluster size ''{1}''
329+
WLSWH-0023=Unsupported introspector environment variable(s) {0} defined in ''introspector.serverPod.env'', \
330+
supported values are {1}
331+

documentation/domains/Cluster.json

Lines changed: 0 additions & 756 deletions
Large diffs are not rendered by default.

documentation/domains/Domain.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,10 @@
364364
"description": "Specifies whether the server .out file will be included in the Pod\u0027s log. Defaults to true.",
365365
"type": "boolean"
366366
},
367+
"introspector": {
368+
"description": "Lifecycle options for the Introspector Job Pod, including Java options, environment variables, and resources.",
369+
"$ref": "#/definitions/Introspector"
370+
},
367371
"clusters": {
368372
"description": "References to Cluster resources that describe the lifecycle options for all of the Managed Server members of a WebLogic cluster, including Java options, environment variables, additional Pod content, and the ability to explicitly start, stop, or restart cluster members. The Cluster resource must describe a cluster that already exists in the WebLogic domain configuration.",
369373
"type": "array",
@@ -564,6 +568,31 @@
564568
}
565569
}
566570
},
571+
"Introspector": {
572+
"type": "object",
573+
"properties": {
574+
"serverPod": {
575+
"description": "Customization affecting the generation of the Introspector Job Pod.",
576+
"$ref": "#/definitions/IntrospectorJobPod"
577+
}
578+
}
579+
},
580+
"IntrospectorJobPod": {
581+
"type": "object",
582+
"properties": {
583+
"resources": {
584+
"description": "Memory and CPU minimum requirements and limits for the Introspector Job Pod. See `kubectl explain pods.spec.containers.resources`.",
585+
"$ref": "https://github.com/garethr/kubernetes-json-schema/blob/master/v1.13.5/_definitions.json#/definitions/io.k8s.api.core.v1.ResourceRequirements"
586+
},
587+
"env": {
588+
"description": "A list of environment variables to set in the Introspector Job Pod container. More info: https://oracle.github.io/weblogic-kubernetes-operator/userguide/managing-domains/domain-resource/#jvm-memory-and-java-option-environment-variables. See `kubectl explain pods.spec.containers.env`.",
589+
"type": "array",
590+
"items": {
591+
"$ref": "https://github.com/garethr/kubernetes-json-schema/blob/master/v1.13.5/_definitions.json#/definitions/io.k8s.api.core.v1.EnvVar"
592+
}
593+
}
594+
}
595+
},
567596
"ManagedServer": {
568597
"type": "object",
569598
"properties": {

documentation/domains/Domain.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ The specification of the operation of the WebLogic domain. Required.
3131
| `imagePullPolicy` | string | The image pull policy for the WebLogic Server image. Legal values are Always, Never, and IfNotPresent. Defaults to Always if image ends in :latest; IfNotPresent, otherwise. |
3232
| `imagePullSecrets` | Array of [Local Object Reference](k8s1.13.5.md#local-object-reference) | A list of image pull Secrets for the WebLogic Server image. |
3333
| `includeServerOutInPodLog` | Boolean | Specifies whether the server .out file will be included in the Pod's log. Defaults to true. |
34+
| `introspector` | [Introspector](#introspector) | Lifecycle options for the Introspector Job Pod, including Java options, environment variables, and resources. |
3435
| `introspectVersion` | string | Changes to this field cause the operator to repeat its introspection of the WebLogic domain configuration. Repeating introspection is required for the operator to recognize changes to the domain configuration, such as adding a new WebLogic cluster or Managed Server instance, to regenerate configuration overrides, or to regenerate the WebLogic domain home when the `domainHomeSourceType` is `FromModel`. Introspection occurs automatically, without requiring change to this field, when servers are first started or restarted after a full domain shut down. For the `FromModel` `domainHomeSourceType`, introspection also occurs when a running server must be restarted because of changes to any of the fields listed here: https://oracle.github.io/weblogic-kubernetes-operator/userguide/managing-domains/domain-lifecycle/startup/#properties-that-cause-servers-to-be-restarted. The introspectVersion value must be a valid label value in Kubernetes. See also `domains.spec.configuration.overrideDistributionStrategy`. |
3536
| `livenessProbeCustomScript` | string | Full path of an optional liveness probe custom script for WebLogic Server instance pods. The existing liveness probe script `livenessProbe.sh` will invoke this custom script after the existing script performs its own checks. This element is optional and is for advanced usage only. Its value is not set by default. If the custom script fails with non-zero exit status, then pod will fail the liveness probe and Kubernetes will restart the container. If the script specified by this element value is not found, then it is ignored. |
3637
| `logHome` | string | The directory in a server's container in which to store the domain, Node Manager, server logs, server *.out, introspector .out, and optionally HTTP access log files if `httpAccessLogInLogHome` is true. Default is `/shared/logs/DOMAIN-UID`. Ignored if `logHomeEnabled` is false.See also `domains.spec.logHomeLayout`. |
@@ -104,6 +105,12 @@ The current status of the operation of the WebLogic domain. Updated automaticall
104105
| `volumeMounts` | Array of [Volume Mount](k8s1.13.5.md#volume-mount) | Volume mounts for fluentd container |
105106
| `watchIntrospectorLogs` | Boolean | Fluentd will watch introspector logs |
106107

108+
### Introspector
109+
110+
| Name | Type | Description |
111+
| --- | --- | --- |
112+
| `serverPod` | [Introspector Job Pod](#introspector-job-pod) | Customization affecting the generation of the Introspector Job Pod. |
113+
107114
### Managed Server
108115

109116
| Name | Type | Description |
@@ -231,6 +238,13 @@ The current status of the operation of the WebLogic domain. Updated automaticall
231238
| `walletFileSecret` | string | Name of a Secret containing the OPSS key wallet file, which must be in a field named `walletFile`. Use this to allow a JRF domain to reuse its entries in the RCU database. This allows you to specify a wallet file that was obtained from the domain home after the domain was booted for the first time. |
232239
| `walletPasswordSecret` | string | Name of a Secret containing the OPSS key passphrase, which must be in a field named `walletPassword`. Used to encrypt and decrypt the wallet that is used for accessing the domain's entries in its RCU database. |
233240

241+
### Introspector Job Pod
242+
243+
| Name | Type | Description |
244+
| --- | --- | --- |
245+
| `env` | Array of [Env Var](k8s1.13.5.md#env-var) | A list of environment variables to set in the Introspector Job Pod container. More info: https://oracle.github.io/weblogic-kubernetes-operator/userguide/managing-domains/domain-resource/#jvm-memory-and-java-option-environment-variables. See `kubectl explain pods.spec.containers.env`. |
246+
| `resources` | [Resource Requirements](k8s1.13.5.md#resource-requirements) | Memory and CPU minimum requirements and limits for the Introspector Job Pod. See `kubectl explain pods.spec.containers.resources`. |
247+
234248
### Probe Tuning
235249

236250
| Name | Type | Description |

json-schema-generator/src/main/java/oracle/kubernetes/json/SchemaGenerator.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2018, 2022, Oracle and/or its affiliates.
1+
// Copyright (c) 2018, 2023, Oracle and/or its affiliates.
22
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33

44
package oracle.kubernetes.json;
@@ -57,7 +57,7 @@ public class SchemaGenerator {
5757
private final Map<Class<?>, String> references = new HashMap<>();
5858

5959
// A map of found classes to their definitions or the constant EXTERNAL_CLASS.
60-
private final Map<Class<?>, Object> definedObjects = new HashMap<>();
60+
private Map<Class<?>, Object> definedObjects = new HashMap<>();
6161

6262
// a map of external class names to the external schema that defines them
6363
private final Map<String, String> schemaUrls = new HashMap<>();
@@ -175,6 +175,10 @@ public void addPackageToSuppressDescriptions(String packageName) {
175175
this.suppressDescriptionForPackages.add(packageName);
176176
}
177177

178+
public void initializeDefinedObjects() {
179+
definedObjects = new HashMap<>();
180+
}
181+
178182
/**
179183
* Generates an object representing a JSON schema for the specified class.
180184
*

json-schema-generator/src/test/java/oracle/kubernetes/json/SchemaGeneratorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2018, 2022, Oracle and/or its affiliates.
1+
// Copyright (c) 2018, 2023, Oracle and/or its affiliates.
22
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33

44
package oracle.kubernetes.json;

json-schema-generator/src/test/java/oracle/kubernetes/json/SimpleObject.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2018, 2021, Oracle and/or its affiliates.
1+
// Copyright (c) 2018, 2023, Oracle and/or its affiliates.
22
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33

44
package oracle.kubernetes.json;

kubernetes/crd/domain-crd.yaml

Lines changed: 92 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ apiVersion: apiextensions.k8s.io/v1
55
kind: CustomResourceDefinition
66
metadata:
77
annotations:
8-
weblogic.sha256: 800688be11eb480e3abcda813ac991a970e6b55273bb8403f1f6c3b6684a9676
8+
weblogic.sha256: 5613ace711131620c27c324b75c8994cc7036312a4c9a386492ced0a9b0fb38f
99
name: domains.weblogic.oracle
1010
spec:
1111
group: weblogic.oracle
@@ -3484,6 +3484,97 @@ spec:
34843484
description: Specifies whether the server .out file will be included
34853485
in the Pod's log. Defaults to true.
34863486
type: boolean
3487+
introspector:
3488+
description: Lifecycle options for the Introspector Job Pod, including
3489+
Java options, environment variables, and resources.
3490+
properties:
3491+
serverPod:
3492+
description: Customization affecting the generation of the Introspector
3493+
Job Pod.
3494+
properties:
3495+
resources:
3496+
description: Memory and CPU minimum requirements and limits
3497+
for the Introspector Job Pod. See `kubectl explain pods.spec.containers.resources`.
3498+
properties:
3499+
requests:
3500+
additionalProperties:
3501+
type: string
3502+
type: object
3503+
limits:
3504+
additionalProperties:
3505+
type: string
3506+
type: object
3507+
type: object
3508+
env:
3509+
description: 'A list of environment variables to set in the
3510+
Introspector Job Pod container. More info: https://oracle.github.io/weblogic-kubernetes-operator/userguide/managing-domains/domain-resource/#jvm-memory-and-java-option-environment-variables.
3511+
See `kubectl explain pods.spec.containers.env`.'
3512+
items:
3513+
type: object
3514+
properties:
3515+
name:
3516+
type: string
3517+
value:
3518+
type: string
3519+
valueFrom:
3520+
type: object
3521+
properties:
3522+
secretKeyRef:
3523+
type: object
3524+
properties:
3525+
name:
3526+
type: string
3527+
optional:
3528+
type: boolean
3529+
key:
3530+
type: string
3531+
required:
3532+
- key
3533+
resourceFieldRef:
3534+
type: object
3535+
properties:
3536+
divisor:
3537+
type: object
3538+
properties:
3539+
number:
3540+
type: integer
3541+
format:
3542+
type: string
3543+
enum:
3544+
- DECIMAL_EXPONENT
3545+
- DECIMAL_SI
3546+
- BINARY_SI
3547+
resource:
3548+
type: string
3549+
containerName:
3550+
type: string
3551+
required:
3552+
- resource
3553+
configMapKeyRef:
3554+
type: object
3555+
properties:
3556+
name:
3557+
type: string
3558+
optional:
3559+
type: boolean
3560+
key:
3561+
type: string
3562+
required:
3563+
- key
3564+
fieldRef:
3565+
type: object
3566+
properties:
3567+
apiVersion:
3568+
type: string
3569+
fieldPath:
3570+
type: string
3571+
required:
3572+
- fieldPath
3573+
required:
3574+
- name
3575+
type: array
3576+
type: object
3577+
type: object
34873578
clusters:
34883579
description: References to Cluster resources that describe the lifecycle
34893580
options for all of the Managed Server members of a WebLogic cluster,

operator-build-maven-plugin/src/main/java/oracle/kubernetes/json/mojo/MainImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2018, 2021, Oracle and/or its affiliates.
1+
// Copyright (c) 2018, 2023, Oracle and/or its affiliates.
22
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33

44
package oracle.kubernetes.json.mojo;
@@ -55,6 +55,7 @@ public void defineSchemaUrlAndContents(URL schemaUrl, URL cacheUrl) throws IOExc
5555
public Map<String, Object> generateSchema(String className, File outputFile)
5656
throws MojoExecutionException {
5757
outputFile.getParentFile().mkdirs();
58+
generator.initializeDefinedObjects();
5859
try (FileWriter writer = new FileWriter(outputFile)) {
5960
Class<?> theClass = classLoader.loadClass(className);
6061
Map<String, Object> schema = generator.generate(theClass);

0 commit comments

Comments
 (0)