Chore: Update k8s.io to v0.33.1 (#105307)
This commit is contained in:
@@ -25,7 +25,6 @@ import (
|
||||
"k8s.io/apiserver/pkg/util/openapi"
|
||||
k8sscheme "k8s.io/client-go/kubernetes/scheme"
|
||||
k8stracing "k8s.io/component-base/tracing"
|
||||
utilversion "k8s.io/component-base/version"
|
||||
"k8s.io/klog/v2"
|
||||
"k8s.io/kube-openapi/pkg/common"
|
||||
|
||||
@@ -231,23 +230,7 @@ func SetupConfig(
|
||||
serverConfig.SkipOpenAPIInstallation = false
|
||||
serverConfig.BuildHandlerChainFunc = buildHandlerChainFuncFromBuilders(builders)
|
||||
|
||||
v := utilversion.DefaultKubeEffectiveVersion()
|
||||
patchver := 0 // required for semver
|
||||
|
||||
info := v.BinaryVersion().Info()
|
||||
info.BuildDate = time.Unix(buildTimestamp, 0).UTC().Format(time.RFC3339)
|
||||
info.GitVersion = fmt.Sprintf("%s.%s.%d+grafana-v%s", info.Major, info.Minor, patchver, buildVersion)
|
||||
info.GitCommit = fmt.Sprintf("%s@%s", buildBranch, buildCommit)
|
||||
info.GitTreeState = fmt.Sprintf("grafana v%s", buildVersion)
|
||||
|
||||
info2 := v.EmulationVersion().Info()
|
||||
info2.BuildDate = info.BuildDate
|
||||
info2.GitVersion = fmt.Sprintf("%s.%s.%d+grafana-v%s", info2.Major, info2.Minor, patchver, buildVersion)
|
||||
info2.GitCommit = info.GitCommit
|
||||
info2.GitTreeState = info.GitTreeState
|
||||
|
||||
serverConfig.EffectiveVersion = v
|
||||
|
||||
serverConfig.EffectiveVersion = getEffectiveVersion(buildTimestamp, buildVersion, buildCommit, buildBranch)
|
||||
// set priority for aggregated discovery
|
||||
for i, b := range builders {
|
||||
gvs := GetGroupVersions(b)
|
||||
|
||||
@@ -17,9 +17,9 @@ func GetOpenAPIDefinitions(builders []APIGroupBuilder) common.GetOpenAPIDefiniti
|
||||
return func(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
|
||||
defs := v0alpha1.GetOpenAPIDefinitions(ref) // common grafana apis
|
||||
maps.Copy(defs, data.GetOpenAPIDefinitions(ref))
|
||||
// TODO: remove when https://github.com/grafana/grafana-plugin-sdk-go/pull/1062 is merged
|
||||
// TODO: add timerange to upstream SDK setup
|
||||
maps.Copy(defs, map[string]common.OpenAPIDefinition{
|
||||
"github.com/grafana/grafana-plugin-sdk-go/experimental/apis/data/v0alpha1.DataSourceRef": {
|
||||
"github.com/grafana/grafana-plugin-sdk-go/experimental/apis/data/v0alpha1.TimeRange": {
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
package builder
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"k8s.io/apimachinery/pkg/util/version"
|
||||
apimachineryversion "k8s.io/apimachinery/pkg/version"
|
||||
utilcompatibility "k8s.io/apiserver/pkg/util/compatibility"
|
||||
"k8s.io/component-base/compatibility"
|
||||
)
|
||||
|
||||
// wrapper that will include grafana version in the /version response
|
||||
type grafanaVersion struct {
|
||||
info *apimachineryversion.Info
|
||||
wrap compatibility.EffectiveVersion
|
||||
}
|
||||
|
||||
func getEffectiveVersion(
|
||||
buildTimestamp int64,
|
||||
buildVersion string,
|
||||
buildCommit string,
|
||||
buildBranch string,
|
||||
) compatibility.EffectiveVersion {
|
||||
v := utilcompatibility.DefaultBuildEffectiveVersion()
|
||||
patchver := 0 // required for semver
|
||||
|
||||
info := v.Info()
|
||||
info.BuildDate = time.Unix(buildTimestamp, 0).UTC().Format(time.RFC3339)
|
||||
info.GitVersion = fmt.Sprintf("%s.%s.%d+grafana-v%s", info.Major, info.Minor, patchver, buildVersion)
|
||||
info.GitCommit = fmt.Sprintf("%s@%s", buildBranch, buildCommit)
|
||||
info.GitTreeState = fmt.Sprintf("grafana v%s", buildVersion)
|
||||
|
||||
info2 := v.EmulationVersion().Info()
|
||||
info2.BuildDate = info.BuildDate
|
||||
info2.GitVersion = fmt.Sprintf("%s.%s.%d+grafana-v%s", info2.Major, info2.Minor, patchver, buildVersion)
|
||||
info2.GitCommit = info.GitCommit
|
||||
info2.GitTreeState = info.GitTreeState
|
||||
|
||||
return &grafanaVersion{
|
||||
wrap: v,
|
||||
info: info,
|
||||
}
|
||||
}
|
||||
|
||||
// Info implements compatibility.EffectiveVersion.
|
||||
// This returns the grafana info along with the standard k8s info
|
||||
func (g *grafanaVersion) Info() *apimachineryversion.Info {
|
||||
return g.info // otherwise the info gets replaced :(
|
||||
}
|
||||
|
||||
// AllowedEmulationVersionRange implements compatibility.EffectiveVersion.
|
||||
func (g *grafanaVersion) AllowedEmulationVersionRange() string {
|
||||
return g.wrap.AllowedEmulationVersionRange()
|
||||
}
|
||||
|
||||
// AllowedMinCompatibilityVersionRange implements compatibility.EffectiveVersion.
|
||||
func (g *grafanaVersion) AllowedMinCompatibilityVersionRange() string {
|
||||
return g.wrap.AllowedMinCompatibilityVersionRange()
|
||||
}
|
||||
|
||||
// BinaryVersion implements compatibility.EffectiveVersion.
|
||||
func (g *grafanaVersion) BinaryVersion() *version.Version {
|
||||
return g.wrap.BinaryVersion()
|
||||
}
|
||||
|
||||
// EmulationVersion implements compatibility.EffectiveVersion.
|
||||
func (g *grafanaVersion) EmulationVersion() *version.Version {
|
||||
return g.wrap.EmulationVersion()
|
||||
}
|
||||
|
||||
// EqualTo implements compatibility.EffectiveVersion.
|
||||
func (g *grafanaVersion) EqualTo(other compatibility.EffectiveVersion) bool {
|
||||
return g.wrap.EqualTo(other)
|
||||
}
|
||||
|
||||
// MinCompatibilityVersion implements compatibility.EffectiveVersion.
|
||||
func (g *grafanaVersion) MinCompatibilityVersion() *version.Version {
|
||||
return g.wrap.MinCompatibilityVersion()
|
||||
}
|
||||
|
||||
// String implements compatibility.EffectiveVersion.
|
||||
func (g *grafanaVersion) String() string {
|
||||
return g.wrap.String()
|
||||
}
|
||||
|
||||
// Validate implements compatibility.EffectiveVersion.
|
||||
func (g *grafanaVersion) Validate() []error {
|
||||
return g.wrap.Validate()
|
||||
}
|
||||
Reference in New Issue
Block a user