Skip to content

Commit

Permalink
Report pod and storage resource via generic resource
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Jan 13, 2025
1 parent c933111 commit bb499fc
Show file tree
Hide file tree
Showing 5 changed files with 284 additions and 27 deletions.
34 changes: 9 additions & 25 deletions .config/api-rules/violation_exceptions.list
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ API rule violation: list_type_missing,kmodules.xyz/offshoot-api/api/v1,PodSpec,V
API rule violation: list_type_missing,kmodules.xyz/offshoot-api/api/v1,ServiceSpec,ExternalIPs
API rule violation: list_type_missing,kmodules.xyz/offshoot-api/api/v1,ServiceSpec,LoadBalancerSourceRanges
API rule violation: list_type_missing,kmodules.xyz/offshoot-api/api/v1,ServiceSpec,Ports
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/identity/v1alpha1,ControlPlaneInfo,DNSNames
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/identity/v1alpha1,ControlPlaneInfo,EmailAddresses
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/identity/v1alpha1,ControlPlaneInfo,IPAddresses
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/identity/v1alpha1,ControlPlaneInfo,URIs
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/identity/v1alpha1,SelfSubjectNamespaceAccessReviewSpec,NonResourceAttributes
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/identity/v1alpha1,SelfSubjectNamespaceAccessReviewSpec,ResourceAttributes
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/identity/v1alpha1,SubjectAccessNamespaceReviewStatus,Namespaces
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/shared,Action,Icons
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/shared,ActionGroup,Items
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/shared,ActionTemplate,Icons
Expand All @@ -52,30 +59,6 @@ API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/shared
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/shared,UIParameterTemplate,InstanceLabelPaths
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/shared,UIParameters,Actions
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/shared,UIParameters,InstanceLabelPaths
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/ui/v1alpha1,ActionTemplate,Icons
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/ui/v1alpha1,ActionTemplateGroup,Items
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/ui/v1alpha1,ChartInfo,ValuesFiles
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/ui/v1alpha1,Dashboard,Panels
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/ui/v1alpha1,Dashboard,Vars
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/ui/v1alpha1,DependentFeatureSet,Features
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/ui/v1alpha1,Dependents,FeatureSets
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/ui/v1alpha1,FeatureSetSpec,Icons
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/ui/v1alpha1,FeatureSetSpec,RequiredFeatures
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/ui/v1alpha1,FeatureSetStatus,Features
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/ui/v1alpha1,FeatureSpec,Icons
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/ui/v1alpha1,FeatureSpec,ValuesFrom
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/ui/v1alpha1,ReadinessChecks,Resources
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/ui/v1alpha1,ReadinessChecks,Workloads
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/ui/v1alpha1,Requirements,Features
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/ui/v1alpha1,ResourceDashboardSpec,Dashboards
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/ui/v1alpha1,ResourceEditorSpec,Icons
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/ui/v1alpha1,ResourceEditorSpec,Variants
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/ui/v1alpha1,ResourceOutlineFilterSpec,Actions
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/ui/v1alpha1,ResourceOutlineFilterSpec,Pages
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/ui/v1alpha1,ResourcePageOutlineFilter,Sections
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/ui/v1alpha1,UIParameters,Actions
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/ui/v1alpha1,UIParameters,InstanceLabelPaths
API rule violation: list_type_missing,kmodules.xyz/resource-metadata/apis/ui/v1alpha1,VariantRef,Icons
API rule violation: names_match,k8s.io/api/core/v1,AzureDiskVolumeSource,DataDiskURI
API rule violation: names_match,k8s.io/api/core/v1,ContainerStatus,LastTerminationState
API rule violation: names_match,k8s.io/api/core/v1,DaemonEndpoint,Port
Expand Down Expand Up @@ -124,7 +107,8 @@ API rule violation: names_match,kmodules.xyz/client-go/api/v1,TimeOfDay,Time
API rule violation: names_match,kmodules.xyz/offshoot-api/api/v1,ContainerRuntimeSettings,IONice
API rule violation: names_match,kmodules.xyz/offshoot-api/api/v1,VolumeSource,CephFS
API rule violation: names_match,kmodules.xyz/offshoot-api/api/v1,VolumeSource,StorageOS
API rule violation: names_match,kmodules.xyz/resource-metadata/apis/identity/v1alpha1,ControlPlaneInfo,URIs
API rule violation: names_match,kmodules.xyz/resource-metadata/apis/identity/v1alpha1,InboxTokenRequestResponse,AgentJWTToken
API rule violation: names_match,kmodules.xyz/resource-metadata/apis/shared,Action,OperationID
API rule violation: names_match,kmodules.xyz/resource-metadata/apis/shared,ActionTemplate,OperationID
API rule violation: names_match,kmodules.xyz/resource-metadata/apis/shared,RegistryProxies,AppsCode
API rule violation: names_match,kmodules.xyz/resource-metadata/apis/ui/v1alpha1,ActionTemplate,OperationID
29 changes: 28 additions & 1 deletion apis/core/v1alpha1/generic_resource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,34 @@ type GenericResourceSpec struct {
RoleResourceLimits map[api.PodRole]core.ResourceList `json:"roleResourceLimits,omitempty"`
// +optional
RoleResourceRequests map[api.PodRole]core.ResourceList `json:"roleResourceRequests,omitempty"`
Status GenericResourceStatus `json:"status"`

Pods []ComputeResource `json:"pods,omitempty"`
Storage []StorageResource `json:"storage,omitempty"`

Status GenericResourceStatus `json:"status"`
}

type ComputeResource struct {
Name string `json:"name"`
// +optional
CreationTimestamp metav1.Time `json:"creationTimestamp,omitempty"`
Containers []ContainerResource `json:"containers,omitempty"`
InitContainers []ContainerResource `json:"initContainers,omitempty"`
}

type ContainerResource struct {
Name string `json:"name"`
// +optional
Resource core.ResourceRequirements `json:"resource"`
RestartPolicy *core.ContainerRestartPolicy `json:"restartPolicy,omitempty"`
}

type StorageResource struct {
Name string `json:"name"`
// +optional
CreationTimestamp metav1.Time `json:"creationTimestamp,omitempty"`
// +optional
Resources core.VolumeResourceRequirements `json:"resources,omitempty"`
}

type GenericResourceStatus struct {
Expand Down
96 changes: 95 additions & 1 deletion apis/core/v1alpha1/openapi_generated.go

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

50 changes: 50 additions & 0 deletions apis/core/v1alpha1/zz_generated.deepcopy.go

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

Loading

0 comments on commit bb499fc

Please sign in to comment.