rebase: update kubernetes to v1.21.2

Updated kubernetes packages to latest release.
resizefs package has been included into k8s.io/mount-utils
package. updated code to use the same.

Updates: #1968

Signed-off-by: Rakshith R <rar@redhat.com>
This commit is contained in:
Rakshith R
2021-06-25 10:29:51 +05:30
committed by mergify[bot]
parent 8ce5ae16c1
commit 1b23d78113
1115 changed files with 98825 additions and 12365 deletions

View File

@ -17,11 +17,8 @@ limitations under the License.
package metrics
import (
"os"
"time"
"github.com/prometheus/procfs"
"k8s.io/klog/v2"
)
@ -44,24 +41,11 @@ func RegisterProcessStartTime(registrationFunc func(Registerable) error) error {
start = float64(time.Now().Unix())
}
// processStartTime is a lazy metric which only get initialized after registered.
// so we have to explicitly create it before setting the label value. Otherwise
// it is a noop.
if !processStartTime.IsCreated() {
processStartTime.initializeMetric()
// so we need to register the metric first and then set the value for it
if err = registrationFunc(processStartTime); err != nil {
return err
}
processStartTime.WithLabelValues().Set(start)
return registrationFunc(processStartTime)
}
func getProcessStart() (float64, error) {
pid := os.Getpid()
p, err := procfs.NewProc(pid)
if err != nil {
return 0, err
}
if stat, err := p.Stat(); err == nil {
return stat.StartTime()
}
return 0, err
return nil
}