-
Notifications
You must be signed in to change notification settings - Fork 55
Use the generic Serializer in libgitops, and fix some API machinery nits #257
Conversation
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.
Excellent work, just a couple of notes and questions.
@@ -56,22 +53,6 @@ func NewCordonHelper(node *corev1.Node, desired DesiredCordonStatus) *CordonHelp | |||
} | |||
} | |||
|
|||
// NewCordonHelperFromRuntimeObject returns a new CordonHelper, or an error if given object is not a | |||
// node or cannot be encoded as JSON | |||
func NewCordonHelperFromRuntimeObject(nodeObject runtime.Object, scheme *runtime.Scheme, gvk schema.GroupVersionKind, desired DesiredCordonStatus) (*CordonHelper, 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.
Apparently this code was copied here due to difficulties importing the library created here so maybe we could revisit whether that can be done now.
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.
Yes, I may open a dedicated PR to that refactor, as I'm not 100% sure how that drain code worked.
private: | ||
address: "172.17.8.101" |
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.
For the record this became an error after 8408805 and I missed the cleanup.
authenticationWebhook: | ||
cacheTTL: 2m0s | ||
server: | ||
url: http://127.0.0.1:5000/authenticate |
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.
These fields exist on BareMetalCluster
so presumably some copy/paste error brought them here.
infrastructureRef: | ||
kind: BareMetalCluster | ||
name: example |
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.
Are we really testing anything, if this was not noticed?
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.
Now we are, as we're using strict parsing. Before, we did non-strict parsing, so all of these just resulted in unset fields.
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.
Looking again, the example is named "clusterMissingBareMetalClusterDefinition" so probably valid to have this wrong.
// Create the secret to decode into | ||
ss := &ssv1alpha1.SealedSecret{} | ||
// Decode the Sealed Secret into the object | ||
if err := scheme.Serializer.Decoder().DecodeInto(fr, ss); err != nil { | ||
return nil, nil, "", nil, errors.Wrapf(err, "File %q does not contain a sealed secret, couldn't decode", secretFileName) |
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.
Previously the code was set up to handle multiple kinds of secret, although it only actually handled one.
I guess we can punt that to the time when we need a second kind, though it might be nice to note this in the commit description or maybe a comment.
…t other types of secrets
Failing at |
It was unexpected for me that the |
Hmm, next one:
|
6d913c6
to
10908cd
Compare
Closing in favor of: #273 |
This builds upon #251
This PR
This fixes some of the nits highlighted in #172
cc @bboreham