File tree Expand file tree Collapse file tree 4 files changed +21
-18
lines changed
examples/08-api-versioning/apis/infra.example.io Expand file tree Collapse file tree 4 files changed +21
-18
lines changed Original file line number Diff line number Diff line change @@ -372,6 +372,14 @@ func (r *` + resourceName + `) GetUID() string {
372372}
373373`
374374
375+ // Add IsHub marker for hub/storage version
376+ if isHub {
377+ content += `
378+ // IsHub marks this as the hub/storage version
379+ func (r *` + resourceName + `) IsHub() {}
380+ `
381+ }
382+
375383 // Add conversion stubs for non-hub versions (spokes)
376384 if ! isHub && config != nil {
377385 hubVersion := config .Features .Versioning .StorageVersion
Original file line number Diff line number Diff line change @@ -57,3 +57,6 @@ func (r *Device) GetName() string {
5757func (r * Device ) GetUID () string {
5858 return r .Metadata .UID
5959}
60+
61+ // IsHub marks this as the hub/storage version
62+ func (r * Device ) IsHub () {}
Original file line number Diff line number Diff line change @@ -21,20 +21,16 @@ type Device struct {
2121
2222// DeviceSpec defines the desired state of Device
2323type DeviceSpec struct {
24- Name string `json:"name" validate:"required"`
25- IPAddress string `json:"ipAddress" validate:"required,ip"`
26- Location string `json:"location,omitempty"`
27- DeviceType string `json:"deviceType" validate:"oneof=server switch router"`
2824 Description string `json:"description,omitempty" validate:"max=200"`
25+ // Add your spec fields here
2926}
3027
3128// DeviceStatus defines the observed state of Device
3229type DeviceStatus struct {
33- Phase string `json:"phase,omitempty"`
34- Message string `json:"message,omitempty"`
35- Ready bool `json:"ready"`
36- Health string `json:"health,omitempty" validate:"omitempty,oneof=healthy degraded unhealthy"`
37- LastChecked string `json:"lastChecked,omitempty"`
30+ Phase string `json:"phase,omitempty"`
31+ Message string `json:"message,omitempty"`
32+ Ready bool `json:"ready"`
33+ // Add your status fields here
3834}
3935
4036// Validate implements custom validation logic for Device
Original file line number Diff line number Diff line change @@ -21,20 +21,16 @@ type Device struct {
2121
2222// DeviceSpec defines the desired state of Device
2323type DeviceSpec struct {
24- Name string `json:"name" validate:"required"`
25- IPAddress string `json:"ipAddress" validate:"required,ip"`
26- Location string `json:"location,omitempty"`
27- DeviceType string `json:"deviceType" validate:"oneof=server switch router"`
2824 Description string `json:"description,omitempty" validate:"max=200"`
25+ // Add your spec fields here
2926}
3027
3128// DeviceStatus defines the observed state of Device
3229type DeviceStatus struct {
33- Phase string `json:"phase,omitempty"`
34- Message string `json:"message,omitempty"`
35- Ready bool `json:"ready"`
36- Health string `json:"health,omitempty" validate:"omitempty,oneof=healthy degraded unhealthy"`
37- LastChecked string `json:"lastChecked,omitempty"`
30+ Phase string `json:"phase,omitempty"`
31+ Message string `json:"message,omitempty"`
32+ Ready bool `json:"ready"`
33+ // Add your status fields here
3834}
3935
4036// Validate implements custom validation logic for Device
You can’t perform that action at this time.
0 commit comments