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

Update CoreDNS manifests #878

Merged
merged 7 commits into from
Jun 17, 2019
Merged

Update CoreDNS manifests #878

merged 7 commits into from
Jun 17, 2019

Conversation

errordeveloper
Copy link
Contributor

@errordeveloper errordeveloper commented Jun 12, 2019

Description

Close #692

Checklist

  • Code compiles correctly (i.e make build)
  • Added tests that cover your change (if possible)
  • All unit tests passing (i.e. make test)

@errordeveloper errordeveloper marked this pull request as ready for review June 13, 2019 12:49
@errordeveloper errordeveloper force-pushed the fix-692 branch 3 times, most recently from d911c8c to 338d005 Compare June 13, 2019 14:18
@martina-if
Copy link
Contributor

LGTM, 2 minor comments. Merge when you need to

@martina-if
Copy link
Contributor

martina-if commented Jun 13, 2019 via email

@errordeveloper
Copy link
Contributor Author

@martina-if I've removed the field now. I kept the logic that sets metadata.resourceVersion and spec.clusterIP, as otherwise I'm seeing this error:

[✖]  Service "kube-dns" is invalid: [metadata.resourceVersion: Invalid value: "": must be specified for an update, spec.clusterIP: Invalid value: "": field is immutable]

@errordeveloper

This comment has been minimized.

@errordeveloper
Copy link
Contributor Author

This is good to go!

func UpdateCoreDNSImageTag(clientSet k8s.Interface, plan bool) (bool, error) {
printer := printers.NewJSONPrinter()
// UpdateCoreDNS will update the `coredns` add-on
func UpdateCoreDNS(rawClient kubernetes.RawClientInterface, region, controlPlaneVersion string, plan bool) (bool, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a bunch of logic here now, it would be good to test that it is doing the right thing, not only not throwing an error.

})

It("can update based to latest version", func() {
_, err := UpdateCoreDNSImageTag(clientSet, false)
_, err := UpdateCoreDNS(rawClient, "eu-west-2", "1.12.x", false)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@martina-if what do you make of this test? It checks as much as currently possible with this fake client of ours...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suppose we could add tests with other kind of pre-conditions that would result in errors, if you think that's important?

Copy link
Contributor

Choose a reason for hiding this comment

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

The problem I see is that if I break the logic in that function this test won't caught it because it only checks that there is no error returned. I prefer tests that tell you that you actually broke some piece of logic. Maybe it's hard to test with how it looks now. Perhaps it needs to be split in smaller pieces that can be tested. Or test that we call the client with the right information?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See below, the test looks at what requests were made - does that seem sufficient?

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, I don't see a better way right now to test this 👍

@errordeveloper errordeveloper merged commit 05ec5be into master Jun 17, 2019
@errordeveloper errordeveloper deleted the fix-692 branch June 17, 2019 12:18
torredil pushed a commit to torredil/eksctl that referenced this pull request May 20, 2022
Fix kustomize RBAC bindings to have namespace kube-system
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.

source latest coredns add-on manifest
2 participants