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 overriding default pod specs #307

Merged
merged 5 commits into from
Sep 24, 2019

Conversation

PrasadG193
Copy link
Contributor

@PrasadG193 PrasadG193 commented Sep 20, 2019

Change Overview

This PR adds support for overriding default pod specs using blueprint args and actionset fields

Usage:

Pod spec overriding with Blueprint args:

    - func: PrepareData
      name: dumpToObjectStore
      args:
        podOverride:
          containers:
          - command: ["ls", "-l", "/override"]

Pod spec overriding with Actionset fields:

spec:
  actions:
    podOverride:
      containers:
      - imagePullPolicy: Never
        volumeMounts:
        - mountPath: /override
          name: data
      volumes:
      - name: data
        persistentVolumeClaim:
          claimName: my-release-mysql

Pull request type

Please check the type of change your PR introduces:

  • Work in Progress
  • Refactoring (no functional changes, no api changes)
  • Trivial/Minor
  • Bugfix
  • Feature
  • Documentation

Issues

  • #XXX

Test Plan

  • Manual
  • Unit test
  • E2E

@PrasadG193 PrasadG193 changed the title Pod spec override Add support for overriding default pod specs Sep 20, 2019
@PrasadG193 PrasadG193 force-pushed the pod-spec-override branch 2 times, most recently from 603e357 to 81296b7 Compare September 23, 2019 12:54
@PrasadG193 PrasadG193 marked this pull request as ready for review September 23, 2019 12:54
Signed-off-by: Prasad Ghangal <prasad.ghangal@gmail.com>
Signed-off-by: Prasad Ghangal <prasad.ghangal@gmail.com>
Signed-off-by: Prasad Ghangal <prasad.ghangal@gmail.com>
Signed-off-by: Prasad Ghangal <prasad.ghangal@gmail.com>
Signed-off-by: Prasad Ghangal <prasad.ghangal@gmail.com>
ServiceAccountName: opts.ServiceAccountName,
}
// Override default specs if podspecs are passed
if !reflect.DeepEqual(opts.PodOverride, v1.PodSpec{}) {
Copy link
Contributor

Choose a reason for hiding this comment

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

rather than repeat this check in each function, can we push this logic down into PodSpecOverride?

@mergify mergify bot merged commit eb7dcde into kanisterio:master Sep 24, 2019
@SupriyaKasten
Copy link
Contributor

Merging this PR, we can work on the review requests in a new PR.

@@ -133,3 +151,18 @@ func WaitForPodCompletion(ctx context.Context, cli kubernetes.Interface, namespa
})
return errors.Wrap(err, "Pod did not transition into complete state")
}

// PodSpecOverride override default pod Spec with the ones provided via specs
func PodSpecOverride(ctx context.Context, defaultSpecs, overrideSpecs v1.PodSpec) (v1.PodSpec, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. I am confused about what the semantics (expected behavior) for this function are. It is not clear from the documentation.
  2. From whatever I can infer (really guess), it is not clear that the implementation below achieves that.
  3. Is there test coverage for this function?

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.

None yet

4 participants