Skip to content

Commit d390563

Browse files
Merge pull request #839 from stlaz/session-secrets
CONSOLE-3912: Add secrets for session encryption/authentication in OIDC
2 parents e349072 + 8fc9630 commit d390563

File tree

71 files changed

+6434
-261
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+6434
-261
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ require (
88
github.com/ghodss/yaml v1.0.0
99
github.com/go-bindata/go-bindata v3.1.2+incompatible
1010
github.com/go-test/deep v1.0.5
11+
github.com/google/go-cmp v0.6.0
1112
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822
1213
github.com/openshift/api v0.0.0-20231218131639-7a5aa77cc72d
1314
github.com/openshift/build-machinery-go v0.0.0-20220913142420-e25cf57ea46d
1415
github.com/openshift/client-go v0.0.0-20231218140158-47f6d749b9d9
1516
github.com/openshift/library-go v0.0.0-20240115112243-470c096a1ca9
1617
github.com/spf13/cobra v1.7.0
18+
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1
1719
gopkg.in/yaml.v2 v2.4.0
1820
k8s.io/api v0.29.0
1921
k8s.io/apiextensions-apiserver v0.29.0
@@ -51,7 +53,6 @@ require (
5153
github.com/golang/protobuf v1.5.3 // indirect
5254
github.com/google/cel-go v0.17.7 // indirect
5355
github.com/google/gnostic-models v0.6.8 // indirect
54-
github.com/google/go-cmp v0.6.0 // indirect
5556
github.com/google/gofuzz v1.2.0 // indirect
5657
github.com/google/pprof v0.0.0-20230705174524-200ffdc848b8 // indirect
5758
github.com/google/uuid v1.3.0 // indirect
@@ -90,7 +91,6 @@ require (
9091
go.uber.org/multierr v1.11.0 // indirect
9192
go.uber.org/zap v1.25.0 // indirect
9293
golang.org/x/crypto v0.14.0 // indirect
93-
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 // indirect
9494
golang.org/x/net v0.17.0 // indirect
9595
golang.org/x/oauth2 v0.10.0 // indirect
9696
golang.org/x/sync v0.3.0 // indirect

go.sum

Lines changed: 32 additions & 0 deletions
Large diffs are not rendered by default.

manifests/03-rbac-role-cluster.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,23 @@ rules:
3535
- apiGroups:
3636
- config.openshift.io
3737
resources:
38+
- authentications
3839
- oauths
3940
- infrastructures
4041
- ingresses
4142
- proxies
4243
- clusterversions
44+
- featuregates
4345
verbs:
4446
- get
4547
- list
4648
- watch
49+
- apiGroups:
50+
- config.openshift.io
51+
resources:
52+
- authentications/status
53+
verbs:
54+
- patch
4755
- apiGroups:
4856
- config.openshift.io
4957
resources:

manifests/03-rbac-role-ns-openshift-config-managed.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ rules:
2121
# Check: https://kubernetes.io/docs/reference/access-authn-authz/rbac/#referring-to-resources
2222
- create
2323
- watch
24+
- apiGroups:
25+
- ""
26+
resources:
27+
- secrets
28+
verbs:
29+
- get
30+
- list
31+
- watch
2432
- apiGroups:
2533
- ""
2634
resources:

pkg/api/api.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package api
22

33
const (
4+
AuthServerCAMountDir = "/var/auth-server-ca"
5+
AuthServerCAFileName = "ca-bundle.crt"
46
ClusterOperatorName = "console"
57
ConfigResourceName = "cluster"
68
ConsoleContainerPort = 443
@@ -35,6 +37,7 @@ const (
3537
RedirectContainerPort = 8444
3638
RedirectContainerPortName = "custom-route-redirect"
3739
ServiceCAConfigMapName = "service-ca"
40+
SessionSecretName = "session-secret"
3841
TargetNamespace = "openshift-console"
3942
TrustedCABundleKey = "ca-bundle.crt"
4043
TrustedCABundleMountDir = "/etc/pki/ca-trust/extracted/pem"

pkg/console/controllers/clidownloads/controller.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
// openshift
1818
v1 "github.com/openshift/api/console/v1"
1919
operatorsv1 "github.com/openshift/api/operator/v1"
20+
operatorv1listers "github.com/openshift/client-go/operator/listers/operator/v1"
2021
"github.com/openshift/library-go/pkg/controller/factory"
2122
"github.com/openshift/library-go/pkg/operator/events"
2223
"github.com/openshift/library-go/pkg/operator/resource/resourcemerge"
@@ -32,7 +33,6 @@ import (
3233

3334
// clients
3435
consoleclientv1 "github.com/openshift/client-go/console/clientset/versioned/typed/console/v1"
35-
operatorclientv1 "github.com/openshift/client-go/operator/clientset/versioned/typed/operator/v1"
3636
routeclientv1 "github.com/openshift/client-go/route/clientset/versioned/typed/route/v1"
3737

3838
// operator
@@ -49,15 +49,14 @@ type CLIDownloadsSyncController struct {
4949
consoleCliDownloadsClient consoleclientv1.ConsoleCLIDownloadInterface
5050
ingressClient configclientv1.IngressInterface
5151
routeClient routeclientv1.RoutesGetter
52-
operatorConfigClient operatorclientv1.ConsoleInterface
52+
operatorConfigLister operatorv1listers.ConsoleLister
5353
}
5454

5555
func NewCLIDownloadsSyncController(
5656
// top level config
5757
configClient configclientv1.ConfigV1Interface,
5858
// clients
5959
operatorClient v1helpers.OperatorClient,
60-
operatorConfigClient operatorclientv1.OperatorV1Interface,
6160
cliDownloadsInterface consoleclientv1.ConsoleCLIDownloadInterface,
6261
routeClient routeclientv1.RoutesGetter,
6362
// informers
@@ -75,7 +74,7 @@ func NewCLIDownloadsSyncController(
7574
consoleCliDownloadsClient: cliDownloadsInterface,
7675
ingressClient: configClient.Ingresses(),
7776
routeClient: routeClient,
78-
operatorConfigClient: operatorConfigClient.Consoles(),
77+
operatorConfigLister: operatorConfigInformer.Lister(),
7978
}
8079

8180
configV1Informers := configInformer.Config().V1()
@@ -95,7 +94,7 @@ func NewCLIDownloadsSyncController(
9594
}
9695

9796
func (c *CLIDownloadsSyncController) Sync(ctx context.Context, controllerContext factory.SyncContext) error {
98-
operatorConfig, err := c.operatorConfigClient.Get(ctx, api.ConfigResourceName, metav1.GetOptions{})
97+
operatorConfig, err := c.operatorConfigLister.Get(api.ConfigResourceName)
9998
if err != nil {
10099
return err
101100
}

pkg/console/controllers/healthcheck/controller.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import (
2222
routev1 "github.com/openshift/api/route/v1"
2323
configclientv1 "github.com/openshift/client-go/config/clientset/versioned/typed/config/v1"
2424
configinformer "github.com/openshift/client-go/config/informers/externalversions"
25-
operatorclientv1 "github.com/openshift/client-go/operator/clientset/versioned/typed/operator/v1"
2625
v1 "github.com/openshift/client-go/operator/informers/externalversions/operator/v1"
26+
operatorv1listers "github.com/openshift/client-go/operator/listers/operator/v1"
2727
routeclientv1 "github.com/openshift/client-go/route/clientset/versioned/typed/route/v1"
2828
routesinformersv1 "github.com/openshift/client-go/route/informers/externalversions/route/v1"
2929
"github.com/openshift/library-go/pkg/controller/factory"
@@ -41,7 +41,7 @@ import (
4141
type HealthCheckController struct {
4242
// clients
4343
operatorClient v1helpers.OperatorClient
44-
operatorConfigClient operatorclientv1.ConsoleInterface
44+
operatorConfigLister operatorv1listers.ConsoleLister
4545
infrastructureClient configclientv1.InfrastructureInterface
4646
ingressClient configclientv1.IngressInterface
4747
routeClient routeclientv1.RoutesGetter
@@ -53,7 +53,6 @@ func NewHealthCheckController(
5353
configClient configclientv1.ConfigV1Interface,
5454
// clients
5555
operatorClient v1helpers.OperatorClient,
56-
operatorConfigClient operatorclientv1.ConsoleInterface,
5756
routev1Client routeclientv1.RoutesGetter,
5857
configMapClient coreclientv1.ConfigMapsGetter,
5958
// informers
@@ -66,7 +65,7 @@ func NewHealthCheckController(
6665
) factory.Controller {
6766
ctrl := &HealthCheckController{
6867
operatorClient: operatorClient,
69-
operatorConfigClient: operatorConfigClient,
68+
operatorConfigLister: operatorConfigInformer.Lister(),
7069
infrastructureClient: configClient.Infrastructures(),
7170
ingressClient: configClient.Ingresses(),
7271
routeClient: routev1Client,
@@ -94,7 +93,7 @@ func NewHealthCheckController(
9493

9594
func (c *HealthCheckController) Sync(ctx context.Context, controllerContext factory.SyncContext) error {
9695
statusHandler := status.NewStatusHandler(c.operatorClient)
97-
operatorConfig, err := c.operatorConfigClient.Get(ctx, api.ConfigResourceName, metav1.GetOptions{})
96+
operatorConfig, err := c.operatorConfigLister.Get(api.ConfigResourceName)
9897
if err != nil {
9998
klog.Errorf("operator config error: %v", err)
10099
return statusHandler.FlushAndReturn(err)

0 commit comments

Comments
 (0)