Skip to content

Commit 946dbb1

Browse files
Add node pool recycling options
1 parent 2a9ccf9 commit 946dbb1

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

cloud/scope/managed_machine_pool.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"context"
2121
"encoding/json"
2222
"fmt"
23+
"github.com/oracle/cluster-api-provider-oci/cloud/util"
2324
"reflect"
2425
"sort"
2526
"strconv"
@@ -697,6 +698,10 @@ func (m *ManagedMachinePoolScope) UpdateNodePool(ctx context.Context, pool *oke.
697698
MaximumUnavailable: recycleConfig.MaximumUnavailable,
698699
}
699700
}
701+
if recycleConfig != nil && len(nodeConfigDetails.PlacementConfigs) != 0 {
702+
m.Logger.V(util.LogLevelWarn).Info("Placement configuration has been changed in the update, " +
703+
"hence node pool recycling configuration will not be sent with the update request")
704+
}
700705
if spec.NodeEvictionNodePoolSettings != nil {
701706
nodePoolDetails.NodeEvictionNodePoolSettings = &oke.NodeEvictionNodePoolSettings{
702707
EvictionGraceDuration: spec.NodeEvictionNodePoolSettings.EvictionGraceDuration,

cloud/util/util.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ import (
3434
"sigs.k8s.io/controller-runtime/pkg/client"
3535
)
3636

37+
const (
38+
LogLevelWarn = 3
39+
)
40+
3741
// GetClusterIdentityFromRef returns the OCIClusterIdentity referenced by the OCICluster.
3842
func GetClusterIdentityFromRef(ctx context.Context, c client.Client, ociClusterNamespace string, ref *corev1.ObjectReference) (*infrastructurev1beta2.OCIClusterIdentity, error) {
3943
identity := &infrastructurev1beta2.OCIClusterIdentity{}

exp/api/v1beta2/ocimanagedmachinepool_webhook.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ package v1beta2
1818

1919
import (
2020
"fmt"
21+
"reflect"
22+
2123
apierrors "k8s.io/apimachinery/pkg/api/errors"
2224
"k8s.io/apimachinery/pkg/runtime"
2325
"k8s.io/apimachinery/pkg/util/validation/field"
24-
"reflect"
2526
"sigs.k8s.io/cluster-api/util/version"
2627
ctrl "sigs.k8s.io/controller-runtime"
2728
"sigs.k8s.io/controller-runtime/pkg/webhook"

0 commit comments

Comments
 (0)