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

(feat) support explicit fsGroup #1603

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Lerentis
Copy link

@Lerentis Lerentis commented Sep 7, 2024

added support to explicitly define the fsGroup according to https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#security-context
I know that in theory it could be overwritten in yaml declaration but there seems to be an xor with limit definitions. explicitly setting it works

Testing done

For testing i created a jenkins job with the following spec:

podTemplate(cloud: 'test', containers: [containerTemplate(args: '9999999', command: 'sleep', image: 'jenkins/inbound-agent:3248.v65ecb_254c298-5', livenessProbe: containerLivenessProbe(execArgs: '', failureThreshold: 0, initialDelaySeconds: 0, periodSeconds: 0, successThreshold: 0, timeoutSeconds: 0), name: 'jnlp', resourceLimitCpu: '', resourceLimitEphemeralStorage: '', resourceLimitMemory: '', resourceRequestCpu: '', resourceRequestEphemeralStorage: '', resourceRequestMemory: '', workingDir: '/home/jenkins/agent')], fsGroup: '1000', name: 'test', namespace: 'default') {
    node(POD_LABEL) {
        stage('test') {
            echo "hello world"
        }
    }
}

and checked if the securityContext of the resulting pod is set to the expected fsGroup:

  securityContext:
    fsGroup: 1000

which was set as expected

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@Lerentis Lerentis requested a review from a team as a code owner September 7, 2024 22:36
@Vlatombe
Copy link
Member

but there seems to be an xor with limit definitions

This needs a unit test.

@Vlatombe Vlatombe added the enhancement Improvements label Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants