Skip to content

Commit

Permalink
feat: Implement SpaceBindingRequest controller main logic (#322)
Browse files Browse the repository at this point in the history
* add spacebindingrequest conditions
  • Loading branch information
mfrancisc authored Aug 23, 2023
1 parent c909c72 commit 6934766
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/codeready-toolchain/toolchain-common
go 1.19

require (
github.com/codeready-toolchain/api v0.0.0-20230630062406-c91909d2a37f
github.com/codeready-toolchain/api v0.0.0-20230823083409-fe9ca973d9a9
github.com/go-logr/logr v1.2.3
github.com/gofrs/uuid v3.3.0+incompatible
github.com/golang-jwt/jwt v3.2.2+incompatible
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWH
github.com/cockroachdb/datadriven v0.0.0-20200714090401-bf6692d28da5/go.mod h1:h6jFvWxBdQXxjopDMZyH2UVceIRfR84bdzbkoKrsWNo=
github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoCr5oaCLELYA=
github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI=
github.com/codeready-toolchain/api v0.0.0-20230630062406-c91909d2a37f h1:8SYKnGfaZdMGLWZw5CPmj6ST4xy3MOSvvPIgFLFgwIM=
github.com/codeready-toolchain/api v0.0.0-20230630062406-c91909d2a37f/go.mod h1:nn3W6eKb9PFIVwSwZW7wDeLACMBOwAV+4kddGuN+ARM=
github.com/codeready-toolchain/api v0.0.0-20230823083409-fe9ca973d9a9 h1:ytFqNSSEvgevqvwMilmmqlrrDH1O/qUwzg8bO3CxCiY=
github.com/codeready-toolchain/api v0.0.0-20230823083409-fe9ca973d9a9/go.mod h1:nn3W6eKb9PFIVwSwZW7wDeLACMBOwAV+4kddGuN+ARM=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
Expand Down
48 changes: 48 additions & 0 deletions pkg/test/spacebindingrequest/spacebindingrequest_assertions.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package spacebindingrequest

import (
toolchainv1alpha1 "github.com/codeready-toolchain/api/api/v1alpha1"
corev1 "k8s.io/api/core/v1"
)

func Provisioning() toolchainv1alpha1.Condition {
return toolchainv1alpha1.Condition{
Type: toolchainv1alpha1.ConditionReady,
Status: corev1.ConditionFalse,
Reason: toolchainv1alpha1.SpaceBindingRequestProvisioningReason,
}
}

func Ready() toolchainv1alpha1.Condition {
return toolchainv1alpha1.Condition{
Type: toolchainv1alpha1.ConditionReady,
Status: corev1.ConditionTrue,
Reason: toolchainv1alpha1.SpaceBindingRequestProvisionedReason,
}
}

func Terminating() toolchainv1alpha1.Condition {
return toolchainv1alpha1.Condition{
Type: toolchainv1alpha1.ConditionReady,
Status: corev1.ConditionFalse,
Reason: toolchainv1alpha1.SpaceBindingRequestTerminatingReason,
}
}

func TerminatingFailed(msg string) toolchainv1alpha1.Condition {
return toolchainv1alpha1.Condition{
Type: toolchainv1alpha1.ConditionReady,
Status: corev1.ConditionFalse,
Reason: toolchainv1alpha1.SpaceBindingRequestTerminatingFailedReason,
Message: msg,
}
}

func UnableToCreateSpaceBinding(msg string) toolchainv1alpha1.Condition {
return toolchainv1alpha1.Condition{
Type: toolchainv1alpha1.ConditionReady,
Status: corev1.ConditionFalse,
Reason: toolchainv1alpha1.SpaceBindingRequestUnableToCreateSpaceBindingReason,
Message: msg,
}
}

0 comments on commit 6934766

Please sign in to comment.