Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var FieldSetReaderTask = inspectiontaskbase.NewFieldSetReadTask(googlecloudlogk8scontainer_contract.FieldSetReaderTaskID, googlecloudlogk8scontainer_contract.ListLogEntriesTaskID.Ref(), []log.FieldSetReader{ &googlecloudlogk8scontainer_contract.K8sContainerLogFieldSetReader{}, })
View Source
var InputContainerQueryNamespaceFilterTask = formtask.NewSetFormTaskBuilder(googlecloudlogk8scontainer_contract.InputContainerQueryNamespacesTaskID, priorityForContainerGroup+1000, "Namespaces(Container logs)"). WithDependencies([]taskid.UntypedTaskReference{googlecloudk8scommon_contract.AutocompleteNamespacesTaskID.Ref()}). WithDefaultValueConstant([]string{"@managed"}, true). WithAllowAddAll(false). WithAllowRemoveAll(false). WithAllowCustomValue(true). WithDescription(`Container logs tend to be a lot and take very long time to query. Specify the space splitted namespace lists to query container logs only in the specific namespaces.`). WithOptionsFunc(func(ctx context.Context, value []string) ([]inspectionmetadata.SetParameterFormFieldOptionItem, error) { result := []inspectionmetadata.SetParameterFormFieldOptionItem{} namespaces := coretask.GetTaskResult(ctx, googlecloudk8scommon_contract.AutocompleteNamespacesTaskID.Ref()) result = append(result, inspectionmetadata.SetParameterFormFieldOptionItem{ ID: "@managed", Description: "[Alias] An alias matches the managed namespaces(e.g kube-system,gke-system,...etc).", }, inspectionmetadata.SetParameterFormFieldOptionItem{ ID: "@any", Description: "[Alias] An alias matches any pod namespaces.", }) for i, namespace := range namespaces.Values { if i >= maxNamespaceFilterOptions { break } result = append(result, inspectionmetadata.SetParameterFormFieldOptionItem{ ID: namespace, }) } return result, nil }). WithHintFunc(func(ctx context.Context, value []string, convertedValue any) (string, inspectionmetadata.ParameterHintType, error) { namespaces := coretask.GetTaskResult(ctx, googlecloudk8scommon_contract.AutocompleteNamespacesTaskID.Ref()) if len(namespaces.Values) > maxNamespaceFilterOptions { return fmt.Sprintf("Some namespaces are not shown on the suggestion list because the number of namespaces is %d, which is more than %d.", len(namespaces.Values), maxNamespaceFilterOptions), inspectionmetadata.Warning, nil } return "", inspectionmetadata.None, nil }). WithValidator(func(ctx context.Context, value []string) (string, error) { setFilterStr := strings.Join(value, " ") result, err := gcpqueryutil.ParseSetFilter(setFilterStr, inputNamespacesAliasMap, true, true, true) if err != nil { return "", err } return result.ValidationError, nil }). WithConverter(func(ctx context.Context, value []string) (*gcpqueryutil.SetFilterParseResult, error) { setFilterStr := strings.Join(value, " ") result, err := gcpqueryutil.ParseSetFilter(setFilterStr, inputNamespacesAliasMap, true, true, true) if err != nil { return nil, err } return result, nil }). Build()
InputContainerQueryNamespaceFilterTask is a form task that allows users to specify which namespaces to query for container logs.
View Source
var InputContainerQueryPodNamesFilterMask = formtask.NewSetFormTaskBuilder(googlecloudlogk8scontainer_contract.InputContainerQueryPodNamesTaskID, priorityForContainerGroup+2000, "Pod names(Container logs)"). WithDependencies([]taskid.UntypedTaskReference{googlecloudk8scommon_contract.AutocompletePodNamesTaskID.Ref()}). WithDefaultValueConstant([]string{"@any"}, true). WithAllowAddAll(false). WithAllowRemoveAll(false). WithAllowCustomValue(true). WithDescription(`Container logs tend to be a lot and take very long time to query. Specify the space splitted pod names lists to query container logs only in the specific pods. This parameter is evaluated as the partial match not the perfect match. You can use the prefix of the pod names.`). WithOptionsFunc(func(ctx context.Context, value []string) ([]inspectionmetadata.SetParameterFormFieldOptionItem, error) { result := []inspectionmetadata.SetParameterFormFieldOptionItem{} podNames := coretask.GetTaskResult(ctx, googlecloudk8scommon_contract.AutocompletePodNamesTaskID.Ref()) result = append(result, inspectionmetadata.SetParameterFormFieldOptionItem{ ID: "@any", Description: "[Alias] An alias matches any pod names.", }) for i, podName := range podNames.Values { if i >= maxPodNameFilterOptions { break } result = append(result, inspectionmetadata.SetParameterFormFieldOptionItem{ ID: podName, }) } return result, nil }). WithHintFunc(func(ctx context.Context, value []string, convertedValue any) (string, inspectionmetadata.ParameterHintType, error) { podNames := coretask.GetTaskResult(ctx, googlecloudk8scommon_contract.AutocompletePodNamesTaskID.Ref()) if len(podNames.Values) > maxPodNameFilterOptions { return fmt.Sprintf("Some pod names are not shown on the suggestion list because the number of pod names is %d, which is more than %d.", len(podNames.Values), maxPodNameFilterOptions), inspectionmetadata.Warning, nil } return "", inspectionmetadata.None, nil }). WithValidator(func(ctx context.Context, value []string) (string, error) { setFilterStr := strings.Join(value, " ") result, err := gcpqueryutil.ParseSetFilter(setFilterStr, inputPodNamesAliasMap, true, true, true) if err != nil { return "", err } return result.ValidationError, nil }). WithConverter(func(ctx context.Context, value []string) (*gcpqueryutil.SetFilterParseResult, error) { setFilterStr := strings.Join(value, " ") result, err := gcpqueryutil.ParseSetFilter(setFilterStr, inputPodNamesAliasMap, true, true, true) if err != nil { return nil, err } return result, nil }). Build()
InputContainerQueryPodNamesFilterMask is a form task that allows users to specify which pod names to query for container logs.
View Source
var ListLogEntriesTask = googlecloudcommon_contract.NewListLogEntriesTask(&containerListLogEntriesTaskSetting{})
View Source
var LogGrouperTask = inspectiontaskbase.NewLogGrouperTask(googlecloudlogk8scontainer_contract.LogGrouperTaskID, googlecloudlogk8scontainer_contract.FieldSetReaderTaskID.Ref(), func(ctx context.Context, l *log.Log) string { containerFields, err := log.GetFieldSet(l, &googlecloudlogk8scontainer_contract.K8sContainerLogFieldSet{}) if err != nil { return "unknown" } return containerFields.ResourcePath().Path })
View Source
var LogIngesterTask = inspectiontaskbase.NewLogIngesterTask(googlecloudlogk8scontainer_contract.LogIngesterTaskID, googlecloudlogk8scontainer_contract.ListLogEntriesTaskID.Ref())
View Source
var LogToTimelineMapperTask = inspectiontaskbase.NewLogToTimelineMapperTask[struct{}](googlecloudlogk8scontainer_contract.LogToTimelineMapperTaskID, &containerLogLogToTimelineMapperSetting{}, inspectioncore_contract.FeatureTaskLabel(`Kubernetes container logs`, `Gather stdout/stderr logs of containers on the cluster to visualize them on the timeline under an associated Pod. Log volume can be huge when the cluster has many Pods.`, enum.LogTypeContainer, 4000, false, googlecloudinspectiontypegroup_contract.GCPK8sClusterInspectionTypes...), )
Functions ¶
func GenerateK8sContainerQuery ¶
func GenerateK8sContainerQuery(clusterName string, namespacesFilter *gcpqueryutil.SetFilterParseResult, podNamesFilter *gcpqueryutil.SetFilterParseResult) string
GenerateK8sContainerQuery generates a Cloud Logging query for Kubernetes container logs.
func Register ¶
func Register(registry coreinspection.InspectionTaskRegistry) error
Register registers all googlecloudlogk8scontainer inspection tasks to the registry.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.