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 oadm migrate etcd-ttl which encodes upstream TTL migration #14559

Merged
merged 1 commit into from
Jun 15, 2017

Conversation

smarterclayton
Copy link
Contributor

This is in support of v2 -> v3

[test] @sdodson

@smarterclayton
Copy link
Contributor Author

@ingvagabund taking the upstream and going to put it into openshift - we may need this in the future anyway

@smarterclayton smarterclayton force-pushed the migrate_etcd branch 2 times, most recently from b758e6c to 86f0a54 Compare June 9, 2017 21:49
@smarterclayton
Copy link
Contributor Author

smarterclayton commented Jun 10, 2017 via email

@smarterclayton
Copy link
Contributor Author

[test]

fmt.Fprintf(o.Out, "info: Attaching lease to %d entries\n", len(objectsResp.Kvs))
errors := 0
for _, kv := range objectsResp.Kvs {
_, err := client.KV.Put(ctx, string(kv.Key), string(kv.Value), clientv3.WithLease(lease.ID))
Copy link
Contributor

@liggitt liggitt Jun 13, 2017

Choose a reason for hiding this comment

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

make conditional so we don't stomp a changed value, gather items we need to retry?

return fmt.Errorf("unable to get objects to attach to the lease: %v", err)
}

lease, err := client.Lease.Grant(ctx, int64(o.leaseDuration/time.Second))
Copy link
Contributor

Choose a reason for hiding this comment

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

are there any downsides to associating a lot of items with a single lease?

func (o *MigrateTTLReferenceOptions) Bind(flag *pflag.FlagSet) {
flag.StringVar(&o.etcdAddress, "etcd-address", "", "Etcd address")
flag.StringVar(&o.ttlKeysPrefix, "ttl-keys-prefix", "", "Prefix for TTL keys")
flag.DurationVar(&o.leaseDuration, "lease-duration", time.Hour, "Lease duration (seconds granularity)")
Copy link
Contributor

Choose a reason for hiding this comment

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

I wouldn't set a default duration... I would require the caller to decide

// Make sure that ttlKeysPrefix is ended with "/" so that we only get children "directories".
if !strings.HasSuffix(o.ttlKeysPrefix, "/") {
o.ttlKeysPrefix += "/"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

require duration to be > time.Second

@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 13, 2017
@smarterclayton
Copy link
Contributor Author

smarterclayton commented Jun 13, 2017 via email

@smarterclayton
Copy link
Contributor Author

[merge]

@openshift-bot
Copy link
Contributor

openshift-bot commented Jun 13, 2017

continuous-integration/openshift-jenkins/merge Waiting: You are in the build queue at position: 19

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to 085df3c

@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 13, 2017
@smarterclayton
Copy link
Contributor Author

[severity:blocker]

@smarterclayton
Copy link
Contributor Author

[test]

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to bfec1fc

@smarterclayton smarterclayton merged commit d89fcd6 into openshift:master Jun 15, 2017
@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin/2252/) (Base Commit: 811a267)

@sdodson
Copy link
Member

sdodson commented Jun 15, 2017

@ingvagabund this should be in the next 3.6 build so you can switch to using this

@ingvagabund
Copy link
Member

Will check repos and update. @smarterclayton @sdodson thanks

@sdodson
Copy link
Member

sdodson commented Jun 16, 2017 via email

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.

5 participants