[WIP] HiveCluster CR restricted securityContext & volumes - #6811
Open
tanishq-chugh wants to merge 3 commits into
Open
tanishq-chugh wants to merge 3 commits into
tanishq-chugh wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
One or more issues must be addressed before approval.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (4)
What changed in this PR
This WIP hardens HiveCluster-generated Kubernetes workloads with restricted security contexts, safer volume schemas, and ServiceAccount approval checks.
Changes:
- Adds restricted volume types and updates the CRD.
- Applies non-root, seccomp, capability, and privilege-escalation restrictions.
- Adds configurable
runAsUserand ServiceAccount validation.
| File | Description |
|---|---|
| packaging/src/kubernetes/src/java/org/apache/hive/kubernetes/operator/reconciler/HiveClusterReconciler.java | Updated as part of this pull request. |
| packaging/src/kubernetes/src/java/org/apache/hive/kubernetes/operator/model/spec/TezAmSpec.java | Updated as part of this pull request. |
| packaging/src/kubernetes/src/java/org/apache/hive/kubernetes/operator/model/spec/RestrictedVolume.java | Updated as part of this pull request. |
| packaging/src/kubernetes/src/java/org/apache/hive/kubernetes/operator/model/spec/MetastoreSpec.java | Updated as part of this pull request. |
| packaging/src/kubernetes/src/java/org/apache/hive/kubernetes/operator/model/spec/LlapSpec.java | Updated as part of this pull request. |
| packaging/src/kubernetes/src/java/org/apache/hive/kubernetes/operator/model/spec/HiveServer2Spec.java | Updated as part of this pull request. |
| packaging/src/kubernetes/src/java/org/apache/hive/kubernetes/operator/model/HiveClusterSpec.java | Updated as part of this pull request. |
| packaging/src/kubernetes/src/java/org/apache/hive/kubernetes/operator/dependent/SchemaInitJobDependent.java | Updated as part of this pull request. |
| packaging/src/kubernetes/src/java/org/apache/hive/kubernetes/operator/dependent/MetastoreDeploymentDependent.java | Updated as part of this pull request. |
| packaging/src/kubernetes/src/java/org/apache/hive/kubernetes/operator/dependent/LlapResourceBuilder.java | Updated as part of this pull request. |
| packaging/src/kubernetes/src/java/org/apache/hive/kubernetes/operator/dependent/HiveServer2DeploymentDependent.java | Updated as part of this pull request. |
| packaging/src/kubernetes/src/java/org/apache/hive/kubernetes/operator/dependent/HiveDependentResource.java | Updated as part of this pull request. |
| packaging/src/kubernetes/helm/hive-operator/values.yaml | Updated as part of this pull request. |
| packaging/src/kubernetes/helm/hive-operator/templates/hivecluster.yaml | Updated as part of this pull request. |
| packaging/src/kubernetes/helm/hive-operator/templates/clusterrole.yaml | Updated as part of this pull request. |
| packaging/src/kubernetes/helm/hive-operator/crds/hiveclusters.hive.apache.org-v1.yml | Updated as part of this pull request. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+643
to
+645
| if (runAsUser != null) { | ||
| podSc.withRunAsUser(runAsUser); | ||
| } |
Comment on lines
+429
to
+431
| if (serviceAccountName == null || serviceAccountName.isBlank()) { | ||
| return; | ||
| } |
Comment on lines
+432
to
+435
| var sa = client.serviceAccounts().inNamespace(namespace).withName(serviceAccountName).get(); | ||
| if (sa == null) { | ||
| throw new IllegalArgumentException( | ||
| "serviceAccountName '" + serviceAccountName + "' not found in namespace " + namespace); |
Comment on lines
+50
to
+58
| public Volume toKubernetesVolume() { | ||
| return new VolumeBuilder() | ||
| .withName(name) | ||
| .withConfigMap(configMap) | ||
| .withSecret(secret) | ||
| .withEmptyDir(emptyDir) | ||
| .withPersistentVolumeClaim(persistentVolumeClaim) | ||
| .build(); | ||
| } |
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.





What changes were proposed in this pull request?
Why are the changes needed?
Does this PR introduce any user-facing change?
How was this patch tested?