Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Status field to OnePasswordItem resource #118

Merged
merged 4 commits into from Jun 28, 2022
Merged

Add Status field to OnePasswordItem resource #118

merged 4 commits into from Jun 28, 2022

Conversation

jpcoenen
Copy link
Member

This makes it easier to see whehter the controller succeeded in creating the Kubernetes secret for a OnePasswordItem. A user or tool can just look at the status field to see whether the Kubernetes secret has successfully been created. If something went wrong, you can just inspect the status field to see the related error. This instead of having to dig into the logs.

Examples

Success example:

apiVersion: onepassword.com/v1
kind: OnePasswordItem
metadata:
   [...]
spec:
  itemPath: vaults/jcg4jdrrp5g6spaqwzpxojmr4i/items/wdqh5wf5ez4mgubnsobs67urzy
status:
  conditions:
    - status: 'True'
      type: Ready
  ready: true

Error example:

apiVersion: onepassword.com/v1
kind: OnePasswordItem
metadata:
   [...]
spec:
  itemPath: vaults/jcg4jdrrp5g6spaqwzpxojmr4i/items/this-does-not-exist
status:
  conditions:
    - message: >-
        Failed to retrieve item: No items found with identifier
        "this-does-not-exist"
      status: 'False'
      type: Ready
  ready: false

References

The topic of status/condition is somewhat confusing and there are many ways to do things. Here are some references I used:

Closes #52

This makes it easier to see whehter the controller
succeeded in creating the Kubernetes secret for a
OnePasswordItem. If something failed, the `ready` field
will be `false` and the `OnePasswordItemReady` condition
will have a `status` of `False` with the error messages
in the `message` field.
This comment was placed manually and therefore
disappeared when regenerating the CRDs.
The usage of such a field is considered deprecated, conditions
should be used instead.

If there is a use-case that is not covered by conditions only
we can always reconsider adding an extra field to the status.

See the k8s guidelines for more details on the deprecation:
https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Report success and error in the OnePasswordItem status field
4 participants