kubernetes-field-selector-extractor

command module
v0.0.0-...-467063a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 27, 2021 License: MIT Imports: 7 Imported by: 0

README

Kubernetes Field Selector Extractor

This application extracts all the available Field Selectors from Kubernetes. Since the list of implemented field selectors is neither exposed via any APIs nor declared anywhere, this application statically finds every call for AddFieldLabelConversionFunc like shown below and looks for hard-coded labels by retrieving ASTs.

err = scheme.AddFieldLabelConversionFunc(SchemeGroupVersion.WithKind("Node"),
    func(label, value string) (string, string, error) {
        switch label {
        case "metadata.name":
            return label, value, nil
        case "spec.unschedulable":
            return label, value, nil
        default:
            return "", "", fmt.Errorf("field label not supported: %s", label)
        }
    },
)

Cited from: pkgs/apis/core/v1/conversion.go (kubernetes/kubernetes)

Set up

$ git clone https://github.com/chitoku-k/kubernetes-field-selector-extractor
$ cd kubernetes-field-selector-extractor
$ git submodule update --init
$ go build -o kubernetes-field-selector-extractor

Usage

$ ./kubernetes-field-selector-extractor ./kubernetes/pkg/apis > selectors.json

Known Limitations

Unsupported style of coding such as the following cases emit warnings.

License

Kubernetes is licensed under the Apache License, Version 2.0.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL