mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
vendor files
This commit is contained in:
1
vendor/k8s.io/kubernetes/pkg/version/.gitattributes
generated
vendored
Normal file
1
vendor/k8s.io/kubernetes/pkg/version/.gitattributes
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
base.go export-subst
|
34
vendor/k8s.io/kubernetes/pkg/version/BUILD
generated
vendored
Normal file
34
vendor/k8s.io/kubernetes/pkg/version/BUILD
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_library",
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"base.go",
|
||||
"doc.go",
|
||||
"version.go",
|
||||
],
|
||||
importpath = "k8s.io/kubernetes/pkg/version",
|
||||
deps = ["//vendor/k8s.io/apimachinery/pkg/version:go_default_library"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [
|
||||
":package-srcs",
|
||||
"//pkg/version/prometheus:all-srcs",
|
||||
"//pkg/version/verflag:all-srcs",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
)
|
63
vendor/k8s.io/kubernetes/pkg/version/base.go
generated
vendored
Normal file
63
vendor/k8s.io/kubernetes/pkg/version/base.go
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
Copyright 2014 The Kubernetes Authors.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
package version
|
||||
|
||||
// Base version information.
|
||||
//
|
||||
// This is the fallback data used when version information from git is not
|
||||
// provided via go ldflags. It provides an approximation of the Kubernetes
|
||||
// version for ad-hoc builds (e.g. `go build`) that cannot get the version
|
||||
// information from git.
|
||||
//
|
||||
// If you are looking at these fields in the git tree, they look
|
||||
// strange. They are modified on the fly by the build process. The
|
||||
// in-tree values are dummy values used for "git archive", which also
|
||||
// works for GitHub tar downloads.
|
||||
//
|
||||
// When releasing a new Kubernetes version, this file is updated by
|
||||
// build/mark_new_version.sh to reflect the new version, and then a
|
||||
// git annotated tag (using format vX.Y where X == Major version and Y
|
||||
// == Minor version) is created to point to the commit that updates
|
||||
// pkg/version/base.go
|
||||
var (
|
||||
// TODO: Deprecate gitMajor and gitMinor, use only gitVersion
|
||||
// instead. First step in deprecation, keep the fields but make
|
||||
// them irrelevant. (Next we'll take it out, which may muck with
|
||||
// scripts consuming the kubectl version output - but most of
|
||||
// these should be looking at gitVersion already anyways.)
|
||||
gitMajor string // major version, always numeric
|
||||
gitMinor string // minor version, numeric possibly followed by "+"
|
||||
|
||||
// semantic version, derived by build scripts (see
|
||||
// https://github.com/kubernetes/community/blob/master/contributors/design-proposals/release/versioning.md
|
||||
// for a detailed discussion of this field)
|
||||
//
|
||||
// TODO: This field is still called "gitVersion" for legacy
|
||||
// reasons. For prerelease versions, the build metadata on the
|
||||
// semantic version is a git hash, but the version itself is no
|
||||
// longer the direct output of "git describe", but a slight
|
||||
// translation to be semver compliant.
|
||||
|
||||
// NOTE: The $Format strings are replaced during 'git archive' thanks to the
|
||||
// companion .gitattributes file containing 'export-subst' in this same
|
||||
// directory. See also https://git-scm.com/docs/gitattributes
|
||||
gitVersion = "v0.0.0-master+$Format:%h$"
|
||||
gitCommit = "$Format:%H$" // sha1 from git, output of $(git rev-parse HEAD)
|
||||
gitTreeState = "" // state of git tree, either "clean" or "dirty"
|
||||
|
||||
buildDate = "1970-01-01T00:00:00Z" // build date in ISO8601 format, output of $(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
||||
)
|
24
vendor/k8s.io/kubernetes/pkg/version/def.bzl
generated
vendored
Normal file
24
vendor/k8s.io/kubernetes/pkg/version/def.bzl
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
# Implements hack/lib/version.sh's kube::version::ldflags() for Bazel.
|
||||
def version_x_defs():
|
||||
# This should match the list of packages in kube::version::ldflag
|
||||
stamp_pkgs = [
|
||||
"k8s.io/kubernetes/pkg/version",
|
||||
# In hack/lib/version.sh, this has a vendor/ prefix. That isn't needed here?
|
||||
"k8s.io/client-go/pkg/version",
|
||||
]
|
||||
# This should match the list of vars in kube::version::ldflags
|
||||
# It should also match the list of vars set in hack/print-workspace-status.sh.
|
||||
stamp_vars = [
|
||||
"buildDate",
|
||||
"gitCommit",
|
||||
"gitMajor",
|
||||
"gitMinor",
|
||||
"gitTreeState",
|
||||
"gitVersion",
|
||||
]
|
||||
# Generate the cross-product.
|
||||
x_defs = {}
|
||||
for pkg in stamp_pkgs:
|
||||
for var in stamp_vars:
|
||||
x_defs["%s.%s" % (pkg, var)] = "{%s}" % var
|
||||
return x_defs
|
20
vendor/k8s.io/kubernetes/pkg/version/doc.go
generated
vendored
Normal file
20
vendor/k8s.io/kubernetes/pkg/version/doc.go
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright 2014 The Kubernetes Authors.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
// Package version supplies version information collected at build time to
|
||||
// kubernetes components.
|
||||
// +k8s:openapi-gen=true
|
||||
package version // import "k8s.io/kubernetes/pkg/version"
|
29
vendor/k8s.io/kubernetes/pkg/version/prometheus/BUILD
generated
vendored
Normal file
29
vendor/k8s.io/kubernetes/pkg/version/prometheus/BUILD
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_library",
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["prometheus.go"],
|
||||
importpath = "k8s.io/kubernetes/pkg/version/prometheus",
|
||||
deps = [
|
||||
"//pkg/version:go_default_library",
|
||||
"//vendor/github.com/prometheus/client_golang/prometheus:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
)
|
38
vendor/k8s.io/kubernetes/pkg/version/prometheus/prometheus.go
generated
vendored
Normal file
38
vendor/k8s.io/kubernetes/pkg/version/prometheus/prometheus.go
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
// Package prometheus registers Kubernetes version information as a
|
||||
// prometheus metric.
|
||||
package prometheus
|
||||
|
||||
import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"k8s.io/kubernetes/pkg/version"
|
||||
)
|
||||
|
||||
func init() {
|
||||
buildInfo := prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Name: "kubernetes_build_info",
|
||||
Help: "A metric with a constant '1' value labeled by major, minor, git version, git commit, git tree state, build date, Go version, and compiler from which Kubernetes was built, and platform on which it is running.",
|
||||
},
|
||||
[]string{"major", "minor", "gitVersion", "gitCommit", "gitTreeState", "buildDate", "goVersion", "compiler", "platform"},
|
||||
)
|
||||
info := version.Get()
|
||||
buildInfo.WithLabelValues(info.Major, info.Minor, info.GitVersion, info.GitCommit, info.GitTreeState, info.BuildDate, info.GoVersion, info.Compiler, info.Platform).Set(1)
|
||||
|
||||
prometheus.MustRegister(buildInfo)
|
||||
}
|
29
vendor/k8s.io/kubernetes/pkg/version/verflag/BUILD
generated
vendored
Normal file
29
vendor/k8s.io/kubernetes/pkg/version/verflag/BUILD
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_library",
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["verflag.go"],
|
||||
importpath = "k8s.io/kubernetes/pkg/version/verflag",
|
||||
deps = [
|
||||
"//pkg/version:go_default_library",
|
||||
"//vendor/github.com/spf13/pflag:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
)
|
102
vendor/k8s.io/kubernetes/pkg/version/verflag/verflag.go
generated
vendored
Normal file
102
vendor/k8s.io/kubernetes/pkg/version/verflag/verflag.go
generated
vendored
Normal file
@ -0,0 +1,102 @@
|
||||
/*
|
||||
Copyright 2014 The Kubernetes Authors.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
// Package verflag defines utility functions to handle command line flags
|
||||
// related to version of Kubernetes.
|
||||
package verflag
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
flag "github.com/spf13/pflag"
|
||||
|
||||
"k8s.io/kubernetes/pkg/version"
|
||||
)
|
||||
|
||||
type versionValue int
|
||||
|
||||
const (
|
||||
VersionFalse versionValue = 0
|
||||
VersionTrue versionValue = 1
|
||||
VersionRaw versionValue = 2
|
||||
)
|
||||
|
||||
const strRawVersion string = "raw"
|
||||
|
||||
func (v *versionValue) IsBoolFlag() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (v *versionValue) Get() interface{} {
|
||||
return versionValue(*v)
|
||||
}
|
||||
|
||||
func (v *versionValue) Set(s string) error {
|
||||
if s == strRawVersion {
|
||||
*v = VersionRaw
|
||||
return nil
|
||||
}
|
||||
boolVal, err := strconv.ParseBool(s)
|
||||
if boolVal {
|
||||
*v = VersionTrue
|
||||
} else {
|
||||
*v = VersionFalse
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (v *versionValue) String() string {
|
||||
if *v == VersionRaw {
|
||||
return strRawVersion
|
||||
}
|
||||
return fmt.Sprintf("%v", bool(*v == VersionTrue))
|
||||
}
|
||||
|
||||
// The type of the flag as required by the pflag.Value interface
|
||||
func (v *versionValue) Type() string {
|
||||
return "version"
|
||||
}
|
||||
|
||||
func VersionVar(p *versionValue, name string, value versionValue, usage string) {
|
||||
*p = value
|
||||
flag.Var(p, name, usage)
|
||||
// "--version" will be treated as "--version=true"
|
||||
flag.Lookup(name).NoOptDefVal = "true"
|
||||
}
|
||||
|
||||
func Version(name string, value versionValue, usage string) *versionValue {
|
||||
p := new(versionValue)
|
||||
VersionVar(p, name, value, usage)
|
||||
return p
|
||||
}
|
||||
|
||||
var (
|
||||
versionFlag = Version("version", VersionFalse, "Print version information and quit")
|
||||
)
|
||||
|
||||
// PrintAndExitIfRequested will check if the -version flag was passed
|
||||
// and, if so, print the version and exit.
|
||||
func PrintAndExitIfRequested() {
|
||||
if *versionFlag == VersionRaw {
|
||||
fmt.Printf("%#v\n", version.Get())
|
||||
os.Exit(0)
|
||||
} else if *versionFlag == VersionTrue {
|
||||
fmt.Printf("Kubernetes %s\n", version.Get())
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
42
vendor/k8s.io/kubernetes/pkg/version/version.go
generated
vendored
Normal file
42
vendor/k8s.io/kubernetes/pkg/version/version.go
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
Copyright 2014 The Kubernetes Authors.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
package version
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
|
||||
apimachineryversion "k8s.io/apimachinery/pkg/version"
|
||||
)
|
||||
|
||||
// Get returns the overall codebase version. It's for detecting
|
||||
// what code a binary was built from.
|
||||
func Get() apimachineryversion.Info {
|
||||
// These variables typically come from -ldflags settings and in
|
||||
// their absence fallback to the settings in pkg/version/base.go
|
||||
return apimachineryversion.Info{
|
||||
Major: gitMajor,
|
||||
Minor: gitMinor,
|
||||
GitVersion: gitVersion,
|
||||
GitCommit: gitCommit,
|
||||
GitTreeState: gitTreeState,
|
||||
BuildDate: buildDate,
|
||||
GoVersion: runtime.Version(),
|
||||
Compiler: runtime.Compiler,
|
||||
Platform: fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH),
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user