Skip to content

Commit ee417b8

Browse files
authored
Merge pull request #942 from oracle/feature/sidecars
Sidecar containers
2 parents 029faf1 + 6b73e81 commit ee417b8

File tree

20 files changed

+407
-70
lines changed

20 files changed

+407
-70
lines changed

docs/domains/Domain.json

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -446,32 +446,17 @@
446446
"description": "Memory and cpu minimum requirements and limits for the server.",
447447
"$ref": "https://github.com/garethr/kubernetes-json-schema/blob/master/v1.9.0/_definitions.json#/definitions/io.k8s.api.core.v1.ResourceRequirements"
448448
},
449-
"readinessProbe": {
450-
"description": "Settings for the readiness probe associated with a server.",
451-
"$ref": "#/definitions/ProbeTuning"
452-
},
453449
"annotations": {
454450
"description": "The annotations to be attached to generated resources.",
455451
"$ref": "#/definitions/Map"
456452
},
457-
"containerSecurityContext": {
458-
"description": "Container-level security attributes. Will override any matching pod-level attributes.",
459-
"$ref": "https://github.com/garethr/kubernetes-json-schema/blob/master/v1.9.0/_definitions.json#/definitions/io.k8s.api.core.v1.SecurityContext"
460-
},
461453
"env": {
462454
"description": "A list of environment variables to add to a server",
463455
"type": "array",
464456
"items": {
465457
"$ref": "https://github.com/garethr/kubernetes-json-schema/blob/master/v1.9.0/_definitions.json#/definitions/io.k8s.api.core.v1.EnvVar"
466458
}
467459
},
468-
"initContainers": {
469-
"description": "Initialization containers",
470-
"type": "array",
471-
"items": {
472-
"$ref": "https://github.com/garethr/kubernetes-json-schema/blob/master/v1.9.0/_definitions.json#/definitions/io.k8s.api.core.v1.Container"
473-
}
474-
},
475460
"nodeSelector": {
476461
"description": "Selector which must match a node\u0027s labels for the pod to be scheduled on that node.",
477462
"$ref": "#/definitions/Map"
@@ -486,6 +471,28 @@
486471
"labels": {
487472
"description": "The labels to be attached to generated resources. The label names must not start with \u0027weblogic.\u0027.",
488473
"$ref": "#/definitions/Map"
474+
},
475+
"readinessProbe": {
476+
"description": "Settings for the readiness probe associated with a server.",
477+
"$ref": "#/definitions/ProbeTuning"
478+
},
479+
"containers": {
480+
"description": "Additional containers to be included in the server pod.",
481+
"type": "array",
482+
"items": {
483+
"$ref": "https://github.com/garethr/kubernetes-json-schema/blob/master/v1.9.0/_definitions.json#/definitions/io.k8s.api.core.v1.Container"
484+
}
485+
},
486+
"containerSecurityContext": {
487+
"description": "Container-level security attributes. Will override any matching pod-level attributes.",
488+
"$ref": "https://github.com/garethr/kubernetes-json-schema/blob/master/v1.9.0/_definitions.json#/definitions/io.k8s.api.core.v1.SecurityContext"
489+
},
490+
"initContainers": {
491+
"description": "Initialization containers",
492+
"type": "array",
493+
"items": {
494+
"$ref": "https://github.com/garethr/kubernetes-json-schema/blob/master/v1.9.0/_definitions.json#/definitions/io.k8s.api.core.v1.Container"
495+
}
489496
}
490497
}
491498
},

docs/domains/Domain.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ ServerPod describes the configuration for a Kubernetes pod for a server.
100100
| Name | Type | Description |
101101
| --- | --- | --- |
102102
| annotations | Map | The annotations to be attached to generated resources. |
103+
| containers | array of [Container](k8s1.9.0.md#container) | Additional containers to be included in the server pod. |
103104
| containerSecurityContext | [Security Context](k8s1.9.0.md#security-context) | Container-level security attributes. Will override any matching pod-level attributes. |
104105
| env | array of [Env Var](k8s1.9.0.md#env-var) | A list of environment variables to add to a server |
105106
| initContainers | array of [Container](k8s1.9.0.md#container) | Initialization containers |

docs/domains/index.html

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,32 +1366,17 @@
13661366
"description": "Memory and cpu minimum requirements and limits for the server.",
13671367
"$ref": "https://github.com/garethr/kubernetes-json-schema/blob/master/v1.9.0/_definitions.json#/definitions/io.k8s.api.core.v1.ResourceRequirements"
13681368
},
1369-
"readinessProbe": {
1370-
"description": "Settings for the readiness probe associated with a server.",
1371-
"$ref": "#/definitions/ProbeTuning"
1372-
},
13731369
"annotations": {
13741370
"description": "The annotations to be attached to generated resources.",
13751371
"$ref": "#/definitions/Map"
13761372
},
1377-
"containerSecurityContext": {
1378-
"description": "Container-level security attributes. Will override any matching pod-level attributes.",
1379-
"$ref": "https://github.com/garethr/kubernetes-json-schema/blob/master/v1.9.0/_definitions.json#/definitions/io.k8s.api.core.v1.SecurityContext"
1380-
},
13811373
"env": {
13821374
"description": "A list of environment variables to add to a server",
13831375
"type": "array",
13841376
"items": {
13851377
"$ref": "https://github.com/garethr/kubernetes-json-schema/blob/master/v1.9.0/_definitions.json#/definitions/io.k8s.api.core.v1.EnvVar"
13861378
}
13871379
},
1388-
"initContainers": {
1389-
"description": "Initialization containers",
1390-
"type": "array",
1391-
"items": {
1392-
"$ref": "https://github.com/garethr/kubernetes-json-schema/blob/master/v1.9.0/_definitions.json#/definitions/io.k8s.api.core.v1.Container"
1393-
}
1394-
},
13951380
"nodeSelector": {
13961381
"description": "Selector which must match a node\u0027s labels for the pod to be scheduled on that node.",
13971382
"$ref": "#/definitions/Map"
@@ -1406,6 +1391,28 @@
14061391
"labels": {
14071392
"description": "The labels to be attached to generated resources. The label names must not start with \u0027weblogic.\u0027.",
14081393
"$ref": "#/definitions/Map"
1394+
},
1395+
"readinessProbe": {
1396+
"description": "Settings for the readiness probe associated with a server.",
1397+
"$ref": "#/definitions/ProbeTuning"
1398+
},
1399+
"containers": {
1400+
"description": "Additional containers to be included in the server pod.",
1401+
"type": "array",
1402+
"items": {
1403+
"$ref": "https://github.com/garethr/kubernetes-json-schema/blob/master/v1.9.0/_definitions.json#/definitions/io.k8s.api.core.v1.Container"
1404+
}
1405+
},
1406+
"containerSecurityContext": {
1407+
"description": "Container-level security attributes. Will override any matching pod-level attributes.",
1408+
"$ref": "https://github.com/garethr/kubernetes-json-schema/blob/master/v1.9.0/_definitions.json#/definitions/io.k8s.api.core.v1.SecurityContext"
1409+
},
1410+
"initContainers": {
1411+
"description": "Initialization containers",
1412+
"type": "array",
1413+
"items": {
1414+
"$ref": "https://github.com/garethr/kubernetes-json-schema/blob/master/v1.9.0/_definitions.json#/definitions/io.k8s.api.core.v1.Container"
1415+
}
14091416
}
14101417
}
14111418
},

docs/domains/k8s1.9.0.md

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -43,30 +43,6 @@ SecretReference represents a Secret Reference. It has enough information to retr
4343
| name | string | Name is unique within a namespace to reference a secret resource. |
4444
| namespace | string | Namespace defines the space within which the secret name must be unique. |
4545

46-
### Security Context
47-
48-
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.
49-
50-
| Name | Type | Description |
51-
| --- | --- | --- |
52-
| 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 |
53-
| capabilities | [Capabilities](#capabilities) | The capabilities to add/drop when running containers. Defaults to the default set of capabilities granted by the container runtime. |
54-
| privileged | boolean | Run container in privileged mode. Processes in privileged containers are essentially equivalent to root on the host. Defaults to false. |
55-
| readOnlyRootFilesystem | boolean | Whether this container has a read-only root filesystem. Default is false. |
56-
| runAsNonRoot | boolean | Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. |
57-
| runAsUser | integer | The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. |
58-
| seLinuxOptions | [SE Linux Options](#se-linux-options) | The SELinux context to be applied to the container. If unspecified, the container runtime will allocate a random SELinux context for each container. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. |
59-
60-
### Env Var
61-
62-
EnvVar represents an environment variable present in a Container.
63-
64-
| Name | Type | Description |
65-
| --- | --- | --- |
66-
| name | string | Name of the environment variable. Must be a C_IDENTIFIER. |
67-
| value | string | Variable references $(VAR_NAME) are expanded using the previous defined environment variables in the container and any service environment variables. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Defaults to "". |
68-
| valueFrom | [Env Var Source](#env-var-source) | Source for the environment variable's value. Cannot be used if value is not empty. |
69-
7046
### Container
7147

7248
A single application container that you want to run within a pod.
@@ -95,6 +71,30 @@ A single application container that you want to run within a pod.
9571
| volumeMounts | array of [Volume Mount](#volume-mount) | Pod volumes to mount into the container's filesystem. Cannot be updated. |
9672
| workingDir | string | Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated. |
9773

74+
### Security Context
75+
76+
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.
77+
78+
| Name | Type | Description |
79+
| --- | --- | --- |
80+
| 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 |
81+
| capabilities | [Capabilities](#capabilities) | The capabilities to add/drop when running containers. Defaults to the default set of capabilities granted by the container runtime. |
82+
| privileged | boolean | Run container in privileged mode. Processes in privileged containers are essentially equivalent to root on the host. Defaults to false. |
83+
| readOnlyRootFilesystem | boolean | Whether this container has a read-only root filesystem. Default is false. |
84+
| runAsNonRoot | boolean | Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. |
85+
| runAsUser | integer | The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. |
86+
| seLinuxOptions | [SE Linux Options](#se-linux-options) | The SELinux context to be applied to the container. If unspecified, the container runtime will allocate a random SELinux context for each container. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. |
87+
88+
### Env Var
89+
90+
EnvVar represents an environment variable present in a Container.
91+
92+
| Name | Type | Description |
93+
| --- | --- | --- |
94+
| name | string | Name of the environment variable. Must be a C_IDENTIFIER. |
95+
| value | string | Variable references $(VAR_NAME) are expanded using the previous defined environment variables in the container and any service environment variables. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Defaults to "". |
96+
| valueFrom | [Env Var Source](#env-var-source) | Source for the environment variable's value. Cannot be used if value is not empty. |
97+
9898
### Pod Security Context
9999

100100
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.
@@ -178,62 +178,62 @@ Volume represents a named volume in a pod that may be accessed by any container
178178
| Name | Type | Description |
179179
| --- | --- | --- |
180180

181-
### Capabilities
181+
### Env Var
182182

183183
| Name | Type | Description |
184184
| --- | --- | --- |
185185

186-
### SE Linux Options
186+
### Env From Source
187187

188188
| Name | Type | Description |
189189
| --- | --- | --- |
190190

191-
### Env Var Source
191+
### Lifecycle
192192

193193
| Name | Type | Description |
194194
| --- | --- | --- |
195195

196-
### Env Var
196+
### Probe
197197

198198
| Name | Type | Description |
199199
| --- | --- | --- |
200200

201-
### Env From Source
201+
### Container Port
202202

203203
| Name | Type | Description |
204204
| --- | --- | --- |
205205

206-
### Lifecycle
206+
### Resource Requirements
207207

208208
| Name | Type | Description |
209209
| --- | --- | --- |
210210

211-
### Probe
211+
### Security Context
212212

213213
| Name | Type | Description |
214214
| --- | --- | --- |
215215

216-
### Container Port
216+
### Volume Device
217217

218218
| Name | Type | Description |
219219
| --- | --- | --- |
220220

221-
### Resource Requirements
221+
### Volume Mount
222222

223223
| Name | Type | Description |
224224
| --- | --- | --- |
225225

226-
### Security Context
226+
### Capabilities
227227

228228
| Name | Type | Description |
229229
| --- | --- | --- |
230230

231-
### Volume Device
231+
### SE Linux Options
232232

233233
| Name | Type | Description |
234234
| --- | --- | --- |
235235

236-
### Volume Mount
236+
### Env Var Source
237237

238238
| Name | Type | Description |
239239
| --- | --- | --- |

model/src/main/java/oracle/kubernetes/weblogic/domain/ClusterConfigurator.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ ClusterConfigurator withLivenessProbeSettings(
8888

8989
ClusterConfigurator withInitContainer(V1Container initContainer);
9090

91+
ClusterConfigurator withContainer(V1Container container);
92+
9193
ClusterConfigurator withPodLabel(String name, String value);
9294

9395
ClusterConfigurator withPodAnnotation(String name, String value);

model/src/main/java/oracle/kubernetes/weblogic/domain/DomainConfigurator.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ protected DomainSpec getDomainSpec() {
203203

204204
public abstract DomainConfigurator withInitContainer(V1Container initContainer);
205205

206+
public abstract DomainConfigurator withContainer(V1Container container);
207+
206208
public abstract DomainConfigurator withPodLabel(String name, String value);
207209

208210
public abstract DomainConfigurator withPodAnnotation(String name, String value);

model/src/main/java/oracle/kubernetes/weblogic/domain/ServerConfigurator.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ ServerConfigurator withReadinessProbeSettings(
8484

8585
ServerConfigurator withInitContainer(V1Container initContainer);
8686

87+
ServerConfigurator withContainer(V1Container container);
88+
8789
ServerConfigurator withPodLabel(String name, String value);
8890

8991
ServerConfigurator withPodAnnotation(String name, String value);

model/src/main/java/oracle/kubernetes/weblogic/domain/model/BaseConfiguration.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,10 @@ void addInitContainer(V1Container initContainer) {
205205
serverPod.addInitContainer(initContainer);
206206
}
207207

208+
void addContainer(V1Container container) {
209+
serverPod.addContainer(container);
210+
}
211+
208212
Map<String, String> getPodLabels() {
209213
return serverPod.getLabels();
210214
}
@@ -245,6 +249,10 @@ public List<V1Container> getInitContainers() {
245249
return serverPod.getInitContainers();
246250
}
247251

252+
public List<V1Container> getContainers() {
253+
return serverPod.getContainers();
254+
}
255+
248256
void addServiceAnnotation(String name, String value) {
249257
serverService.addAnnotations(name, value);
250258
}

model/src/main/java/oracle/kubernetes/weblogic/domain/model/ClusterSpec.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,14 @@ public abstract class ClusterSpec {
5252
public List<V1Container> getInitContainers() {
5353
return Collections.emptyList();
5454
}
55+
56+
/**
57+
* Returns the list of additional containers.
58+
*
59+
* @return a list of containers
60+
*/
61+
@Nonnull
62+
public List<V1Container> getContainers() {
63+
return Collections.emptyList();
64+
}
5565
}

model/src/main/java/oracle/kubernetes/weblogic/domain/model/ClusterSpecCommonImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,9 @@ public Map<String, String> getClusterAnnotations() {
4444
public List<V1Container> getInitContainers() {
4545
return cluster.getInitContainers();
4646
}
47+
48+
@Override
49+
public List<V1Container> getContainers() {
50+
return cluster.getContainers();
51+
}
4752
}

0 commit comments

Comments
 (0)