Skip to content

Commit

Permalink
api: add conditions to uiresource (#5230)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicks committed Nov 29, 2021
1 parent 021e360 commit 36c5660
Show file tree
Hide file tree
Showing 7 changed files with 1,102 additions and 501 deletions.
1,395 changes: 895 additions & 500 deletions pkg/apis/core/v1alpha1/generated.pb.go

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions pkg/apis/core/v1alpha1/generated.proto

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

33 changes: 33 additions & 0 deletions pkg/apis/core/v1alpha1/uiresource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,14 @@ type UIResourceStatus struct {
//
// +optional
Waiting *UIResourceStateWaiting `json:"waiting,omitempty" protobuf:"bytes,17,opt,name=waiting"`

// Represents the latest available observations of a UIResource's current state.
//
// Designed for compatibility with 'wait' and cross-resource status reporting.
// https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
//
// +optional
Conditions []UIResourceCondition `json:"conditions,omitempty" protobuf:"bytes,18,rep,name=conditions"`
}

// UIResource implements ObjectWithStatusSubResource interface.
Expand Down Expand Up @@ -384,3 +392,28 @@ type UIResourceStateWaitingOnRef struct {
// Name of the object being waiting on.
Name string `json:"name" protobuf:"bytes,4,opt,name=name"`
}

type UIResourceConditionType string

// Ready means the UI Resource has built, deployed, and passed any readiness checks.
const UIResourceReady UIResourceConditionType = "Ready"

type UIResourceCondition struct {
// Type of UI Resource condition.
Type UIResourceConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=UIResourceConditionType"`

// Status of the condition, one of True, False, Unknown.
Status metav1.ConditionStatus `json:"status" protobuf:"bytes,6,opt,name=status,casttype=k8s.io/apimachinery/pkg/apis/meta/v1.ConditionStatus"`

// Last time the condition transitioned from one status to another.
// +optional
LastTransitionTime metav1.MicroTime `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"`

// The reason for the condition's last transition.
// +optional
Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`

// A human readable message indicating details about the transition.
// +optional
Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
}
24 changes: 24 additions & 0 deletions pkg/apis/core/v1alpha1/zz_generated.deepcopy.go

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

69 changes: 68 additions & 1 deletion pkg/openapi/zz_generated.openapi.go

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

32 changes: 32 additions & 0 deletions pkg/webview/view.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,31 @@
},
"description": "UIResource represents per-resource status data for rendering the web UI.\n\nTreat this as a legacy data structure that's more intended to make transition\neasier rather than a robust long-term API.\n\n+k8s:openapi-gen=true"
},
"v1alpha1UIResourceCondition": {
"type": "object",
"properties": {
"type": {
"type": "string",
"description": "Type of UI Resource condition."
},
"status": {
"type": "string",
"description": "Status of the condition, one of True, False, Unknown."
},
"lastTransitionTime": {
"type": "string", "format": "date-time",
"title": "Last time the condition transitioned from one status to another.\n+optional"
},
"reason": {
"type": "string",
"title": "The reason for the condition's last transition.\n+optional"
},
"message": {
"type": "string",
"title": "A human readable message indicating details about the transition.\n+optional"
}
}
},
"v1alpha1UIResourceKubernetes": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -849,6 +874,13 @@
"waiting": {
"$ref": "#/definitions/v1alpha1UIResourceStateWaiting",
"description": "Waiting provides detail on why the resource is currently blocked from updating.\n\n+optional"
},
"conditions": {
"type": "array",
"items": {
"$ref": "#/definitions/v1alpha1UIResourceCondition"
},
"description": "Represents the latest available observations of a UIResource's current state.\n\nDesigned for compatibility with 'wait' and cross-resource status reporting.\nhttps://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties\n\n+optional"
}
},
"title": "UIResourceStatus defines the observed state of UIResource"
Expand Down
22 changes: 22 additions & 0 deletions web/src/view.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,15 @@ declare namespace Proto {
* +optional
*/
waiting?: v1alpha1UIResourceStateWaiting;
/**
* Represents the latest available observations of a UIResource's current state.
*
* Designed for compatibility with 'wait' and cross-resource status reporting.
* https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
*
* +optional
*/
conditions?: v1alpha1UIResourceCondition[];
}
export interface v1alpha1UIResourceStateWaitingOnRef {
/**
Expand Down Expand Up @@ -520,6 +529,19 @@ declare namespace Proto {
spanID?: string;
displayNames?: string[];
}
export interface v1alpha1UIResourceCondition {
/**
* Type of UI Resource condition.
*/
type?: string;
/**
* Status of the condition, one of True, False, Unknown.
*/
status?: string;
lastTransitionTime?: string;
reason?: string;
message?: string;
}
export interface v1alpha1UIResource {
metadata?: v1ObjectMeta;
spec?: v1alpha1UIResourceSpec;
Expand Down

0 comments on commit 36c5660

Please sign in to comment.