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

refactor namespace/name logic #6871

Merged
merged 4 commits into from
Nov 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions internal/k8s/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1747,7 +1747,7 @@
}

func (lbc *LoadBalancerController) handleSecretUpdate(secret *api_v1.Secret, resources []Resource) {
secretNsName := secret.Namespace + "/" + secret.Name
secretNsName := generateSecretNSName(secret)

Check warning on line 1750 in internal/k8s/controller.go

View check run for this annotation

Codecov / codecov/patch

internal/k8s/controller.go#L1750

Added line #L1750 was not covered by tests

var warnings configs.Warnings
var addOrUpdateErr error
Expand All @@ -1764,7 +1764,7 @@
}

func (lbc *LoadBalancerController) validationTLSSpecialSecret(secret *api_v1.Secret, secretName string, secretList *[]string) {
secretNsName := secret.Namespace + "/" + secret.Name
secretNsName := generateSecretNSName(secret)

Check warning on line 1767 in internal/k8s/controller.go

View check run for this annotation

Codecov / codecov/patch

internal/k8s/controller.go#L1767

Added line #L1767 was not covered by tests

err := secrets.ValidateTLSSecret(secret)
if err != nil {
Expand All @@ -1777,7 +1777,7 @@

func (lbc *LoadBalancerController) handleSpecialSecretUpdate(secret *api_v1.Secret) {
var specialTLSSecretsToUpdate []string
secretNsName := secret.Namespace + "/" + secret.Name
secretNsName := generateSecretNSName(secret)

Check warning on line 1780 in internal/k8s/controller.go

View check run for this annotation

Codecov / codecov/patch

internal/k8s/controller.go#L1780

Added line #L1780 was not covered by tests

if secretNsName == lbc.specialSecrets.defaultServerSecret {
lbc.validationTLSSpecialSecret(secret, configs.DefaultServerSecretFileName, &specialTLSSecretsToUpdate)
Expand All @@ -1795,6 +1795,10 @@
lbc.recorder.Eventf(secret, api_v1.EventTypeNormal, "Updated", "the special Secret %v was updated", secretNsName)
}

func generateSecretNSName(secret *api_v1.Secret) string {
return secret.Namespace + "/" + secret.Name

Check warning on line 1799 in internal/k8s/controller.go

View check run for this annotation

Codecov / codecov/patch

internal/k8s/controller.go#L1798-L1799

Added lines #L1798 - L1799 were not covered by tests
}
vepatel marked this conversation as resolved.
Show resolved Hide resolved

func getStatusFromEventTitle(eventTitle string) string {
switch eventTitle {
case "AddedOrUpdatedWithError", "Rejected", "NoVirtualServersFound", "Missing Secret", "UpdatedWithError":
Expand Down
Loading