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

Create nodetasks.IssueCert() #9282

Merged
merged 1 commit into from
Jun 8, 2020

Conversation

johngmyers
Copy link
Member

No description provided.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. area/nodeup labels Jun 5, 2020
@k8s-ci-robot k8s-ci-robot requested review from rdrgmnzs and zetaab June 5, 2020 15:03
@fejta-bot
Copy link

Unknown CLA label state. Rechecking for CLA labels.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/check-cla

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 5, 2020
return i.cert, i.key, i.ca
}

func (i *IssueCert) AddFileTasks(c *fi.ModelBuilderContext, dir string, name string, caName string, owner *string) {
Copy link
Member

Choose a reason for hiding this comment

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

Not something to address now, but we might want to use a struct just so we can name these fields. (Or we could have 3 methods that each build one of the file tasks, then it's easy to set e.g. the owner on them.)

Copy link
Member Author

Choose a reason for hiding this comment

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

Most Builders that use certs write them as three files. A few write as two files, omitting the CA. A very few, like the kubelet builder, need to include them in a configuration file.

I do want to keep the common case succinct. I'll see what using the struct looks like.


func (i *IssueCert) AddFileTasks(c *fi.ModelBuilderContext, dir string, name string, caName string, owner *string) {
certResource, keyResource, caResource := i.GetResources()
c.AddTask(&File{
Copy link
Member

Choose a reason for hiding this comment

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

FYI we have EnsureTask which can cope with duplicates (and enforces that the duplicates should be the same ... I guess we're not hitting it though!)

Copy link
Member Author

Choose a reason for hiding this comment

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

That would require two Builders to write the same cert to the same file. It would be a bad practice for two independent things to share the same cert. I might use EnsureTask for the CA file, though.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry - I was really thinking about the directory!


func (r *TaskDependentResource) Open() (io.Reader, error) {
if r.Resource == nil {
return nil, fmt.Errorf("resource opened before it is ready")
Copy link
Member

Choose a reason for hiding this comment

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

Nit: we might want to put the task name in here to help us debug if we do hit it - but I'm guessing we don't expect to hit this.

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't expect to hit this: it would require a bug where the consumer of the TaskDependentResource fails to declare it as a dependency. I'm thinking of turning this into a panic() as the retrying behavior of the Task scheduler would mask any such bug.

Copy link
Member

Choose a reason for hiding this comment

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

👍 either way works. klog.Fatalf == panic but makes it easier to add more information!

upup/pkg/fi/nodeup/nodetasks/issue_cert.go Show resolved Hide resolved
@justinsb
Copy link
Member

justinsb commented Jun 7, 2020

This LGTM - I had some comments / thoughts which I want to make sure you see @johngmyers , but you can choose whether they're worth resolving. So I'm going to add hold, but feel free to hold cancel.

/approve
/lgtm
/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 7, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: johngmyers, justinsb

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 lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jun 7, 2020
@johngmyers
Copy link
Member Author

/hold cancel
I'm going to wait for #9248 to land, then see about converting one of those client certs to IssueCert, adding the testing infrastructure around IssueCert users.

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 7, 2020
@justinsb
Copy link
Member

justinsb commented Jun 7, 2020

Sounds great, thanks @johngmyers - should I rebase #9248 now or are there more we should get in first? (I'm happy to add the testing for this task in #9248, I'm guessing it'll be required now anyway!)

@johngmyers
Copy link
Member Author

Please proceed with #9248 now. I was planning on doing further cert work on top of both. I also have one refactor depending on this and NodeupContext changes that could benefit from having golden tests.

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

4 similar comments
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@rifelpet
Copy link
Member

rifelpet commented Jun 8, 2020

/retest

@k8s-ci-robot k8s-ci-robot merged commit cd8681c into kubernetes:master Jun 8, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.19 milestone Jun 8, 2020
@johngmyers johngmyers deleted the create-issuecert branch June 8, 2020 15:33
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. area/nodeup 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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants