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

[release-v1.34] used uncached client to get cluster proxy configmap (#2055) #2122

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions pkg/controller/config-controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,25 +382,26 @@ func (r *CDIConfigReconciler) reconcileImportProxy(config *cdiv1.CDIConfig) erro

// Create/Update a configmap with the CA certificates in the controllor context with the cluster-wide proxy CA certificates to be used by the importer pod
func (r *CDIConfigReconciler) reconcileImportProxyCAConfigMap(config *cdiv1.CDIConfig, proxy *ocpconfigv1.Proxy) error {
client := r.uncachedClient
cmName := proxy.Spec.TrustedCA.Name
if cmName == "" {
// Using the default cluster-wide proxy CA certificates configmap name
cmName = ClusterWideProxyConfigMapName
}
clusterWideProxyConfigMap := &v1.ConfigMap{}
if err := r.client.Get(context.TODO(), types.NamespacedName{Name: cmName, Namespace: ClusterWideProxyConfigMapNameSpace}, clusterWideProxyConfigMap); err == nil {
if err := client.Get(context.TODO(), types.NamespacedName{Name: cmName, Namespace: ClusterWideProxyConfigMapNameSpace}, clusterWideProxyConfigMap); err == nil {
// Copy the cluster-wide proxy CA certificates to the importer pod proxy CA certificates configMap
if certBytes, ok := clusterWideProxyConfigMap.Data[ClusterWideProxyConfigMapKey]; ok {
configMap := &v1.ConfigMap{}
if err := r.client.Get(context.TODO(), types.NamespacedName{Name: common.ImportProxyConfigMapName, Namespace: r.cdiNamespace}, configMap); errors.IsNotFound(err) {
if err := r.client.Create(context.TODO(), r.createProxyConfigMap(certBytes)); err != nil {
if err := client.Get(context.TODO(), types.NamespacedName{Name: common.ImportProxyConfigMapName, Namespace: r.cdiNamespace}, configMap); errors.IsNotFound(err) {
if err := client.Create(context.TODO(), r.createProxyConfigMap(certBytes)); err != nil {
return err
}
return nil
}
if configMap != nil {
configMap.Data[common.ImportProxyConfigMapKey] = certBytes
if err := r.client.Update(context.TODO(), configMap); err != nil {
if err := client.Update(context.TODO(), configMap); err != nil {
return err
}
}
Expand Down