-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Improve channel updates #7133
Improve channel updates #7133
Conversation
Cleanup of #6829 |
/assign @justinsb |
} | ||
|
||
name := b.cluster.ObjectMeta.Name + "-addons-bootstrap" | ||
// manifestURL, err := a.GetManifestFullUrl() |
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.
Any reason to leave the commented out section here?
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.
Nope, good catch. I cleaned that up.
manifestHash, err := utils.HashString(&rawManifest) | ||
klog.V(4).Infof("hash %s", manifestHash) | ||
if err != nil { | ||
manifestHash = "" |
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.
Typically a good idea to warn if there's any error we're ignoring. I'd probably return error here, as we should always be able to hash a string!
// HashString Takes String and returns a sha1 hash represented as a string | ||
func HashString(s *string) (string, error) { | ||
h := sha1.New() | ||
ts := strings.TrimSpace(*s) |
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.
Trimming the string probably belongs in the caller, not a generic HashString function
) | ||
|
||
// HashString Takes String and returns a sha1 hash represented as a string | ||
func HashString(s *string) (string, error) { |
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.
We probably shouldn't take a string pointer - it's a ref type anyway, and we can't pass nil
if err != nil { | ||
return "", err | ||
} | ||
sha := h.Sum(nil) // "sha" is uint8 type, encoded in base16 |
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.
Nit: I think the type is [20]byte
, actually
Looks great - thanks @granular-ryanbonham ! /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: granular-ryanbonham, 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 |
I'm going to create a target to fix the golden output, as now we have hashes the golden output is going to change even more often! |
Needs a rebase and a run of the new streamlined script in #7291 (It's a one-liner, so you can also just run it!) |
New changes are detected. LGTM label has been removed. |
48773a1
to
438a651
Compare
The update-hash script didn't update gobindata; will fix that separately.
438a651
to
cd0075d
Compare
…ease-1.14 Cherry Pick #7133 to release 1.14
Improve channel updates to use hash of manifests to ensure we always update.