fix cron triggers (#1171)
parent
164b8658dd
commit
a35155415e
697
.golangci.yml
697
.golangci.yml
|
|
@ -16,16 +16,18 @@ run:
|
|||
tests: true
|
||||
|
||||
# list of build tags, all linters use it. Default is empty list.
|
||||
# build-tags:
|
||||
# - mytag
|
||||
build-tags:
|
||||
- mytag
|
||||
|
||||
# which dirs to skip: issues from them won't be reported;
|
||||
# can use regexp here: generated.*, regexp is applied on full path;
|
||||
# default value is empty list, but default dirs are skipped independently
|
||||
# from this option's value (see skip-dirs-use-default).
|
||||
# skip-dirs:
|
||||
# - src/external_libs
|
||||
# - autogenerated_by_my_lib
|
||||
# "/" will be replaced by current OS file path separator to properly work
|
||||
# on Windows.
|
||||
skip-dirs:
|
||||
- src/external_libs
|
||||
- autogenerated_by_my_lib
|
||||
|
||||
# default is true. Enables skipping of directories:
|
||||
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
|
||||
|
|
@ -35,9 +37,12 @@ run:
|
|||
# won't be reported. Default value is empty list, but there is
|
||||
# no need to include all autogenerated files, we confidently recognize
|
||||
# autogenerated files. If it's not please let us know.
|
||||
# skip-files:
|
||||
# - ".*\\.my\\.go$"
|
||||
# - lib/bad.go
|
||||
# "/" will be replaced by current OS file path separator to properly work
|
||||
# on Windows.
|
||||
skip-files:
|
||||
- ".*\\.my\\.go$"
|
||||
- lib/bad.go
|
||||
|
||||
# by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules":
|
||||
# If invoked with -mod=readonly, the go command is disallowed from the implicit
|
||||
# automatic updating of go.mod described above. Instead, it fails when any changes
|
||||
|
|
@ -46,11 +51,16 @@ run:
|
|||
# If invoked with -mod=vendor, the go command assumes that the vendor
|
||||
# directory holds the correct copies of dependencies and ignores
|
||||
# the dependency descriptions in go.mod.
|
||||
# modules-download-mode: readonly|release|vendor
|
||||
# modules-download-mode: readonly|vendor|mod
|
||||
|
||||
# Allow multiple parallel golangci-lint instances running.
|
||||
# If false (default) - golangci-lint acquires file lock on start.
|
||||
allow-parallel-runners: false
|
||||
|
||||
# output configuration options
|
||||
output:
|
||||
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
|
||||
# colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions
|
||||
# default is "colored-line-number"
|
||||
format: colored-line-number
|
||||
|
||||
# print lines of code with issue, default is true
|
||||
|
|
@ -59,12 +69,37 @@ output:
|
|||
# print linter name in the end of issue text, default is true
|
||||
print-linter-name: true
|
||||
|
||||
# make issues output unique by line, default is true
|
||||
uniq-by-line: true
|
||||
|
||||
# add a prefix to the output file references; default is no prefix
|
||||
path-prefix: ""
|
||||
|
||||
# sorts results by: filepath, line and column
|
||||
sort-results: false
|
||||
|
||||
# all available settings of specific linters
|
||||
linters-settings:
|
||||
cyclop:
|
||||
# the maximal code complexity to report
|
||||
max-complexity: 20
|
||||
# the maximal average package complexity. If it's higher than 0.0 (float) the check is enabled (default 0.0)
|
||||
package-average: 0.0
|
||||
# should ignore tests (default false)
|
||||
skip-tests: false
|
||||
|
||||
dogsled:
|
||||
# checks assignments with too many blank identifiers; default is 2
|
||||
max-blank-identifiers: 2
|
||||
|
||||
dupl:
|
||||
# tokens count to trigger issue, 150 by default
|
||||
threshold: 100
|
||||
|
||||
errcheck:
|
||||
# report about not checking of errors in type assertions: `a := b.(MyStruct)`;
|
||||
# default is false: such cases aren't reported by default.
|
||||
check-type-assertions: true
|
||||
check-type-assertions: false
|
||||
|
||||
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
|
||||
# default is false: such cases aren't reported by default.
|
||||
|
|
@ -73,107 +108,69 @@ linters-settings:
|
|||
# [deprecated] comma-separated list of pairs of the form pkg:regex
|
||||
# the regex is used to ignore names within pkg. (default "fmt:.*").
|
||||
# see https://github.com/kisielk/errcheck#the-deprecated-method for details
|
||||
# ignore: fmt:.*,io/ioutil:^Read.*
|
||||
ignore: fmt:.*,io/ioutil:^Read.*
|
||||
|
||||
# path to a file containing a list of functions to exclude from checking
|
||||
# see https://github.com/kisielk/errcheck#excluding-functions for details
|
||||
# exclude: /path/to/file.txt
|
||||
|
||||
errorlint:
|
||||
# Check whether fmt.Errorf uses the %w verb for formatting errors. See the readme for caveats
|
||||
errorf: true
|
||||
# Check for plain type assertions and type switches
|
||||
asserts: true
|
||||
# Check for plain error comparisons
|
||||
comparison: true
|
||||
|
||||
exhaustive:
|
||||
# check switch statements in generated files also
|
||||
check-generated: false
|
||||
# indicates that switch statements are to be considered exhaustive if a
|
||||
# 'default' case is present, even if all enum members aren't listed in the
|
||||
# switch
|
||||
default-signifies-exhaustive: false
|
||||
|
||||
exhaustivestruct:
|
||||
# Struct Patterns is list of expressions to match struct packages and names
|
||||
# The struct packages have the form example.com/package.ExampleStruct
|
||||
# The matching patterns can use matching syntax from https://pkg.go.dev/path#Match
|
||||
# If this list is empty, all structs are tested.
|
||||
struct-patterns:
|
||||
- "*.Test"
|
||||
- "example.com/package.ExampleStruct"
|
||||
|
||||
forbidigo:
|
||||
# Forbid the following identifiers (identifiers are written using regexp):
|
||||
forbid:
|
||||
- ^print.*$
|
||||
- 'fmt\.Print.*'
|
||||
# Exclude godoc examples from forbidigo checks. Default is true.
|
||||
exclude_godoc_examples: false
|
||||
|
||||
funlen:
|
||||
lines: 100
|
||||
statements: 40
|
||||
|
||||
govet:
|
||||
# report about shadowed variables
|
||||
check-shadowing: true
|
||||
|
||||
# settings per analyzer
|
||||
settings:
|
||||
printf: # analyzer name, run `go tool vet help` to see all analyzers
|
||||
funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer
|
||||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
|
||||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
|
||||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
|
||||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
|
||||
|
||||
# enable or disable analyzers by name
|
||||
enable:
|
||||
- atomicalign
|
||||
enable-all: false
|
||||
disable:
|
||||
# - shadow
|
||||
disable-all: false
|
||||
golint:
|
||||
# minimal confidence for issues, default is 0.8
|
||||
min-confidence: 0.8
|
||||
gofmt:
|
||||
# simplify code: gofmt with `-s` option, true by default
|
||||
simplify: true
|
||||
goimports:
|
||||
gci:
|
||||
# put imports beginning with prefix after 3rd-party packages;
|
||||
# it's a comma-separated list of prefixes
|
||||
# only support one prefix
|
||||
# if not set, use goimports.local-prefixes
|
||||
local-prefixes: github.com/org/project
|
||||
gocyclo:
|
||||
# minimal code complexity to report, 30 by default (but we recommend 10-20)
|
||||
min-complexity: 20
|
||||
|
||||
gocognit:
|
||||
# minimal code complexity to report, 30 by default (but we recommend 10-20)
|
||||
min-complexity: 20
|
||||
maligned:
|
||||
# print struct with more effective memory layout or not, false by default
|
||||
suggest-new: true
|
||||
dupl:
|
||||
# tokens count to trigger issue, 150 by default
|
||||
threshold: 100
|
||||
min-complexity: 10
|
||||
|
||||
nestif:
|
||||
# minimal complexity of if statements to report, 5 by default
|
||||
min-complexity: 4
|
||||
|
||||
goconst:
|
||||
# minimal length of string constant, 3 by default
|
||||
min-len: 3
|
||||
# minimal occurrences count to trigger, 3 by default
|
||||
min-occurrences: 3
|
||||
depguard:
|
||||
list-type: blacklist
|
||||
include-go-root: false
|
||||
packages:
|
||||
- github.com/sirupsen/logrus
|
||||
packages-with-error-messages:
|
||||
# specify an error message to output when a blacklisted package is used
|
||||
github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
|
||||
misspell:
|
||||
# Correct spellings using locale preferences for US or UK.
|
||||
# Default is to use a neutral variety of English.
|
||||
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
|
||||
locale: US
|
||||
ignore-words:
|
||||
- someword
|
||||
lll:
|
||||
# max line length, lines longer will be reported. Default is 120.
|
||||
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
|
||||
line-length: 120
|
||||
# tab width in spaces. Default to 1.
|
||||
tab-width: 1
|
||||
unused:
|
||||
# treat code as a program (not a library) and report unused exported identifiers; default is false.
|
||||
# XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
|
||||
# if it's called for subdir of a project it can't find funcs usages. All text editor integrations
|
||||
# with golangci-lint call it on a directory with the changed file.
|
||||
check-exported: false
|
||||
unparam:
|
||||
# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
|
||||
# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
|
||||
# if it's called for subdir of a project it can't find external interfaces. All text editor integrations
|
||||
# with golangci-lint call it on a directory with the changed file.
|
||||
check-exported: false
|
||||
nakedret:
|
||||
# make an issue if func has more lines of code than this setting and it has naked returns; default is 30
|
||||
max-func-lines: 30
|
||||
prealloc:
|
||||
# XXX: we don't recommend using this linter before doing performance profiling.
|
||||
# For most programs usage of prealloc will be a premature optimization.
|
||||
|
||||
# Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
|
||||
# True by default.
|
||||
simple: true
|
||||
range-loops: true # Report preallocation suggestions on range loops, true by default
|
||||
for-loops: false # Report preallocation suggestions on for loops, false by default
|
||||
gocritic:
|
||||
# Which checks should be enabled; can't be combined with 'disabled-checks';
|
||||
# See https://go-critic.github.io/overview#checks-overview
|
||||
|
|
@ -190,12 +187,62 @@ linters-settings:
|
|||
# Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
|
||||
enabled-tags:
|
||||
- performance
|
||||
disabled-tags:
|
||||
- experimental
|
||||
|
||||
settings: # settings passed to gocritic
|
||||
# Settings passed to gocritic.
|
||||
# The settings key is the name of a supported gocritic checker.
|
||||
# The list of supported checkers can be find in https://go-critic.github.io/overview.
|
||||
settings:
|
||||
captLocal: # must be valid enabled check name
|
||||
# whether to restrict checker to params only (default true)
|
||||
paramsOnly: true
|
||||
elseif:
|
||||
# whether to skip balanced if-else pairs (default true)
|
||||
skipBalanced: true
|
||||
hugeParam:
|
||||
# size in bytes that makes the warning trigger (default 80)
|
||||
sizeThreshold: 80
|
||||
# nestingReduce:
|
||||
# # min number of statements inside a branch to trigger a warning (default 5)
|
||||
# bodyWidth: 5
|
||||
rangeExprCopy:
|
||||
# size in bytes that makes the warning trigger (default 512)
|
||||
sizeThreshold: 512
|
||||
# whether to check test functions (default true)
|
||||
skipTestFuncs: true
|
||||
rangeValCopy:
|
||||
# size in bytes that makes the warning trigger (default 128)
|
||||
sizeThreshold: 32
|
||||
# whether to check test functions (default true)
|
||||
skipTestFuncs: true
|
||||
# ruleguard:
|
||||
# path to a gorules file for the ruleguard checker
|
||||
# rules: ""
|
||||
# truncateCmp:
|
||||
# # whether to skip int/uint/uintptr types (default true)
|
||||
# skipArchDependent: true
|
||||
underef:
|
||||
# whether to skip (*x).method() calls where x is a pointer receiver (default true)
|
||||
skipRecvDeref: true
|
||||
# unnamedResult:
|
||||
# # whether to check exported functions
|
||||
# checkExported: true
|
||||
|
||||
gocyclo:
|
||||
# minimal code complexity to report, 30 by default (but we recommend 10-20)
|
||||
min-complexity: 20
|
||||
|
||||
godot:
|
||||
# comments to be checked: `declarations`, `toplevel`, or `all`
|
||||
scope: declarations
|
||||
# list of regexps for excluding particular comment lines from check
|
||||
exclude:
|
||||
# example: exclude comments which contain numbers
|
||||
# - '[0-9]+'
|
||||
# check that each sentence starts with a capital letter
|
||||
capital: false
|
||||
|
||||
godox:
|
||||
# report any comments starting with keywords, this is useful for TODO or FIXME comments that
|
||||
# might be left in the code accidentally and should be resolved before merging
|
||||
|
|
@ -203,40 +250,432 @@ linters-settings:
|
|||
- NOTE
|
||||
- OPTIMIZE # marks code that should be optimized before merging
|
||||
- HACK # marks hack-arounds that should be removed before merging
|
||||
dogsled:
|
||||
# checks assignments with too many blank identifiers; default is 2
|
||||
max-blank-identifiers: 2
|
||||
|
||||
gofmt:
|
||||
# simplify code: gofmt with `-s` option, true by default
|
||||
simplify: true
|
||||
|
||||
gofumpt:
|
||||
# Choose whether or not to use the extra rules that are disabled
|
||||
# by default
|
||||
extra-rules: false
|
||||
|
||||
# goheader:
|
||||
# values:
|
||||
# const:
|
||||
# define here const type values in format k:v, for example:
|
||||
# COMPANY: MY COMPANY
|
||||
# regexp:
|
||||
# define here regexp type values, for example
|
||||
# AUTHOR: .*@mycompany\.com
|
||||
# template:# |-
|
||||
# put here copyright header template for source code files, for example:
|
||||
# Note: {{ YEAR }} is a builtin value that returns the year relative to the current machine time.
|
||||
#
|
||||
# {{ AUTHOR }} {{ COMPANY }} {{ YEAR }}
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at:
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# template-path:
|
||||
# also as alternative of directive 'template' you may put the path to file with the template source
|
||||
|
||||
goimports:
|
||||
# put imports beginning with prefix after 3rd-party packages;
|
||||
# it's a comma-separated list of prefixes
|
||||
local-prefixes: github.com/org/project
|
||||
|
||||
golint:
|
||||
# minimal confidence for issues, default is 0.8
|
||||
min-confidence: 0.8
|
||||
|
||||
gomnd:
|
||||
settings:
|
||||
mnd:
|
||||
# the list of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description.
|
||||
checks:
|
||||
- argument
|
||||
- case
|
||||
- condition
|
||||
- operation
|
||||
- return
|
||||
- assign
|
||||
# ignored-numbers: 1000
|
||||
# ignored-files: magic_.*.go
|
||||
# ignored-functions: math.*
|
||||
|
||||
gomoddirectives:
|
||||
# Allow local `replace` directives. Default is false.
|
||||
replace-local: false
|
||||
# List of allowed `replace` directives. Default is empty.
|
||||
replace-allow-list:
|
||||
- launchpad.net/gocheck
|
||||
# Allow to not explain why the version has been retracted in the `retract` directives. Default is false.
|
||||
retract-allow-no-explanation: false
|
||||
# Forbid the use of the `exclude` directives. Default is false.
|
||||
exclude-forbidden: false
|
||||
|
||||
gomodguard:
|
||||
# allowed:
|
||||
# modules: # List of allowed modules
|
||||
# - gopkg.in/yaml.v2
|
||||
# domains:# List of allowed module domains
|
||||
# - golang.org
|
||||
# blocked:
|
||||
# modules: # List of blocked modules
|
||||
# - github.com/uudashr/go-module: # Blocked module
|
||||
# recommendations: # Recommended modules that should be used instead (Optional)
|
||||
# - golang.org/x/mod
|
||||
# reason: "`mod` is the official go.mod parser library." # Reason why the recommended module should be used (Optional)
|
||||
# versions:# List of blocked module version constraints
|
||||
# - github.com/mitchellh/go-homedir: # Blocked module with version constraint
|
||||
# version: "< 1.1.0" # Version constraint, see https://github.com/Masterminds/semver#basic-comparisons
|
||||
# reason: "testing if blocked version constraint works." # Reason why the version constraint exists. (Optional)
|
||||
local_replace_directives: false # Set to true to raise lint issues for packages that are loaded from a local path via replace directive
|
||||
|
||||
gosec:
|
||||
# To select a subset of rules to run.
|
||||
# Available rules: https://github.com/securego/gosec#available-rules
|
||||
includes:
|
||||
- G401
|
||||
- G306
|
||||
- G101
|
||||
# To specify a set of rules to explicitly exclude.
|
||||
# Available rules: https://github.com/securego/gosec#available-rules
|
||||
excludes:
|
||||
- G204
|
||||
# To specify the configuration of rules.
|
||||
# The configuration of rules is not fully documented by gosec:
|
||||
# https://github.com/securego/gosec#configuration
|
||||
# https://github.com/securego/gosec/blob/569328eade2ccbad4ce2d0f21ee158ab5356a5cf/rules/rulelist.go#L60-L102
|
||||
config:
|
||||
G306: "0600"
|
||||
G101:
|
||||
pattern: "(?i)example"
|
||||
ignore_entropy: false
|
||||
entropy_threshold: "80.0"
|
||||
per_char_threshold: "3.0"
|
||||
truncate: "32"
|
||||
|
||||
gosimple:
|
||||
# Select the Go version to target. The default is '1.13'.
|
||||
go: "1.15"
|
||||
# https://staticcheck.io/docs/options#checks
|
||||
checks: ["all"]
|
||||
|
||||
govet:
|
||||
# report about shadowed variables
|
||||
check-shadowing: true
|
||||
|
||||
# settings per analyzer
|
||||
settings:
|
||||
printf: # analyzer name, run `go tool vet help` to see all analyzers
|
||||
funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer
|
||||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
|
||||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
|
||||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
|
||||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
|
||||
|
||||
# enable or disable analyzers by name
|
||||
# run `go tool vet help` to see all analyzers
|
||||
# enable:
|
||||
# - atomicalign
|
||||
# enable-all: true
|
||||
# disable:
|
||||
# - shadow
|
||||
# disable-all: false
|
||||
|
||||
depguard:
|
||||
list-type: blacklist
|
||||
include-go-root: false
|
||||
packages:
|
||||
- github.com/sirupsen/logrus
|
||||
packages-with-error-message:
|
||||
# specify an error message to output when a blacklisted package is used
|
||||
- github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
|
||||
|
||||
ifshort:
|
||||
# Maximum length of variable declaration measured in number of lines, after which linter won't suggest using short syntax.
|
||||
# Has higher priority than max-decl-chars.
|
||||
max-decl-lines: 1
|
||||
# Maximum length of variable declaration measured in number of characters, after which linter won't suggest using short syntax.
|
||||
max-decl-chars: 30
|
||||
|
||||
importas:
|
||||
# if set to `true`, force to use alias.
|
||||
no-unaliased: true
|
||||
# List of aliases
|
||||
alias:
|
||||
# using `servingv1` alias for `knative.dev/serving/pkg/apis/serving/v1` package
|
||||
- pkg: knative.dev/serving/pkg/apis/serving/v1
|
||||
alias: servingv1
|
||||
# using `autoscalingv1alpha1` alias for `knative.dev/serving/pkg/apis/autoscaling/v1alpha1` package
|
||||
- pkg: knative.dev/serving/pkg/apis/autoscaling/v1alpha1
|
||||
alias: autoscalingv1alpha1
|
||||
# You can specify the package path by regular expression,
|
||||
# and alias by regular expression expansion syntax like below.
|
||||
# see https://github.com/julz/importas#use-regular-expression for details
|
||||
- pkg: knative.dev/serving/pkg/apis/(\w+)/(v[\w\d]+)
|
||||
alias: $1$2
|
||||
|
||||
lll:
|
||||
# max line length, lines longer will be reported. Default is 120.
|
||||
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
|
||||
line-length: 120
|
||||
# tab width in spaces. Default to 1.
|
||||
tab-width: 1
|
||||
|
||||
makezero:
|
||||
# Allow only slices initialized with a length of zero. Default is false.
|
||||
always: false
|
||||
|
||||
maligned:
|
||||
# print struct with more effective memory layout or not, false by default
|
||||
suggest-new: true
|
||||
|
||||
misspell:
|
||||
# Correct spellings using locale preferences for US or UK.
|
||||
# Default is to use a neutral variety of English.
|
||||
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
|
||||
locale: US
|
||||
ignore-words:
|
||||
- someword
|
||||
|
||||
nakedret:
|
||||
# make an issue if func has more lines of code than this setting and it has naked returns; default is 30
|
||||
max-func-lines: 30
|
||||
|
||||
prealloc:
|
||||
# XXX: we don't recommend using this linter before doing performance profiling.
|
||||
# For most programs usage of prealloc will be a premature optimization.
|
||||
|
||||
# Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
|
||||
# True by default.
|
||||
simple: true
|
||||
range-loops: true # Report preallocation suggestions on range loops, true by default
|
||||
for-loops: false # Report preallocation suggestions on for loops, false by default
|
||||
|
||||
promlinter:
|
||||
# Promlinter cannot infer all metrics name in static analysis.
|
||||
# Enable strict mode will also include the errors caused by failing to parse the args.
|
||||
strict: false
|
||||
# Please refer to https://github.com/yeya24/promlinter#usage for detailed usage.
|
||||
disabled-linters:
|
||||
# - "Help"
|
||||
# - "MetricUnits"
|
||||
# - "Counter"
|
||||
# - "HistogramSummaryReserved"
|
||||
# - "MetricTypeInName"
|
||||
# - "ReservedChars"
|
||||
# - "CamelCase"
|
||||
# - "lintUnitAbbreviations"
|
||||
|
||||
predeclared:
|
||||
# comma-separated list of predeclared identifiers to not report on
|
||||
ignore: ""
|
||||
# include method names and field names (i.e., qualified names) in checks
|
||||
q: false
|
||||
|
||||
nolintlint:
|
||||
# Enable to ensure that nolint directives are all used. Default is true.
|
||||
allow-unused: false
|
||||
# Disable to ensure that nolint directives don't have a leading space. Default is true.
|
||||
allow-leading-space: true
|
||||
# Exclude following linters from requiring an explanation. Default is [].
|
||||
allow-no-explanation: []
|
||||
# Enable to require an explanation of nonzero length after each nolint directive. Default is false.
|
||||
require-explanation: true
|
||||
# Enable to require nolint directives to mention the specific linter being suppressed. Default is false.
|
||||
require-specific: true
|
||||
|
||||
rowserrcheck:
|
||||
packages:
|
||||
- github.com/jmoiron/sqlx
|
||||
|
||||
revive:
|
||||
# see https://github.com/mgechev/revive#available-rules for details.
|
||||
ignore-generated-header: true
|
||||
severity: warning
|
||||
rules:
|
||||
- name: indent-error-flow
|
||||
severity: warning
|
||||
- name: add-constant
|
||||
severity: warning
|
||||
arguments:
|
||||
- maxLitCount: "3"
|
||||
allowStrs: '""'
|
||||
allowInts: "0,1,2"
|
||||
allowFloats: "0.0,0.,1.0,1.,2.0,2."
|
||||
|
||||
staticcheck:
|
||||
# Select the Go version to target. The default is '1.13'.
|
||||
go: "1.15"
|
||||
# https://staticcheck.io/docs/options#checks
|
||||
checks: ["all"]
|
||||
|
||||
stylecheck:
|
||||
# Select the Go version to target. The default is '1.13'.
|
||||
go: "1.15"
|
||||
# https://staticcheck.io/docs/options#checks
|
||||
checks:
|
||||
["all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022"]
|
||||
# https://staticcheck.io/docs/options#dot_import_whitelist
|
||||
dot-import-whitelist:
|
||||
- fmt
|
||||
# https://staticcheck.io/docs/options#initialisms
|
||||
initialisms:
|
||||
[
|
||||
"ACL",
|
||||
"API",
|
||||
"ASCII",
|
||||
"CPU",
|
||||
"CSS",
|
||||
"DNS",
|
||||
"EOF",
|
||||
"GUID",
|
||||
"HTML",
|
||||
"HTTP",
|
||||
"HTTPS",
|
||||
"ID",
|
||||
"IP",
|
||||
"JSON",
|
||||
"QPS",
|
||||
"RAM",
|
||||
"RPC",
|
||||
"SLA",
|
||||
"SMTP",
|
||||
"SQL",
|
||||
"SSH",
|
||||
"TCP",
|
||||
"TLS",
|
||||
"TTL",
|
||||
"UDP",
|
||||
"UI",
|
||||
"GID",
|
||||
"UID",
|
||||
"UUID",
|
||||
"URI",
|
||||
"URL",
|
||||
"UTF8",
|
||||
"VM",
|
||||
"XML",
|
||||
"XMPP",
|
||||
"XSRF",
|
||||
"XSS",
|
||||
]
|
||||
# https://staticcheck.io/docs/options#http_status_code_whitelist
|
||||
http-status-code-whitelist: ["200", "400", "404", "500"]
|
||||
|
||||
tagliatelle:
|
||||
# check the struck tag name case
|
||||
case:
|
||||
# use the struct field name to check the name of the struct tag
|
||||
use-field-name: true
|
||||
rules:
|
||||
# any struct tag type can be used.
|
||||
# support string case: `camel`, `pascal`, `kebab`, `snake`, `goCamel`, `goPascal`, `goKebab`, `goSnake`, `upper`, `lower`
|
||||
json: camel
|
||||
yaml: camel
|
||||
xml: camel
|
||||
bson: camel
|
||||
avro: snake
|
||||
mapstructure: kebab
|
||||
|
||||
testpackage:
|
||||
# regexp pattern to skip files
|
||||
skip-regexp: (export|internal)_test\.go
|
||||
|
||||
thelper:
|
||||
# The following configurations enable all checks. It can be omitted because all checks are enabled by default.
|
||||
# You can enable only required checks deleting unnecessary checks.
|
||||
test:
|
||||
first: true
|
||||
name: true
|
||||
begin: true
|
||||
benchmark:
|
||||
first: true
|
||||
name: true
|
||||
begin: true
|
||||
tb:
|
||||
first: true
|
||||
name: true
|
||||
begin: true
|
||||
|
||||
unparam:
|
||||
# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
|
||||
# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
|
||||
# if it's called for subdir of a project it can't find external interfaces. All text editor integrations
|
||||
# with golangci-lint call it on a directory with the changed file.
|
||||
check-exported: false
|
||||
|
||||
unused:
|
||||
# Select the Go version to target. The default is '1.13'.
|
||||
go: "1.15"
|
||||
|
||||
whitespace:
|
||||
multi-if: false # Enforces newlines (or comments) after every multi-line if statement
|
||||
multi-func: false # Enforces newlines (or comments) after every multi-line function signature
|
||||
|
||||
wrapcheck:
|
||||
# An array of strings that specify substrings of signatures to ignore.
|
||||
# If this set, it will override the default set of ignored signatures.
|
||||
# See https://github.com/tomarrell/wrapcheck#configuration for more information.
|
||||
ignoreSigs:
|
||||
- .Errorf(
|
||||
- errors.New(
|
||||
- errors.Unwrap(
|
||||
- .Wrap(
|
||||
- .Wrapf(
|
||||
- .WithMessage(
|
||||
|
||||
wsl:
|
||||
# If true append is only allowed to be cuddled if appending value is
|
||||
# matching variables, fields or types on line above. Default is true.
|
||||
strict-append: true
|
||||
# Allow calls and assignments to be cuddled as long as the lines have any
|
||||
# matching variables, fields or types. Default is true.
|
||||
# See https://github.com/bombsimon/wsl/blob/master/doc/configuration.md for
|
||||
# documentation of available settings. These are the defaults for
|
||||
# `golangci-lint`.
|
||||
allow-assign-and-anything: false
|
||||
allow-assign-and-call: true
|
||||
# Allow multiline assignments to be cuddled. Default is true.
|
||||
allow-multiline-assign: true
|
||||
# Allow declarations (var) to be cuddled.
|
||||
allow-cuddle-declarations: false
|
||||
# Allow trailing comments in ending of blocks
|
||||
allow-multiline-assign: true
|
||||
allow-separated-leading-comment: false
|
||||
allow-trailing-comment: false
|
||||
# Force newlines in end of case at this limit (0 = never).
|
||||
force-case-trailing-whitespace: 0
|
||||
force-err-cuddling: false
|
||||
force-short-decl-cuddling: false
|
||||
strict-append: true
|
||||
|
||||
# The custom section can be used to define linter plugins to be loaded at runtime.
|
||||
# See README doc for more info.
|
||||
# custom:
|
||||
# # Each custom linter should have a unique name.
|
||||
# example:
|
||||
# # The path to the plugin *.so. Can be absolute or local. Required for each custom linter
|
||||
# path: /path/to/example.so
|
||||
# # The description of the linter. Optional, just for documentation purposes.
|
||||
# description: This is an example usage of a plugin linter.
|
||||
# # Intended to point to the repo location of the linter. Optional, just for documentation purposes.
|
||||
# original-url: github.com/golangci/example-linter
|
||||
|
||||
linters:
|
||||
# disable-all: true
|
||||
enable:
|
||||
- megacheck
|
||||
- govet
|
||||
- funlen
|
||||
- gocyclo
|
||||
- maligned
|
||||
# - fieldalignment
|
||||
- prealloc
|
||||
- typecheck
|
||||
# enable-all: true
|
||||
disable:
|
||||
- gosec
|
||||
disable-all: false
|
||||
# - maligned
|
||||
# - prealloc
|
||||
presets:
|
||||
- bugs
|
||||
- unused
|
||||
|
|
@ -286,6 +725,14 @@ issues:
|
|||
# Default value for this option is true.
|
||||
exclude-use-default: false
|
||||
|
||||
# The default value is false. If set to true exclude and exclude-rules
|
||||
# regular expressions become case sensitive.
|
||||
exclude-case-sensitive: false
|
||||
|
||||
# The list of ids of default excludes to include or disable. By default it's empty.
|
||||
include:
|
||||
- EXC0002 # disable excluding of issues about comments from golint
|
||||
|
||||
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
|
||||
max-issues-per-linter: 0
|
||||
|
||||
|
|
@ -299,7 +746,37 @@ issues:
|
|||
# of integration: much better don't allow issues in new code.
|
||||
# Default is false.
|
||||
new: false
|
||||
|
||||
# Show only new issues created after git revision `REV`
|
||||
# new-from-rev: REV
|
||||
|
||||
# Show only new issues created in git patch with set file path.
|
||||
# new-from-patch: path/to/patch/file
|
||||
|
||||
# Fix found issues (if it's supported by the linter)
|
||||
fix: true
|
||||
|
||||
severity:
|
||||
# Default value is empty string.
|
||||
# Set the default severity for issues. If severity rules are defined and the issues
|
||||
# do not match or no severity is provided to the rule this will be the default
|
||||
# severity applied. Severities should match the supported severity names of the
|
||||
# selected out format.
|
||||
# - Code climate: https://docs.codeclimate.com/docs/issues#issue-severity
|
||||
# - Checkstyle: https://checkstyle.sourceforge.io/property_types.html#severity
|
||||
# - Github: https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message
|
||||
default-severity: error
|
||||
|
||||
# The default value is false.
|
||||
# If set to true severity-rules regular expressions become case sensitive.
|
||||
case-sensitive: false
|
||||
|
||||
# Default value is empty list.
|
||||
# When a list of severity rules are provided, severity information will be added to lint
|
||||
# issues. Severity rules have the same filtering capability as exclude rules except you
|
||||
# are allowed to specify one matcher per severity rule.
|
||||
# Only affects out formats that support setting severity information.
|
||||
rules:
|
||||
- linters:
|
||||
- dupl
|
||||
severity: info
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# -----------------------------------------------------------------------------
|
||||
# The base image for building the k9s binary
|
||||
|
||||
FROM golang:1.16.2-alpine3.13 AS build
|
||||
FROM golang:1.16.5-alpine3.14.0 AS build
|
||||
|
||||
WORKDIR /k9s
|
||||
COPY go.mod go.sum main.go Makefile ./
|
||||
|
|
@ -12,8 +12,8 @@ RUN apk --no-cache add make git gcc libc-dev curl && make build
|
|||
# -----------------------------------------------------------------------------
|
||||
# Build the final Docker image
|
||||
|
||||
FROM alpine:3.13.2
|
||||
ARG KUBECTL_VERSION="v1.20.5"
|
||||
FROM alpine:3.14.0
|
||||
ARG KUBECTL_VERSION="v1.21.2"
|
||||
|
||||
COPY --from=build /k9s/execs/k9s /bin/k9s
|
||||
RUN apk add --update ca-certificates \
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ func init() {
|
|||
initK8sFlags()
|
||||
}
|
||||
|
||||
// Execute root command
|
||||
// Execute root command.
|
||||
func Execute() {
|
||||
if err := rootCmd.Execute(); err != nil {
|
||||
log.Panic().Err(err)
|
||||
|
|
|
|||
15
go.mod
15
go.mod
|
|
@ -15,7 +15,6 @@ require (
|
|||
github.com/derailed/popeye v0.9.0
|
||||
github.com/derailed/tview v0.6.1
|
||||
github.com/drone/envsubst v1.0.2 // indirect
|
||||
github.com/emicklei/go-restful v2.15.0+incompatible // indirect
|
||||
github.com/fatih/color v1.10.0
|
||||
github.com/fsnotify/fsnotify v1.4.9
|
||||
github.com/fvbommel/sortorder v1.0.2
|
||||
|
|
@ -35,13 +34,13 @@ require (
|
|||
github.com/stretchr/testify v1.7.0
|
||||
golang.org/x/text v0.3.6
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
helm.sh/helm/v3 v3.5.3
|
||||
k8s.io/api v0.20.5
|
||||
k8s.io/apimachinery v0.20.5
|
||||
k8s.io/cli-runtime v0.20.5
|
||||
k8s.io/client-go v0.20.5
|
||||
helm.sh/helm/v3 v3.6.1
|
||||
k8s.io/api v0.21.2
|
||||
k8s.io/apimachinery v0.21.2
|
||||
k8s.io/cli-runtime v0.21.2
|
||||
k8s.io/client-go v0.21.2
|
||||
k8s.io/klog/v2 v2.8.0
|
||||
k8s.io/kubectl v0.20.5
|
||||
k8s.io/metrics v0.20.5
|
||||
k8s.io/kubectl v0.21.2
|
||||
k8s.io/metrics v0.21.2
|
||||
sigs.k8s.io/yaml v1.2.0
|
||||
)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import (
|
|||
)
|
||||
|
||||
// GVR represents a kubernetes resource schema as a string.
|
||||
// Format is group/version/resources:subresource
|
||||
// Format is group/version/resources:subresource.
|
||||
type GVR struct {
|
||||
raw, g, v, r, sr string
|
||||
}
|
||||
|
|
|
|||
|
|
@ -320,7 +320,7 @@ func ToPercentage(v1, v2 int64) int {
|
|||
return int(math.Floor((float64(v1) / float64(v2)) * 100))
|
||||
}
|
||||
|
||||
// ToPercentageStr computes percentage, but if v2 is 0, it will return NAValue instead of 0
|
||||
// ToPercentageStr computes percentage, but if v2 is 0, it will return NAValue instead of 0.
|
||||
func ToPercentageStr(v1, v2 int64) string {
|
||||
if v2 == 0 {
|
||||
return NA
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import (
|
|||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
mv1beta1 "k8s.io/metrics/pkg/apis/metrics/v1beta1"
|
||||
v1beta1 "k8s.io/metrics/pkg/apis/metrics/v1beta1"
|
||||
)
|
||||
|
||||
|
|
@ -45,7 +44,7 @@ func TestToMB(t *testing.T) {
|
|||
|
||||
func TestPodsMetrics(t *testing.T) {
|
||||
uu := map[string]struct {
|
||||
metrics *mv1beta1.PodMetricsList
|
||||
metrics *v1beta1.PodMetricsList
|
||||
eSize int
|
||||
e client.PodsMetrics
|
||||
}{
|
||||
|
|
@ -110,7 +109,7 @@ func BenchmarkPodsMetrics(b *testing.B) {
|
|||
func TestNodesMetrics(t *testing.T) {
|
||||
uu := map[string]struct {
|
||||
nodes *v1.NodeList
|
||||
metrics *mv1beta1.NodeMetricsList
|
||||
metrics *v1beta1.NodeMetricsList
|
||||
eSize int
|
||||
e client.NodesMetrics
|
||||
}{
|
||||
|
|
@ -212,7 +211,7 @@ func BenchmarkNodesMetrics(b *testing.B) {
|
|||
func TestClusterLoad(t *testing.T) {
|
||||
uu := map[string]struct {
|
||||
nodes *v1.NodeList
|
||||
metrics *mv1beta1.NodeMetricsList
|
||||
metrics *v1beta1.NodeMetricsList
|
||||
eSize int
|
||||
e client.ClusterMetrics
|
||||
}{
|
||||
|
|
@ -279,8 +278,8 @@ func BenchmarkClusterLoad(b *testing.B) {
|
|||
},
|
||||
}
|
||||
|
||||
metrics := mv1beta1.NodeMetricsList{
|
||||
Items: []mv1beta1.NodeMetrics{
|
||||
metrics := v1beta1.NodeMetricsList{
|
||||
Items: []v1beta1.NodeMetrics{
|
||||
*makeMxNode("n1", "50m", "1Mi"),
|
||||
*makeMxNode("n2", "50m", "1Mi"),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
// NA Not available
|
||||
// NA Not available.
|
||||
NA = "n/a"
|
||||
|
||||
// NamespaceAll designates the fictional all namespace.
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@ func (a *Aliases) ShortNames() ShortNames {
|
|||
|
||||
m := make(ShortNames, len(a.Alias))
|
||||
for alias, gvr := range a.Alias {
|
||||
if _, ok := m[gvr]; ok {
|
||||
m[gvr] = append(m[gvr], alias)
|
||||
if v, ok := m[gvr]; ok {
|
||||
m[gvr] = append(v, alias)
|
||||
} else {
|
||||
m[gvr] = []string{alias}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ type (
|
|||
Containers map[string]BenchConfig `yam':"containers"`
|
||||
}
|
||||
|
||||
// Auth basic auth creds
|
||||
// Auth basic auth creds.
|
||||
Auth struct {
|
||||
User string `yaml:"user"`
|
||||
Password string `yaml:"password"`
|
||||
|
|
@ -71,7 +71,7 @@ func newBenchmark() Benchmark {
|
|||
}
|
||||
}
|
||||
|
||||
// Empty checks if the benchmark is set
|
||||
// Empty checks if the benchmark is set.
|
||||
func (b Benchmark) Empty() bool {
|
||||
return b.C == 0 && b.N == 0
|
||||
}
|
||||
|
|
@ -94,7 +94,7 @@ func (s *Bench) Reload(path string) error {
|
|||
return s.load(path)
|
||||
}
|
||||
|
||||
// Load K9s benchmark configs from file
|
||||
// Load K9s benchmark configs from file.
|
||||
func (s *Bench) load(path string) error {
|
||||
f, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ func (c *Config) ActiveView() string {
|
|||
return cmd
|
||||
}
|
||||
|
||||
// SetActiveView set the currently cluster active view
|
||||
// SetActiveView set the currently cluster active view.
|
||||
func (c *Config) SetActiveView(view string) {
|
||||
cl := c.K9s.ActiveCluster()
|
||||
if cl != nil {
|
||||
|
|
@ -210,7 +210,7 @@ func (c *Config) SetConnection(conn client.Connection) {
|
|||
}
|
||||
}
|
||||
|
||||
// Load K9s configuration from file
|
||||
// Load K9s configuration from file.
|
||||
func (c *Config) Load(path string) error {
|
||||
f, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ const (
|
|||
DefaultSinceSeconds = 60 // all logs
|
||||
)
|
||||
|
||||
// Logger tracks logger options
|
||||
// Logger tracks logger options.
|
||||
type Logger struct {
|
||||
TailCount int64 `yaml:"tail"`
|
||||
BufferSize int `yaml:"buffer"`
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ func NewNamespace() *Namespace {
|
|||
}
|
||||
}
|
||||
|
||||
// Validate a namespace is setup correctly
|
||||
// Validate a namespace is setup correctly.
|
||||
func (n *Namespace) Validate(c client.Connection, ks KubeSettings) {
|
||||
nns, err := c.ValidNamespaces()
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ type Plugins struct {
|
|||
Plugin map[string]Plugin `yaml:"plugin"`
|
||||
}
|
||||
|
||||
// Plugin describes a K9s plugin
|
||||
// Plugin describes a K9s plugin.
|
||||
type Plugin struct {
|
||||
Scopes []string `yaml:"scopes"`
|
||||
Args []string `yaml:"args"`
|
||||
|
|
|
|||
|
|
@ -453,7 +453,7 @@ func (s *Styles) Reset() {
|
|||
s.K9s = newStyle()
|
||||
}
|
||||
|
||||
// DefaultSkin loads the default skin
|
||||
// DefaultSkin loads the default skin.
|
||||
func (s *Styles) DefaultSkin() {
|
||||
s.K9s = newStyle()
|
||||
}
|
||||
|
|
@ -539,7 +539,7 @@ func (s *Styles) Views() Views {
|
|||
return s.K9s.Views
|
||||
}
|
||||
|
||||
// Load K9s configuration from file
|
||||
// Load K9s configuration from file.
|
||||
func (s *Styles) Load(path string) error {
|
||||
f, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
|
|
@ -549,7 +549,7 @@ func (s *Styles) Load(path string) error {
|
|||
if err := yaml.Unmarshal(f, s); err != nil {
|
||||
return err
|
||||
}
|
||||
//s.fireStylesChanged()
|
||||
// s.fireStylesChanged()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ func NewThreshold() Threshold {
|
|||
}
|
||||
}
|
||||
|
||||
// Validate a namespace is setup correctly
|
||||
// Validate a namespace is setup correctly.
|
||||
func (t Threshold) Validate(c client.Connection, ks KubeSettings) {
|
||||
for _, k := range []string{"cpu", "memory"} {
|
||||
v, ok := t[k]
|
||||
|
|
|
|||
|
|
@ -80,7 +80,6 @@ func (v *CustomView) AddListener(gvr string, l ViewConfigListener) {
|
|||
// RemoveListener unregister a listener.
|
||||
func (v *CustomView) RemoveListener(gvr string) {
|
||||
delete(v.listeners, gvr)
|
||||
|
||||
}
|
||||
|
||||
func (v *CustomView) fireConfigChanged() {
|
||||
|
|
|
|||
|
|
@ -51,15 +51,19 @@ var _ dao.Factory = testFactory{}
|
|||
func (f testFactory) Client() client.Connection {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f testFactory) Get(gvr, path string, wait bool, sel labels.Selector) (runtime.Object, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (f testFactory) List(gvr, ns string, wait bool, sel labels.Selector) ([]runtime.Object, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (f testFactory) ForResource(ns, gvr string) (informers.GenericInformer, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (f testFactory) CanForResource(ns, gvr string, verbs []string) (informers.GenericInformer, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ func (c *Container) List(ctx context.Context, _ string) ([]runtime.Object, error
|
|||
return res, nil
|
||||
}
|
||||
|
||||
// TailLogs tails a given container logs
|
||||
// TailLogs tails a given container logs.
|
||||
func (c *Container) TailLogs(ctx context.Context, logChan LogChan, opts *LogOptions) error {
|
||||
po := Pod{}
|
||||
po.Init(c.Factory, client.NewGVR("v1/pods"))
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ var _ dao.Factory = testFactory{}
|
|||
func (f podFactory) Client() client.Connection {
|
||||
return makeConn()
|
||||
}
|
||||
|
||||
func (f podFactory) Get(gvr, path string, wait bool, sel labels.Selector) (runtime.Object, error) {
|
||||
var m map[string]interface{}
|
||||
if err := yaml.Unmarshal([]byte(poYaml()), &m); err != nil {
|
||||
|
|
@ -79,6 +80,7 @@ func (f podFactory) Get(gvr, path string, wait bool, sel labels.Selector) (runti
|
|||
}
|
||||
return &unstructured.Unstructured{Object: m}, nil
|
||||
}
|
||||
|
||||
func (f podFactory) List(gvr, ns string, wait bool, sel labels.Selector) ([]runtime.Object, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import (
|
|||
"github.com/derailed/k9s/internal/client"
|
||||
"github.com/rs/zerolog/log"
|
||||
batchv1 "k8s.io/api/batch/v1"
|
||||
batchv1beta1 "k8s.io/api/batch/v1beta1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
|
|
@ -47,12 +46,12 @@ func (c *CronJob) Run(path string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var cj batchv1beta1.CronJob
|
||||
var cj batchv1.CronJob
|
||||
err = runtime.DefaultUnstructuredConverter.FromUnstructured(o.(*unstructured.Unstructured).Object, &cj)
|
||||
if err != nil {
|
||||
return errors.New("expecting CronJob resource")
|
||||
}
|
||||
var jobName = cj.Name
|
||||
jobName := cj.Name
|
||||
if len(cj.Name) >= maxJobNameSize {
|
||||
jobName = cj.Name[0:maxJobNameSize]
|
||||
}
|
||||
|
|
@ -95,7 +94,7 @@ func (c *CronJob) ScanSA(ctx context.Context, fqn string, wait bool) (Refs, erro
|
|||
|
||||
refs := make(Refs, 0, len(oo))
|
||||
for _, o := range oo {
|
||||
var cj batchv1beta1.CronJob
|
||||
var cj batchv1.CronJob
|
||||
err = runtime.DefaultUnstructuredConverter.FromUnstructured(o.(*unstructured.Unstructured).Object, &cj)
|
||||
if err != nil {
|
||||
return nil, errors.New("expecting CronJob resource")
|
||||
|
|
@ -127,7 +126,7 @@ func (c *CronJob) ToggleSuspend(ctx context.Context, path string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var cj batchv1beta1.CronJob
|
||||
var cj batchv1.CronJob
|
||||
err = runtime.DefaultUnstructuredConverter.FromUnstructured(o.(*unstructured.Unstructured).Object, &cj)
|
||||
if err != nil {
|
||||
return errors.New("expecting CronJob resource")
|
||||
|
|
@ -144,7 +143,7 @@ func (c *CronJob) ToggleSuspend(ctx context.Context, path string) error {
|
|||
true := true
|
||||
cj.Spec.Suspend = &true
|
||||
}
|
||||
_, err = dial.BatchV1beta1().CronJobs(ns).Update(ctx, &cj, metav1.UpdateOptions{})
|
||||
_, err = dial.BatchV1().CronJobs(ns).Update(ctx, &cj, metav1.UpdateOptions{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
|
@ -159,7 +158,7 @@ func (c *CronJob) Scan(ctx context.Context, gvr, fqn string, wait bool) (Refs, e
|
|||
|
||||
refs := make(Refs, 0, len(oo))
|
||||
for _, o := range oo {
|
||||
var cj batchv1beta1.CronJob
|
||||
var cj batchv1.CronJob
|
||||
err = runtime.DefaultUnstructuredConverter.FromUnstructured(o.(*unstructured.Unstructured).Object, &cj)
|
||||
if err != nil {
|
||||
return nil, errors.New("expecting CronJob resource")
|
||||
|
|
|
|||
|
|
@ -4,11 +4,10 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
|
||||
"github.com/derailed/k9s/internal"
|
||||
"github.com/derailed/k9s/internal/client"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/client-go/dynamic"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ func (l *LogItems) Render(showTime bool, ll [][]byte) {
|
|||
}
|
||||
}
|
||||
|
||||
// DumpDebug for debugging
|
||||
// DumpDebug for debugging.
|
||||
func (l *LogItems) DumpDebug(m string) {
|
||||
fmt.Println(m + strings.Repeat("-", 50))
|
||||
for i, line := range l.items {
|
||||
|
|
|
|||
|
|
@ -129,7 +129,6 @@ func (n *Node) Get(ctx context.Context, path string) (runtime.Object, error) {
|
|||
|
||||
// List returns a collection of node resources.
|
||||
func (n *Node) List(ctx context.Context, ns string) ([]runtime.Object, error) {
|
||||
|
||||
oo, err := n.Resource.List(ctx, ns)
|
||||
if err != nil {
|
||||
return oo, err
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ func (f *OpenFaas) Describe(path string) (string, error) {
|
|||
return string(bytes), nil
|
||||
}
|
||||
|
||||
// BOZO!! Meow! openfaas fn prints to stdout have to dup ;(
|
||||
// BOZO!! Meow! openfaas fn prints to stdout have to dup ;(.
|
||||
func deleteFunctionToken(gateway string, functionName string, tlsInsecure bool, token string, namespace string) error {
|
||||
defaultCommandTimeout := 60 * time.Second
|
||||
|
||||
|
|
@ -158,7 +158,7 @@ func deleteFunctionToken(gateway string, functionName string, tlsInsecure bool,
|
|||
return err
|
||||
}
|
||||
|
||||
req, err := http.NewRequest("DELETE", deleteEndpoint, reader)
|
||||
req, err := http.NewRequestWithContext(context.Background(), "DELETE", deleteEndpoint, reader)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ type Element struct {
|
|||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// GetTemplateJsonPatch builds a json patch string to update PodSpec images
|
||||
// GetTemplateJsonPatch builds a json patch string to update PodSpec images.
|
||||
func GetTemplateJsonPatch(imageSpecs ImageSpecs) ([]byte, error) {
|
||||
jsonPatch := JsonPatch{
|
||||
Spec: Spec{
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ func (p *Pod) Logs(path string, opts *v1.PodLogOptions) (*restclient.Request, er
|
|||
return dial.CoreV1().Pods(ns).GetLogs(n, opts), nil
|
||||
}
|
||||
|
||||
// Containers returns all container names on pod
|
||||
// Containers returns all container names on pod.
|
||||
func (p *Pod) Containers(path string, includeInit bool) ([]string, error) {
|
||||
pod, err := p.GetInstance(path)
|
||||
if err != nil {
|
||||
|
|
@ -176,7 +176,7 @@ func (p *Pod) GetInstance(fqn string) (*v1.Pod, error) {
|
|||
return &pod, nil
|
||||
}
|
||||
|
||||
// TailLogs tails a given container logs
|
||||
// TailLogs tails a given container logs.
|
||||
func (p *Pod) TailLogs(ctx context.Context, c LogChan, opts *LogOptions) error {
|
||||
log.Debug().Msgf("TAIL-LOGS for %q:%q", opts.Path, opts.Container)
|
||||
fac, ok := ctx.Value(internal.KeyFactory).(*watch.Factory)
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@ func TestGetDefaultLogContainer(t *testing.T) {
|
|||
"container_found": {
|
||||
po: &v1.Pod{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Annotations: map[string]string{"kubectl.kubernetes.io/default-logs-container": "container1"}},
|
||||
Annotations: map[string]string{"kubectl.kubernetes.io/default-logs-container": "container1"},
|
||||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{{Name: "container1"}},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -123,6 +123,7 @@ var _ types.Factory = (*popFactory)(nil)
|
|||
func newPopeyeFactory(f Factory) *popFactory {
|
||||
return &popFactory{Factory: f}
|
||||
}
|
||||
|
||||
func (p *popFactory) Client() types.Connection {
|
||||
return &popeyeConnection{Connection: p.Factory.Client()}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ func (p *PortForward) List(ctx context.Context, _ string) ([]runtime.Object, err
|
|||
|
||||
var podNameRX = regexp.MustCompile(`\A(.+)\-(\w{10})\-(\w{5})\z`)
|
||||
|
||||
// PodToKey converts a pod path to a generic bench config key
|
||||
// PodToKey converts a pod path to a generic bench config key.
|
||||
func PodToKey(path string) string {
|
||||
tokens := strings.Split(path, ":")
|
||||
ns, po := client.Namespaced(tokens[0])
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ func (p *PortForwarder) Container() string {
|
|||
return p.container
|
||||
}
|
||||
|
||||
// Stop terminates a port forward
|
||||
// Stop terminates a port forward.
|
||||
func (p *PortForwarder) Stop() {
|
||||
log.Debug().Msgf("<<< Stopping PortForward %q %v", p.path, p.ports)
|
||||
p.active = false
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import (
|
|||
"k8s.io/client-go/restmapper"
|
||||
)
|
||||
|
||||
// RestMapping holds k8s resource mapping
|
||||
// RestMapping holds k8s resource mapping.
|
||||
var RestMapping = &RestMapper{}
|
||||
|
||||
// RestMapper map resource to REST mapping ie kind, group, version.
|
||||
|
|
|
|||
|
|
@ -87,7 +87,8 @@ func (r *ReplicaSet) Rollback(fqn string) error {
|
|||
|
||||
rb, err := polymorphichelpers.RollbackerFor(schema.GroupKind{
|
||||
Group: apiGroup,
|
||||
Kind: kind},
|
||||
Kind: kind,
|
||||
},
|
||||
dial,
|
||||
)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ const (
|
|||
)
|
||||
|
||||
type (
|
||||
// BufferKind indicates a buffer type
|
||||
// BufferKind indicates a buffer type.
|
||||
BufferKind int8
|
||||
|
||||
// BuffWatcher represents a command buffer listener.
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ func (d *Describe) fireResourceFailed(err error) {
|
|||
}
|
||||
}
|
||||
|
||||
// ClearFilter clear out the filter
|
||||
// ClearFilter clear out the filter.
|
||||
func (d *Describe) ClearFilter() {
|
||||
}
|
||||
|
||||
|
|
@ -141,6 +141,7 @@ func (d *Describe) updater(ctx context.Context) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (d *Describe) refresh(ctx context.Context) error {
|
||||
if !atomic.CompareAndSwapInt32(&d.inUpdate, 0, 1) {
|
||||
log.Debug().Msgf("Dropping update...")
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import (
|
|||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
// MaxHistory tracks max command history
|
||||
// MaxHistory tracks max command history.
|
||||
const MaxHistory = 20
|
||||
|
||||
// History represents a command history.
|
||||
|
|
|
|||
|
|
@ -249,10 +249,12 @@ func (t *testView) LogChanged(ll [][]byte) {
|
|||
t.data = ll
|
||||
t.dataCalled++
|
||||
}
|
||||
|
||||
func (t *testView) LogCleared() {
|
||||
t.clearCalled++
|
||||
t.data = nil
|
||||
}
|
||||
|
||||
func (t *testView) LogFailed(err error) {
|
||||
fmt.Println("LogErr", err)
|
||||
t.errCalled++
|
||||
|
|
@ -267,15 +269,19 @@ var _ dao.Factory = testFactory{}
|
|||
func (f testFactory) Client() client.Connection {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f testFactory) Get(gvr, path string, wait bool, sel labels.Selector) (runtime.Object, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (f testFactory) List(gvr, ns string, wait bool, sel labels.Selector) ([]runtime.Object, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (f testFactory) ForResource(ns, gvr string) (informers.GenericInformer, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (f testFactory) CanForResource(ns, gvr string, verbs []string) (informers.GenericInformer, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ func (m MenuHint) String() string {
|
|||
// MenuHints represents a collection of hints.
|
||||
type MenuHints []MenuHint
|
||||
|
||||
// Len returns the hints length
|
||||
// Len returns the hints length.
|
||||
func (h MenuHints) Len() int {
|
||||
return len(h)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import (
|
|||
)
|
||||
|
||||
// Registry tracks resources metadata.
|
||||
// BOZO!! Break up deps and merge into single registrar
|
||||
// BOZO!! Break up deps and merge into single registrar.
|
||||
var Registry = map[string]ResourceMeta{
|
||||
// Custom...
|
||||
"references": {
|
||||
|
|
|
|||
|
|
@ -274,6 +274,7 @@ type stackL struct {
|
|||
func (s *stackL) StackPushed(model.Component) {
|
||||
s.count++
|
||||
}
|
||||
|
||||
func (s *stackL) StackPopped(c, top model.Component) {
|
||||
s.count--
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/derailed/k9s/internal"
|
||||
|
||||
"github.com/derailed/k9s/internal/client"
|
||||
"github.com/derailed/k9s/internal/dao"
|
||||
"github.com/derailed/k9s/internal/render"
|
||||
|
|
@ -181,21 +180,25 @@ var _ dao.Factory = testFactory{}
|
|||
func (f testFactory) Client() client.Connection {
|
||||
return client.NewTestAPIClient()
|
||||
}
|
||||
|
||||
func (f testFactory) Get(gvr, path string, wait bool, sel labels.Selector) (runtime.Object, error) {
|
||||
if len(f.rows) > 0 {
|
||||
return f.rows[0], nil
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (f testFactory) List(gvr, ns string, wait bool, sel labels.Selector) ([]runtime.Object, error) {
|
||||
if len(f.rows) > 0 {
|
||||
return f.rows, nil
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (f testFactory) ForResource(ns, gvr string) (informers.GenericInformer, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (f testFactory) CanForResource(ns, gvr string, verbs []string) (informers.GenericInformer, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
|
@ -224,6 +227,7 @@ func (a *accessor) Get(ctx context.Context, path string) (runtime.Object, error)
|
|||
func (a *accessor) Init(_ dao.Factory, gvr client.GVR) {
|
||||
a.gvr = gvr
|
||||
}
|
||||
|
||||
func (a *accessor) GVR() string {
|
||||
return a.gvr.String()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ type tableListener struct {
|
|||
func (l *tableListener) TableDataChanged(render.TableData) {
|
||||
l.count++
|
||||
}
|
||||
|
||||
func (l *tableListener) TableLoadFailed(error) {
|
||||
l.errs++
|
||||
}
|
||||
|
|
@ -88,21 +89,25 @@ var _ dao.Factory = tableFactory{}
|
|||
func (f tableFactory) Client() client.Connection {
|
||||
return client.NewTestAPIClient()
|
||||
}
|
||||
|
||||
func (f tableFactory) Get(gvr, path string, wait bool, sel labels.Selector) (runtime.Object, error) {
|
||||
if len(f.rows) > 0 {
|
||||
return f.rows[0], nil
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (f tableFactory) List(gvr, ns string, wait bool, sel labels.Selector) ([]runtime.Object, error) {
|
||||
if len(f.rows) > 0 {
|
||||
return f.rows, nil
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (f tableFactory) ForResource(ns, gvr string) (informers.GenericInformer, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (f tableFactory) CanForResource(ns, gvr string, verbs []string) (informers.GenericInformer, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ type Commander interface {
|
|||
InCmdMode() bool
|
||||
}
|
||||
|
||||
// Component represents a ui component
|
||||
// Component represents a ui component.
|
||||
type Component interface {
|
||||
Primitive
|
||||
Igniter
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ func (y *YAML) Peek() []string {
|
|||
return y.lines
|
||||
}
|
||||
|
||||
// Refresh updates model data
|
||||
// Refresh updates model data.
|
||||
func (y *YAML) Refresh(ctx context.Context) error {
|
||||
return y.refresh(ctx)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
// BOZO!! Revisit bench and when we should timeout
|
||||
// BOZO!! Revisit bench and when we should timeout.
|
||||
benchTimeout = 2 * time.Minute
|
||||
benchFmat = "%s_%s_%d.txt"
|
||||
k9sUA = "k9s/"
|
||||
|
|
@ -104,7 +104,7 @@ func (b *Benchmark) Canceled() bool {
|
|||
return b.canceled
|
||||
}
|
||||
|
||||
// Run starts a benchmark,
|
||||
// Run starts a benchmark,.
|
||||
func (b *Benchmark) Run(cluster string, done func()) {
|
||||
log.Debug().Msgf("Running benchmark on cluster %s", cluster)
|
||||
buff := new(bytes.Buffer)
|
||||
|
|
|
|||
|
|
@ -25,11 +25,13 @@ func TestAliasColorer(t *testing.T) {
|
|||
"addAll": {
|
||||
ns: client.AllNamespaces,
|
||||
re: render.RowEvent{Kind: render.EventAdd, Row: r},
|
||||
e: tcell.ColorBlue},
|
||||
e: tcell.ColorBlue,
|
||||
},
|
||||
"deleteAll": {
|
||||
ns: client.AllNamespaces,
|
||||
re: render.RowEvent{Kind: render.EventDelete, Row: r},
|
||||
e: tcell.ColorGray},
|
||||
e: tcell.ColorGray,
|
||||
},
|
||||
"updateAll": {
|
||||
ns: client.AllNamespaces,
|
||||
re: render.RowEvent{Kind: render.EventUpdate, Row: r},
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ func (b Benchmark) Render(o interface{}, ns string, r *Row) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Happy returns true if resource is happy, false otherwise
|
||||
// Happy returns true if resource is happy, false otherwise.
|
||||
func (Benchmark) diagnose(ns string, ff Fields) error {
|
||||
statusCol := 3
|
||||
if !client.IsAllNamespaces(ns) {
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ func (c Container) Render(o interface{}, name string, r *Row) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Happy returns true if resource is happy, false otherwise
|
||||
// Happy returns true if resource is happy, false otherwise.
|
||||
func (Container) diagnose(state, ready string) error {
|
||||
if state == "Completed" {
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -75,7 +75,6 @@ func BenchmarkContainerRender(b *testing.B) {
|
|||
func toQty(s string) resource.Quantity {
|
||||
q, _ := resource.ParseQuantity(s)
|
||||
return q
|
||||
|
||||
}
|
||||
|
||||
func makeContainerMetrics() *mv1beta1.ContainerMetrics {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import (
|
|||
|
||||
"github.com/derailed/k9s/internal/client"
|
||||
batchv1 "k8s.io/api/batch/v1"
|
||||
batchv1beta1 "k8s.io/api/batch/v1beta1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
|
@ -45,7 +44,7 @@ func (c CronJob) Render(o interface{}, ns string, r *Row) error {
|
|||
if !ok {
|
||||
return fmt.Errorf("Expected CronJob, but got %T", o)
|
||||
}
|
||||
var cj batchv1beta1.CronJob
|
||||
var cj batchv1.CronJob
|
||||
err := runtime.DefaultUnstructuredConverter.FromUnstructured(raw.Object, &cj)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ func (d DaemonSet) Render(o interface{}, ns string, r *Row) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Happy returns true if resource is happy, false otherwise
|
||||
// Happy returns true if resource is happy, false otherwise.
|
||||
func (DaemonSet) diagnose(d, r int32) error {
|
||||
if d != r {
|
||||
return fmt.Errorf("desiring %d replicas but %d ready", d, r)
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ func (e Event) Render(o interface{}, ns string, r *Row) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Happy returns true if resource is happy, false otherwise
|
||||
// Happy returns true if resource is happy, false otherwise.
|
||||
func (Event) diagnose(kind string) error {
|
||||
if kind != "Normal" {
|
||||
return errors.New("failed event")
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ type Generic struct {
|
|||
ageIndex int
|
||||
}
|
||||
|
||||
// Happy returns true if resource is happy, false otherwise
|
||||
// Happy returns true if resource is happy, false otherwise.
|
||||
func (Generic) Happy(ns string, r Row) bool {
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
const ageCol = "AGE"
|
||||
|
||||
// HeaderColumn represent a table header
|
||||
// HeaderColumn represent a table header.
|
||||
type HeaderColumn struct {
|
||||
Name string
|
||||
Align int
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ func AsThousands(n int64) string {
|
|||
return p.Sprintf("%d", n)
|
||||
}
|
||||
|
||||
// Happy returns true if resource is happy, false otherwise
|
||||
// Happy returns true if resource is happy, false otherwise.
|
||||
func Happy(ns string, h Header, r Row) bool {
|
||||
if len(r.Fields) == 0 {
|
||||
return true
|
||||
|
|
@ -300,7 +300,7 @@ func Pad(s string, width int) string {
|
|||
return s + strings.Repeat(" ", width-len(s))
|
||||
}
|
||||
|
||||
// Converts labels string to map
|
||||
// Converts labels string to map.
|
||||
func labelize(labels string) map[string]string {
|
||||
ll := strings.Split(labels, ",")
|
||||
data := make(map[string]string, len(ll))
|
||||
|
|
|
|||
|
|
@ -220,7 +220,6 @@ func status(conds []v1.NodeCondition, exempt bool, res []string) {
|
|||
}
|
||||
res[index] = neg + string(condition.Type)
|
||||
index++
|
||||
|
||||
}
|
||||
if len(res) == 0 {
|
||||
res[index] = "Unknown"
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ func (o OpenFaas) Render(i interface{}, ns string, r *Row) error {
|
|||
if fn.Function.Labels != nil {
|
||||
labels = mapToStr(*fn.Function.Labels)
|
||||
}
|
||||
var status = fnStatusReady
|
||||
status := fnStatusReady
|
||||
if fn.Function.AvailableReplicas == 0 {
|
||||
status = fnStatusNotReady
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/derailed/k9s/internal/client"
|
||||
|
||||
"github.com/derailed/popeye/pkg/config"
|
||||
"github.com/derailed/tview"
|
||||
"github.com/gdamore/tcell/v2"
|
||||
|
|
@ -89,7 +88,7 @@ type (
|
|||
// Sections represents a collection of sections.
|
||||
Sections []Section
|
||||
|
||||
// Section represents a sanitizer pass
|
||||
// Section represents a sanitizer pass.
|
||||
Section struct {
|
||||
Title string `json:"sanitizer" yaml:"sanitizer"`
|
||||
GVR string `yaml:"gvr" json:"gvr"`
|
||||
|
|
@ -187,7 +186,7 @@ func (i Issues) MaxSeverity() config.Level {
|
|||
return max
|
||||
}
|
||||
|
||||
// CountSeverity counts severity level instances
|
||||
// CountSeverity counts severity level instances.
|
||||
func (i Issues) CountSeverity(l config.Level) int {
|
||||
var count int
|
||||
for _, is := range i {
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ func (r RowEvents) Delete(id string) RowEvents {
|
|||
return append(r[0:victim], r[victim+1:]...)
|
||||
}
|
||||
|
||||
// Clear delete all row events
|
||||
// Clear delete all row events.
|
||||
func (r RowEvents) Clear() RowEvents {
|
||||
return RowEvents{}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import (
|
|||
// Subject renders a rbac to screen.
|
||||
type Subject struct{}
|
||||
|
||||
// Happy returns true if resource is happy, false otherwise
|
||||
// Happy returns true if resource is happy, false otherwise.
|
||||
func (Subject) Happy(_ string, _ Row) bool {
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ func (t *TableData) IndexOfHeader(h string) int {
|
|||
return t.Header.IndexOf(h, false)
|
||||
}
|
||||
|
||||
// Labelize prints out specific label columns
|
||||
// Labelize prints out specific label columns.
|
||||
func (t *TableData) Labelize(labels []string) TableData {
|
||||
labelCol := t.Header.IndexOf("LABELS", true)
|
||||
cols := []int{0, 1}
|
||||
|
|
@ -54,7 +54,7 @@ func (t *TableData) Clear() {
|
|||
t.Header, t.RowEvents = Header{}, RowEvents{}
|
||||
}
|
||||
|
||||
// Clone returns a copy of the table
|
||||
// Clone returns a copy of the table.
|
||||
func (t *TableData) Clone() TableData {
|
||||
return TableData{
|
||||
Header: t.Header.Clone(),
|
||||
|
|
|
|||
|
|
@ -392,5 +392,4 @@ func TestTableDataDelete(t *testing.T) {
|
|||
assert.Equal(t, u.e, table.RowEvents)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ const (
|
|||
// UnknownValue represents an unknown.
|
||||
UnknownValue = "<unknown>"
|
||||
|
||||
// UnsetValue represent an unset value
|
||||
// UnsetValue represent an unset value.
|
||||
UnsetValue = ""
|
||||
|
||||
// ZeroValue represents a zero value.
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ func (c *Component) InputHandler() func(event *tcell.EventKey, setFocus func(p t
|
|||
})
|
||||
}
|
||||
|
||||
// IsDial returns true if chart is a dial
|
||||
// IsDial returns true if chart is a dial.
|
||||
func (c *Component) IsDial() bool {
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ func (d DotMatrix) Print(n int) Matrix {
|
|||
return To3x3Char(n)
|
||||
}
|
||||
|
||||
// To3x3Char returns 3x3 number matrix
|
||||
// To3x3Char returns 3x3 number matrix.
|
||||
func To3x3Char(numb int) Matrix {
|
||||
switch numb {
|
||||
case 1:
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ func (g *Gauge) SetResolution(n int) {
|
|||
g.resolution = n
|
||||
}
|
||||
|
||||
// IsDial returns true if chart is a dial
|
||||
// IsDial returns true if chart is a dial.
|
||||
func (g *Gauge) IsDial() bool {
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ func (a *App) Flash() *model.Flash {
|
|||
// ----------------------------------------------------------------------------
|
||||
// Helpers...
|
||||
|
||||
// AsKey converts rune to keyboard key.,
|
||||
// AsKey converts rune to keyboard key.,.
|
||||
func AsKey(evt *tcell.EventKey) tcell.Key {
|
||||
if evt.Key() != tcell.KeyRune {
|
||||
return evt.Key()
|
||||
|
|
|
|||
|
|
@ -46,13 +46,13 @@ func (c *Crumbs) StackPushed(comp model.Component) {
|
|||
c.refresh(c.stack.Flatten())
|
||||
}
|
||||
|
||||
// StackPopped indicates an item was deleted
|
||||
// StackPopped indicates an item was deleted.
|
||||
func (c *Crumbs) StackPopped(_, _ model.Component) {
|
||||
c.stack.Pop()
|
||||
c.refresh(c.stack.Flatten())
|
||||
}
|
||||
|
||||
// StackTop indicates the top of the stack
|
||||
// StackTop indicates the top of the stack.
|
||||
func (c *Crumbs) StackTop(top model.Component) {}
|
||||
|
||||
// Refresh updates view with new crumbs.
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ func (s *StatusIndicator) ClusterInfoChanged(prev, cur model.ClusterMeta) {
|
|||
})
|
||||
}
|
||||
|
||||
// SetPermanent sets permanent title to be reset to after updates
|
||||
// SetPermanent sets permanent title to be reset to after updates.
|
||||
func (s *StatusIndicator) SetPermanent(info string) {
|
||||
s.permanent = info
|
||||
s.SetText(info)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ func initKeys() {
|
|||
initShiftNumKeys()
|
||||
}
|
||||
|
||||
// Defines numeric keys for container actions
|
||||
// Defines numeric keys for container actions.
|
||||
const (
|
||||
Key0 tcell.Key = iota + 48
|
||||
Key1
|
||||
|
|
@ -31,7 +31,7 @@ const (
|
|||
Key9
|
||||
)
|
||||
|
||||
// Defines numeric keys for container actions
|
||||
// Defines numeric keys for container actions.
|
||||
const (
|
||||
KeyShift0 tcell.Key = 41
|
||||
KeyShift1 tcell.Key = 33
|
||||
|
|
@ -45,7 +45,7 @@ const (
|
|||
KeyShift9 tcell.Key = 40
|
||||
)
|
||||
|
||||
// Defines char keystrokes
|
||||
// Defines char keystrokes.
|
||||
const (
|
||||
KeyA tcell.Key = iota + 97
|
||||
KeyB
|
||||
|
|
@ -79,7 +79,7 @@ const (
|
|||
KeySpace = 32
|
||||
)
|
||||
|
||||
// Define Shift Keys
|
||||
// Define Shift Keys.
|
||||
const (
|
||||
KeyShiftA tcell.Key = iota + 65
|
||||
KeyShiftB
|
||||
|
|
|
|||
|
|
@ -54,5 +54,4 @@ func TestLogoStatus(t *testing.T) {
|
|||
assert.Equal(t, u.e, v.Status().GetText(false))
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,7 +151,6 @@ func (m *Menu) layout(table []model.MenuHints, mm []int, out [][]string) {
|
|||
out[r][c] = keyConv(m.formatMenu(table[r][c], mm[c]))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (m *Menu) formatMenu(h model.MenuHint, size int) string {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ type Suggester interface {
|
|||
ClearSuggestions()
|
||||
}
|
||||
|
||||
// PromptModel represents a prompt buffer
|
||||
// PromptModel represents a prompt buffer.
|
||||
type PromptModel interface {
|
||||
// SetText sets the model text.
|
||||
SetText(string)
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ func (s *SelectTable) DeleteMark(k string) {
|
|||
delete(s.marks, k)
|
||||
}
|
||||
|
||||
// ToggleMark toggles marked row
|
||||
// ToggleMark toggles marked row.
|
||||
func (s *SelectTable) ToggleMark() {
|
||||
sel := s.GetSelectedItem()
|
||||
if sel == "" {
|
||||
|
|
@ -148,7 +148,7 @@ func (s *SelectTable) ToggleMark() {
|
|||
}
|
||||
}
|
||||
|
||||
// SpanMark toggles marked row
|
||||
// SpanMark toggles marked row.
|
||||
func (s *SelectTable) SpanMark() {
|
||||
selIndex, prev := s.GetSelectedRowIndex(), -1
|
||||
if selIndex <= 0 {
|
||||
|
|
|
|||
|
|
@ -382,7 +382,7 @@ func (t *Table) filtered(data render.TableData) render.TableData {
|
|||
filtered, err := rxFilter(q, IsInverseSelector(q), filtered)
|
||||
if err != nil {
|
||||
log.Error().Err(errors.New("Invalid filter expression")).Msg("Regexp")
|
||||
//t.cmdBuff.ClearText(true)
|
||||
// t.cmdBuff.ClearText(true)
|
||||
}
|
||||
|
||||
return filtered
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ const (
|
|||
)
|
||||
|
||||
var (
|
||||
// LabelRx identifies a label query
|
||||
// LabelRx identifies a label query.
|
||||
LabelRx = regexp.MustCompile(`\A\-l`)
|
||||
|
||||
inverseRx = regexp.MustCompile(`\A\!`)
|
||||
|
|
|
|||
|
|
@ -77,12 +77,15 @@ func (t *mockModel) Watch(context.Context) error { return nil }
|
|||
func (t *mockModel) Get(ctx context.Context, path string) (runtime.Object, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (t *mockModel) Delete(ctx context.Context, path string, c, f bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *mockModel) Describe(context.Context, string) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func (t *mockModel) ToYAML(ctx context.Context, path string) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ func NewTree() *Tree {
|
|||
}
|
||||
}
|
||||
|
||||
// Init initializes the view
|
||||
// Init initializes the view.
|
||||
func (t *Tree) Init(ctx context.Context) error {
|
||||
t.BindKeys()
|
||||
t.SetBorder(true)
|
||||
|
|
|
|||
|
|
@ -98,8 +98,10 @@ func (k ks) NamespaceNames(nn []v1.Namespace) []string {
|
|||
|
||||
type mockModel struct{}
|
||||
|
||||
var _ ui.Tabular = (*mockModel)(nil)
|
||||
var _ ui.Suggester = (*mockModel)(nil)
|
||||
var (
|
||||
_ ui.Tabular = (*mockModel)(nil)
|
||||
_ ui.Suggester = (*mockModel)(nil)
|
||||
)
|
||||
|
||||
func (t *mockModel) CurrentSuggestion() (string, bool) { return "", false }
|
||||
func (t *mockModel) NextSuggestion() (string, bool) { return "", false }
|
||||
|
|
@ -119,15 +121,17 @@ func (t *mockModel) RemoveListener(model.TableListener) {}
|
|||
func (t *mockModel) Watch(context.Context) error { return nil }
|
||||
func (t *mockModel) Refresh(context.Context) error { return nil }
|
||||
func (t *mockModel) Get(context.Context, string) (runtime.Object, error) {
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (t *mockModel) Delete(context.Context, string, bool, bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *mockModel) Describe(context.Context, string) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func (t *mockModel) ToYAML(ctx context.Context, path string) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -437,7 +437,7 @@ func (a *App) BailOut() {
|
|||
a.App.BailOut()
|
||||
}
|
||||
|
||||
// Run starts the application loop
|
||||
// Run starts the application loop.
|
||||
func (a *App) Run() error {
|
||||
a.Resume()
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ func NewBrowser(gvr client.GVR) ResourceViewer {
|
|||
}
|
||||
}
|
||||
|
||||
// Init watches all running pods in given namespace
|
||||
// Init watches all running pods in given namespace.
|
||||
func (b *Browser) Init(ctx context.Context) error {
|
||||
var err error
|
||||
b.meta, err = dao.MetaAccess.MetaFor(b.GVR())
|
||||
|
|
@ -343,7 +343,6 @@ func (b *Browser) editCmd(evt *tcell.EventKey) *tcell.EventKey {
|
|||
path := b.GetSelectedItem()
|
||||
if path == "" {
|
||||
return evt
|
||||
|
||||
}
|
||||
ns, n := client.Namespaced(path)
|
||||
if client.IsClusterScoped(ns) {
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ func (c *Command) exec(cmd, gvr string, comp model.Component, clearStack bool) (
|
|||
return fmt.Errorf("No component found for %s", gvr)
|
||||
}
|
||||
c.app.Flash().Infof("Viewing %s...", client.NewGVR(gvr).R())
|
||||
if tokens:= strings.Split(cmd, " "); len(tokens) >= 2 {
|
||||
if tokens := strings.Split(cmd, " "); len(tokens) >= 2 {
|
||||
cmd = tokens[0]
|
||||
}
|
||||
c.app.Config.SetActiveView(cmd)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import (
|
|||
"github.com/gdamore/tcell/v2"
|
||||
)
|
||||
|
||||
// Cow represents a bomb viewer
|
||||
// Cow represents a bomb viewer.
|
||||
type Cow struct {
|
||||
*tview.TextView
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ func (c *Cow) resetCmd(evt *tcell.EventKey) *tcell.EventKey {
|
|||
return c.app.PrevCmd(evt)
|
||||
}
|
||||
|
||||
// Actions returns menu actions
|
||||
// Actions returns menu actions.
|
||||
func (c *Cow) Actions() ui.KeyActions {
|
||||
return c.actions
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import (
|
|||
"github.com/derailed/tview"
|
||||
"github.com/gdamore/tcell/v2"
|
||||
"github.com/rs/zerolog/log"
|
||||
batchv1beta1 "k8s.io/api/batch/v1beta1"
|
||||
batchv1 "k8s.io/api/batch/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
|
@ -45,7 +45,7 @@ func (c *CronJob) showJobs(app *App, model ui.Tabular, gvr, path string) {
|
|||
return
|
||||
}
|
||||
|
||||
var cj batchv1beta1.CronJob
|
||||
var cj batchv1.CronJob
|
||||
err = runtime.DefaultUnstructuredConverter.FromUnstructured(o.(*unstructured.Unstructured).Object, &cj)
|
||||
if err != nil {
|
||||
app.Flash().Err(err)
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ func (d *Details) SetSubject(s string) {
|
|||
d.subject = s
|
||||
}
|
||||
|
||||
// Actions returns menu actions
|
||||
// Actions returns menu actions.
|
||||
func (d *Details) Actions() ui.KeyActions {
|
||||
return d.actions
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ func (d *Deploy) logOptions() (*dao.LogOptions, error) {
|
|||
|
||||
return &opts, nil
|
||||
}
|
||||
|
||||
func (d *Deploy) showPods(app *App, model ui.Tabular, gvr, path string) {
|
||||
var ddp dao.Deployment
|
||||
dp, err := ddp.Load(app.factory, path)
|
||||
|
|
|
|||
|
|
@ -159,7 +159,8 @@ func (h *Help) showNav() model.MenuHints {
|
|||
},
|
||||
{
|
||||
Mnemonic: "Ctrl-b",
|
||||
Description: "Page Up"},
|
||||
Description: "Page Up",
|
||||
},
|
||||
{
|
||||
Mnemonic: "Ctrl-f",
|
||||
Description: "Page Down",
|
||||
|
|
|
|||
|
|
@ -21,12 +21,12 @@ type imageFormSpec struct {
|
|||
}
|
||||
|
||||
func (m *imageFormSpec) modified() bool {
|
||||
var newDockerImage = strings.TrimSpace(m.newDockerImage)
|
||||
newDockerImage := strings.TrimSpace(m.newDockerImage)
|
||||
return newDockerImage != "" && m.dockerImage != newDockerImage
|
||||
}
|
||||
|
||||
func (m *imageFormSpec) imageSpec() dao.ImageSpec {
|
||||
var ret = dao.ImageSpec{
|
||||
ret := dao.ImageSpec{
|
||||
Name: m.name,
|
||||
Init: m.init,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ func (v *LiveView) bindKeys() {
|
|||
}
|
||||
}
|
||||
|
||||
// ToggleRefreshCmd is used for pausing the refreshing of data on config map and secrets
|
||||
// ToggleRefreshCmd is used for pausing the refreshing of data on config map and secrets.
|
||||
func (v *LiveView) toggleRefreshCmd(evt *tcell.EventKey) *tcell.EventKey {
|
||||
v.autoRefresh = !v.autoRefresh
|
||||
if v.autoRefresh {
|
||||
|
|
@ -181,7 +181,7 @@ func (v *LiveView) StylesChanged(s *config.Styles) {
|
|||
v.ResourceChanged(v.model.Peek(), nil)
|
||||
}
|
||||
|
||||
// Actions returns menu actions
|
||||
// Actions returns menu actions.
|
||||
func (v *LiveView) Actions() ui.KeyActions {
|
||||
return v.actions
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/atotto/clipboard"
|
||||
|
||||
"github.com/derailed/k9s/internal/client"
|
||||
"github.com/derailed/k9s/internal/color"
|
||||
"github.com/derailed/k9s/internal/config"
|
||||
|
|
@ -355,7 +354,6 @@ func saveData(cluster, name, data string) (string, error) {
|
|||
if err != nil {
|
||||
log.Error().Err(err).Msgf("LogFile create %s", path)
|
||||
return "", nil
|
||||
|
||||
}
|
||||
defer func() {
|
||||
if err := file.Close(); err != nil {
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ func (l *Logger) SetSubject(s string) {
|
|||
l.subject = s
|
||||
}
|
||||
|
||||
// Actions returns menu actions
|
||||
// Actions returns menu actions.
|
||||
func (l *Logger) Actions() ui.KeyActions {
|
||||
return l.actions
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ func (l *LogsExtender) showLogs(path string, prev bool) {
|
|||
}
|
||||
}
|
||||
|
||||
// buildLogOpts(path, co, prev, false, config.DefaultLoggerTailCount),
|
||||
// buildLogOpts(path, co, prev, false, config.DefaultLoggerTailCount),.
|
||||
func (l *LogsExtender) buildLogOpts(path, co string, prevLogs bool) *dao.LogOptions {
|
||||
cfg := l.App().Config.K9s.Logger
|
||||
opts := dao.LogOptions{
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ type Namespace struct {
|
|||
ResourceViewer
|
||||
}
|
||||
|
||||
// NewNamespace returns a new viewer
|
||||
// NewNamespace returns a new viewer.
|
||||
func NewNamespace(gvr client.GVR) ResourceViewer {
|
||||
n := Namespace{
|
||||
ResourceViewer: NewBrowser(gvr),
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ func (p *Pulse) Stop() {
|
|||
p.cancelFn = nil
|
||||
}
|
||||
|
||||
// Refresh updates the view
|
||||
// Refresh updates the view.
|
||||
func (p *Pulse) Refresh() {}
|
||||
|
||||
// GVR returns a resource descriptor.
|
||||
|
|
|
|||
|
|
@ -135,13 +135,9 @@ func rbacViewers(vv MetaViewers) {
|
|||
}
|
||||
|
||||
func batchViewers(vv MetaViewers) {
|
||||
vv[client.NewGVR("batch/v1/cronjobs")] = MetaViewer{
|
||||
viewerFn: NewCronJob,
|
||||
}
|
||||
vv[client.NewGVR("batch/v1beta1/cronjobs")] = MetaViewer{
|
||||
viewerFn: NewCronJob,
|
||||
}
|
||||
|
||||
vv[client.NewGVR("batch/v1/jobs")] = MetaViewer{
|
||||
viewerFn: NewJob,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ func NewSanitizer(gvr client.GVR) ResourceViewer {
|
|||
}
|
||||
}
|
||||
|
||||
// Init initializes the view
|
||||
// Init initializes the view.
|
||||
func (s *Sanitizer) Init(ctx context.Context) error {
|
||||
s.envFn = s.k9sEnv
|
||||
|
||||
|
|
@ -317,7 +317,7 @@ func (s *Sanitizer) hydrate(parent *tview.TreeNode, n *xray.TreeNode) {
|
|||
// SetEnvFn sets the custom environment function.
|
||||
func (s *Sanitizer) SetEnvFn(EnvFunc) {}
|
||||
|
||||
// Refresh updates the view
|
||||
// Refresh updates the view.
|
||||
func (s *Sanitizer) Refresh() {}
|
||||
|
||||
// BufferChanged indicates the buffer was changed.
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
package view
|
||||
|
||||
import (
|
||||
"sigs.k8s.io/yaml"
|
||||
|
||||
"github.com/derailed/k9s/internal/client"
|
||||
"github.com/derailed/k9s/internal/ui"
|
||||
"github.com/gdamore/tcell/v2"
|
||||
|
|
@ -10,6 +8,7 @@ import (
|
|||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"sigs.k8s.io/yaml"
|
||||
)
|
||||
|
||||
// Secret presents a secret viewer.
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ func (s *Service) toggleBenchCmd(evt *tcell.EventKey) *tcell.EventKey {
|
|||
return nil
|
||||
}
|
||||
|
||||
// BOZO!! Refactor used by forwards
|
||||
// BOZO!! Refactor used by forwards.
|
||||
func (s *Service) runBenchmark(port string, cfg config.BenchConfig) error {
|
||||
if cfg.HTTP.Host == "" {
|
||||
return fmt.Errorf("Invalid benchmark host %q", cfg.HTTP.Host)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ func NewTable(gvr client.GVR) *Table {
|
|||
return &t
|
||||
}
|
||||
|
||||
// Init initializes the component
|
||||
// Init initializes the component.
|
||||
func (t *Table) Init(ctx context.Context) (err error) {
|
||||
if t.app, err = extractApp(ctx); err != nil {
|
||||
return err
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue