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 ova provider creation for k8s in restricted namespace #643

Closed
wants to merge 1 commit into from

Conversation

bkhizgiy
Copy link
Member

@bkhizgiy bkhizgiy commented Nov 7, 2023

This fix checks on which platform it running on and accordingly setting the appropriate pod security setting.

  • For openShift we have this configured in the SCC file.
  • For k8s we need to set it as art of the pod security while creation.

…penshift and k8s platform.

Signed-off-by: Bella Khizgiyaev <[email protected]>
@bkhizgiy bkhizgiy requested a review from ahadas as a code owner November 7, 2023 18:31
Copy link

sonarqubecloud bot commented Nov 7, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@bkhizgiy bkhizgiy changed the title Add support for ova provider creation for k8s Add support for ova provider creation for k8s in restricted namespace Nov 7, 2023
@bkhizgiy bkhizgiy requested review from bennyz and liranr23 November 7, 2023 18:32
@@ -188,44 +191,92 @@ func (r *Reconciler) createServerService(provider *api.Provider, ctx context.Con
func (r *Reconciler) makeOvaProviderPodSpec(pvcName string, providerName string) core.PodSpec {
imageName, ok := os.LookupEnv(ovaImageVar)
if !ok {
r.Log.Error(nil, "Failed to find OVA server image")
fmt.Println("Failed to find OVA server image")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why? we need to use the logger here

isOpenShift := r.runningInOpenShift()
//Security settings for k8s
if !isOpenShift {
container.SecurityContext.RunAsUser = &user
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens when we set this on openshift?


//Security pod settings for k8s
if !isOpenShift {
podSpec.SecurityContext = &core.PodSecurityContext{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question here - I see that we set this and the RunAsUser regardless of the cluster type (openshift/k8s) on the pvc-init pod, why do we have to differentiate here?

return podSpec
}

func (r *Reconciler) runningInOpenShift() bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should be a "cleaner" way to know the cluster type (by propagating this from the operator to an environment variable of the pod) but please clarify first why we need to differentiate them here

@bkhizgiy
Copy link
Member Author

replace this PR with #660, closing this one.

@bkhizgiy bkhizgiy closed this Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants