Skip to content

Commit

Permalink
annotate package discovery to generate deepcopy implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusfm committed May 9, 2023
1 parent 86c9f35 commit fbdaaeb
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
5 changes: 2 additions & 3 deletions pkg/discovery/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +kubebuilder:object:generate=true
package discovery

import (
Expand All @@ -24,13 +25,13 @@ import (

var MeasuredResources = []corev1.ResourceName{corev1.ResourceCPU, corev1.ResourceMemory}

// +kubebuilder:object:generate=false
type ClusterDiscoverer interface {
Info(context.Context) (*ClusterInfo, error)
Resources(ctx context.Context) (ClusterResources, error)
Version() (string, error)
}

// +k8s:deepcopy-gen=true
type ClusterInfo struct {
// total of Nodes
TotalNodes *int `json:"totalNodes,omitempty"`
Expand Down Expand Up @@ -64,7 +65,6 @@ type NodeInfo struct {
CreationTimestamp metav1.Time `json:"-"`
}

// +k8s:deepcopy-gen=true
type Resources struct {
// Quantity of resources available for scheduling
Available resource.Quantity `json:"available,omitempty"`
Expand All @@ -76,5 +76,4 @@ type Resources struct {
UsagePercentage int32 `json:"usagePercentage,omitempty"`
}

// +k8s:deepcopy-gen=true
type ClusterResources map[corev1.ResourceName]Resources
34 changes: 33 additions & 1 deletion pkg/discovery/zz_generated.deepcopy.go

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

0 comments on commit fbdaaeb

Please sign in to comment.