Skip to content

Commit cfa7444

Browse files
author
Arvind Thirumurugan
committed
check workload health
Signed-off-by: Arvind Thirumurugan <[email protected]>
1 parent a3c6e1d commit cfa7444

File tree

7 files changed

+384
-5
lines changed

7 files changed

+384
-5
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
Copyright 2025 The KubeFleet Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1beta1
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
)
22+
23+
// WorkloadReference represents a workload to be tracked
24+
type WorkloadReference struct {
25+
// Name is the name of the workload
26+
// +required
27+
Name string `json:"name"`
28+
29+
// Namespace is the namespace of the workload
30+
// +required
31+
Namespace string `json:"namespace"`
32+
}
33+
34+
// +genclient
35+
// +genclient:nonNamespaced
36+
// +kubebuilder:object:root=true
37+
// +kubebuilder:resource:scope="Cluster",categories={fleet,fleet-placement}
38+
// +kubebuilder:storageversion
39+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
40+
41+
// WorkloadTracker expresses user intent to track certain workloads
42+
type WorkloadTracker struct {
43+
metav1.TypeMeta `json:",inline"`
44+
metav1.ObjectMeta `json:"metadata,omitempty"`
45+
46+
// Workloads is a list of workloads to track
47+
// +optional
48+
Workloads []WorkloadReference `json:"workloads,omitempty"`
49+
}
50+
51+
// +kubebuilder:object:root=true
52+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
53+
54+
// WorkloadTrackerList contains a list of WorkloadTracker
55+
type WorkloadTrackerList struct {
56+
metav1.TypeMeta `json:",inline"`
57+
metav1.ListMeta `json:"metadata,omitempty"`
58+
Items []WorkloadTracker `json:"items"`
59+
}
60+
61+
func init() {
62+
SchemeBuilder.Register(&WorkloadTracker{}, &WorkloadTrackerList{})
63+
}

apis/placement/v1beta1/zz_generated.deepcopy.go

Lines changed: 78 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../config/crd/bases/placement.kubernetes-fleet.io_metriccollectors.yaml
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../config/crd/bases/placement.kubernetes-fleet.io_workloadtrackers.yaml
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
apiVersion: apiextensions.k8s.io/v1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
annotations:
6+
controller-gen.kubebuilder.io/version: v0.16.0
7+
name: workloadtrackers.placement.kubernetes-fleet.io
8+
spec:
9+
group: placement.kubernetes-fleet.io
10+
names:
11+
categories:
12+
- fleet
13+
- fleet-placement
14+
kind: WorkloadTracker
15+
listKind: WorkloadTrackerList
16+
plural: workloadtrackers
17+
singular: workloadtracker
18+
scope: Cluster
19+
versions:
20+
- name: v1beta1
21+
schema:
22+
openAPIV3Schema:
23+
description: WorkloadTracker expresses user intent to track certain workloads
24+
properties:
25+
apiVersion:
26+
description: |-
27+
APIVersion defines the versioned schema of this representation of an object.
28+
Servers should convert recognized schemas to the latest internal value, and
29+
may reject unrecognized values.
30+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
31+
type: string
32+
kind:
33+
description: |-
34+
Kind is a string value representing the REST resource this object represents.
35+
Servers may infer this from the endpoint the client submits requests to.
36+
Cannot be updated.
37+
In CamelCase.
38+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
39+
type: string
40+
metadata:
41+
type: object
42+
workloads:
43+
description: Workloads is a list of workloads to track
44+
items:
45+
description: WorkloadReference represents a workload to be tracked
46+
properties:
47+
name:
48+
description: Name is the name of the workload
49+
type: string
50+
namespace:
51+
description: Namespace is the namespace of the workload
52+
type: string
53+
required:
54+
- name
55+
- namespace
56+
type: object
57+
type: array
58+
type: object
59+
served: true
60+
storage: true
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
apiVersion: cluster.kubernetes-fleet.io/v1beta1
22
kind: MemberCluster
33
metadata:
4-
name: kind-cluster-1
4+
name: kind-cluster-3
55
labels:
66
environment: staging
7-
kubernetes-fleet.io/cluster-name: kind-cluster-1
7+
kubernetes-fleet.io/cluster-name: kind-cluster-3
88
spec:
99
identity:
10-
name: fleet-member-agent-cluster-1
10+
name: fleet-member-agent-cluster-3
1111
kind: ServiceAccount
1212
namespace: fleet-system
1313
apiGroup: ""

0 commit comments

Comments
 (0)