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

Notify admin exp certs #23

Merged
merged 9 commits into from
Jul 6, 2017
Merged

Notify admin exp certs #23

merged 9 commits into from
Jul 6, 2017

Conversation

ashiquzzaman33
Copy link
Contributor

#11

apiv1 "k8s.io/client-go/pkg/api/v1"
)

func TestIsSoonExpired(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Each test should be its own method.

if !ok {
return nil, errors.New("No notifier set")
}
driver := extpoints.Drivers.Lookup(via)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just use a switch statement, simpler

Copy link
Contributor

Choose a reason for hiding this comment

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

use switch and simple methods call to notify lib instead of all these ext points and boiler plate.

return false, int(cert.NotAfter.Sub(time.Now()) / (24 * time.Hour)), nil
}

func (c CertWatcher) configuration() (map[string]string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

/var/run/secrets/kubernetes.io/serviceaccount/ca.crt

}

func (c CertWatcher) Run() {
f, err := os.Open(c.CertPath)
Copy link
Contributor

Choose a reason for hiding this comment

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

Open file on every tick and close it when the tick finishes.

if !ok {
return nil, errors.New("No notifier set")
}
driver := extpoints.Drivers.Lookup(via)
Copy link
Contributor

Choose a reason for hiding this comment

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

use switch and simple methods call to notify lib instead of all these ext points and boiler plate.

@ashiquzzaman33 ashiquzzaman33 force-pushed the notify_admin_exp_certs branch 2 times, most recently from c5400e1 to 559e24e Compare July 4, 2017 05:04
@@ -0,0 +1,35 @@
package utils
Copy link
Contributor

Choose a reason for hiding this comment

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

package util not utils

}
}

func (c CertWatcher) Run() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Run() -> RunAndHold()

@tamalsaha tamalsaha merged commit 25f0857 into master Jul 6, 2017
@tamalsaha tamalsaha deleted the notify_admin_exp_certs branch July 6, 2017 21:04
tamalsaha added a commit that referenced this pull request Aug 18, 2018
70ef1128 fix branch naming issue (#23)

git-subtree-dir: hack/libbuild
git-subtree-split: 70ef11282ee43c0ba11ee94e9e3d4d008b82498e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants