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

karmor install --local does not set ImagePullPolicy to IfNotPresent for all containers #307

Closed
Vyom-Yadav opened this issue Apr 5, 2023 · 10 comments · Fixed by #326
Closed
Labels
good first issue Good for newcomers

Comments

@Vyom-Yadav
Copy link
Contributor

Vyom-Yadav commented Apr 5, 2023

Description

--local flag does not set ImagePullPolicy to IfNotPresent for many containers across different deployments. For example:

    spec:
      containers:
      - image: kubearmor/kubearmor-relay-server:latest
        imagePullPolicy: Always # This should have been IfNotPresent
        name: kubearmor-relay-server

Work in the scope of this issue

Check all pod controllers (deployments, daemon sets, etc.) deployed by karmor install have ImagePullPolicy set to IfNotPresent for all containers if --local flag is specified.

@kranurag7 kranurag7 added the good first issue Good for newcomers label Apr 5, 2023
@chirag0002
Copy link

Hey @kranurag7, as I'm new here, so up to my understanding I think changes had to be made in deployment>>probdeployment.go file.
Do correct me if I'm wrong...
Screenshot from 2023-04-08 18-01-21

@kranurag7
Copy link
Member

Hey @chirag0002 Thanks for looking into the issue.
You need to make the changes here with respect to kubearmor-relay-server. For other resources, where ImagePullPolicy is not set, you can add ImagePullPolicy in the same file.

@rootxrishabh
Copy link
Member

rootxrishabh commented May 16, 2023

Hi @kranurag7, I have identified these places in objects.go (1, 2, 3, 4 5, 6, 7, 8, 9 ) where the "ImagePullPolicy" could be modified/created.

@kranurag7
Copy link
Member

Hey @Abhishek-569 Sorry for the delayed response, your implementation works I think for the issue.

@rootxrishabh the changes needs to be done only in the ImagePullPolicy not the Image

@rootxrishabh
Copy link
Member

Hey @kranurag7,
As you specified in this comment I'll update the ImagePullPolicy where it already exists and add where it doesn't.

Hey @chirag0002 Thanks for looking into the issue. You need to make the changes here with respect to kubearmor-relay-server. For other resources, where ImagePullPolicy is not set, you can add ImagePullPolicy in the same file.

@daemon1024
Copy link
Member

daemon1024 commented May 18, 2023

Hey @rootxrishabh, We don't want to update the deployment YAMLs.

As you can see here

if o.Local == true {
daemonset.Spec.Template.Spec.Containers[0].ImagePullPolicy = "IfNotPresent"
daemonset.Spec.Template.Spec.InitContainers[0].ImagePullPolicy = "IfNotPresent"

But this is limited to the Daemonset.
In my opinion the scope of the issue is to implement the same things as part of other deployment and services as well that are installed.

@Abhishek-569
Copy link

Thanks @kranurag7 will raise a PR soon.

@rootxrishabh
Copy link
Member

Hey @daemon1024, I appreciate the information. As I understand it, the deployments in the install.go file should be set up with the "IfNotPresent" imagePullPolicy. One specific deployment(one of the many) that needs this configuration is the Policy Manager Deployment. Please correct me if my understanding is incorrect.

@daemon1024
Copy link
Member

As I understand it, the deployments in the install.go file should be set up with the "IfNotPresent" imagePullPolicy.

It should be set to "IfNotPresent" only if the --local flag is used, like how we do in the Daemonset.

One specific deployment(one of the many) that needs this configuration is the Policy Manager Deployment.

That's right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants