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

Add support for readOnlyRootFilesystem (fixes #1402) #1403

Merged
merged 4 commits into from
Sep 12, 2024
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
1 change: 1 addition & 0 deletions CHANGELOG/CHANGELOG-1.20.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ When cutting a new release, update the `unreleased` heading to the tag being gen

* [BUGFIX] [#1399](https://github.com/k8ssandra/k8ssandra-operator/issues/1399) Fixed SecretSyncController to handle multiple namespaces
* [FEATURE] [#1382](https://github.com/k8ssandra/k8ssandra-operator/issues/1382) Add service to expose DC nodes in the control plane
* [FEATURE] [#1402](https://github.com/k8ssandra/k8ssandra-operator/issues/1402) Add support for readOnlyRootFilesystem
4 changes: 4 additions & 0 deletions apis/k8ssandra/v1alpha1/k8ssandracluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,10 @@ type DatacenterOptions struct {
// Use cautiously.
// +optional
DatacenterName string `json:"datacenterName,omitempty"`

// ReadOnlyRootFilesystem makes the cassandra container to be run with a read-only root filesystem. Currently only functional when used with the
// new k8ssandra-client config builder (Cassandra 4.1 and newer and HCD)
ReadOnlyRootFilesystem *bool `json:"readOnlyRootFilesystem,omitempty"`
}

// NetworkingConfig is a copy of cass-operator's NetworkingConfig struct. It is copied here to
Expand Down
5 changes: 5 additions & 0 deletions apis/k8ssandra/v1alpha1/zz_generated.deepcopy.go

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

10 changes: 10 additions & 0 deletions charts/k8ssandra-operator/crds/k8ssandra-operator-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10671,6 +10671,11 @@ spec:
- name
type: object
type: array
readOnlyRootFilesystem:
description: |-
ReadOnlyRootFilesystem makes the cassandra container to be run with a read-only root filesystem. Currently only functional when used with the
new k8ssandra-client config builder (Cassandra 4.1 and newer and HCD)
type: boolean
resources:
description: Resources is the cpu and memory resources for
the cassandra container.
Expand Down Expand Up @@ -23112,6 +23117,11 @@ spec:
- name
type: object
type: array
readOnlyRootFilesystem:
description: |-
ReadOnlyRootFilesystem makes the cassandra container to be run with a read-only root filesystem. Currently only functional when used with the
new k8ssandra-client config builder (Cassandra 4.1 and newer and HCD)
type: boolean
resources:
description: Resources is the cpu and memory resources for the
cassandra container.
Expand Down
10 changes: 10 additions & 0 deletions config/crd/bases/k8ssandra.io_k8ssandraclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10609,6 +10609,11 @@ spec:
- name
type: object
type: array
readOnlyRootFilesystem:
description: |-
ReadOnlyRootFilesystem makes the cassandra container to be run with a read-only root filesystem. Currently only functional when used with the
new k8ssandra-client config builder (Cassandra 4.1 and newer and HCD)
type: boolean
resources:
description: Resources is the cpu and memory resources for
the cassandra container.
Expand Down Expand Up @@ -23050,6 +23055,11 @@ spec:
- name
type: object
type: array
readOnlyRootFilesystem:
description: |-
ReadOnlyRootFilesystem makes the cassandra container to be run with a read-only root filesystem. Currently only functional when used with the
new k8ssandra-client config builder (Cassandra 4.1 and newer and HCD)
type: boolean
resources:
description: Resources is the cpu and memory resources for the
cassandra container.
Expand Down
3 changes: 2 additions & 1 deletion controllers/k8ssandra/k8ssandracluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ func createSingleDcCluster(t *testing.T, ctx context.Context, f *framework.Frame
ManagementApiAuth: &cassdcapi.ManagementApiAuthConfig{
Insecure: &cassdcapi.ManagementApiAuthInsecureConfig{},
},
ReadOnlyRootFilesystem: ptr.To(true),
},
},
},
Expand Down Expand Up @@ -186,7 +187,7 @@ func createSingleDcCluster(t *testing.T, ctx context.Context, f *framework.Frame
require.NoError(err, "failed to get CassandraDatacenter")
require.True(dc.Spec.PodTemplateSpec.Spec.SecurityContext.RunAsUser != nil && *dc.Spec.PodTemplateSpec.Spec.SecurityContext.RunAsUser == 999, "pod security context was not properly set")
require.True(dc.Spec.ManagementApiAuth.Insecure != nil, "management api auth was not properly set")

require.True(*dc.Spec.ReadOnlyRootFilesystem, "read only root filesystem was not properly set")
lastTransitionTime := metav1.Now()

t.Log("update datacenter status to scaling up")
Expand Down
Loading
Loading