Skip to content

Commit

Permalink
fix labels & taints for static nodes (#1112)
Browse files Browse the repository at this point in the history
* fix labels & taints for static nodes

* Auto commit - update kustomization.yaml

* Auto commit - update kustomization.yaml

---------

Co-authored-by: CI/CD pipeline <CI/[email protected]>
  • Loading branch information
Despire and CI/CD pipeline authored Nov 27, 2023
1 parent e70ec62 commit e379a61
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion manifests/claudie/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ images:
- name: ghcr.io/berops/claudie/builder
newTag: 5b5ed1a-2449
- name: ghcr.io/berops/claudie/claudie-operator
newTag: 5b5ed1a-2449
newTag: 075a1c4-2451
- name: ghcr.io/berops/claudie/context-box
newTag: 5b5ed1a-2449
- name: ghcr.io/berops/claudie/kube-eleven
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ type StaticNodePool struct {
// Name of the nodepool.
Name string `json:"name"`
// List of static nodes for a particular static nodepool.
Nodes []StaticNode `json:"nodes"`
Nodes []StaticNode `json:"nodes"`
Labels map[string]string `json:"labels"`
Taints []corev1.Taint `json:"taints"`
}

// StaticNode defines a single static node for a particular static nodepool.
Expand Down
20 changes: 18 additions & 2 deletions services/claudie-operator/pkg/controller/controler_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package controller

import (
"fmt"

"github.com/berops/claudie/internal/manifest"
v1beta "github.com/berops/claudie/services/claudie-operator/pkg/api/v1beta1"
)
Expand Down Expand Up @@ -168,7 +167,15 @@ func mergeInputManifestWithSecrets(crd v1beta.InputManifest, providersWithSecret
return manifest.Manifest{}, buildSecretError(secretNamespaceName, fmt.Errorf("field %s not found", v1beta.PRIVATE_KEY))
}
}
nodePools.Static = append(nodePools.Static, manifest.StaticNodePool{Name: nodepool, Nodes: nodes})

np := getStaticNodePool(nodepool, crd.Spec.NodePools.Static)

nodePools.Static = append(nodePools.Static, manifest.StaticNodePool{
Name: nodepool,
Nodes: nodes,
Labels: np.Labels,
Taints: np.Taints,
})
}

return manifest.Manifest{
Expand Down Expand Up @@ -196,3 +203,12 @@ func buildProvisioningError(state v1beta.InputManifestStatus) error {
}
return fmt.Errorf(msg)
}

func getStaticNodePool(name string, nps []v1beta.StaticNodePool) *v1beta.StaticNodePool {
for _, v := range nps {
if v.Name == name {
return &v
}
}
return nil
}

0 comments on commit e379a61

Please sign in to comment.