Documentation
¶
Index ¶
- func DefaultServerUrlFor(config *rest.Config) (*url.URL, string, error)deprecated
- func FormatFieldIDs(diffs *structuredreporting.Diff) string
- func GetAlternativeControllerExpectedMap(configMap resourceconfig.ResourcesControllerMap) map[schema.GroupKind]k8s.ReconcilerType
- type Action
- type BlockedGCPError
- type ClientOptions
- type EventType
- type GKNN
- type GKNNReconciledResult
- type GroupVersionResource
- type ListListener
- type ListMetadata
- type Object
- type ObjectTransformer
- type PreviewInstance
- type PreviewInstanceOptions
- type ReconcileStatus
- type Recorder
- func (r *Recorder) DeepCopy() *Recorder
- func (r *Recorder) DoneReconciling() bool
- func (r *Recorder) ExportDetailObjectsEvent(filename string) error
- func (r *Recorder) GKNNDoneReconcile(gknn GKNN) bool
- func (r *Recorder) GenerateRecorderReconciledResults() *RecorderReconciledResults
- func (recorder *Recorder) GetOrCreateReconciledResults() *RecorderReconciledResults
- func (r *Recorder) GetRemainResourcesCount() int
- func (r *Recorder) NewStructuredReportingListener() structuredreporting.Listener
- func (r *Recorder) PreloadGKNN(ctx context.Context, config *rest.Config, namespace string) error
- func (r *Recorder) RecordBlockedKubeMethod(ctx context.Context, scheme *runtime.Scheme, method string, args ...any)
- func (r *Recorder) RecordIgnoredKubeMethod(ctx context.Context, scheme *runtime.Scheme, method string, args ...any)
- type RecorderReconciledResults
- func (r *RecorderReconciledResults) AddResult(gknn GKNN, result *GKNNReconciledResult)
- func (r *RecorderReconciledResults) BadResultReport(badResultFile string, badResult []*GKNNReconciledResult) error
- func (r *RecorderReconciledResults) CombinedSummaryReport(summaryFile string, altResult *RecorderReconciledResults, ...) error
- type StreamingClient
- func (c *StreamingClient) Get(ctx context.Context, typeInfo *typeInfo, namespace, name string, dest Object) error
- func (c *StreamingClient) List(ctx context.Context, typeInfo *typeInfo, namespace string, ...) error
- func (c *StreamingClient) Watch(ctx context.Context, typeInfo *typeInfo, namespace string, ...) error
- type WatchListener
- type WatchOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatFieldIDs ¶ added in v1.145.0
func FormatFieldIDs(diffs *structuredreporting.Diff) string
func GetAlternativeControllerExpectedMap ¶ added in v1.147.1
func GetAlternativeControllerExpectedMap(configMap resourceconfig.ResourcesControllerMap) map[schema.GroupKind]k8s.ReconcilerType
Types ¶
type Action ¶
type Action string
Action indicates whether we blocked or ignored the requested action.
type BlockedGCPError ¶
BlockedGCPError is an error that occurs when a GCP API call is blocked.
func ExtractBlockedGCPError ¶
func ExtractBlockedGCPError(err error) (*BlockedGCPError, bool)
ExtractBlockedGCPError will unwrap a BlockedGCPError. To tolerate terraform using string-wrapping of error messages, we also parse a json-encoded form.
func (BlockedGCPError) Error ¶
func (e BlockedGCPError) Error() string
Error implements the error interface.
type ClientOptions ¶
ClientOptions are the options for creating a StreamingClient.
type GKNN ¶
GKNN is the canonical identity for a kube object; it is short for Group-Kind-Namespaced-Name (Version is an encoding artifact, and does not change the identity of the object)
type GKNNReconciledResult ¶ added in v1.145.0
type GKNNReconciledResult struct {
GKNN GKNN
ControllerType k8s.ReconcilerType
ReconcileStatus ReconcileStatus
Diffs *structuredreporting.Diff
GCPActions []*gcpAction
}
GKNNReconciledResult is the result of reconciling a GKNN object with a specific controller type.
func (*GKNNReconciledResult) FormatGKNNReconciledResult ¶ added in v1.145.0
func (r *GKNNReconciledResult) FormatGKNNReconciledResult() string
FormatGKNNReconciledResult formats the GKNNReconciledResult into a string.
type GroupVersionResource ¶
GroupVersionResource is a group, version, and resource.
type ListListener ¶
type ListListener interface {
OnListBegin(metadata ListMetadata)
OnListObject(ctx context.Context, obj Object) error
OnListEnd()
}
ListListener is a listener for list operations.
type ListMetadata ¶
ListMetadata is the metadata for a list operation.
type ObjectTransformer ¶ added in v1.147.0
ObjectTransformer transforms a Kubernetes object.
func NewSetAlternativeOverrideTransformer ¶ added in v1.147.0
func NewSetAlternativeOverrideTransformer(namespace string) ObjectTransformer
NewSetAlternativeOverrideTransformer returns a transformer that sets the controller override to the alternative controller for each resource.
type PreviewInstance ¶
type PreviewInstance struct {
// Namespace is the namespace of the cluster to preview
// If empty, all namespaces are previewed
// Namespace is the namespace of the cluster to preview
// If empty, all namespaces are previewed
Namespace string
ObjectTransformers []ObjectTransformer
// contains filtered or unexported fields
}
PreviewInstance runs KCC but intercepts GCP and Kubernetes API calls. We allow read-only operations to pass through, but block and log write operations. It is useful for testing the behavior of KCC without actually making any changes to GCP or Kubernetes.
func NewPreviewInstance ¶
func NewPreviewInstance(recorder *Recorder, options PreviewInstanceOptions) (*PreviewInstance, error)
NewPreviewInstance creates a new PreviewInstance.
type PreviewInstanceOptions ¶
type PreviewInstanceOptions struct {
// UpstreamRESTConfig is the rest configuration to use when talking to upstream (real) kube-apiserver
// (Upstream kube-apiserver may be mocked in tests)
UpstreamRESTConfig *rest.Config
// UpstreamGCPAuthorization is the authorization to use when talking to upstream (real) GCP
// (Upstream GCP may be mocked in tests)
UpstreamGCPAuthorization oauth2.TokenSource
// UpstreamGCPHTTPClient is the http client to use when talking to upstream (real) GCP
// (Upstream GCP may be mocked in tests)
UpstreamGCPHTTPClient *http.Client
// UpstreamGCPQPS is the QPS to use when talking to upstream (real) GCP
// This limit is per API.
UpstreamGCPQPS float64
// UpstreamGCPBurst is the burst to use when talking to upstream (real) GCP
// This limit is per API.
UpstreamGCPBurst int
// Namespace is the namespace of the cluster to preview
// If empty, all namespaces are previewed
Namespace string
// ObjectTransformers are the transformers to apply to objects
ObjectTransformers []ObjectTransformer
}
PreviewInstanceOptions are the options for creating a PreviewInstance.
type ReconcileStatus ¶ added in v1.145.0
type ReconcileStatus int
const ( ReconcileStatusUnknown ReconcileStatus = iota ReconcileStatusHealthy ReconcileStatusUnhealthy )
ReconcileStatus is the status of a GKNN object after being reconciled.
func (ReconcileStatus) String ¶ added in v1.145.0
func (s ReconcileStatus) String() string
type Recorder ¶
type Recorder struct {
// Track if a resource has been reconciled.
ReconciledResources map[GKNN]bool
// Number of resources has not been reconciled.
RemainResourcesCount int
// contains filtered or unexported fields
}
Recorder holds the information from reconciling the objects
func (*Recorder) DoneReconciling ¶ added in v1.137.0
func (*Recorder) ExportDetailObjectsEvent ¶ added in v1.137.0
ExportObjectsEvent writes all captured GKNN and its event to filename.
func (*Recorder) GKNNDoneReconcile ¶ added in v1.137.0
func (*Recorder) GenerateRecorderReconciledResults ¶ added in v1.145.0
func (r *Recorder) GenerateRecorderReconciledResults() *RecorderReconciledResults
func (*Recorder) GetOrCreateReconciledResults ¶ added in v1.147.1
func (recorder *Recorder) GetOrCreateReconciledResults() *RecorderReconciledResults
func (*Recorder) GetRemainResourcesCount ¶ added in v1.147.1
func (*Recorder) NewStructuredReportingListener ¶
func (r *Recorder) NewStructuredReportingListener() structuredreporting.Listener
NewStructuredReportingListener creates a new StructuredReportingListener.
func (*Recorder) PreloadGKNN ¶ added in v1.137.0
TODO: Implement concurrent worker by GVRs.
type RecorderReconciledResults ¶ added in v1.145.0
type RecorderReconciledResults struct {
// contains filtered or unexported fields
}
RecorderReconciledResults is the result of reconciling all GKNN objects recorded by the recorder.
func (*RecorderReconciledResults) AddResult ¶ added in v1.145.0
func (r *RecorderReconciledResults) AddResult(gknn GKNN, result *GKNNReconciledResult)
func (*RecorderReconciledResults) BadResultReport ¶ added in v1.145.0
func (r *RecorderReconciledResults) BadResultReport(badResultFile string, badResult []*GKNNReconciledResult) error
func (*RecorderReconciledResults) CombinedSummaryReport ¶ added in v1.147.1
func (r *RecorderReconciledResults) CombinedSummaryReport(summaryFile string, altResult *RecorderReconciledResults, altExpectedMap map[schema.GroupKind]k8s.ReconcilerType) error
type StreamingClient ¶
type StreamingClient struct {
// contains filtered or unexported fields
}
StreamingClient is a client for streaming Kubernetes API responses.
func NewStreamingClient ¶
func NewStreamingClient(opt ClientOptions) *StreamingClient
NewStreamingClient creates a new StreamingClient.
func (*StreamingClient) Get ¶
func (c *StreamingClient) Get(ctx context.Context, typeInfo *typeInfo, namespace, name string, dest Object) error
Get gets the requested object
func (*StreamingClient) List ¶
func (c *StreamingClient) List(ctx context.Context, typeInfo *typeInfo, namespace string, listener ListListener) error
List lists the objects for the given type.
func (*StreamingClient) Watch ¶
func (c *StreamingClient) Watch(ctx context.Context, typeInfo *typeInfo, namespace string, watchOptions WatchOptions, listener WatchListener) error
Watch watches the given type.
type WatchListener ¶
type WatchListener interface {
OnWatchEvent(ctx context.Context, eventType string, object Object) error
}
WatchListener is a listener for watch operations.
type WatchOptions ¶
WatchOptions are the options for a watch operation.