This repository has been archived by the owner on Jun 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
pulls in DRONE_RUNNER_ANNOTATONS and puts it on the job spec #61
Open
whereismyjetpack
wants to merge
6
commits into
drone:master
Choose a base branch
from
whereismyjetpack:runnerAnnotations
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+22
−11
Open
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1b4d759
pulls in KUBE_RUNNER_ANNOTATONS and puts it on the job spec
whereismyjetpack cbecfa4
adds annotations to Runners Step
whereismyjetpack 710f49b
pass annotations to engine
whereismyjetpack dada226
pulls in annottions from step
whereismyjetpack c9c374d
pass new annotations to NewFiew
whereismyjetpack 1849bc5
fix syntax error
whereismyjetpack File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,12 +7,14 @@ package kube | |
import ( | ||
"path" | ||
"path/filepath" | ||
"strings" | ||
"strconv" | ||
"strings" | ||
|
||
"github.com/drone/drone-runtime/engine" | ||
"github.com/drone/drone/cmd/drone-controller/config" | ||
"github.com/sirupsen/logrus" | ||
|
||
"k8s.io/api/core/v1" | ||
v1 "k8s.io/api/core/v1" | ||
"k8s.io/apimachinery/pkg/api/resource" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/util/intstr" | ||
|
@@ -236,6 +238,13 @@ func toResources(step *engine.Step) v1.ResourceRequirements { | |
// helper function returns a kubernetes pod for the | ||
// given step and specification. | ||
func toPod(spec *engine.Spec, step *engine.Step) *v1.Pod { | ||
config, err := config.Environ() | ||
|
||
if err != nil { | ||
logrus.WithError(err).Fatalln("invalid configuration") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should return an error. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This has been removed in refactoring to use step config! |
||
|
||
} | ||
|
||
var volumes []v1.Volume | ||
volumes = append(volumes, toVolumes(spec, step)...) | ||
volumes = append(volumes, toConfigVolumes(spec, step)...) | ||
|
@@ -253,9 +262,10 @@ func toPod(spec *engine.Spec, step *engine.Step) *v1.Pod { | |
|
||
return &v1.Pod{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: step.Metadata.UID, | ||
Namespace: step.Metadata.Namespace, | ||
Labels: step.Metadata.Labels, | ||
Name: step.Metadata.UID, | ||
Namespace: step.Metadata.Namespace, | ||
Labels: step.Metadata.Labels, | ||
Annotations: config.Runner.Annotations, | ||
}, | ||
Spec: v1.PodSpec{ | ||
AutomountServiceAccountToken: boolptr(false), | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a standalone package and should not link to the main Drone repository as a dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering about this. I couldn't find a better way to pull the config in without copy-pasting the config code.. :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you would typically pass these through the Engine Constructor from Drone https://github.com/drone/drone-runtime/blob/master/engine/kube/kube.go#L34
I recommend looking at how the controller passes the Node to the Engine, for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the tip. I will work on this tonight
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This, too has been removed in recent commits!