Skip to content

Commit

Permalink
🍇 retain existing finalizers (#635)
Browse files Browse the repository at this point in the history
  • Loading branch information
petar-cvit authored Oct 27, 2024
1 parent 6acf5e7 commit c150e6b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
18 changes: 18 additions & 0 deletions cyclops-ctrl/pkg/cluster/k8sclient/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ func (k *KubernetesClient) createDynamicNamespaced(
}

obj.SetResourceVersion(current.GetResourceVersion())
obj.SetAnnotations(mergeAnnotations(current.GetAnnotations(), obj.GetAnnotations()))
obj.SetFinalizers(current.GetFinalizers())

_, err = k.Dynamic.Resource(gvr).Namespace(namespace).Update(
context.Background(),
Expand Down Expand Up @@ -264,6 +266,8 @@ func (k *KubernetesClient) createDynamicNonNamespaced(
}

obj.SetResourceVersion(current.GetResourceVersion())
obj.SetAnnotations(mergeAnnotations(current.GetAnnotations(), obj.GetAnnotations()))
obj.SetFinalizers(current.GetFinalizers())

_, err = k.Dynamic.Resource(gvr).Update(
context.Background(),
Expand Down Expand Up @@ -333,6 +337,20 @@ func mergePVCWithCurrent(current, obj *unstructured.Unstructured) error {
return unstructured.SetNestedMap(current.Object, requests, "spec", "resources", "requests")
}

func mergeAnnotations(existing, new map[string]string) map[string]string {
out := make(map[string]string)

for k, v := range existing {
out[k] = v
}

for k, v := range new {
out[k] = v
}

return out
}

func (k *KubernetesClient) ListNodes() ([]apiv1.Node, error) {
nodeList, err := k.clientset.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{})
return nodeList.Items, err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ const PodLogs = ({ pod }: PodLogsProps) => {
onCancel={handleCancelLogs}
cancelButtonProps={{ style: { display: "none" } }}
style={{ zIndex: 100 }}
width={"80%"}
width={"90%"}
>
{error.message.length !== 0 && (
<Alert
Expand Down
2 changes: 1 addition & 1 deletion cyclops-ui/src/components/pages/Modules/Modules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const Modules = () => {

const getStatusColor = (module: any) => {
if (module.status === "unknown") {
return "gray";
return "#d3d3d3";
}

if (module.status === "healthy") {
Expand Down

0 comments on commit c150e6b

Please sign in to comment.