-
Notifications
You must be signed in to change notification settings - Fork 451
/
manifest_status.go
59 lines (47 loc) · 1.96 KB
/
manifest_status.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
package k8s
import (
"github.com/cosi-project/runtime/pkg/resource"
"github.com/cosi-project/runtime/pkg/resource/meta"
"github.com/cosi-project/runtime/pkg/resource/protobuf"
"github.com/cosi-project/runtime/pkg/resource/typed"
"github.com/siderolabs/talos/pkg/machinery/proto"
)
// ManifestStatusType is type of ManifestStatus resource.
const ManifestStatusType = resource.Type("ManifestStatuses.kubernetes.talos.dev")
// ManifestStatusID is a singleton resource ID.
const ManifestStatusID = resource.ID("manifests")
// ManifestStatus resource holds definition of kubelet static pod.
type ManifestStatus = typed.Resource[ManifestStatusSpec, ManifestStatusExtension]
// ManifestStatusSpec describes manifest application status.
//
//gotagsrewrite:gen
type ManifestStatusSpec struct {
ManifestsApplied []string `yaml:"manifestsApplied" protobuf:"1"`
}
// NewManifestStatus initializes an empty ManifestStatus resource.
func NewManifestStatus(namespace resource.Namespace) *ManifestStatus {
return typed.NewResource[ManifestStatusSpec, ManifestStatusExtension](
resource.NewMetadata(namespace, ManifestStatusType, ManifestStatusID, resource.VersionUndefined),
ManifestStatusSpec{},
)
}
// ManifestStatusExtension provides auxiliary methods for ManifestStatus.
type ManifestStatusExtension struct{}
// ResourceDefinition implements [typed.Extension] interface.
func (ManifestStatusExtension) ResourceDefinition() meta.ResourceDefinitionSpec {
return meta.ResourceDefinitionSpec{
Type: ManifestStatusType,
Aliases: []resource.Type{},
DefaultNamespace: ControlPlaneNamespaceName,
}
}
func init() {
proto.RegisterDefaultTypes()
err := protobuf.RegisterDynamic[ManifestStatusSpec](ManifestStatusType, &ManifestStatus{})
if err != nil {
panic(err)
}
}