Skip to content

Commit

Permalink
Provide wrappers for SecretRefsReady conditions
Browse files Browse the repository at this point in the history
Signed-off-by: Jean du Plessis <[email protected]>
  • Loading branch information
jeanduplessis committed Aug 1, 2024
1 parent 12f6309 commit d38f01c
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion apis/spaces/v1alpha1/secretstore_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package v1alpha1

import (

Check failure on line 17 in apis/spaces/v1alpha1/secretstore_types.go

View workflow job for this annotation

GitHub Actions / lint

File is not `goimports`-ed with -local github.com/upbound (goimports)
xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
corev1 "k8s.io/api/core/v1"
"reflect"

esv1beta1 "github.com/external-secrets/external-secrets/apis/externalsecrets/v1beta1"
Expand Down Expand Up @@ -105,17 +106,63 @@ const (
// ConditionSecretRefReady indicates the status of any referenced secrets
// for API objects that reference a secret.
ConditionSecretRefReady = xpv1.ConditionType("SecretRefsReady")
)

const (
// ReasonSecretRefMissing is added to object if the referenced secret(s) do not exist
ReasonSecretRefMissing = xpv1.ConditionReason("ReferencedSecretNotFound")
// ReasonSecretRefMissingKey is added when the object if the secret(s) exists, but the key data is missing
ReasonSecretRefMissingKey = xpv1.ConditionReason("ReferencedSecretKeyNotFound")
// ReasonSecretRefReady is added when the referenced secret(s) and data are found
ReasonSecretRefReady = xpv1.ConditionReason("ReferencedSecretsReady")
// ReasonSecretRefNone is added when object not reference a secret
// ReasonSecretRefNone is added when object does not reference a secret
ReasonSecretRefNone = xpv1.ConditionReason("NoReferencedSecrets")
)

// SecretRefsReadyMissing returns a condition indicating that the referenced
// secret(s) do not exist.
func SecretRefsReadyMissing() xpv1.Condition {
return xpv1.Condition{
Type: ConditionSecretRefReady,
Status: corev1.ConditionTrue,
LastTransitionTime: metav1.Now(),
Reason: ReasonSecretRefMissing,
}
}

// SecretRefsReadyMissingKey returns a condition indicating that the referenced
// secret(s) exist, but the key data is missing.
func SecretRefsReadyMissingKey() xpv1.Condition {
return xpv1.Condition{
Type: ConditionSecretRefReady,
Status: corev1.ConditionTrue,
LastTransitionTime: metav1.Now(),
Reason: ReasonSecretRefMissingKey,
}
}

// SecretRefsReadyReady returns a condition indicating that the referenced
// secret(s) and data are found.
func SecretRefsReadyReady() xpv1.Condition {
return xpv1.Condition{
Type: ConditionSecretRefReady,
Status: corev1.ConditionTrue,
LastTransitionTime: metav1.Now(),
Reason: ReasonSecretRefReady,
}
}

// SecretRefsReadyNone returns a condition indicating that the referenced
// object is not a secret.
func SecretRefsReadyNone() xpv1.Condition {
return xpv1.Condition{
Type: ConditionSecretRefReady,
Status: corev1.ConditionTrue,
LastTransitionTime: metav1.Now(),
Reason: ReasonSecretRefNone,
}
}

// SharedSecretStoreStatus defines the observed state of the SecretStore.
type SharedSecretStoreStatus struct {

Expand Down

0 comments on commit d38f01c

Please sign in to comment.