Update finalizer for runtime namespace
Change [0] moves the daemonset and configmap resources for a VINO resource to the runtime namespace; this change updates the finalizer to use the same name and namespace for those resources at delete time. Also updates commands at the end of the README for examining the cluster. [0] https://review.opendev.org/c/airship/vino/+/774549 Change-Id: If3d400f4f8a95d6413d1a8ee3805427eb0a3ead1
This commit is contained in:
parent
03dfc5ce8b
commit
a570f85718
@ -139,16 +139,16 @@ vino-system vino-controller-manager-788b994c74-sbf26 2/2 Running 0
|
|||||||
|
|
||||||
```
|
```
|
||||||
# kubectl apply -f config/samples/vino_cr.yaml
|
# kubectl apply -f config/samples/vino_cr.yaml
|
||||||
# kubectl get pods
|
# kubectl -n vino-system get pods
|
||||||
# kubectl get ds
|
# kubectl -n vino-system get ds
|
||||||
```
|
```
|
||||||
|
|
||||||
delete vino CR and make sure DaemonSet is deleted as well
|
delete vino CR and make sure DaemonSet is deleted as well
|
||||||
|
|
||||||
```
|
```
|
||||||
# kubectl delete vino vino-test-cr
|
# kubectl delete vino vino-test-cr
|
||||||
# kubectl get ds
|
# kubectl -n vino-system get ds
|
||||||
# kubectl get cm
|
# kubectl -n vino-system get cm
|
||||||
```
|
```
|
||||||
|
|
||||||
## Get in Touch
|
## Get in Touch
|
||||||
|
@ -366,6 +366,10 @@ func (r *VinoReconciler) getConfigMapName(vino *vinov1.Vino) string {
|
|||||||
return fmt.Sprintf("%s-%s", vino.Namespace, vino.Name)
|
return fmt.Sprintf("%s-%s", vino.Namespace, vino.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *VinoReconciler) getDaemonSetName(vino *vinov1.Vino) string {
|
||||||
|
return fmt.Sprintf("%s-%s", vino.Namespace, vino.Name)
|
||||||
|
}
|
||||||
|
|
||||||
func (r *VinoReconciler) getCurrentConfigMap(ctx context.Context, vino *vinov1.Vino) (*corev1.ConfigMap, error) {
|
func (r *VinoReconciler) getCurrentConfigMap(ctx context.Context, vino *vinov1.Vino) (*corev1.ConfigMap, error) {
|
||||||
logr.FromContext(ctx).Info("Getting current config map for vino object")
|
logr.FromContext(ctx).Info("Getting current config map for vino object")
|
||||||
cm := &corev1.ConfigMap{}
|
cm := &corev1.ConfigMap{}
|
||||||
@ -475,7 +479,7 @@ func (r *VinoReconciler) decorateDaemonSet(ctx context.Context, ds *appsv1.Daemo
|
|||||||
|
|
||||||
ds.Spec.Template.Spec.NodeSelector = vino.Spec.NodeSelector.MatchLabels
|
ds.Spec.Template.Spec.NodeSelector = vino.Spec.NodeSelector.MatchLabels
|
||||||
ds.Namespace = getRuntimeNamespace()
|
ds.Namespace = getRuntimeNamespace()
|
||||||
ds.Name = fmt.Sprintf("%s-%s", vino.Namespace, vino.Name)
|
ds.Name = r.getDaemonSetName(vino)
|
||||||
|
|
||||||
found := false
|
found := false
|
||||||
for _, vol := range ds.Spec.Template.Spec.Volumes {
|
for _, vol := range ds.Spec.Template.Spec.Volumes {
|
||||||
@ -639,7 +643,7 @@ func (r *VinoReconciler) finalize(ctx context.Context, vino *vinov1.Vino) error
|
|||||||
if err := r.Delete(ctx,
|
if err := r.Delete(ctx,
|
||||||
&appsv1.DaemonSet{
|
&appsv1.DaemonSet{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: vino.Name, Namespace: vino.Namespace,
|
Name: r.getDaemonSetName(vino), Namespace: getRuntimeNamespace(),
|
||||||
},
|
},
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -647,7 +651,7 @@ func (r *VinoReconciler) finalize(ctx context.Context, vino *vinov1.Vino) error
|
|||||||
if err := r.Delete(ctx,
|
if err := r.Delete(ctx,
|
||||||
&corev1.ConfigMap{
|
&corev1.ConfigMap{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: vino.Name, Namespace: vino.Namespace,
|
Name: r.getConfigMapName(vino), Namespace: getRuntimeNamespace(),
|
||||||
},
|
},
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user