Skip to content
Merged
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 @@ -35,6 +35,9 @@
},
{
"name": "EtcdSharding"
},
{
"name": "HCPUserFacingOperatorLogs"
}
],
"enabled": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
},
{
"name": "TLSAdherence"
},
{
"name": "HCPUserFacingOperatorLogs"
}
],
"version": ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
},
{
"name": "EtcdSharding"
},
{
"name": "HCPUserFacingOperatorLogs"
}
],
"enabled": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
},
{
"name": "EtcdSharding"
},
{
"name": "HCPUserFacingOperatorLogs"
}
],
"version": ""
Expand Down
77 changes: 77 additions & 0 deletions api/hypershift/v1beta1/hostedcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,9 @@ const (
RecommendedClusterSizeAnnotation = "hypershift.openshift.io/recommended-cluster-size"

// KubeAPIServerVerbosityLevelAnnotation allows specifying the log verbosity of kube-apiserver.
// Deprecated: Use spec.operatorConfiguration.kubeAPIServer.logLevel instead.
// When both are set, the OperatorConfiguration field takes precedence.
// This annotation will be removed in a future release.
Comment on lines +391 to +393

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Have you considered adding a VAP that warns users when this annotation is present? It would print a warning any time they write to the object.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We have created an epic to take care of this https://redhat.atlassian.net/browse/CNTRLPLANE-3998
This will emit a warning if the annotation is present.

KubeAPIServerVerbosityLevelAnnotation = "hypershift.openshift.io/kube-apiserver-verbosity-level"

// NodePoolSupportsKubevirtTopologySpreadConstraintsAnnotation indicates if the NodePool currently supports
Expand Down Expand Up @@ -2895,6 +2898,80 @@ type OperatorConfiguration struct {
//
// +optional
IngressOperator *IngressOperatorSpec `json:"ingressOperator,omitempty"`

// kubeAPIServer configures the kube-apiserver component.
Comment thread
dhgautam99 marked this conversation as resolved.
// Setting the logLevel field triggers a rolling restart of the component.
// When omitted, this means the user has no opinion and the platform
// chooses a reasonable default, which is subject to change over time.
// The current default log level is Normal.
// +optional
// +openshift:enable:FeatureGate=HCPUserFacingOperatorLogs
KubeAPIServer KubeAPIServerOperatorSpec `json:"kubeAPIServer,omitzero"`

Comment thread
dhgautam99 marked this conversation as resolved.
// etcd configures the etcd component.
Comment thread
dhgautam99 marked this conversation as resolved.
// Setting the logLevel field triggers a rolling restart of the component.
// Note: etcd supports fewer log levels than klog-based components,
// etcd supports only Normal and Debug log levels.
// When omitted, this means the user has no opinion and the platform
// chooses a reasonable default, which is subject to change over time.
// The current default log level is Normal.
// +optional
// +openshift:enable:FeatureGate=HCPUserFacingOperatorLogs
Etcd EtcdOperatorSpec `json:"etcd,omitzero"`

// kubeControllerManager configures the kube-controller-manager component.
// Setting the logLevel field triggers a rolling restart of the component.
// When omitted, this means the user has no opinion and the platform
// chooses a reasonable default, which is subject to change over time.
// The current default log level is Normal.
// +optional
// +openshift:enable:FeatureGate=HCPUserFacingOperatorLogs
KubeControllerManager KubeControllerManagerOperatorSpec `json:"kubeControllerManager,omitzero"`

// kubeScheduler configures the kube-scheduler component.
// Setting the logLevel field triggers a rolling restart of the component.
// When omitted, this means the user has no opinion and the platform
// chooses a reasonable default, which is subject to change over time.
// The current default log level is Normal.
// +optional
// +openshift:enable:FeatureGate=HCPUserFacingOperatorLogs
KubeScheduler KubeSchedulerOperatorSpec `json:"kubeScheduler,omitzero"`

// openShiftControllerManager configures the openshift-controller-manager component.
// Setting the logLevel field triggers a rolling restart of the component.
// When omitted, this means the user has no opinion and the platform
// chooses a reasonable default, which is subject to change over time.
// The current default log level is Normal.
// +optional
// +openshift:enable:FeatureGate=HCPUserFacingOperatorLogs
OpenShiftControllerManager OpenShiftControllerManagerOperatorSpec `json:"openShiftControllerManager,omitzero"`

// openShiftAPIServer configures the openshift-apiserver component.
// Setting the logLevel field triggers a rolling restart of the component.
// When omitted, this means the user has no opinion and the platform
// chooses a reasonable default, which is subject to change over time.
// The current default log level is Normal.
// +optional
// +openshift:enable:FeatureGate=HCPUserFacingOperatorLogs
OpenShiftAPIServer OpenShiftAPIServerOperatorSpec `json:"openShiftAPIServer,omitzero"`

// openShiftOAuthAPIServer configures the openshift-oauth-apiserver component.
// Setting the logLevel field triggers a rolling restart of the component.
// When omitted, this means the user has no opinion and the platform
// chooses a reasonable default, which is subject to change over time.
// The current default log level is Normal.
// +optional
// +openshift:enable:FeatureGate=HCPUserFacingOperatorLogs
OpenShiftOAuthAPIServer OpenShiftOAuthAPIServerOperatorSpec `json:"openShiftOAuthAPIServer,omitzero"`

// oauthServer configures the oauth-server component.
// Setting the logLevel field triggers a rolling restart of the component.
// When omitted, this means the user has no opinion and the platform
// chooses a reasonable default, which is subject to change over time.
// The current default log level is Normal.
// +optional
// +openshift:enable:FeatureGate=HCPUserFacingOperatorLogs
OAuthServer OAuthServerOperatorSpec `json:"oauthServer,omitzero"`
}

// +genclient
Expand Down
68 changes: 67 additions & 1 deletion api/hypershift/v1beta1/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const (
KubevirtDefaultV4InternalSubnet = "100.66.0.0/16"
)

// +kubebuilder:validation:Enum="";Normal;Debug;Trace;TraceAll
// +kubebuilder:validation:Enum=Normal;Debug;Trace;TraceAll
Comment thread
JoelSpeed marked this conversation as resolved.
Comment thread
dhgautam99 marked this conversation as resolved.
type LogLevel string

var (
Expand All @@ -40,6 +40,72 @@ var (
TraceAll LogLevel = "TraceAll"
)

// ComponentLogLevelSpec configures the log verbosity for a hosted control plane component.
// +kubebuilder:validation:MinProperties=1
Comment thread
dhgautam99 marked this conversation as resolved.
type ComponentLogLevelSpec struct {
Comment thread
dhgautam99 marked this conversation as resolved.
// logLevel sets the log verbosity for the component.
// Valid values are: "Normal", "Debug", "Trace", "TraceAll".
// When set to Normal, standard operational log messages are produced for auditing and common operations.
// When set to Debug, more verbose logging is enabled for diagnosing problems.
// When set to Trace, very verbose logging is enabled including function-level tracing.
// When set to TraceAll, the most verbose logging is used, including full API body content,
// this can cause significant performance impact and produce large volumes of logs.
// When omitted, this means the user has no opinion and the platform
// chooses a reasonable default, which is subject to change over time.
// The current default log level is Normal.
// +optional
LogLevel LogLevel `json:"logLevel,omitempty"`
Comment thread
dhgautam99 marked this conversation as resolved.
}

// KubeAPIServerOperatorSpec specifies the configuration for the Kube API Server.
// +kubebuilder:validation:MinProperties=1
type KubeAPIServerOperatorSpec struct {
ComponentLogLevelSpec `json:",inline"`
}

// EtcdOperatorSpec specifies the configuration for the etcd.
// +kubebuilder:validation:MinProperties=1
// +kubebuilder:validation:XValidation:rule="!has(self.logLevel) || self.logLevel in ['Normal', 'Debug']",message="etcd only supports Normal and Debug log levels; Trace and TraceAll are not valid for etcd"
type EtcdOperatorSpec struct {
ComponentLogLevelSpec `json:",inline"`
}

// KubeControllerManagerOperatorSpec specifies the configuration for the Kube Controller Manager.
// +kubebuilder:validation:MinProperties=1
type KubeControllerManagerOperatorSpec struct {
ComponentLogLevelSpec `json:",inline"`
}

// KubeSchedulerOperatorSpec specifies the configuration for the Kube Scheduler.
// +kubebuilder:validation:MinProperties=1
type KubeSchedulerOperatorSpec struct {
ComponentLogLevelSpec `json:",inline"`
}

// OpenShiftControllerManagerOperatorSpec specifies the configuration for the OpenShift Controller Manager.
// +kubebuilder:validation:MinProperties=1
type OpenShiftControllerManagerOperatorSpec struct {
ComponentLogLevelSpec `json:",inline"`
}

// OpenShiftAPIServerOperatorSpec specifies the configuration for the OpenShift API Server.
// +kubebuilder:validation:MinProperties=1
type OpenShiftAPIServerOperatorSpec struct {
ComponentLogLevelSpec `json:",inline"`
}

// OpenShiftOAuthAPIServerOperatorSpec specifies the configuration for the OpenShift OAuth API Server.
// +kubebuilder:validation:MinProperties=1
type OpenShiftOAuthAPIServerOperatorSpec struct {
ComponentLogLevelSpec `json:",inline"`
}

// OAuthServerOperatorSpec specifies the configuration for the OAuth Server.
// +kubebuilder:validation:MinProperties=1
type OAuthServerOperatorSpec struct {
ComponentLogLevelSpec `json:",inline"`
}

// ClusterVersionOperatorSpec is the specification of the desired behavior of the Cluster Version Operator.
type ClusterVersionOperatorSpec struct {
// operatorLogLevel is an intent based logging for the operator itself. It does not give fine-grained control,
Expand Down
Loading