Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addon certificate tracking and more addon status condition types #140

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,18 @@ spec:
description: RegistrationConfig defines the configuration of the addon agent to register to hub. The Klusterlet agent will create a csr for the addon agent with the registrationConfig.
type: object
properties:
certificateStatus:
description: certificateStatus actively tracks the status of the certificate used by the addon.
type: object
properties:
expiringTimestamp:
description: expiringTimestamp records the next time certificate will expire.
type: string
format: date-time
lastRenewedTimestamp:
description: lastRenewedTimestamp records the last timestamp when we approved/renewed certificates for the addon agents.
type: string
format: date-time
signerName:
description: signerName is the name of signer that addon agent will use to create csr.
type: string
Expand Down
22 changes: 22 additions & 0 deletions addon/v1alpha1/types_managedclusteraddon.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ type RegistrationConfig struct {
//
// +optional
Subject Subject `json:"subject,omitempty"`

// certificateStatus actively tracks the status of the certificate used by the addon.
CertificateStatus *RegistrationConfigCertificateStatus `json:"certificateStatus,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this field is only used for configuration of registration. I do not think we want to expose this field to addon when setting the configuration. Maybe we should move this out with the name of RegistrationStatuses?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we're moving this out, we will need an identifier field for each certificate status struct to correlate the status and registration config. i cant find such an identifier to use, otherwise we will need to duplicate the whole config. wdyt?

}

type RegistrationConfigCertificateStatus struct {
// lastRenewedTimestamp records the last timestamp when we approved/renewed certificates
// for the addon agents.
LastRenewedTimestamp metav1.Time `json:"lastRenewedTimestamp,omitempty"`

// expiringTimestamp records the next time certificate will expire.
ExpiringTimestamp metav1.Time `json:"expiringTimestamp,omitempty"`
}

// Subject is the user subject of the addon agent to be registered to the hub.
Expand Down Expand Up @@ -126,6 +138,16 @@ const (
// ManagedClusterAddOnConditionDegraded represents that the addon agent is providing degraded service on
// the managed cluster.
ManagedClusterAddOnConditionDegraded string = "Degraded"

// ManagedClusterAddOConditionTypeRegistrationApplied represents that whether the addon agent finished
// its registration into the hub control plane, including finishing CSR approval, signing, permission
// configuration, etc.
ManagedClusterAddOConditionTypeRegistrationApplied = "RegistrationApplied"

// ManagedClusterAddOConditionTypeManifestApplied represents that whether the corresponding resources are
// applied to the hub cluster as a ManifestWork resource. Note that it doesn't imply the applied ManifestWork
// is successfully delivered/executed by the work agent.
ManagedClusterAddOConditionTypeManifestApplied = "ManifestApplied"
)

// ObjectReference contains enough information to let you inspect or modify the referred object.
Expand Down
23 changes: 23 additions & 0 deletions addon/v1alpha1/zz_generated.deepcopy.go

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

16 changes: 13 additions & 3 deletions addon/v1alpha1/zz_generated.swagger_doc_generated.go

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