@@ -42,6 +42,8 @@ type CDAPMasterSpec struct {
4242 SecuritySecret string `json:"securitySecret,omitempty"`
4343 // ServiceAccountName is the service account for all the service pods.
4444 ServiceAccountName string `json:"serviceAccountName,omitempty"`
45+ // Env is a list of environment variables for the all service containers.
46+ Env []corev1.EnvVar `json:"env,omitempty"`
4547 // LocationURI is an URI specifying an object storage for CDAP.
4648 LocationURI string `json:"locationURI"`
4749 // Config is a set of configurations that goes into cdap-site.xml.
@@ -76,6 +78,21 @@ type CDAPMasterSpec struct {
7678 Router RouterSpec `json:"router,omitempty"`
7779 // UserInterface is specification for the CDAP UI service.
7880 UserInterface UserInterfaceSpec `json:"userInterface,omitempty"`
81+ // SupportBundle is specification for the CDAP support-bundle service.
82+ // This is an optional service and may not be required for CDAP to be operational.
83+ // To disable this service: either omit or set the field to nil
84+ // To enable this service: set it to a pointer to a SupportBundleSpec struct (can be an empty struct)
85+ SupportBundle * SupportBundleSpec `json:"supportBundle,omitempty"`
86+ // TetheringAgent is specification for the CDAP Tethering Agent service.
87+ // This is an optional service and may not be required for CDAP to be operational.
88+ // To disable this service: either omit or set the field to nil
89+ // To enable this service: set it to a pointer to a TetheringAgentSpec struct (can be an empty struct)
90+ TetheringAgent * TetheringAgentSpec `json:"tetheringAgent,omitempty"`
91+ // ArtifactCache is specification for the CDAP Artifact Cache service.
92+ // This is an optional service and may not be required for CDAP to be operational.
93+ // To disable this service: either omit or set the field to nil
94+ // To enable this service: set it to a pointer to a ArtifactCacheSpec struct (can be an empty struct)
95+ ArtifactCache * ArtifactCacheSpec `json:"artifactCache,omitempty"`
7996 // Runtime is specification for the CDAP runtime service.
8097 // This is an optional service and may not be required for CDAP to be operational.
8198 // To disable this service: either omit or set the field to nil
@@ -86,6 +103,22 @@ type CDAPMasterSpec struct {
86103 // To disable this service: either omit or set the field to nil
87104 // To enable this service: set it to a pointer to a AuthenticationSpec struct (can be an empty struct)
88105 Authentication * AuthenticationSpec `json:"authentication,omitempty"`
106+ // SystemMetricsExporter is specification for the CDAP SystemMetricsExporter service.
107+ // This is an optional service and may not be required for CDAP to be operational.
108+ // To disable this service: either omit or set the field to nil
109+ // To enable this service: set it to a pointer to a SystemMetricsExporterSpec struct (can be an empty struct).
110+ // CDAPServiceSpec.EnableSystemMetrics field also needs to be set to true for stateful services which require
111+ // collection of system metrics. Services which have CDAPServiceSpec.EnableSystemMetrics as nil, missing or set to false,
112+ // will have metrics sidecar container disabled.
113+ SystemMetricsExporter * SystemMetricExporterSpec `json:"systemMetricsExporter,omitempty"`
114+ // SecurityContext defines the security context for all pods for all services.
115+ SecurityContext * SecurityContext `json:"securityContext,omitempty"`
116+ // AdditionalVolumes defines a list of additional volumes for all services.
117+ // For information on supported volume types, see https://kubernetes.io/docs/concepts/storage/volumes/.
118+ AdditionalVolumes []corev1.Volume `json:"additionalVolumes,omitempty"`
119+ // AdditionalVolumeMounts defines a list of additional volume mounts for all services.
120+ // For information on suported volume mount types, see https://kubernetes.io/docs/concepts/storage/volumes/.
121+ AdditionalVolumeMounts []corev1.VolumeMount `json:"additionalVolumeMounts,omitempty"`
89122}
90123
91124// CDAPServiceSpec defines the base set of specifications applicable to all master services.
@@ -115,13 +148,34 @@ type CDAPServiceSpec struct {
115148 // Key is the secret object name. Value is the mount path.
116149 // This adds Secret data to the directory specified by the volume mount path.
117150 SecretVolumes map [string ]string `json:"secretVolumes,omitempty"`
151+ // AdditionalVolumes defines a list of additional volumes to mount to the service.
152+ // For information on supported volume types, see https://kubernetes.io/docs/concepts/storage/volumes/.
153+ AdditionalVolumes []corev1.Volume `json:"additionalVolumes,omitempty"`
154+ // AdditionalVolumeMounts defines a list of additional volume mounts for the service.
155+ // For information on suported volume mount types, see https://kubernetes.io/docs/concepts/storage/volumes/.
156+ AdditionalVolumeMounts []corev1.VolumeMount `json:"additionalVolumeMounts,omitempty"`
157+ // SecurityContext overrides the security context for the service pods.
158+ SecurityContext * SecurityContext `json:"securityContext,omitempty"`
159+ // EnableSystemMetrics is an optional field that is considered along with CDAPMasterSpec.SystemMetricsExporter
160+ // to start a metrics collection container in statefulsets. SystemMetricsExporter is a global setting in CDAPMasterSpec.
161+ // When SystemMetricsExporter is absent, it disables metrics collection for all stateful services.
162+ // When SystemMetricsExporter is present, this value should also be set to true for services which require system metrics
163+ // collection.
164+ EnableSystemMetrics * bool `json:"enableSystemMetrics,omitempty"`
165+ // Lifecycle is to specify Container Lifecycle hooks provided by Kubernetes for containers.
166+ // This will not be applied to the init containers as init containers do not support lifecycle.
167+ Lifecycle * corev1.Lifecycle `json:"lifecycle,omitempty"`
118168}
119169
120170// CDAPScalableServiceSpec defines the base specification for master services that can have more than one instance.
121171type CDAPScalableServiceSpec struct {
122172 CDAPServiceSpec `json:",inline"`
123173 // Replicas is number of replicas for the service.
124174 Replicas * int32 `json:"replicas,omitempty"`
175+ // Containers define any additional containers a service has
176+ // This is a list of containers and can be left blank
177+ // A typical use is to add sidecars for a deployment
178+ Containers []* corev1.Container `json:"containers,omitempty"`
125179}
126180
127181// CDAPExternalServiceSpec defines the base specification for master services that expose to outside of the cluster.
@@ -144,6 +198,10 @@ type CDAPStatefulServiceSpec struct {
144198 StorageSize string `json:"storageSize,omitempty"`
145199 // StorageClassName is the name of the StorageClass for the persistent volume used by the service.
146200 StorageClassName * string `json:"storageClassName,omitempty"`
201+ // Containers define any additional containers a service has
202+ // This is a list of containers and can be left blank
203+ // A typical use is to add sidecars for a stateful set
204+ Containers []* corev1.Container `json:"containers,omitempty"`
147205}
148206
149207// AppFabricSpec defines the specification for the AppFabric service.
@@ -196,6 +254,26 @@ type UserInterfaceSpec struct {
196254 CDAPExternalServiceSpec `json:",inline"`
197255}
198256
257+ // SupportBundleSpec defines the specification for the SupportBundle service.
258+ type SupportBundleSpec struct {
259+ CDAPStatefulServiceSpec `json:",inline"`
260+ }
261+
262+ // TetheringAgentSpec defines the specification for the TetheringAgent service.
263+ type TetheringAgentSpec struct {
264+ CDAPStatefulServiceSpec `json:",inline"`
265+ }
266+
267+ // ArtifactCacheSpec defines the specification for the ArtifactCache service.
268+ type ArtifactCacheSpec struct {
269+ CDAPStatefulServiceSpec `json:",inline"`
270+ }
271+
272+ // SystemMetricExporterSpec defines the specification for the SystemMetricsExporter service.
273+ type SystemMetricExporterSpec struct {
274+ CDAPServiceSpec `json:",inline"`
275+ }
276+
199277// CDAPMasterStatus defines the observed state of CDAPMaster
200278type CDAPMasterStatus struct {
201279 status.Meta `json:",inline"`
@@ -230,6 +308,32 @@ type CDAPMasterList struct {
230308 Items []CDAPMaster `json:"items"`
231309}
232310
311+ // SecurityContext defines fields for setting corev1.SecurityContext for containers and
312+ // corev1.PodSecurityContext for pods.
313+ // For additional information, see https://kubernetes.io/docs/tasks/configure-pod-container/security-context/.
314+ type SecurityContext struct {
315+ // RunAsUser runs the pod as the specified user ID. It is applied at the pod level.
316+ RunAsUser * int64 `json:"runAsUser,omitempty"`
317+ // RunAsGroup runs the pod as the specified group ID. It is applied at the pod level.
318+ RunAsGroup * int64 `json:"runAsGroup,omitempty"`
319+ // FSGroup mounts volumes as the specified group ID and gives the primary user access
320+ // to that group. It is applied at the pod level.
321+ FSGroup * int64 `json:"fsGroup,omitempty"`
322+ // AllowPrivilegeEscalation prevents the container process from running SUID binaries.
323+ // It is applied at the container level.
324+ AllowPrivilegeEscalation * bool `json:"allowPrivilegeEscalation,omitempty"`
325+ // RunAsNonRoot indicates that the container must run as a non-root user.
326+ // If true, the Kubelet will validate the image at runtime to ensure that it
327+ // does not run as UID 0 (root) and fail to start the container if it does.
328+ RunAsNonRoot * bool `json:"runAsNonRoot,omitempty"`
329+ // Privileged runs container in privileged mode. It is applied at the container level.
330+ // Processes in privileged containers are essentially equivalent to root on the host.
331+ Privileged * bool `json:"privileged,omitempty"`
332+ // ReadOnlyRootFilesystem specifies whether the container's root filesystem is read-only.
333+ // It is applied at the container level.
334+ ReadOnlyRootFilesystem * bool `json:"readOnlyRootFilesystem,omitempty"`
335+ }
336+
233337func init () {
234338 SchemeBuilder .Register (& CDAPMaster {}, & CDAPMasterList {})
235339}
0 commit comments