Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
with:
egress-policy: audit

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ e2e-tests-v1alpha1: create-kind-cluster run-e2e-v1alpha1

.PHONY: e2e-tests
e2e-tests: setup-clusters
cd ./test/e2e && ginkgo --label-filter="!custom" -v -p .
cd ./test/e2e && ginkgo --timeout=70m --label-filter="!custom" -v -p .

e2e-tests-custom: setup-clusters
cd ./test/e2e && ginkgo --label-filter="custom" -v -p .
Expand Down
4 changes: 3 additions & 1 deletion apis/placement/v1beta1/binding_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"

"go.goms.io/fleet/apis"
)

const (
Expand Down Expand Up @@ -52,7 +54,7 @@ type BindingStatusGetterSetter interface {
// A BindingObj offers an abstract way to work with fleet binding objects.
// +kubebuilder:object:generate=false
type BindingObj interface {
client.Object
apis.ConditionedObj
BindingSpecGetterSetter
BindingStatusGetterSetter
}
Expand Down
4 changes: 3 additions & 1 deletion apis/placement/v1beta1/clusterresourceplacement_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"sigs.k8s.io/controller-runtime/pkg/client"

"go.goms.io/fleet/apis"
)

const (
Expand Down Expand Up @@ -58,7 +60,7 @@ type PlacementStatusGetterSetter interface {
// PlacementObj offers the functionality to work with fleet placement object.
// +kubebuilder:object:generate=false
type PlacementObj interface {
client.Object
apis.ConditionedObj
PlacementSpecGetterSetter
PlacementStatusGetterSetter
}
Expand Down
4 changes: 3 additions & 1 deletion apis/placement/v1beta1/policysnapshot_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"

"go.goms.io/fleet/apis"
)

const (
Expand Down Expand Up @@ -57,7 +59,7 @@ type PolicySnapshotStatusGetterSetter interface {
// A PolicySnapshotObj offers an abstract way to work with a fleet policy snapshot object.
// +kubebuilder:object:generate=false
type PolicySnapshotObj interface {
client.Object
apis.ConditionedObj
PolicySnapshotSpecGetterSetter
PolicySnapshotStatusGetterSetter
}
Expand Down
4 changes: 3 additions & 1 deletion apis/placement/v1beta1/resourcesnapshot_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"sigs.k8s.io/controller-runtime/pkg/client"

"go.goms.io/fleet/apis"
)

const (
Expand Down Expand Up @@ -74,7 +76,7 @@ type ResourceSnapshotStatusGetterSetter interface {
// A ResourceSnapshotObj offers an abstract way to work with a resource snapshot object.
// +kubebuilder:object:generate=false
type ResourceSnapshotObj interface {
client.Object
apis.ConditionedObj
ResourceSnapshotSpecGetterSetter
ResourceSnapshotStatusGetterSetter
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/clusterresourceplacement/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func (r *Reconciler) handleUpdate(ctx context.Context, crp *fleetv1beta1.Cluster
scheduleCondition := metav1.Condition{
Status: metav1.ConditionFalse,
Type: string(fleetv1beta1.ClusterResourcePlacementScheduledConditionType),
Reason: InvalidResourceSelectorsReason,
Reason: condition.InvalidResourceSelectorsReason,
Message: fmt.Sprintf("The resource selectors are invalid: %v", err),
ObservedGeneration: crp.Generation,
}
Expand Down Expand Up @@ -1194,7 +1194,7 @@ func buildScheduledCondition(crp *fleetv1beta1.ClusterResourcePlacement, latestS
return metav1.Condition{
Status: metav1.ConditionUnknown,
Type: string(fleetv1beta1.ClusterResourcePlacementScheduledConditionType),
Reason: SchedulingUnknownReason,
Reason: condition.SchedulingUnknownReason,
Message: "Scheduling has not completed",
ObservedGeneration: crp.Generation,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,9 @@ func checkClusterResourceSnapshot() *placementv1beta1.ClusterResourceSnapshot {
}

func updateClusterSchedulingPolicySnapshotStatus(status metav1.ConditionStatus, clustersSelected bool) *placementv1beta1.ClusterSchedulingPolicySnapshot {
reason := ResourceScheduleSucceededReason
reason := condition.ResourceScheduleSucceededReason
if status == metav1.ConditionFalse {
reason = ResourceScheduleFailedReason
reason = condition.ResourceScheduleFailedReason
}

// Update scheduling condition
Expand Down Expand Up @@ -422,7 +422,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{
Status: metav1.ConditionUnknown,
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
Reason: SchedulingUnknownReason,
Reason: condition.SchedulingUnknownReason,
},
},
},
Expand Down Expand Up @@ -461,7 +461,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{
Status: metav1.ConditionTrue,
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
Reason: ResourceScheduleSucceededReason,
Reason: condition.ResourceScheduleSucceededReason,
},
},
},
Expand All @@ -479,7 +479,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{Name: ptr.To("generation"), Value: ptr.To(strconv.FormatInt(gotCRP.Generation, 10))},
{Name: ptr.To("conditionType"), Value: ptr.To(string(placementv1beta1.ClusterResourcePlacementScheduledConditionType))},
{Name: ptr.To("status"), Value: ptr.To(string(corev1.ConditionUnknown))},
{Name: ptr.To("reason"), Value: ptr.To(SchedulingUnknownReason)},
{Name: ptr.To("reason"), Value: ptr.To(condition.SchedulingUnknownReason)},
},
Gauge: &prometheusclientmodel.Gauge{
Value: ptr.To(float64(time.Now().UnixNano()) / 1e9),
Expand Down Expand Up @@ -518,7 +518,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{
Status: metav1.ConditionFalse,
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
Reason: ResourceScheduleFailedReason,
Reason: condition.ResourceScheduleFailedReason,
},
},
},
Expand All @@ -535,7 +535,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{Name: ptr.To("generation"), Value: ptr.To(strconv.FormatInt(gotCRP.Generation, 10))},
{Name: ptr.To("conditionType"), Value: ptr.To(string(placementv1beta1.ClusterResourcePlacementScheduledConditionType))},
{Name: ptr.To("status"), Value: ptr.To(string(corev1.ConditionUnknown))},
{Name: ptr.To("reason"), Value: ptr.To(SchedulingUnknownReason)},
{Name: ptr.To("reason"), Value: ptr.To(condition.SchedulingUnknownReason)},
},
Gauge: &prometheusclientmodel.Gauge{
Value: ptr.To(float64(time.Now().UnixNano()) / 1e9),
Expand All @@ -547,7 +547,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{Name: ptr.To("generation"), Value: ptr.To(strconv.FormatInt(gotCRP.Generation, 10))},
{Name: ptr.To("conditionType"), Value: ptr.To(string(placementv1beta1.ClusterResourcePlacementScheduledConditionType))},
{Name: ptr.To("status"), Value: ptr.To(string(corev1.ConditionFalse))},
{Name: ptr.To("reason"), Value: ptr.To(ResourceScheduleFailedReason)},
{Name: ptr.To("reason"), Value: ptr.To(condition.ResourceScheduleFailedReason)},
},
Gauge: &prometheusclientmodel.Gauge{
Value: ptr.To(float64(time.Now().UnixNano()) / 1e9),
Expand Down Expand Up @@ -577,7 +577,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{
Status: metav1.ConditionTrue,
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
Reason: ResourceScheduleSucceededReason,
Reason: condition.ResourceScheduleSucceededReason,
},
{
Status: metav1.ConditionUnknown,
Expand Down Expand Up @@ -643,7 +643,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{Name: ptr.To("generation"), Value: ptr.To(strconv.FormatInt(gotCRP.Generation, 10))},
{Name: ptr.To("conditionType"), Value: ptr.To(string(placementv1beta1.ClusterResourcePlacementScheduledConditionType))},
{Name: ptr.To("status"), Value: ptr.To(string(corev1.ConditionUnknown))},
{Name: ptr.To("reason"), Value: ptr.To(SchedulingUnknownReason)},
{Name: ptr.To("reason"), Value: ptr.To(condition.SchedulingUnknownReason)},
},
Gauge: &prometheusclientmodel.Gauge{
Value: ptr.To(float64(time.Now().UnixNano()) / 1e9),
Expand Down Expand Up @@ -672,7 +672,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{
Status: metav1.ConditionTrue,
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
Reason: ResourceScheduleSucceededReason,
Reason: condition.ResourceScheduleSucceededReason,
},
{
Status: metav1.ConditionTrue,
Expand Down Expand Up @@ -787,7 +787,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{
Status: metav1.ConditionTrue,
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
Reason: ResourceScheduleSucceededReason,
Reason: condition.ResourceScheduleSucceededReason,
},
{
Status: metav1.ConditionUnknown,
Expand Down Expand Up @@ -851,7 +851,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{Name: ptr.To("generation"), Value: ptr.To(strconv.FormatInt(gotCRP.Generation, 10))},
{Name: ptr.To("conditionType"), Value: ptr.To(string(placementv1beta1.ClusterResourcePlacementScheduledConditionType))},
{Name: ptr.To("status"), Value: ptr.To(string(corev1.ConditionUnknown))},
{Name: ptr.To("reason"), Value: ptr.To(SchedulingUnknownReason)},
{Name: ptr.To("reason"), Value: ptr.To(condition.SchedulingUnknownReason)},
},
Gauge: &prometheusclientmodel.Gauge{
Value: ptr.To(float64(time.Now().UnixNano()) / 1e9),
Expand Down Expand Up @@ -880,7 +880,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{
Status: metav1.ConditionTrue,
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
Reason: ResourceScheduleSucceededReason,
Reason: condition.ResourceScheduleSucceededReason,
},
{
Status: metav1.ConditionTrue,
Expand Down Expand Up @@ -993,7 +993,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{
Status: metav1.ConditionUnknown,
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
Reason: SchedulingUnknownReason,
Reason: condition.SchedulingUnknownReason,
ObservedGeneration: 2,
},
{
Expand Down Expand Up @@ -1028,7 +1028,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{Name: ptr.To("generation"), Value: ptr.To(strconv.FormatInt(gotCRP.Generation, 10))},
{Name: ptr.To("conditionType"), Value: ptr.To(string(placementv1beta1.ClusterResourcePlacementScheduledConditionType))},
{Name: ptr.To("status"), Value: ptr.To(string(corev1.ConditionUnknown))},
{Name: ptr.To("reason"), Value: ptr.To(SchedulingUnknownReason)},
{Name: ptr.To("reason"), Value: ptr.To(condition.SchedulingUnknownReason)},
},
Gauge: &prometheusclientmodel.Gauge{
Value: ptr.To(float64(time.Now().UnixNano()) / 1e9),
Expand All @@ -1047,7 +1047,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{
Status: metav1.ConditionTrue,
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
Reason: ResourceScheduleSucceededReason,
Reason: condition.ResourceScheduleSucceededReason,
ObservedGeneration: 2,
},
{
Expand Down Expand Up @@ -1181,7 +1181,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{
Status: metav1.ConditionTrue,
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
Reason: ResourceScheduleSucceededReason,
Reason: condition.ResourceScheduleSucceededReason,
},
{
Status: metav1.ConditionTrue,
Expand Down Expand Up @@ -1270,7 +1270,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{Name: ptr.To("generation"), Value: ptr.To(strconv.FormatInt(gotCRP.Generation, 10))},
{Name: ptr.To("conditionType"), Value: ptr.To(string(placementv1beta1.ClusterResourcePlacementScheduledConditionType))},
{Name: ptr.To("status"), Value: ptr.To(string(corev1.ConditionUnknown))},
{Name: ptr.To("reason"), Value: ptr.To(SchedulingUnknownReason)},
{Name: ptr.To("reason"), Value: ptr.To(condition.SchedulingUnknownReason)},
},
Gauge: &prometheusclientmodel.Gauge{
Value: ptr.To(float64(time.Now().UnixNano()) / 1e9),
Expand Down Expand Up @@ -1439,7 +1439,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{
Status: metav1.ConditionUnknown,
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
Reason: SchedulingUnknownReason,
Reason: condition.SchedulingUnknownReason,
},
},
},
Expand Down Expand Up @@ -1480,7 +1480,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{
Status: metav1.ConditionTrue,
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
Reason: ResourceScheduleSucceededReason,
Reason: condition.ResourceScheduleSucceededReason,
},
{
Status: metav1.ConditionTrue,
Expand Down Expand Up @@ -1564,7 +1564,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{Name: ptr.To("generation"), Value: ptr.To(strconv.FormatInt(gotCRP.Generation, 10))},
{Name: ptr.To("conditionType"), Value: ptr.To(string(placementv1beta1.ClusterResourcePlacementScheduledConditionType))},
{Name: ptr.To("status"), Value: ptr.To(string(corev1.ConditionUnknown))},
{Name: ptr.To("reason"), Value: ptr.To(SchedulingUnknownReason)},
{Name: ptr.To("reason"), Value: ptr.To(condition.SchedulingUnknownReason)},
},
Gauge: &prometheusclientmodel.Gauge{
Value: ptr.To(float64(time.Now().UnixNano()) / 1e9),
Expand Down Expand Up @@ -1663,7 +1663,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{
Status: metav1.ConditionTrue,
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
Reason: ResourceScheduleSucceededReason,
Reason: condition.ResourceScheduleSucceededReason,
},
{
Status: metav1.ConditionTrue,
Expand Down Expand Up @@ -1747,7 +1747,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{Name: ptr.To("generation"), Value: ptr.To(strconv.FormatInt(gotCRP.Generation, 10))},
{Name: ptr.To("conditionType"), Value: ptr.To(string(placementv1beta1.ClusterResourcePlacementScheduledConditionType))},
{Name: ptr.To("status"), Value: ptr.To(string(corev1.ConditionUnknown))},
{Name: ptr.To("reason"), Value: ptr.To(SchedulingUnknownReason)},
{Name: ptr.To("reason"), Value: ptr.To(condition.SchedulingUnknownReason)},
},
Gauge: &prometheusclientmodel.Gauge{
Value: ptr.To(float64(time.Now().UnixNano()) / 1e9),
Expand Down Expand Up @@ -1791,7 +1791,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{
Status: metav1.ConditionTrue,
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
Reason: ResourceScheduleSucceededReason,
Reason: condition.ResourceScheduleSucceededReason,
},
{
Status: metav1.ConditionTrue,
Expand Down Expand Up @@ -1943,7 +1943,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{
Status: metav1.ConditionFalse,
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
Reason: InvalidResourceSelectorsReason,
Reason: condition.InvalidResourceSelectorsReason,
},
},
},
Expand All @@ -1958,7 +1958,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{Name: ptr.To("generation"), Value: ptr.To(strconv.FormatInt(gotCRP.Generation, 10))},
{Name: ptr.To("conditionType"), Value: ptr.To(string(placementv1beta1.ClusterResourcePlacementScheduledConditionType))},
{Name: ptr.To("status"), Value: ptr.To(string(corev1.ConditionFalse))},
{Name: ptr.To("reason"), Value: ptr.To(InvalidResourceSelectorsReason)},
{Name: ptr.To("reason"), Value: ptr.To(condition.InvalidResourceSelectorsReason)},
},
Gauge: &prometheusclientmodel.Gauge{
Value: ptr.To(float64(time.Now().UnixNano()) / 1e9),
Expand Down Expand Up @@ -2017,7 +2017,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{
Status: metav1.ConditionUnknown,
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
Reason: SchedulingUnknownReason,
Reason: condition.SchedulingUnknownReason,
},
},
},
Expand All @@ -2040,7 +2040,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{Name: ptr.To("generation"), Value: ptr.To(strconv.FormatInt(gotCRP.Generation, 10))},
{Name: ptr.To("conditionType"), Value: ptr.To(string(placementv1beta1.ClusterResourcePlacementScheduledConditionType))},
{Name: ptr.To("status"), Value: ptr.To(string(corev1.ConditionUnknown))},
{Name: ptr.To("reason"), Value: ptr.To(SchedulingUnknownReason)},
{Name: ptr.To("reason"), Value: ptr.To(condition.SchedulingUnknownReason)},
},
Gauge: &prometheusclientmodel.Gauge{
Value: ptr.To(float64(time.Now().UnixNano()) / 1e9),
Expand All @@ -2064,7 +2064,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
{
Status: metav1.ConditionTrue,
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
Reason: ResourceScheduleSucceededReason,
Reason: condition.ResourceScheduleSucceededReason,
},
{
Status: metav1.ConditionUnknown,
Expand Down
Loading
Loading