Skip to content

Commit

Permalink
Sidecar container spec for druid (#296)
Browse files Browse the repository at this point in the history
* Sidecar container spec for druid

* Fix PR comments on additionalcontainer

* Add envFrom and add comments

* Add example spec to example.md

* Add multi container deployment to features.md

Co-authored-by: cinto <[email protected]>
  • Loading branch information
cintoSunny and cinto authored Oct 19, 2022
1 parent 593b668 commit 480ccb5
Show file tree
Hide file tree
Showing 10 changed files with 1,126 additions and 24 deletions.
41 changes: 41 additions & 0 deletions apis/druid/v1alpha1/druid_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,44 @@ import (
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// AdditionalContainer defines the additional sidecar container
type AdditionalContainer struct {
// List of configurations to use which are not present or to override default implementation configurations

// This is the image for the additional container to run.
// This is a required field
Image string `json:"image"`

// This is the name of the additional container.
// This is a required field
ContainerName string `json:"containerName"`

// This is the command for the additional container to run.
// This is a required field
Command []string `json:"command"`

// Optional: If not present, will be taken from top level spec
ImagePullPolicy v1.PullPolicy `json:"imagePullPolicy,omitempty"`

// Optional: Argument to call the command
Args []string `json:"args,omitempty"`

// Optional: ContainerSecurityContext. If not present, will be taken from top level pod
ContainerSecurityContext *v1.SecurityContext `json:"securityContext,omitempty"`

// Optional: CPU/Memory Resources
Resources v1.ResourceRequirements `json:"resources,omitempty"`

// Optional: volumes etc for the Druid pods
VolumeMounts []v1.VolumeMount `json:"volumeMounts,omitempty"`

// Optional: environment variables for the Additional Container
Env []v1.EnvVar `json:"env,omitempty"`

// Optional: Extra environment variables
EnvFrom []v1.EnvFromSource `json:"envFrom,omitempty"`
}

// DruidSpec defines the desired state of Druid
type DruidSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
Expand Down Expand Up @@ -132,6 +170,9 @@ type DruidSpec struct {
// that is, it must match regex '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*'
Nodes map[string]DruidNodeSpec `json:"nodes"`

// Operator deploys the sidecar container based on these properties. Sidecar will be deployed for all the Druid pods.
AdditionalContainer []AdditionalContainer `json:"additionalContainer,omitempty"`

// Operator deploys above list of nodes in the Druid prescribed order of Historical, Overlord, MiddleManager,
// Broker, Coordinator etc.
// Optional: If set to true then operator checks the rollout status of previous version StateSets before updating next.
Expand Down
60 changes: 59 additions & 1 deletion apis/druid/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

204 changes: 204 additions & 0 deletions chart/templates/crds/druid.apache.org_druids.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,210 @@ spec:
type: object
spec:
properties:
additionalContainer:
items:
properties:
args:
items:
type: string
type: array
command:
items:
type: string
type: array
containerName:
type: string
env:
items:
properties:
name:
type: string
value:
type: string
valueFrom:
properties:
configMapKeyRef:
properties:
key:
type: string
name:
type: string
optional:
type: boolean
required:
- key
type: object
fieldRef:
properties:
apiVersion:
type: string
fieldPath:
type: string
required:
- fieldPath
type: object
resourceFieldRef:
properties:
containerName:
type: string
divisor:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
resource:
type: string
required:
- resource
type: object
secretKeyRef:
properties:
key:
type: string
name:
type: string
optional:
type: boolean
required:
- key
type: object
type: object
required:
- name
type: object
type: array
envFrom:
items:
properties:
configMapRef:
properties:
name:
type: string
optional:
type: boolean
type: object
prefix:
type: string
secretRef:
properties:
name:
type: string
optional:
type: boolean
type: object
type: object
type: array
image:
type: string
imagePullPolicy:
type: string
resources:
properties:
limits:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
type: object
requests:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
type: object
type: object
securityContext:
properties:
allowPrivilegeEscalation:
type: boolean
capabilities:
properties:
add:
items:
type: string
type: array
drop:
items:
type: string
type: array
type: object
privileged:
type: boolean
procMount:
type: string
readOnlyRootFilesystem:
type: boolean
runAsGroup:
format: int64
type: integer
runAsNonRoot:
type: boolean
runAsUser:
format: int64
type: integer
seLinuxOptions:
properties:
level:
type: string
role:
type: string
type:
type: string
user:
type: string
type: object
seccompProfile:
properties:
localhostProfile:
type: string
type:
type: string
required:
- type
type: object
windowsOptions:
properties:
gmsaCredentialSpec:
type: string
gmsaCredentialSpecName:
type: string
hostProcess:
type: boolean
runAsUserName:
type: string
type: object
type: object
volumeMounts:
items:
properties:
mountPath:
type: string
mountPropagation:
type: string
name:
type: string
readOnly:
type: boolean
subPath:
type: string
subPathExpr:
type: string
required:
- mountPath
- name
type: object
type: array
required:
- command
- containerName
- image
type: object
type: array
affinity:
properties:
nodeAffinity:
Expand Down
Loading

0 comments on commit 480ccb5

Please sign in to comment.