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

Make garbage-collection labelling resource-specific #1798

Merged

Conversation

Projects
None yet
4 participants
@2opremio
Copy link
Collaborator

2opremio commented Mar 6, 2019

This prevents unintended delitions from happening if/when cluster object labels
are copied around.

I also changed some names and tweaked comments a bit.

Fixes #1787

Disclaimer: I haven't tested it (yet)

@2opremio 2opremio requested a review from squaremo Mar 6, 2019

@2opremio 2opremio force-pushed the 2opremio:make-gc-labelling-resource-specific branch 5 times, most recently from c7303e4 to a2ca569 Mar 6, 2019

Make garbage-collection labelling resource-specific
This prevents unintended delitions from happening if/when cluster object labels
are copied around.

I also, changed some names and tweaked comments a bit.

@2opremio 2opremio force-pushed the 2opremio:make-gc-labelling-resource-specific branch from a2ca569 to a085d5b Mar 6, 2019

@squaremo
Copy link
Member

squaremo left a comment

Looks correct to me. Can we have a test that resources with duplicated labels don't get collected?

@2opremio

This comment has been minimized.

Copy link
Collaborator Author

2opremio commented Mar 6, 2019

@2opremio 2opremio merged commit c9cda8a into weaveworks:master Mar 7, 2019

1 check passed

ci/circleci: build Your tests passed on CircleCI!
Details

@2opremio 2opremio deleted the 2opremio:make-gc-labelling-resource-specific branch Mar 7, 2019

// To prevent deleting objects with copied labels
// an object-specific mark is created (by including its identifier).
hasher.Write([]byte(resourceID))
return "sha256:" + base64.RawURLEncoding.EncodeToString(hasher.Sum(nil))

This comment has been minimized.

Copy link
@rndstr

rndstr Mar 7, 2019

Member

the colon : is not allowed in the k8s version we have running:

ts=2019-03-07T20:07:59.874086773Z caller=sync.go:482 component=cluster method=Sync cmd="kubectl apply -f -" took=1.260555818s err="running kubectl: The Secret \"my-secret\" is invalid: metadata.labels: Invalid value: \"sha256:XmUQTWgJCpTt_vgSxwB113djqIlbulw_bNcdVL9zNmk\": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue',  or 'my_value',  or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')" output=

will create an issue with more information

This comment has been minimized.

Copy link
@dimitropoulos

dimitropoulos Mar 7, 2019

Contributor

@rndstr so were you debuggin this for the last hour too? #1805

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.