-
Notifications
You must be signed in to change notification settings - Fork 94
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
Conversation
to remove circular dependency in tests.
pkg/cert/cert_watcher_test.go
Outdated
apiv1 "k8s.io/client-go/pkg/api/v1" | ||
) | ||
|
||
func TestIsSoonExpired(t *testing.T) { |
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.
Each test should be its own method.
pkg/notifier/lib.go
Outdated
if !ok { | ||
return nil, errors.New("No notifier set") | ||
} | ||
driver := extpoints.Drivers.Lookup(via) |
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.
Just use a switch statement, simpler
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.
use switch and simple methods call to notify lib instead of all these ext points and boiler plate.
pkg/cert/cert_watcher.go
Outdated
return false, int(cert.NotAfter.Sub(time.Now()) / (24 * time.Hour)), nil | ||
} | ||
|
||
func (c CertWatcher) configuration() (map[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.
/var/run/secrets/kubernetes.io/serviceaccount/ca.crt
pkg/cert/cert_watcher.go
Outdated
} | ||
|
||
func (c CertWatcher) Run() { | ||
f, err := os.Open(c.CertPath) |
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.
Open file on every tick and close it when the tick finishes.
pkg/notifier/lib.go
Outdated
if !ok { | ||
return nil, errors.New("No notifier set") | ||
} | ||
driver := extpoints.Drivers.Lookup(via) |
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.
use switch and simple methods call to notify lib instead of all these ext points and boiler plate.
c5400e1
to
559e24e
Compare
pkg/utils/utils.go
Outdated
@@ -0,0 +1,35 @@ | |||
package utils |
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.
package util not utils
559e24e
to
93088e0
Compare
pkg/cert/cert_watcher.go
Outdated
} | ||
} | ||
|
||
func (c CertWatcher) Run() { |
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.
Run() -> RunAndHold()
70ef1128 fix branch naming issue (#23) git-subtree-dir: hack/libbuild git-subtree-split: 70ef11282ee43c0ba11ee94e9e3d4d008b82498e
#11