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

Warn on missing TLS secret #9875

Merged
merged 54 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
43f195f
update api and code
jbohanon Aug 6, 2024
bb44d44
codegen
jbohanon Aug 6, 2024
304b6d4
kubernetes e2e
jbohanon Aug 8, 2024
531e91d
fix tests
jbohanon Aug 8, 2024
e9ba457
Merge main into jbohanon/missing-tls-secret
soloio-bulldozer[bot] Aug 8, 2024
e322dcb
add changelog
jbohanon Aug 8, 2024
647804e
Merge refs/heads/main into jbohanon/missing-tls-secret
soloio-bulldozer[bot] Aug 8, 2024
816ef5b
Merge refs/heads/main into jbohanon/missing-tls-secret
soloio-bulldozer[bot] Aug 8, 2024
82f2438
Merge refs/heads/main into jbohanon/missing-tls-secret
soloio-bulldozer[bot] Aug 8, 2024
3ba2380
fixes
jbohanon Aug 9, 2024
06a5999
Adding changelog file to new location
Aug 9, 2024
b847a7e
Deleting changelog file from old location
Aug 9, 2024
52c04a5
fix listener_subsystem_test
jbohanon Aug 9, 2024
c3ce3eb
tee gha output and grep for success/fail
jbohanon Aug 9, 2024
5e5223d
fix kubernetes e2e test
jbohanon Aug 9, 2024
eb65fc5
kube2e
jbohanon Aug 9, 2024
1e9f256
Merge branch 'main' of ssh://github.com/solo-io/gloo into jbohanon/mi…
jbohanon Aug 9, 2024
13ff84b
update action
jbohanon Aug 12, 2024
d85c578
unset ns env var when test installation run finishes
jbohanon Aug 12, 2024
4df4e4f
fix helm test import
jbohanon Aug 12, 2024
b7dc251
Merge refs/heads/main into jbohanon/missing-tls-secret
soloio-bulldozer[bot] Aug 12, 2024
bda0de3
revert gha
jbohanon Aug 12, 2024
6beb2c7
Merge branch 'jbohanon/missing-tls-secret' of ssh://github.com/solo-i…
jbohanon Aug 12, 2024
ad09a1e
Merge refs/heads/main into jbohanon/missing-tls-secret
soloio-bulldozer[bot] Aug 13, 2024
fbd5c27
Adding changelog file to new location
Aug 14, 2024
0f1b807
Deleting changelog file from old location
Aug 14, 2024
9123836
Merge branch 'main' into jbohanon/missing-tls-secret
jbohanon Aug 15, 2024
759aa30
PR feedback
jbohanon Aug 15, 2024
dc26e9a
Merge refs/heads/main into jbohanon/missing-tls-secret
soloio-bulldozer[bot] Aug 15, 2024
c5a1163
Merge refs/heads/main into jbohanon/missing-tls-secret
soloio-bulldozer[bot] Aug 15, 2024
266343f
update comment
jbohanon Aug 16, 2024
849ec77
add settings API for warning
jbohanon Aug 16, 2024
9745908
settings option for warning instead of error
jbohanon Aug 16, 2024
4a00783
update changelog
jbohanon Aug 16, 2024
23eaa92
helm and tests
jbohanon Aug 16, 2024
e0c7b84
fix build issues and codegen
jbohanon Aug 16, 2024
1ee3b05
missing curlies >_>
jbohanon Aug 16, 2024
de34f50
helm values fixes
jbohanon Aug 16, 2024
e2a98ab
missed one
jbohanon Aug 16, 2024
2dd6438
wrong value in test setup
jbohanon Aug 16, 2024
97d46c6
helm tests are actually passing now... excellent...
jbohanon Aug 16, 2024
a8c4afd
fix translation tests
jbohanon Aug 16, 2024
efb1631
put breaking change verbage in changelog
jbohanon Aug 16, 2024
b7c9d8e
add setting to preserve missing secret error to test manifest
jbohanon Aug 16, 2024
4500382
revert allow_warnings test
jbohanon Aug 19, 2024
6eeb021
add icky sleep
jbohanon Aug 19, 2024
25d0a89
Merge refs/heads/main into jbohanon/missing-tls-secret
soloio-bulldozer[bot] Aug 19, 2024
ffdc5b1
expand admin server assertions, move server tls test
jbohanon Aug 19, 2024
faa8d41
remove extra skeleton
jbohanon Aug 19, 2024
9aa94bb
Merge refs/heads/main into jbohanon/missing-tls-secret
soloio-bulldozer[bot] Aug 19, 2024
e65e20a
Merge refs/heads/main into jbohanon/missing-tls-secret
soloio-bulldozer[bot] Aug 19, 2024
383cd6f
rename bool and fix logic
jbohanon Aug 20, 2024
bd91d85
update setting in always accept test
jbohanon Aug 20, 2024
2df643e
Merge refs/heads/main into jbohanon/missing-tls-secret
soloio-bulldozer[bot] Aug 20, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ runs:
TEST_PKG: ./test/kubernetes/e2e/tests
ISTIO_VERSION: ${{ inputs.istio-version }}
shell: bash
run: make go-test
# we tee the output into a temp file and then grep through that for an overall summary of the run at the end.
run: 'mkdir ./_test/test_output && make go-test | tee ./_test/test_output/${{inputs.cluster-name}} || grep -E "(--- FAIL)|(--- PASS)" ./_test/test_output/${{inputs.cluster-name}}'
jbohanon marked this conversation as resolved.
Show resolved Hide resolved
- name: Archive bug report directory on failure
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: bug-report-${{ inputs.cluster-name }}
path: ./_test/bug_report/${{ inputs.cluster-name }}
path: ./_test/bug_report/${{ inputs.cluster-name }}
8 changes: 8 additions & 0 deletions changelog/v1.18.0-beta15/missing-tls-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
changelog:
- type: FIX
issueLink: https://github.com/solo-io/gloo/issues/6957
resolvesIssue: false
description: >-
Fix for issue where a missing TLS secret was treated by validation as an error,
potentially bringing down the entire HTTPS gateway if the gloo pod restarts while
in this bad state.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions pkg/utils/env/env.go

This file was deleted.

20 changes: 20 additions & 0 deletions pkg/utils/envutils/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,23 @@ func IsTruthyValue(value string) bool {
envValue, _ := strconv.ParseBool(value)
return envValue
}

// GetOrDefault returns the value of the environment variable for the given key,
// or the default value if the environment variable is not set.
func GetOrDefault(key, fallback string) string {
if value, ok := os.LookupEnv(key); ok {
return value
}
return fallback
}

// LookupOrDefault returns the value of the environment variable for the given key,
// or the default value if the environment variable is not set. Also returns whether
// the value existed.
func LookupOrDefault(key, fallback string) (string, bool) {
if value, ok := os.LookupEnv(key); ok {
return value, ok
} else {
return fallback, ok
}
}
18 changes: 18 additions & 0 deletions pkg/utils/kubeutils/kubectl/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,24 @@ func (c *Cli) Scale(ctx context.Context, namespace string, resource string, repl
return c.RunCommand(ctx, "wait", "-n", namespace, "--for=condition=available", resource, "--timeout=300s")
}

// RestartDeployment restarts a deployment. It does not wait for the deployment to be ready.
func (c *Cli) RestartDeployment(ctx context.Context, name string, extraArgs ...string) error {
args := append([]string{
"rollout",
"restart",
fmt.Sprintf("deployment/%s", name),
}, extraArgs...)
return c.RunCommand(ctx, args...)
}

// RestartDeploymentAndWait restarts a deployment and waits for it to become healthy.
func (c *Cli) RestartDeploymentAndWait(ctx context.Context, name string, extraArgs ...string) error {
if err := c.RestartDeployment(ctx, name, extraArgs...); err != nil {
return err
}
return c.DeploymentRolloutStatus(ctx, name, extraArgs...)
}

// GetContainerLogs retrieves the logs for the specified container
func (c *Cli) GetContainerLogs(ctx context.Context, namespace string, name string) (string, error) {
stdout, stderr, err := c.Execute(ctx, "-n", namespace, "logs", name)
Expand Down
4 changes: 2 additions & 2 deletions pkg/utils/requestutils/curl/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ func (c *requestConfig) generateArgs() []string {
var fullAddress string

if c.sni != "" {
sniResolution := fmt.Sprintf("%s:%d:%s", c.sni, c.port, c.host)
sniResolution := fmt.Sprintf("%s:%d:%s:%d", c.sni, c.port, c.host, c.port)
sam-heilbron marked this conversation as resolved.
Show resolved Hide resolved
fullAddress = fmt.Sprintf("%s://%s:%d", c.scheme, c.sni, c.port)
args = append(args, "--resolve", sniResolution)
args = append(args, "--connect-to", sniResolution)
} else {
fullAddress = fmt.Sprintf("%v://%s:%v/%s", c.scheme, c.host, c.port, c.path)
if len(c.queryParameters) > 0 {
Expand Down
10 changes: 10 additions & 0 deletions projects/gateway/pkg/reporting/add_proxy_validation_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,15 @@ func AddProxyValidationResult(resourceReports reporter.ResourceReports, proxy *g

func addListenerResult(resourceReports reporter.ResourceReports, listener *gloov1.Listener, listenerReport *validation.ListenerReport) error {
listenerErrs := getListenerLevelErrors(listenerReport)
listenerWarnings := getListenerLevelWarnings(listenerReport)

return translator.ForEachSource(listener, func(src translator.SourceRef) error {
srcResource, _ := resourceReports.Find(src.ResourceKind, &core.ResourceRef{Name: src.Name, Namespace: src.Namespace})
if srcResource == nil {
return missingReportForSourceErr
}
resourceReports.AddErrors(srcResource, listenerErrs...)
resourceReports.AddWarnings(srcResource, listenerWarnings...)
return nil
})
}
Expand Down Expand Up @@ -180,6 +182,14 @@ func getListenerLevelErrors(listenerReport *validation.ListenerReport) []error {

return listenerErrs
}
func getListenerLevelWarnings(listenerReport *validation.ListenerReport) []string {
listenerWarnings := validationutils.GetListenerWarning(listenerReport)

// TODO(jbohanon) implement warnings on various listener types and account for them here
sam-heilbron marked this conversation as resolved.
Show resolved Hide resolved
// similarly to the errors aggregation func above.

return listenerWarnings
}

// get errors that can be caused by virtual services
func getVirtualHostLevelErrorsAndWarnings(vhReport *validation.VirtualHostReport) ([]error, []string) {
Expand Down
16 changes: 16 additions & 0 deletions projects/gloo/api/grpc/validation/gloo_validation.proto
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,25 @@ message ListenerReport {
string reason = 2;
}

// warning types for the given listener config
message Warning {
enum Type {
jbohanon marked this conversation as resolved.
Show resolved Hide resolved
SSLConfigWarning = 0;
jbohanon marked this conversation as resolved.
Show resolved Hide resolved
}

// the type of the error
Type type = 1;
// any extra info as a string
string reason = 2;
}


// errors on top-level config of the listener
repeated Error errors = 2;

// warnings on the top-levelconfig of the listener
repeated Warning warnings = 7;

oneof listener_type_report {
// report for the http listener
HttpListenerReport http_listener_report = 3;
Expand Down
28 changes: 28 additions & 0 deletions projects/gloo/pkg/api/grpc/validation/gloo_validation.pb.clone.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 49 additions & 0 deletions projects/gloo/pkg/api/grpc/validation/gloo_validation.pb.equal.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading