Skip to content

Commit

Permalink
Make package internal functions private
Browse files Browse the repository at this point in the history
  • Loading branch information
kispaljr committed Aug 28, 2024
1 parent f0ef6f5 commit 8a3a3cc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pkg/apiserver/webhooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ type WebhookConfig struct {
CertManWebhook bool
}

// NewWebhookConfig creates a new WebhookConfig object filled with values read from environment variables
func NewWebhookConfig(ctx context.Context) *WebhookConfig {
// newWebhookConfig creates a new WebhookConfig object filled with values read from environment variables
func newWebhookConfig(ctx context.Context) *WebhookConfig {
var cfg WebhookConfig
// NOTE: CERT_NAMESPACE is supported for backward compatibility.
// TODO: We may consider using only WEBHOOK_SERVICE_NAMESPACE instead.
Expand All @@ -86,7 +86,7 @@ func NewWebhookConfig(ctx context.Context) *WebhookConfig {
!hasEnv("WEBHOOK_HOST") {

cfg.Type = WebhookTypeService
cfg.ServiceName, cfg.ServiceNamespace = WebhookServiceName(ctx)
cfg.ServiceName, cfg.ServiceNamespace = webhookServiceName(ctx)
cfg.Host = fmt.Sprintf("%s.%s.svc", cfg.ServiceName, cfg.ServiceNamespace)
} else {
cfg.Type = WebhookTypeUrl
Expand All @@ -99,8 +99,8 @@ func NewWebhookConfig(ctx context.Context) *WebhookConfig {
return &cfg
}

// WebhookServiceName returns the name and namespace of Kubernetes service belonging to the webhook
func WebhookServiceName(ctx context.Context) (serviceName, serviceNamespace string) {
// webhookServiceName returns the name and namespace of Kubernetes service belonging to the webhook
func webhookServiceName(ctx context.Context) (serviceName, serviceNamespace string) {
var apiSvcNs string

// the webhook service namespace gets it value from the following sources in order of precedence:
Expand Down Expand Up @@ -151,7 +151,7 @@ func WebhookServiceName(ctx context.Context) (serviceName, serviceNamespace stri
}

func setupWebhooks(ctx context.Context) error {
cfg := NewWebhookConfig(ctx)
cfg := newWebhookConfig(ctx)
if !cfg.CertManWebhook {
caBytes, err := createCerts(cfg)
if err != nil {
Expand Down

0 comments on commit 8a3a3cc

Please sign in to comment.