Skip to content

Commit d95e980

Browse files
committed
Add descriptions for types
1 parent d5b63e6 commit d95e980

File tree

18 files changed

+77
-8
lines changed

18 files changed

+77
-8
lines changed

docs/domains/Domain.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
22
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"description": "Domain represents a WebLogic domain and how it will be realized in the Kubernetes cluster.",
34
"type": "object",
45
"definitions": {
56
"AdminServer": {
7+
"description": "AdminServer represents the operator configuration for the admin server.",
68
"type": "object",
79
"properties": {
810
"serverStartState": {
@@ -53,10 +55,11 @@
5355
}
5456
},
5557
"Channel": {
58+
"description": "Describes a single channel used by the admin server.",
5659
"type": "object",
5760
"properties": {
5861
"channelName": {
59-
"description": "Name of channel.\ndefault\u0027 refers to the admin server\u0027s default channel (configured via the ServerMBean\u0027s ListenPort) \n\u0027default-secure\u0027 refers to the admin server\u0027s default secure channel (configured via the ServerMBean\u0027s SSLMBean\u0027s ListenPort) \n\u0027default-admin\u0027 refers to the admin server\u0027s default administrative channel (configured via the DomainMBean\u0027s AdministrationPort) \nOtherwise, the name is the name of one of the admin server\u0027s network access points (configured via the ServerMBean\u0027s NetworkAccessMBeans).",
62+
"description": "Name of channel.\n\u0027default\u0027 refers to the admin server\u0027s default channel (configured via the ServerMBean\u0027s ListenPort) \n\u0027default-secure\u0027 refers to the admin server\u0027s default secure channel (configured via the ServerMBean\u0027s SSLMBean\u0027s ListenPort) \n\u0027default-admin\u0027 refers to the admin server\u0027s default administrative channel (configured via the DomainMBean\u0027s AdministrationPort) \nOtherwise, the name is the name of one of the admin server\u0027s network access points (configured via the ServerMBean\u0027s NetworkAccessMBeans).",
6063
"type": "string"
6164
},
6265
"nodePort": {
@@ -69,6 +72,7 @@
6972
]
7073
},
7174
"Cluster": {
75+
"description": "An element representing a cluster in the domain configuration.",
7276
"type": "object",
7377
"properties": {
7478
"serverStartState": {
@@ -156,6 +160,7 @@
156160
}
157161
},
158162
"DomainSpec": {
163+
"description": "DomainSpec is a description of a domain.",
159164
"type": "object",
160165
"properties": {
161166
"serverStartState": {
@@ -273,6 +278,7 @@
273278
}
274279
},
275280
"DomainStatus": {
281+
"description": "DomainStatus represents information about the status of a domain. Status may trail the actual state of a system.",
276282
"type": "object",
277283
"properties": {
278284
"reason": {
@@ -322,6 +328,7 @@
322328
}
323329
},
324330
"ManagedServer": {
331+
"description": "ManagedServer represents the operator configuration for a single managed server.",
325332
"type": "object",
326333
"properties": {
327334
"serverStartState": {
@@ -404,6 +411,7 @@
404411
}
405412
},
406413
"ServerPod": {
414+
"description": "ServerPod describes the configuration for a Kubernetes pod for a server.",
407415
"type": "object",
408416
"properties": {
409417
"livenessProbe": {

docs/domains/Domain.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
### Domain
22

3+
Domain represents a WebLogic domain and how it will be realized in the Kubernetes cluster.
34
| Name | Type | Description |
45
| --- | --- | --- |
56
| apiVersion | string | The API version for the Domain. Must be 'weblogic.oracle/v2'. |
@@ -10,6 +11,7 @@
1011

1112
### Domain Spec
1213

14+
DomainSpec is a description of a domain.
1315
| Name | Type | Description |
1416
| --- | --- | --- |
1517
| adminServer | [Admin Server](#admin-server) | Configuration for the admin server. |
@@ -36,6 +38,7 @@
3638

3739
### Domain Status
3840

41+
DomainStatus represents information about the status of a domain. Status may trail the actual state of a system.
3942
| Name | Type | Description |
4043
| --- | --- | --- |
4144
| conditions | array of [Domain Condition](#domain-condition) | Current service state of domain. |
@@ -47,6 +50,7 @@
4750

4851
### Admin Server
4952

53+
AdminServer represents the operator configuration for the admin server.
5054
| Name | Type | Description |
5155
| --- | --- | --- |
5256
| adminService | [Admin Service](#admin-service) | Configures which of the admin server's WebLogic admin channels should be exposed outside the Kubernetes cluster via a node port service. |
@@ -58,6 +62,7 @@
5862

5963
### Cluster
6064

65+
An element representing a cluster in the domain configuration.
6166
| Name | Type | Description |
6267
| --- | --- | --- |
6368
| clusterName | string | The name of this cluster. Required |
@@ -72,6 +77,7 @@
7277

7378
### Managed Server
7479

80+
ManagedServer represents the operator configuration for a single managed server.
7581
| Name | Type | Description |
7682
| --- | --- | --- |
7783
| restartVersion | string | If present, every time this value is updated the operator will restart the required servers. |
@@ -83,6 +89,7 @@
8389

8490
### Server Pod
8591

92+
ServerPod describes the configuration for a Kubernetes pod for a server.
8693
| Name | Type | Description |
8794
| --- | --- | --- |
8895
| annotations | | The annotations to be attached to generated resources. |
@@ -159,9 +166,10 @@
159166

160167
### Channel
161168

169+
Describes a single channel used by the admin server.
162170
| Name | Type | Description |
163171
| --- | --- | --- |
164-
| channelName | string | Name of channel.<br/>default' refers to the admin server's default channel (configured via the ServerMBean's ListenPort) <br/>'default-secure' refers to the admin server's default secure channel (configured via the ServerMBean's SSLMBean's ListenPort) <br/>'default-admin' refers to the admin server's default administrative channel (configured via the DomainMBean's AdministrationPort) <br/>Otherwise, the name is the name of one of the admin server's network access points (configured via the ServerMBean's NetworkAccessMBeans). |
172+
| channelName | string | Name of channel.<br/>'default' refers to the admin server's default channel (configured via the ServerMBean's ListenPort) <br/>'default-secure' refers to the admin server's default secure channel (configured via the ServerMBean's SSLMBean's ListenPort) <br/>'default-admin' refers to the admin server's default administrative channel (configured via the DomainMBean's AdministrationPort) <br/>Otherwise, the name is the name of one of the admin server's network access points (configured via the ServerMBean's NetworkAccessMBeans). |
165173
| nodePort | number | Specifies the port number used to access the WebLogic channel outside of the Kubernetes cluster. If not specified, defaults to the port defined by the WebLogic channel. |
166174

167175
### Subsystem Health

docs/domains/index.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,6 +924,7 @@
924924
"properties": {}
925925
},
926926
"AdminServer": {
927+
"description": "AdminServer represents the operator configuration for the admin server.",
927928
"type": "object",
928929
"properties": {
929930
"serverStartState": {
@@ -974,10 +975,11 @@
974975
}
975976
},
976977
"Channel": {
978+
"description": "Describes a single channel used by the admin server.",
977979
"type": "object",
978980
"properties": {
979981
"channelName": {
980-
"description": "Name of channel.\ndefault\u0027 refers to the admin server\u0027s default channel (configured via the ServerMBean\u0027s ListenPort) \n\u0027default-secure\u0027 refers to the admin server\u0027s default secure channel (configured via the ServerMBean\u0027s SSLMBean\u0027s ListenPort) \n\u0027default-admin\u0027 refers to the admin server\u0027s default administrative channel (configured via the DomainMBean\u0027s AdministrationPort) \nOtherwise, the name is the name of one of the admin server\u0027s network access points (configured via the ServerMBean\u0027s NetworkAccessMBeans).",
982+
"description": "Name of channel.\n\u0027default\u0027 refers to the admin server\u0027s default channel (configured via the ServerMBean\u0027s ListenPort) \n\u0027default-secure\u0027 refers to the admin server\u0027s default secure channel (configured via the ServerMBean\u0027s SSLMBean\u0027s ListenPort) \n\u0027default-admin\u0027 refers to the admin server\u0027s default administrative channel (configured via the DomainMBean\u0027s AdministrationPort) \nOtherwise, the name is the name of one of the admin server\u0027s network access points (configured via the ServerMBean\u0027s NetworkAccessMBeans).",
981983
"type": "string"
982984
},
983985
"nodePort": {
@@ -990,6 +992,7 @@
990992
]
991993
},
992994
"Cluster": {
995+
"description": "An element representing a cluster in the domain configuration.",
993996
"type": "object",
994997
"properties": {
995998
"serverStartState": {
@@ -1077,6 +1080,7 @@
10771080
}
10781081
},
10791082
"DomainSpec": {
1083+
"description": "DomainSpec is a description of a domain.",
10801084
"type": "object",
10811085
"properties": {
10821086
"serverStartState": {
@@ -1194,6 +1198,7 @@
11941198
}
11951199
},
11961200
"DomainStatus": {
1201+
"description": "DomainStatus represents information about the status of a domain. Status may trail the actual state of a system.",
11971202
"type": "object",
11981203
"properties": {
11991204
"reason": {
@@ -1243,6 +1248,7 @@
12431248
}
12441249
},
12451250
"ManagedServer": {
1251+
"description": "ManagedServer represents the operator configuration for a single managed server.",
12461252
"type": "object",
12471253
"properties": {
12481254
"serverStartState": {
@@ -1325,6 +1331,7 @@
13251331
}
13261332
},
13271333
"ServerPod": {
1334+
"description": "ServerPod describes the configuration for a Kubernetes pod for a server.",
13281335
"type": "object",
13291336
"properties": {
13301337
"livenessProbe": {

docs/domains/k8s1.9.0.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
### Object Meta
77

8+
ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.
89
| Name | Type | Description |
910
| --- | --- | --- |
1011
| annotations | | Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations |
@@ -26,19 +27,22 @@
2627

2728
### Local Object Reference
2829

30+
LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace.
2931
| Name | Type | Description |
3032
| --- | --- | --- |
3133
| name | string | Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names |
3234

3335
### Secret Reference
3436

37+
SecretReference represents a Secret Reference. It has enough information to retrieve secret in any namespace
3538
| Name | Type | Description |
3639
| --- | --- | --- |
3740
| name | string | Name is unique within a namespace to reference a secret resource. |
3841
| namespace | string | Namespace defines the space within which the secret name must be unique. |
3942

4043
### Security Context
4144

45+
SecurityContext holds security configuration that will be applied to a container. Some fields are present in both SecurityContext and PodSecurityContext. When both are set, the values in SecurityContext take precedence.
4246
| Name | Type | Description |
4347
| --- | --- | --- |
4448
| allowPrivilegeEscalation | boolean | AllowPrivilegeEscalation controls whether a process can gain more privileges than its parent process. This bool directly controls if the no_new_privs flag will be set on the container process. AllowPrivilegeEscalation is true always when the container is: 1) run as Privileged 2) has CAP_SYS_ADMIN |
@@ -51,6 +55,7 @@
5155

5256
### Env Var
5357

58+
EnvVar represents an environment variable present in a Container.
5459
| Name | Type | Description |
5560
| --- | --- | --- |
5661
| name | string | Name of the environment variable. Must be a C_IDENTIFIER. |
@@ -59,6 +64,7 @@
5964

6065
### Pod Security Context
6166

67+
PodSecurityContext holds pod-level security attributes and common container settings. Some fields are also present in container.securityContext. Field values of container.securityContext take precedence over field values of PodSecurityContext.
6268
| Name | Type | Description |
6369
| --- | --- | --- |
6470
| fsGroup | | A special supplemental group that applies to all containers in a pod. Some volume types allow the Kubelet to change the ownership of that volume to be owned by the pod:<br/><br/>1. The owning GID will be the FSGroup 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) 3. The permission bits are OR'd with rw-rw----<br/><br/>If unset, the Kubelet will not modify the ownership and permissions of any volume. |
@@ -69,13 +75,15 @@
6975

7076
### Resource Requirements
7177

78+
ResourceRequirements describes the compute resource requirements.
7279
| Name | Type | Description |
7380
| --- | --- | --- |
7481
| limits | | Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ |
7582
| requests | | Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ |
7683

7784
### Volume Mount
7885

86+
VolumeMount describes a mounting of a Volume within a container.
7987
| Name | Type | Description |
8088
| --- | --- | --- |
8189
| mountPath | string | Path within the container at which the volume should be mounted. Must not contain ':'. |
@@ -86,6 +94,7 @@
8694

8795
### Volume
8896

97+
Volume represents a named volume in a pod that may be accessed by any container in the pod.
8998
| Name | Type | Description |
9099
| --- | --- | --- |
91100
| awsElasticBlockStore | [AWS Elastic Block Store Volume Source](#aws-elastic-block-store-volume-source) | AWSElasticBlockStore represents an AWS Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore |

json-schema/src/main/java/oracle/kubernetes/json/Description.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
package oracle.kubernetes.json;
66

77
import static java.lang.annotation.ElementType.FIELD;
8+
import static java.lang.annotation.ElementType.TYPE;
89

910
import java.lang.annotation.Retention;
1011
import java.lang.annotation.RetentionPolicy;
1112
import java.lang.annotation.Target;
1213

1314
/** Supplies a description for a field to be inserted into the generated JSON schema. */
1415
@Retention(RetentionPolicy.RUNTIME)
15-
@Target(FIELD)
16+
@Target({TYPE, FIELD})
1617
public @interface Description {
1718
String value();
1819
}

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,17 @@
1515
import java.lang.reflect.Method;
1616
import java.lang.reflect.Modifier;
1717
import java.net.URL;
18-
import java.util.*;
18+
import java.util.ArrayList;
19+
import java.util.Arrays;
20+
import java.util.Collection;
21+
import java.util.HashMap;
22+
import java.util.HashSet;
23+
import java.util.Iterator;
24+
import java.util.List;
25+
import java.util.Map;
26+
import java.util.Optional;
27+
import java.util.Set;
28+
import java.util.TreeMap;
1929
import javax.annotation.Nonnull;
2030
import org.joda.time.DateTime;
2131

@@ -398,6 +408,7 @@ private void generateObjectTypeIn(Map<String, Object> result, Class<?> type) {
398408
List<String> requiredFields = new ArrayList<>();
399409
result.put("type", "object");
400410
if (includeAdditionalProperties) result.put("additionalProperties", "false");
411+
Optional.ofNullable(getDescription(type)).ifPresent(s -> result.put("description", s));
401412
result.put("properties", properties);
402413

403414
for (Field field : getPropertyFields(type)) {
@@ -411,6 +422,11 @@ private void generateObjectTypeIn(Map<String, Object> result, Class<?> type) {
411422
}
412423
}
413424

425+
private String getDescription(Class<?> aClass) {
426+
Description description = aClass.getAnnotation(Description.class);
427+
return description != null ? description.value() : null;
428+
}
429+
414430
private Collection<Field> getPropertyFields(Class<?> type) {
415431
Set<Field> result = new HashSet<>();
416432
for (Class<?> cl = type; cl != null && !cl.equals(Object.class); cl = cl.getSuperclass())

json-schema/src/main/java/oracle/kubernetes/json/YamlDocGenerator.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,19 @@ public String generate(String schemaName) {
3636
public String generate(String reference, Map<String, Object> schema) {
3737
referencesNeeded.remove(reference);
3838
StringBuilder sb = new StringBuilder("### ");
39-
sb.append(toStructureName(reference)).append("\n\n").append(generateForClass(schema));
39+
sb.append(toStructureName(reference)).append("\n\n");
40+
Optional.ofNullable(getDescription(schema)).ifPresent(s -> sb.append(s).append("\n"));
41+
sb.append(generateForClass(schema));
4042
while (!referencesNeeded.isEmpty()) {
4143
generateForDefinition(sb, referencesNeeded.get(0));
4244
}
4345
return sb.toString();
4446
}
4547

48+
private String getDescription(Map<String, Object> schema) {
49+
return (String) schema.get("description");
50+
}
51+
4652
private void generateForDefinition(StringBuilder sb, String reference) {
4753
Map<String, Object> definitions = subMap(schema, "definitions");
4854
Map<String, Object> definition = subMap(definitions, reference);

json-schema/src/test/java/oracle/kubernetes/json/DerivedObject.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package oracle.kubernetes.json;
66

77
@SuppressWarnings("unused")
8+
@Description("A simple object used for testing")
89
class DerivedObject extends SimpleObject {
910
@Description("An int\nvalue")
1011
private int anInt;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ public void whenAdditionalPropertiesDisabled_doNotGenerateTheProperty() {
250250
public void generateSchemaForDerivedObject() {
251251
Object schema = generator.generate(DerivedObject.class);
252252

253+
assertThat(schema, hasJsonPath("$.description", equalTo("A simple object used for testing")));
253254
assertThat(schema, hasJsonPath("$.type", equalTo("object")));
254255
assertThat(schema, hasJsonPath("$.additionalProperties", equalTo("false")));
255256
assertThat(schema, hasJsonPath("$.properties.aBoolean.type", equalTo("boolean")));

json-schema/src/test/java/oracle/kubernetes/json/YamlDocGeneratorTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ public void generateMarkdownWithReferencedSections() {
179179
"",
180180
"### Derived Object",
181181
"",
182+
"A simple object used for testing",
182183
tableHeader(),
183184
tableEntry("aBoolean", "boolean", "A flag"),
184185
tableEntry("anInt", "number", "An int<br/>value"))));
@@ -247,6 +248,7 @@ public void whenExternalSchemaSpecified_generateMarkdownForIt() throws IOExcepti
247248
"\n",
248249
"### Env Var",
249250
"",
251+
"EnvVar represents an environment variable present in a Container.",
250252
tableHeader(),
251253
tableEntry(
252254
"name",

0 commit comments

Comments
 (0)