Skip to content

(question) assist with retrieving status values on a crd #1347

@lknite

Description

@lknite

I'm using the CustomResourceDefinition template as shown in the examples, all code around crds is working well.

Recently I've attempted to get some status values from a clusterapi resource:

status:
  <snip>
  controlPlaneReady: true
  infrastructureReady: true
  observedGeneration: 2
  phase: Provisioned

My Crd has code like so:

    public class CrdCluster : CustomResourceDefinitions.CustomResource<CrdClusterSpec, CrdClusterStatus>
    {
        public override string ToString() { echo ""; }
    }

    public class CrdClusterSpec
    {
        [JsonPropertyName("asdf")]
        public string asdf { get; set; }
    }

    public class CrdClusterStatus : V1Status
    {
        [JsonPropertyName("infrastructureReady")]
        public bool infrastructureReady { get; set; }
        [JsonPropertyName("controlPlaneReady")]
        public bool controlPlaneReady { get; set; }
        [JsonPropertyName("phase")]
        public string phase { get; set; }
    }

Yet, in my code when I have an instance of the crd, 'cluster.CStatus' is null.

What am I missing? The 'CStatus' is supposed to be the representation of the 'status' right?

update

I modified the CustomResourceDefinition.cs from having 'CStatus' to 'Status' and now everything is working as expected. So, why was it CStatus instead of Status?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions