Skip to content

Conversation

camilamacedo86
Copy link
Member

@camilamacedo86 camilamacedo86 commented Jul 20, 2025

Description

Now, when users run create api the following will also added by default

// <KIND>Status defines the observed state of <KIND>.
type KINDStatus struct {
	// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
	// Important: Run "make" to regenerate code after modifying this file

	// conditions represent the current state of the <KIND> resource.
	// Each condition has a unique type and reflects the status of a specific aspect of the resource.
	//
	// Standard condition types include:
	// - "Available": the resource is fully functional
	// - "Progressing": the resource is being created or updated
	// - "Degraded": the resource failed to reach or maintain its desired state
	//
	// The status of each condition is one of True, False, or Unknown.
	// +listType=map
	// +listMapKey=type
	// +optional
	Conditions []metav1.Condition `json:"conditions,omitempty"`
}

Motivation

To promote best practices in Kubernetes API development by including status conditions during resource scaffolding.

P.S.: Adapt tutorial generation hack scripts. In a follow-up, we should change the tutorial code to use the conditions and be more aligned with best practices, such as the deploy-image scaffold.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 20, 2025
@k8s-ci-robot k8s-ci-robot requested a review from Kavinjsir July 20, 2025 08:14
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 20, 2025
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jul 20, 2025
@camilamacedo86 camilamacedo86 changed the title ✨ (go/v4): Create API command now adds status conditions WIP: ✨ (go/v4): Create API command now adds status conditions Jul 20, 2025
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 20, 2025
@camilamacedo86 camilamacedo86 force-pushed the add-conditons-default branch 2 times, most recently from c81201b to dc3b7c0 Compare July 20, 2025 08:40
@camilamacedo86 camilamacedo86 changed the title WIP: ✨ (go/v4): Create API command now adds status conditions ✨ (go/v4): Create API command now adds status conditions Jul 20, 2025
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 20, 2025
@camilamacedo86 camilamacedo86 force-pushed the add-conditons-default branch from dc3b7c0 to 1dbc0ed Compare July 20, 2025 08:48
Copy link
Member

@afzal442 afzal442 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice learning for me

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: afzal442, camilamacedo86

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

// {{ .Resource.Kind }}Status defines the observed state of {{ .Resource.Kind }}.
type {{ .Resource.Kind }}Status struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should doc be more explicit here?

Suggested change
// Important: Run "make" to regenerate code after modifying this file
// Important: Run "make generate manifests" to regenerate code after modifying this file

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we do it in a follow up?
Would you like to do this one?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, it can be follow up

@camilamacedo86 camilamacedo86 added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 22, 2025
@k8s-ci-robot k8s-ci-robot merged commit a5626c7 into kubernetes-sigs:master Jul 22, 2025
36 checks passed
@camilamacedo86 camilamacedo86 deleted the add-conditons-default branch July 22, 2025 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants