@@ -6,36 +6,23 @@ import (
6
6
corev1 "k8s.io/api/core/v1"
7
7
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
8
8
"k8s.io/apimachinery/pkg/runtime"
9
- "k8s.io/apimachinery/pkg/runtime/serializer"
10
- utilruntime "k8s.io/apimachinery/pkg/util/runtime"
11
9
12
10
"github.com/golang/glog"
13
11
14
12
configv1 "github.com/openshift/api/config/v1"
15
- kubecontrolplanev1 "github.com/openshift/api/kubecontrolplane/v1"
16
13
operatorv1 "github.com/openshift/api/operator/v1"
17
14
osinv1 "github.com/openshift/api/osin/v1"
18
15
routev1 "github.com/openshift/api/route/v1"
19
16
"github.com/openshift/library-go/pkg/crypto"
20
17
"github.com/openshift/library-go/pkg/operator/resource/resourcemerge"
21
18
)
22
19
23
- // TODO this code dies once we get our own CLI config
24
- var (
25
- kubeControlplaneScheme = runtime .NewScheme ()
26
- kubeControlplaneCodecs = serializer .NewCodecFactory (kubeControlplaneScheme )
27
- kubeControlplaneEncoder = kubeControlplaneCodecs .LegacyCodec (kubecontrolplanev1 .GroupVersion ) // TODO I think there is a better way to do this
28
- )
29
-
30
- func init () {
31
- utilruntime .Must (kubecontrolplanev1 .Install (kubeControlplaneScheme ))
32
- }
33
-
34
20
func (c * authOperator ) handleOAuthConfig (
35
21
operatorConfig * operatorv1.Authentication ,
36
22
route * routev1.Route ,
37
23
service * corev1.Service ,
38
24
consoleConfig * configv1.Console ,
25
+ infrastructureConfig * configv1.Infrastructure ,
39
26
) (
40
27
* configv1.OAuth ,
41
28
* corev1.ConfigMap ,
@@ -93,8 +80,7 @@ func (c *authOperator) handleOAuthConfig(
93
80
94
81
assetPublicURL , corsAllowedOrigins := consoleToDeploymentData (consoleConfig )
95
82
96
- // TODO this pretends this is an OsinServerConfig
97
- cliConfig := & kubecontrolplanev1.KubeAPIServerConfig {
83
+ cliConfig := & osinv1.OsinServerConfig {
98
84
GenericAPIServerConfig : configv1.GenericAPIServerConfig {
99
85
ServingInfo : configv1.HTTPServingInfo {
100
86
ServingInfo : configv1.ServingInfo {
@@ -123,15 +109,11 @@ func (c *authOperator) handleOAuthConfig(
123
109
},
124
110
},
125
111
},
126
- OAuthConfig : & osinv1.OAuthConfig {
127
- MasterCA : getMasterCA (), // we have valid serving certs provided by service-ca so we can use the service for loopback
128
- // TODO osin's code needs to be updated to properly use these values
129
- // it should use MasterURL in almost all places except the token request endpoint
130
- // which needs to direct the user to the real public URL (MasterPublicURL)
131
- // that means we still need to get that value from the installer's config
132
- // TODO ask installer team to make it easier to get that URL
112
+ OAuthConfig : osinv1.OAuthConfig {
113
+ MasterCA : getMasterCA (), // we have valid serving certs provided by service-ca so we can use the service for loopback
133
114
MasterURL : fmt .Sprintf ("https://%s.%s.svc" , service .Name , service .Namespace ),
134
115
MasterPublicURL : fmt .Sprintf ("https://%s" , route .Spec .Host ),
116
+ LoginURL : infrastructureConfig .Status .APIServerURL ,
135
117
AssetPublicURL : assetPublicURL , // set console route as valid 302 redirect for logout
136
118
AlwaysShowProviderSelection : false ,
137
119
IdentityProviders : identityProviders ,
@@ -153,7 +135,7 @@ func (c *authOperator) handleOAuthConfig(
153
135
},
154
136
}
155
137
156
- cliConfigBytes := encodeOrDieKubeControlplane (cliConfig )
138
+ cliConfigBytes := encodeOrDie (cliConfig )
157
139
158
140
completeConfigBytes , err := resourcemerge .MergeProcessConfig (nil , cliConfigBytes , operatorConfig .Spec .UnsupportedConfigOverrides .Raw )
159
141
if err != nil {
@@ -179,11 +161,3 @@ func getMasterCA() *string {
179
161
ca := serviceCAPath // need local var to be able to take address of it
180
162
return & ca
181
163
}
182
-
183
- func encodeOrDieKubeControlplane (obj runtime.Object ) []byte {
184
- bytes , err := runtime .Encode (kubeControlplaneEncoder , obj )
185
- if err != nil {
186
- panic (err ) // indicates static generated code is broken, unrecoverable
187
- }
188
- return bytes
189
- }
0 commit comments