-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add watching for secret resource updates
- Feature: The Ingress controller now watches for updates of Secrets with a TLS certificate and a key. If a Secret is updated and it is referenced by any deployed Ingress resource, the Ingress controller will update NGINX configuration. - Change: If a Secret referenced by one or more Ingress resources becomes invalid or gets removed, the configuration for those Ingress resources will be disabled until there is a valid Secret.
- Loading branch information
Showing
5 changed files
with
269 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package controller | ||
|
||
import ( | ||
"fmt" | ||
|
||
api_v1 "k8s.io/client-go/pkg/api/v1" | ||
) | ||
|
||
// ValidateTLSSecret validates the secret. If it is valid, the function returns nil. | ||
func ValidateTLSSecret(secret *api_v1.Secret) error { | ||
if _, exists := secret.Data[api_v1.TLSCertKey]; !exists { | ||
return fmt.Errorf("Secret doesn't have %v", api_v1.TLSCertKey) | ||
} | ||
|
||
if _, exists := secret.Data[api_v1.TLSPrivateKeyKey]; !exists { | ||
return fmt.Errorf("Secret doesn't have %v", api_v1.TLSPrivateKeyKey) | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.