Skip to content

Commit 9cef0e6

Browse files
committed
Fix un-initialized once that causes panic
1 parent 120b59a commit 9cef0e6

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

pkg/admission/controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ type CertProvisioner struct {
3737
CertGenerator generator.CertGenerator
3838
CertWriter writer.CertWriter
3939

40-
once *sync.Once
40+
once sync.Once
4141
}
4242

4343
// Sync takes a runtime.Object which is expected to be either a MutatingWebhookConfiguration or

pkg/admission/controller_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package admission
2+
3+
import (
4+
"testing"
5+
6+
"k8s.io/api/admissionregistration/v1beta1"
7+
)
8+
9+
func TestCertProvisionerInit(t *testing.T) {
10+
p := &CertProvisioner{}
11+
config := &v1beta1.MutatingWebhookConfiguration{}
12+
p.Sync(config)
13+
}

0 commit comments

Comments
 (0)