Skip to content

Commit afdae6f

Browse files
committed
Add OAuth metadata CM resource sync
Create the OAuth metadata ConfigMap in the target namespace and then use the already existing logic to sync it to openshift-config-managed
1 parent ca12aa1 commit afdae6f

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

pkg/operator2/configmap.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func getMetadata(route *routev1.Route) string {
4444

4545
func getMetadataConfigMap(route *routev1.Route) *corev1.ConfigMap {
4646
meta := defaultMeta()
47-
meta.Namespace = machineConfigNamespace
47+
meta.Name = oauthMetadataName
4848
return &corev1.ConfigMap{
4949
ObjectMeta: meta,
5050
Data: map[string]string{

pkg/operator2/operator.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ const (
6767
cliConfigMount = systemConfigPathConfigMaps + "/" + cliConfigNameAndKey
6868
cliConfigPath = cliConfigMount + "/" + cliConfigNameAndKey
6969

70+
oauthMetadataName = systemConfigPrefix + "metadata"
71+
7072
userConfigPath = "/var/config/user"
7173

7274
servicePort = 443

pkg/operator2/starter.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,12 @@ func RunOperator(ctx *controllercmd.ControllerContext) error {
112112
v1helpers.EnsureOperatorConfigExists(dynamicClient, []byte(resource), gvr)
113113
}
114114

115-
resourceSyncerInformers := v1helpers.NewKubeInformersForNamespaces(kubeClient, targetName, userConfigNamespace)
115+
resourceSyncerInformers := v1helpers.NewKubeInformersForNamespaces(
116+
kubeClient,
117+
targetName,
118+
userConfigNamespace,
119+
machineConfigNamespace,
120+
)
116121

117122
operatorClient := &OperatorClient{
118123
authOperatorConfigInformers,
@@ -127,6 +132,14 @@ func RunOperator(ctx *controllercmd.ControllerContext) error {
127132
ctx.EventRecorder,
128133
)
129134

135+
// add syncing for the OAuth metadata ConfigMap
136+
if err := resourceSyncer.SyncSecret(
137+
resourcesynccontroller.ResourceLocation{Namespace: machineConfigNamespace, Name: targetName},
138+
resourcesynccontroller.ResourceLocation{Namespace: targetName, Name: oauthMetadataName},
139+
); err != nil {
140+
return err
141+
}
142+
130143
operator := NewAuthenticationOperator(
131144
*operatorClient,
132145
kubeInformersNamespaced,

0 commit comments

Comments
 (0)