Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 1 addition & 17 deletions pkg/config/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ type PrintConfig struct {
// resource in `kubectl get` response.
//
// Default value is true.
// Deprecated: We now print Ready condition by default
AddSyncedColumn *bool `json:"add_synced_column"`
// OrderBy is the field used to sort the list of PrinterColumn options.
OrderBy string `json:"order_by"`
Expand Down Expand Up @@ -485,23 +486,6 @@ func (c *Config) ResourceDisplaysAgeColumn(resourceName string) bool {
return false
}

// ResourceDisplaysSyncedColumn returns true if the resource is
// configured to display the synced status.
func (c *Config) ResourceDisplaysSyncedColumn(resourceName string) bool {
if c == nil {
return false
}
rConfig, ok := c.Resources[resourceName]
if !ok {
return false
}
if rConfig.Print != nil {
// default value should be true.
return rConfig.Print.AddSyncedColumn == nil || *rConfig.Print.AddSyncedColumn
}
return false
}

// ResourceSetsSingleAttribute returns true if the supplied resource name has
// a SetAttributes operation that only actually changes a single attribute at a
// time. See: SNS SetTopicAttributes API call, which is entirely different from
Expand Down
6 changes: 0 additions & 6 deletions pkg/model/crd.go
Original file line number Diff line number Diff line change
Expand Up @@ -599,12 +599,6 @@ func (r *CRD) PrintAgeColumn() bool {
return r.cfg.ResourceDisplaysAgeColumn(r.Names.Camel)
}

// PrintSyncedColumn returns whether the code generator should append 'Sync'
// kubebuilder:printcolumn comment marker
func (r *CRD) PrintSyncedColumn() bool {
return r.cfg.ResourceDisplaysSyncedColumn(r.Names.Camel)
}

func (r *CRD) addAdditionalPrinterColumns(additionalColumns []*ackgenconfig.AdditionalColumnConfig) {
for _, additionalColumn := range additionalColumns {
printerColumn := &PrinterColumn{}
Expand Down
4 changes: 1 addition & 3 deletions templates/apis/crd.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ type {{ .CRD.Kind }}Status struct {
{{- range $column := .CRD.AdditionalPrinterColumns }}
// +kubebuilder:printcolumn:name="{{$column.Name}}",type={{$column.Type}},priority={{$column.Priority}},JSONPath=`{{$column.JSONPath}}`
{{- end }}
{{- if .CRD.PrintSyncedColumn }}
// +kubebuilder:printcolumn:name="Synced",type="string",priority=0,JSONPath=".status.conditions[?(@.type==\"ACK.ResourceSynced\")].status"
{{- end }}
// +kubebuilder:printcolumn:name="Ready",type="string",priority=0,JSONPath=".status.conditions[?(@.type==\"Ready\")].status"
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we need to still wrap it with {{- if .CRD.PrintSyncedColumn }} ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Is there a reason why we had that?
I would think we want to print the Synced/Ready conditions all the time

Copy link
Member

Choose a reason for hiding this comment

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

fair. let's remove PrintSyncedColumn ?

{{- if .CRD.PrintAgeColumn }}
// +kubebuilder:printcolumn:name="Age",type="date",priority=0,JSONPath=".metadata.creationTimestamp"
{{- end }}
Expand Down