Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
bfc1b89
transport: Add TransportForCARefWithProxy
tchap Jul 7, 2026
cd22c77
Add proxy resolution helpers
tchap Jul 7, 2026
7ee06c7
Add component-scoped proxy to all controllers
tchap Jul 7, 2026
6e856a3
Align integration tests
tchap Jul 15, 2026
ccddfe3
Add shared test helpers and improve test coverage
tchap Jul 15, 2026
053f60f
Make mergeNoProxy output deterministic and remove duplicate test
tchap Jul 23, 2026
b52e4de
Load proxy trustedCA into endpoint accessible controller TLS config
tchap Jul 23, 2026
9a6dc13
Add KUBERNETES_SERVICE_HOST to component proxy NO_PROXY entries
tchap Jul 23, 2026
5d82d59
Add e2e test for proxy validation degraded condition
tchap Jul 16, 2026
929b0a8
Add e2e test for IdPEndpointUnreachable warning event
tchap Jul 17, 2026
5a6b3ad
Refactor e2e proxy tests: extract SaveAndRestoreProxyConfig helper, a…
tchap Jul 20, 2026
6436859
Add A1/A2 e2e tests, split DeployKeycloak from AddKeycloakIDP
tchap Jul 21, 2026
b4381db
DeploySquidProxy returns host:port, callers choose http/https scheme
tchap Jul 21, 2026
b785c1f
A2 test: use TLS proxy with trustedCA, verify mount is removed after …
tchap Jul 21, 2026
0bf8910
C2 test: verify IdP reachability check went through Squid proxy
tchap Jul 21, 2026
9107129
Make the test suite disruptive
tchap Jul 22, 2026
09983d1
VerifyOAuthServerDeploymentProxyConfig: accept explicit expected values
tchap Jul 22, 2026
a9160d8
Implement proxy e2e test helpers and clean up test code
tchap Jul 22, 2026
2c1c88d
DeploySquidProxy: return both HTTP and HTTPS URLs, fix Squid 7 TLS co…
tchap Jul 22, 2026
58ffa5d
Make A1 passing
tchap Jul 23, 2026
ee6d9be
Align test name
tchap Jul 23, 2026
4fcc3d8
VerifyOAuthServerDeploymentProxyConfig: check NO_PROXY as superset
tchap Jul 23, 2026
e8ab356
Simplify A2 test: use plain HTTP proxy, no trustedCA
tchap Jul 24, 2026
562571e
C1 test: start with working proxy before switching to bad URL
tchap Jul 24, 2026
5f30dcb
Fix cleanup and conflict issues in proxy tests
tchap Jul 24, 2026
82504a7
migrate tests over from origin to cao + test no proxy, full/partial p…
ehearne-redhat Jul 20, 2026
d25f343
add extractNamespaceFromIDPName()
ehearne-redhat Jul 21, 2026
19184fd
use split api convention for keycloak deployment
ehearne-redhat Jul 21, 2026
d753a8f
amend tchap suggestions
ehearne-redhat Jul 23, 2026
4fea0cf
fix testPartialFullProxyEnvVars()
ehearne-redhat Jul 24, 2026
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
12 changes: 12 additions & 0 deletions cmd/cluster-authentication-operator-tests-ext/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/openshift/cluster-authentication-operator/pkg/version"

_ "github.com/openshift/cluster-authentication-operator/test/e2e"
_ "github.com/openshift/cluster-authentication-operator/test/e2e-component-proxy"
_ "github.com/openshift/cluster-authentication-operator/test/e2e-encryption"
_ "github.com/openshift/cluster-authentication-operator/test/e2e-encryption-kms"
_ "github.com/openshift/cluster-authentication-operator/test/e2e-encryption-perf"
Expand Down Expand Up @@ -85,6 +86,17 @@ func prepareOperatorTestsRegistry() (*oteextension.Registry, error) {
},
})

// ClusterStability set to Disruptive: component-proxy tests intentionally
// degrade the authentication operator to validate error handling.
extension.AddSuite(oteextension.Suite{
Name: "openshift/cluster-authentication-operator/component-proxy/disruptive",
Parallelism: 1,
ClusterStability: oteextension.ClusterStabilityDisruptive,
Qualifiers: []string{
`name.contains("[ComponentProxy]")`,
},
})

// The following suite runs tests that are disruptive to the cluster.
extension.AddSuite(oteextension.Suite{
Name: "openshift/cluster-authentication-operator/operator/disruptive",
Expand Down
114 changes: 114 additions & 0 deletions pkg/controllers/common/proxy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
package common

import (
"fmt"
"os"
"strings"

"golang.org/x/net/http/httpproxy"

"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/util/sets"

"github.com/openshift/api/features"
operatorv1 "github.com/openshift/api/operator/v1"
operatorv1listers "github.com/openshift/client-go/operator/listers/operator/v1"
"github.com/openshift/library-go/pkg/operator/configobserver/featuregates"

"github.com/openshift/cluster-authentication-operator/pkg/transport"
)

// ResolvedProxy holds the effective proxy configuration for authentication components.
type ResolvedProxy struct {
*httpproxy.Config
TrustedCAName string
}

func (p *ResolvedProxy) IsProxyConfigured() bool {
return len(p.HTTPProxy) != 0 || len(p.HTTPSProxy) != 0
}

// ProxyFunc returns a function that resolves the proxy URL for a given request URL.
func (p *ResolvedProxy) ProxyFunc() transport.ProxyFunc {
return transport.ProxyFunc(p.Config.ProxyFunc())
}

// ResolveProxy reads the component-scoped proxy from the Authentication
// operator CR (when the feature gate is enabled) and returns the effective proxy
// settings. When no component proxy is configured, it falls back to the process
// environment (which reflects the cluster-wide proxy).
func ResolveProxy(
featureGateAccessor featuregates.FeatureGateAccess,
operatorAuthLister operatorv1listers.AuthenticationLister,
) (*ResolvedProxy, error) {
authProxy, err := getComponentProxyConfig(featureGateAccessor, operatorAuthLister)
if err != nil {
return nil, err
}

if authProxy != nil {
return &ResolvedProxy{
TrustedCAName: authProxy.TrustedCA.Name,
Config: &httpproxy.Config{
HTTPProxy: authProxy.HTTPProxy,
HTTPSProxy: authProxy.HTTPSProxy,
NoProxy: mergeNoProxy(authProxy.NoProxy),
},
}, nil
}

return &ResolvedProxy{
Config: httpproxy.FromEnvironment(),
}, nil
}

// getComponentProxyConfig returns the component-scoped proxy configuration
// from operator.openshift.io/v1 Authentication if the feature gate is enabled.
// Returns (nil, nil) when the gate is disabled or the resource is not found.
func getComponentProxyConfig(
featureGateAccessor featuregates.FeatureGateAccess,
operatorAuthLister operatorv1listers.AuthenticationLister,
) (*operatorv1.AuthenticationProxyConfig, error) {
featureGates, err := featureGateAccessor.CurrentFeatureGates()
if err != nil {
return nil, fmt.Errorf("failed to get current feature gates: %w", err)
}
if !featureGates.Enabled(features.FeatureGateAuthenticationComponentProxy) {
return nil, nil
}

authOp, err := operatorAuthLister.Get("cluster")
if err != nil {
if errors.IsNotFound(err) {
return nil, nil
}
return nil, fmt.Errorf("failed to get operator.openshift.io/v1 authentication/cluster: %w", err)
}

proxy := authOp.Spec.Proxy
if proxy.HTTPProxy == "" && proxy.HTTPSProxy == "" {
return nil, nil
}
return &proxy, nil
}

// staticNoProxyEntries contains cluster-internal addresses that must bypass the
// proxy. Auth components connect to internal services via DNS names covered by
// .svc and .cluster.local. The kubernetes API service IP (KUBERNETES_SERVICE_HOST)
// is included explicitly because Go's in-cluster client connects to it by raw IP,
// which does not match the hostname-based entries above.
var staticNoProxyEntries = func() []string {
entries := []string{".cluster.local", ".svc", "127.0.0.1", "localhost"}
if host := os.Getenv("KUBERNETES_SERVICE_HOST"); host != "" {
entries = append(entries, host)
}
return entries
}()

// mergeNoProxy combines user-provided noProxy entries with static cluster-internal
// defaults. The result is deduplicated and sorted for deterministic output.
func mergeNoProxy(userNoProxy []string) string {
entries := sets.New[string](staticNoProxyEntries...)
entries.Insert(userNoProxy...)
return strings.Join(sets.List(entries), ",")
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Loading