-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- When there is a problem in remote namespace creation onto a remote cluster, the associated NamespaceMap is updated with a Refused phase for that namespace (Status->CurrentMapping->NamespaceEntry->RemoteStatus->Phase=Refused). The NamespaceMap Controller will try to create that Namespace until the problem will be solved with an exponential backoff. - The controller updates the remote namespace condition in the NamespaceOffloading resource associated with the just created remote namespace.
- Loading branch information
1 parent
8476758
commit 9218feb
Showing
5 changed files
with
100 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
pkg/liqo-controller-manager/namespaceMap-controller/update_remoteNamespaceStatus.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package namespacemapctrl | ||
|
||
import ( | ||
"context" | ||
|
||
corev1 "k8s.io/api/core/v1" | ||
"k8s.io/apimachinery/pkg/types" | ||
"k8s.io/klog" | ||
|
||
offv1alpha1 "github.com/liqotech/liqo/apis/offloading/v1alpha1" | ||
mapsv1alpha1 "github.com/liqotech/liqo/apis/virtualKubelet/v1alpha1" | ||
liqoconst "github.com/liqotech/liqo/pkg/consts" | ||
liqoutils "github.com/liqotech/liqo/pkg/utils" | ||
) | ||
|
||
func (r *NamespaceMapReconciler) setReadyConditionOnRemoteNamespace(localName, message, clusterID string, | ||
namespacePhase mapsv1alpha1.MappingPhase) error { | ||
namespaceOffloading := &offv1alpha1.NamespaceOffloading{} | ||
if err := r.Get(context.TODO(), types.NamespacedName{ | ||
Namespace: localName, | ||
Name: liqoconst.DefaultNameNamespaceOffloading, | ||
}, namespaceOffloading); err != nil { | ||
klog.Errorf("%s -> unable to get namespaceOffloading for the namespace '%s'", | ||
err, localName) | ||
return err | ||
} | ||
|
||
var remoteNamespaceCondition offv1alpha1.RemoteNamespaceCondition | ||
remoteNamespaceCondition.Type = offv1alpha1.NamespaceReady | ||
remoteNamespaceCondition.Message = message | ||
if namespacePhase == mapsv1alpha1.MappingAccepted { | ||
remoteNamespaceCondition.Status = corev1.ConditionTrue | ||
remoteNamespaceCondition.Reason = "RemoteNamespaceCreated" | ||
} else { | ||
remoteNamespaceCondition.Status = corev1.ConditionFalse | ||
remoteNamespaceCondition.Reason = "RemoteNamespaceNotCreated" | ||
} | ||
|
||
_ = liqoutils.UpdateNamespaceOffloadingCondition(&namespaceOffloading.Status, | ||
&remoteNamespaceCondition, | ||
clusterID) | ||
|
||
if err := r.Update(context.TODO(), namespaceOffloading); err != nil { | ||
klog.Errorf("%s -> unable to update namespaceOffloading for the namespace '%s'", | ||
err, localName) | ||
return err | ||
} | ||
|
||
return nil | ||
} |