Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 328: Add support of customized volumeMounts for zookeeper container #327

Merged
merged 6 commits into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3735,6 +3735,47 @@ spec:
- name
type: object
type: array
volumeMounts:
description: Customized volumeMounts for zookeeper container.
Cannot be updated.
items:
description: VolumeMount describes a mounting of a Volume within
a container.
properties:
mountPath:
description: Path within the container at which the volume
should be mounted. Must not contain ':'.
type: string
mountPropagation:
description: mountPropagation determines how mounts are
propagated from the host to container and the other way
around. When not set, MountPropagationNone is used. This
field is beta in 1.10.
type: string
name:
description: This must match the Name of a Volume.
type: string
readOnly:
description: Mounted read-only if true, read-write otherwise
(false or unspecified). Defaults to false.
type: boolean
subPath:
description: Path within the volume from which the container's
volume should be mounted. Defaults to "" (volume's root).
type: string
subPathExpr:
description: Expanded path within the volume from which
the container's volume should be mounted. Behaves similarly
to SubPath but environment variable references $(VAR_NAME)
are expanded using the container's environment. Defaults
to "" (volume's root). SubPathExpr and SubPath are mutually
exclusive.
type: string
required:
- mountPath
- name
type: object
type: array
type: object
status:
description: ZookeeperClusterStatus defines the observed state of ZookeeperCluster
Expand Down
1 change: 1 addition & 0 deletions charts/zookeeper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,4 @@ The following table lists the configurable parameters of the zookeeper chart and
| `ephemeral.emptydirvolumesource.sizeLimit` | Total amount of local storage required for the EmptyDir volume. | `20Gi` |
| `containers` | Application containers run with the zookeeper pod | `[]` |
| `volumes` | Named volumes that may be accessed by any container in the pod | `[]` |
| `volumeMounts` | Customized volumeMounts for zookeeper container that can be configured to mount volumes to zookeeper container | `[]` |
1 change: 1 addition & 0 deletions charts/zookeeper/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,4 @@ hooks:

containers: []
volumes: []
volumeMounts: []
41 changes: 41 additions & 0 deletions deploy/crds/zookeeper.pravega.io_zookeeperclusters_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3731,6 +3731,47 @@ spec:
- name
type: object
type: array
volumeMounts:
description: Customized volumeMounts for zookeeper container.
Cannot be updated.
items:
description: VolumeMount describes a mounting of a Volume within
a container.
properties:
mountPath:
description: Path within the container at which the volume
should be mounted. Must not contain ':'.
type: string
mountPropagation:
description: mountPropagation determines how mounts are
propagated from the host to container and the other way
around. When not set, MountPropagationNone is used. This
field is beta in 1.10.
type: string
name:
description: This must match the Name of a Volume.
type: string
readOnly:
description: Mounted read-only if true, read-write otherwise
(false or unspecified). Defaults to false.
type: boolean
subPath:
description: Path within the volume from which the container's
volume should be mounted. Defaults to "" (volume's root).
type: string
subPathExpr:
description: Expanded path within the volume from which
the container's volume should be mounted. Behaves similarly
to SubPath but environment variable references $(VAR_NAME)
are expanded using the container's environment. Defaults
to "" (volume's root). SubPathExpr and SubPath are mutually
exclusive.
type: string
required:
- mountPath
- name
type: object
type: array
type: object
status:
description: ZookeeperClusterStatus defines the observed state of ZookeeperCluster
Expand Down
6 changes: 6 additions & 0 deletions pkg/apis/zookeeper/v1beta1/deepcopy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ var _ = Describe("ZookeeperCluster DeepCopy", func() {
Name: "testvolume",
},
},
VolumeMounts: []v1.VolumeMount{
{
Name: "testvolume",
MountPath: "/test/volume",
},
},
}

z1.WithDefaults()
Expand Down
3 changes: 3 additions & 0 deletions pkg/apis/zookeeper/v1beta1/zookeepercluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ type ZookeeperClusterSpec struct {
// Volumes defines to support customized volumes
Volumes []v1.Volume `json:"volumes,omitempty"`

// VolumeMounts defines to support customized volumeMounts
VolumeMounts []v1.VolumeMount `json:"volumeMounts,omitempty"`

// Probes specifies the timeout values for the Readiness and Liveness Probes
// for the zookeeper pods.
// +optional
Expand Down
79 changes: 79 additions & 0 deletions pkg/apis/zookeeper/v1beta1/zz_generated.deepcopy.go

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

4 changes: 2 additions & 2 deletions pkg/zk/generators.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ func makeZkPodSpec(z *v1beta1.ZookeeperCluster, volumes []v1.Volume) v1.PodSpec
Exec: &v1.ExecAction{Command: []string{"zookeeperLive.sh"}},
},
},
VolumeMounts: []v1.VolumeMount{
VolumeMounts: append(z.Spec.VolumeMounts, []v1.VolumeMount{
CraneShiEMC marked this conversation as resolved.
Show resolved Hide resolved
{Name: "data", MountPath: "/data"},
{Name: "conf", MountPath: "/conf"},
},
}...),
Lifecycle: &v1.Lifecycle{
PreStop: &v1.Handler{
Exec: &v1.ExecAction{
Expand Down