mirror of https://github.com/k3s-io/k3s
Merge pull request #41841 from csbell/dont-disable-configmap
Automatic merge from submit-queue (batch tested with PRs 41931, 39821, 41841, 42197, 42195) Revert conditional updates to configmap that breaks ingress Don't prevent configmap updates to happen on existing ingress-uid configmap despite the lack of ingress objects. Otherwise, ingress objects get created with the wrong name.pull/6/head
commit
adc5293ce6
|
@ -501,12 +501,6 @@ func (ic *IngressController) reconcileConfigMapForCluster(clusterName string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ingressList := ic.ingressInformerStore.List()
|
|
||||||
if len(ingressList) <= 0 {
|
|
||||||
glog.V(4).Infof("No federated ingresses, ignore reconcile config map.")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if clusterName == allClustersKey {
|
if clusterName == allClustersKey {
|
||||||
clusters, err := ic.configMapFederatedInformer.GetReadyClusters()
|
clusters, err := ic.configMapFederatedInformer.GetReadyClusters()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -529,7 +523,12 @@ func (ic *IngressController) reconcileConfigMapForCluster(clusterName string) {
|
||||||
uidConfigMapNamespacedName := types.NamespacedName{Name: uidConfigMapName, Namespace: uidConfigMapNamespace}
|
uidConfigMapNamespacedName := types.NamespacedName{Name: uidConfigMapName, Namespace: uidConfigMapNamespace}
|
||||||
configMapObj, found, err := ic.configMapFederatedInformer.GetTargetStore().GetByKey(cluster.Name, uidConfigMapNamespacedName.String())
|
configMapObj, found, err := ic.configMapFederatedInformer.GetTargetStore().GetByKey(cluster.Name, uidConfigMapNamespacedName.String())
|
||||||
if !found || err != nil {
|
if !found || err != nil {
|
||||||
glog.Errorf("Failed to get ConfigMap %q for cluster %q. Will try again later: %v", uidConfigMapNamespacedName, cluster.Name, err)
|
logmsg := fmt.Sprintf("Failed to get ConfigMap %q for cluster %q. Will try again later: %v", uidConfigMapNamespacedName, cluster.Name, err)
|
||||||
|
if len(ic.ingressInformerStore.List()) > 0 { // Error-level if ingresses are active, Info-level otherwise.
|
||||||
|
glog.Errorf(logmsg)
|
||||||
|
} else {
|
||||||
|
glog.V(4).Infof(logmsg)
|
||||||
|
}
|
||||||
ic.configMapDeliverer.DeliverAfter(clusterName, nil, ic.configMapReviewDelay)
|
ic.configMapDeliverer.DeliverAfter(clusterName, nil, ic.configMapReviewDelay)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,15 +133,15 @@ func TestIngressController(t *testing.T) {
|
||||||
t.Log("Adding Ingress UID ConfigMap to cluster 1")
|
t.Log("Adding Ingress UID ConfigMap to cluster 1")
|
||||||
cluster1ConfigMapWatch.Add(cfg1)
|
cluster1ConfigMapWatch.Add(cfg1)
|
||||||
|
|
||||||
// Test add federated ingress.
|
t.Log("Checking that UID annotation on Cluster 1 annotation was correctly updated prior to adding Federated Ingress")
|
||||||
t.Log("Adding Federated Ingress")
|
|
||||||
fedIngressWatch.Add(&fedIngress)
|
|
||||||
|
|
||||||
t.Log("Checking that UID annotation on Cluster 1 annotation was correctly updated after adding Federated Ingress")
|
|
||||||
cluster := GetClusterFromChan(fedClusterUpdateChan)
|
cluster := GetClusterFromChan(fedClusterUpdateChan)
|
||||||
assert.NotNil(t, cluster)
|
assert.NotNil(t, cluster)
|
||||||
assert.Equal(t, cluster.ObjectMeta.Annotations[uidAnnotationKey], cfg1.Data[uidKey])
|
assert.Equal(t, cluster.ObjectMeta.Annotations[uidAnnotationKey], cfg1.Data[uidKey])
|
||||||
|
|
||||||
|
// Test add federated ingress.
|
||||||
|
t.Log("Adding Federated Ingress")
|
||||||
|
fedIngressWatch.Add(&fedIngress)
|
||||||
|
|
||||||
t.Logf("Checking that appropriate finalizers are added")
|
t.Logf("Checking that appropriate finalizers are added")
|
||||||
// There should be an update to add both the finalizers.
|
// There should be an update to add both the finalizers.
|
||||||
updatedIngress := GetIngressFromChan(t, fedIngressUpdateChan)
|
updatedIngress := GetIngressFromChan(t, fedIngressUpdateChan)
|
||||||
|
|
Loading…
Reference in New Issue