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

Avoid initContainer while mounting a volume #1179

Closed
thibaut-fluteaux-infy opened this issue Dec 20, 2021 · 9 comments · Fixed by #1928
Closed

Avoid initContainer while mounting a volume #1179

thibaut-fluteaux-infy opened this issue Dec 20, 2021 · 9 comments · Fixed by #1928
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@thibaut-fluteaux-infy
Copy link

Description

Since I switch from fabric8 to JKUBE, When I add a volume in my description.yaml.
An initContainer using busybox is automatically added, was not the case with fabric8.

The main issue, my openshift instance dont have access to busybox image (due to corporate restriction)

Info

  • Eclipse JKube version : 1.4.0
  • Maven version (mvn -v) : 3.8.1

  • Kubernetes / Red Hat OpenShift setup and version : 3.11
@rohanKanojia
Copy link
Member

Is this duplicate of #891 ? If yes, you might be able to specify image like this:

<plugin>
    <groupId>org.eclipse.jkube</groupId>
    <artifactId>kubernetes-maven-plugin</artifactId>
    <version>${jkube.version}</version>
    <configuration>
      <enricher>
        <config>
            <jkube-volume-permission>
              <imageName>name-foo</imageName>
            </jkube-volume-permission>
        </config>
      </enricher>
    </configuration>
</plugin>

@thibaut-fluteaux-infy
Copy link
Author

Thanks for the help to change the image, is there any option to avoid the usage of init container ?
with Fabric8 it was fully working without initcontainer.
regards,

@rohanKanojia
Copy link
Member

@thibaut-fluteaux-infy : Would it be possible for you to share a reproducer project? I will help me debug cause for behavioral difference between two plugins.

@thibaut-fluteaux-infy
Copy link
Author

considering volumeclaim "volumetest" allready exist.
here is my reproducer : https://github.com/thibaut-fluteaux-infy/jkube-kmp
maven profile :
-fmp for fabric8
-jkube for jkube

regards

@rohanKanojia
Copy link
Member

I see you're using quite an old version of the Fabric8 Maven Plugin. I tried with the latest version of FMP v4.4.1 and I was able to see initContainers generated.

I think this change was done by me in fabric8io/fabric8-maven-plugin#1318

@thibaut-fluteaux-infy
Copy link
Author

thanks for your answer, no way to disable the usage of init container by jkube ?

@rohanKanojia
Copy link
Member

Right now, no. If you want we can add a configuration option to disable this here:

https://github.com/eclipse/jkube/blob/cce1b0de09a3657ec9000b3097d7266daa49aaec/jkube-kit/enricher/generic/src/main/java/org/eclipse/jkube/enricher/generic/VolumePermissionEnricher.java#L94

However, we need to decide if it's really the way we would like to go.

@manusa manusa added the enhancement New feature or request label Dec 21, 2021
@kuailexingmao
Copy link

kuailexingmao commented Jan 7, 2022

I encountered the same problem and did not want to use initContainer automatically loaded in Depl0ymentConfig, so I disabled jkube-volume-Permission.My configuration is as follows:

<configuration>
       <enricher>
          <excludes>
                 jkube-volume-permission
           <excludes>
        </enricher>
</configuration>

@rohanKanojia rohanKanojia self-assigned this Nov 21, 2022
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Nov 21, 2022
…isable initContainer addition (eclipse-jkube#1179)

Currently, VolumePermissionEnricher adds an initContainer in order to
fix permission of currently mounted PeristentVolume. However, some users
have reported that they don't really need it.

Adding a flag to disable this behavior.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Nov 21, 2022
…isable initContainer addition (eclipse-jkube#1179)

Currently, VolumePermissionEnricher adds an initContainer in order to
fix permission of currently mounted PeristentVolume. However, some users
have reported that they don't really need it.

Adding a flag to disable this behavior.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Dec 8, 2022
…isable initContainer addition (eclipse-jkube#1179)

Currently, VolumePermissionEnricher adds an initContainer in order to
fix permission of currently mounted PeristentVolume. However, some users
have reported that they don't really need it.

Adding a flag to disable this behavior.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Jan 3, 2023
…ty out of VolumePermissionEnricher (eclipse-jkube#1179)

Related to eclipse-jkube#1179

+ Move setting PersistentVolumeClaim's storageClass related logic into a
 new enricher : PersistentVolumeClaimStorageClassEnricher . This way user can
 simply exclude VolumePermissionEnricher to opt out of volume permission
 initContainer.
+ Deprecate VolumePermissionEnricher's `defaultStorageClass` and
  `useStorageClassAnnotation` fields in favor of
  PersistentVolumeClaimStorageClassEnricher equivalents.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
@rohanKanojia
Copy link
Member

I've moved out functionality unrelated to Volume permissions in #1179

Now in order to avoid initContainer you just need to exclude the enricher as @kuailexingmao suggested.

rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Jan 4, 2023
…ty out of VolumePermissionEnricher (eclipse-jkube#1179)

Related to eclipse-jkube#1179

+ Move setting PersistentVolumeClaim's storageClass related logic into a
 new enricher : PersistentVolumeClaimStorageClassEnricher . This way user can
 simply exclude VolumePermissionEnricher to opt out of volume permission
 initContainer.
+ Deprecate VolumePermissionEnricher's `defaultStorageClass` and
  `useStorageClassAnnotation` fields in favor of
  PersistentVolumeClaimStorageClassEnricher equivalents.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Jan 5, 2023
…ty out of VolumePermissionEnricher (eclipse-jkube#1179)

Related to eclipse-jkube#1179

+ Move setting PersistentVolumeClaim's storageClass related logic into a
 new enricher : PersistentVolumeClaimStorageClassEnricher . This way user can
 simply exclude VolumePermissionEnricher to opt out of volume permission
 initContainer.
+ Deprecate VolumePermissionEnricher's `defaultStorageClass` and
  `useStorageClassAnnotation` fields in favor of
  PersistentVolumeClaimStorageClassEnricher equivalents.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Jan 30, 2023
…ty out of VolumePermissionEnricher (eclipse-jkube#1179)

Related to eclipse-jkube#1179

+ Move setting PersistentVolumeClaim's storageClass related logic into a
 new enricher : PersistentVolumeClaimStorageClassEnricher . This way user can
 simply exclude VolumePermissionEnricher to opt out of volume permission
 initContainer.
+ Deprecate VolumePermissionEnricher's `defaultStorageClass` and
  `useStorageClassAnnotation` fields in favor of
  PersistentVolumeClaimStorageClassEnricher equivalents.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Feb 14, 2023
…ty out of VolumePermissionEnricher (eclipse-jkube#1179)

Related to eclipse-jkube#1179

+ Move setting PersistentVolumeClaim's storageClass related logic into a
 new enricher : PersistentVolumeClaimStorageClassEnricher . This way user can
 simply exclude VolumePermissionEnricher to opt out of volume permission
 initContainer.
+ Deprecate VolumePermissionEnricher's `defaultStorageClass` and
  `useStorageClassAnnotation` fields in favor of
  PersistentVolumeClaimStorageClassEnricher equivalents.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Feb 21, 2023
…ty out of VolumePermissionEnricher (eclipse-jkube#1179)

Related to eclipse-jkube#1179

+ Move setting PersistentVolumeClaim's storageClass related logic into a
 new enricher : PersistentVolumeClaimStorageClassEnricher . This way user can
 simply exclude VolumePermissionEnricher to opt out of volume permission
 initContainer.
+ Deprecate VolumePermissionEnricher's `defaultStorageClass` and
  `useStorageClassAnnotation` fields in favor of
  PersistentVolumeClaimStorageClassEnricher equivalents.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Mar 1, 2023
…ty out of VolumePermissionEnricher (eclipse-jkube#1179)

Related to eclipse-jkube#1179

+ Move setting PersistentVolumeClaim's storageClass related logic into a
 new enricher : PersistentVolumeClaimStorageClassEnricher . This way user can
 simply exclude VolumePermissionEnricher to opt out of volume permission
 initContainer.
+ Deprecate VolumePermissionEnricher's `defaultStorageClass` and
  `useStorageClassAnnotation` fields in favor of
  PersistentVolumeClaimStorageClassEnricher equivalents.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Mar 24, 2023
…ty out of VolumePermissionEnricher (eclipse-jkube#1179)

Related to eclipse-jkube#1179

+ Move setting PersistentVolumeClaim's storageClass related logic into a
 new enricher : PersistentVolumeClaimStorageClassEnricher . This way user can
 simply exclude VolumePermissionEnricher to opt out of volume permission
 initContainer.
+ Deprecate VolumePermissionEnricher's `defaultStorageClass` and
  `useStorageClassAnnotation` fields in favor of
  PersistentVolumeClaimStorageClassEnricher equivalents.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
@manusa manusa added this to the 1.12.0 milestone Mar 27, 2023
manusa pushed a commit that referenced this issue Mar 27, 2023
…ty out of VolumePermissionEnricher (#1179)

Related to #1179

+ Move setting PersistentVolumeClaim's storageClass related logic into a
 new enricher : PersistentVolumeClaimStorageClassEnricher . This way user can
 simply exclude VolumePermissionEnricher to opt out of volume permission
 initContainer.
+ Deprecate VolumePermissionEnricher's `defaultStorageClass` and
  `useStorageClassAnnotation` fields in favor of
  PersistentVolumeClaimStorageClassEnricher equivalents.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
4 participants