Skip to content

Use debian-base as base image #154

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

Merged
merged 1 commit into from
Mar 24, 2019

Conversation

thockin
Copy link
Member

@thockin thockin commented Mar 12, 2019

All of the main Kubernetes components are switching to it, since we can
maintain it more easily.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 12, 2019
@thockin thockin added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 12, 2019
@k8s-ci-robot k8s-ci-robot requested a review from stp-ip March 12, 2019 00:16
All of the main Kubernetes components are switching to it, since we can
maintain it more easily.
@thockin
Copy link
Member Author

thockin commented Mar 12, 2019

Still playing with this.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 12, 2019
@Vampouille
Copy link

It would ease the usage of libnss_wrapper that are not available on alpine:
https://bugs.alpinelinux.org/issues/6710
With libnss_wrapper we could get rid of :

        securityContext:
          runAsUser: 65533 # git-sync user
      securityContext:
        fsGroup: 65533 # to make SSH key readable

@thockin
Copy link
Member Author

thockin commented Mar 15, 2019 via email

@Vampouille
Copy link

Are you saying those are not needed or that we need more work to get rid of those, but now it would be possib? I don't know the details..

I think we need more work to get rid of this:
I'm currently working on an openshift plateform where pods are runs with arbitrary user. So I have random UID like : 1000320000. Policies / guide lines prevent me to create serviceAccount anyuid/runasroot... So I'm looking for a way to run git-sync as arbitrary user.

We need entry in /etc/passwd to be able to use ssh commands. One way to do this at runtime is to use lilbnss_wrapper. We can dynamically populate passwd and group file with this kind of shell script :

 #!/bin/sh                                                                                                                                                                                                            
                                                                                                                                                                                                                     
echo "git-sync:x:$(id -u):$(id -g):git-sync:/tmp:/bin/sh" > /tmp/passwd                                                                                                                                              
echo "git-sync:x:$(id -g):" > /tmp/group                                                                                                                                                                             
                                                                                                                                                                                                                     
exec /git-sync $*

and use libnss_wrapper to use this new files before launching git-sync with 3 env vars :

          env:
            - name: LD_PRELOAD
              value: /usr/local/lib64/libnss_wrapper.so
            - name: NSS_WRAPPER_PASSWD
              value: /tmp/passwd
            - name: NSS_WRAPPER_GROUP
              value: /tmp/group

Adding libnss_wrapper.so is done with :

apk add --no-cache --virtual .nss_wrapper-build-deps git build-base cmake cmocka-dev
git clone git://git.samba.org/nss_wrapper.git
cd nss_wrapper
mkdir build
cd build/

mkdir -p /usr/local/include/
echo -e "#ifndef NSS__H\n#define NSS__H\n\nenum nss_status\n{\n\tNSS_STATUS_TRYAGAIN = -2,\n\tNSS_STATUS_UNAVAIL = -1,\n\tNSS_STATUS_NOTFOUND = 0,\n\tNSS_STATUS_SUCCESS = 1,\n\tNSS_STATUS_RETURN = 2\n};\n\n#endif" > /usr/local/include/nss.h
cmake .. -DUNIT_TESTING:BOOL=ON
make
make CTEST_OUTPUT_ON_FAILURE=TRUE test
make install

This way I can run git-sync on openshift platform without any specific serviceAccount.

So switching to debian may help because debian already includes libnss_wrapper

@thockin
Copy link
Member Author

thockin commented Mar 15, 2019 via email

@Vampouille
Copy link

If you have time to prototype this, it would be great - I don't have openshift, so I can't test it directly.

Done with #155

@thockin
Copy link
Member Author

thockin commented Mar 18, 2019 via email

@Vampouille
Copy link

though nothing calls that script?

In order to use libnss_wrapper you need to set at least 3 env vars:

  • LD_PRELOAD: path to the libnss_wrapper.so file
  • NSS_WRAPPER_PASSWD: path to the fake passwd file (like /etc/passwd)
  • NSS_WRAPPER_GROUP: path to the fake group file
    but I can define those variables at build time in Dockerfile

If we switch to debian we no longer need any of that?

We don't need to build libnss_wrapper but we still need to use it to fit openshift security requirement

@thockin
Copy link
Member Author

thockin commented Mar 19, 2019 via email

@thockin thockin removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 22, 2019
@thockin
Copy link
Member Author

thockin commented Mar 22, 2019

I am removing the hold. I think we should do this.

Copy link
Member

@stp-ip stp-ip left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve
/merge

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 24, 2019
@stp-ip
Copy link
Member

stp-ip commented Mar 24, 2019

/approve
/merge

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: stp-ip

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 24, 2019
@k8s-ci-robot k8s-ci-robot merged commit 076076d into kubernetes:master Mar 24, 2019
@thockin thockin deleted the baseimage-debian branch October 31, 2020 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants