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 worker token TTL #621

Merged
merged 7 commits into from
Aug 26, 2024
Merged

Add worker token TTL #621

merged 7 commits into from
Aug 26, 2024

Conversation

bschimke95
Copy link
Contributor

Add an optional TTL for worker tokens similar to #620

This PR requires the (backward-compatible) update in the k8s-snap-api.
canonical/k8s-snap-api#5
Once this PR is reviewed and approved, I will merge the API change, create a new tag (1.0.3) and update this k8s-snap PR to use the new API version.

@bschimke95 bschimke95 requested a review from a team as a code owner August 23, 2024 07:48
Copy link
Contributor

@addyess addyess left a comment

Choose a reason for hiding this comment

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

LGTM

@addyess addyess force-pushed the KU-1414/worker-token-ttl branch 2 times, most recently from e54f001 to 9d87f9c Compare August 23, 2024 16:49
@bschimke95 bschimke95 force-pushed the KU-1414/worker-token-ttl branch 3 times, most recently from cf54e39 to 83daee4 Compare August 26, 2024 06:49
Copy link
Contributor

@HomayoonAlimohammadi HomayoonAlimohammadi left a comment

Choose a reason for hiding this comment

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

Thanks a lot @bschimke95! LGTM, Just a minor comment.

src/k8s/pkg/k8sd/database/worker.go Outdated Show resolved Hide resolved
Base automatically changed from KU-1246/token-expiration to main August 26, 2024 10:12
@bschimke95 bschimke95 merged commit 0bf274d into main Aug 26, 2024
19 of 20 checks passed
@bschimke95 bschimke95 deleted the KU-1414/worker-token-ttl branch August 26, 2024 12:04
Comment on lines +17 to 26
// Note(ben): Never change the order or remove a migration as this would break the internal microcluster counter!
SchemaExtensions = []schema.Update{
schemaApplyMigration("kubernetes-auth-tokens", "000-create.sql"),
schemaApplyMigration("cluster-configs", "000-create.sql"),

schemaApplyMigration("worker-tokens", "000-create.sql"),
schemaApplyMigration("worker-tokens", "001-add-expiry.sql"),

schemaApplyMigration("feature-status", "000-feature-status.sql"),
}
Copy link

Choose a reason for hiding this comment

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

Looks like the addition of schemaApplyMigration("worker-tokens", "001-add-expiry.sql") did not obey the comment at the top of this function:

// Note(ben): Never change the order or remove a migration as this would break the internal microcluster counter!

Comment on lines +1 to +2
ALTER TABLE worker_tokens
ADD COLUMN expiry DATETIME DEFAULT '2100-01-01 23:59:59';
Copy link
Contributor

Choose a reason for hiding this comment

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

@bschimke95 what if the table worker_tokens has a column named expiry already. Won't this fail?

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