Skip to content

Commit

Permalink
Tag Status field as omitempty
Browse files Browse the repository at this point in the history
Checked that nobody depends on the Status field since we're technically breaking source backward compat
https://pkg.go.dev/github.com/bitnami-labs/sealed-secrets@v0.11.0/pkg/apis/sealed-secrets/v1alpha1?tab=doc#SealedSecretStatus
  • Loading branch information
Marko Mikulicic committed Mar 26, 2020
1 parent 4c1a221 commit 047c24c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
6 changes: 5 additions & 1 deletion cmd/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,11 @@ func (c *Controller) unseal(key string) (unsealErr error) {

func (c *Controller) updateSealedSecretStatus(ssecret *ssv1alpha1.SealedSecret, unsealError error) error {
ssecret = ssecret.DeepCopy()
st := &ssecret.Status
st := ssecret.Status
if st == nil {
st = &ssv1alpha1.SealedSecretStatus{}
}
ssecret.Status = st

st.ObservedGeneration = ssecret.ObjectMeta.Generation
updateSealedSecretsStatusConditions(st, unsealError)
Expand Down
7 changes: 4 additions & 3 deletions pkg/apis/sealed-secrets/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const (

// SealedSecretManagedAnnotation is the name for the annotation for
// flaging the existing secrets be managed by SealedSecret controller.
SealedSecretManagedAnnotation = annoNs + "managed"
SealedSecretManagedAnnotation = annoNs + "managed"
)

// SecretTemplateSpec describes the structure a Secret should have
Expand Down Expand Up @@ -101,8 +101,9 @@ type SealedSecret struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec SealedSecretSpec `json:"spec"`
Status SealedSecretStatus `json:"status"`
Spec SealedSecretSpec `json:"spec"`
// +optional
Status *SealedSecretStatus `json:"status,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
6 changes: 5 additions & 1 deletion pkg/apis/sealed-secrets/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 047c24c

Please sign in to comment.