remove unused code
Change-Id: If821920ec8872e326b7d85437ad8d2620807799d
This commit is contained in:
parent
0772f852ad
commit
7b8c9acc09
@ -1088,10 +1088,6 @@ func RunPullImagesCheck(execer utilsexec.Interface, cfg *kubeadmapi.InitConfigur
|
|||||||
// RunChecks runs each check, displays it's warnings/errors, and once all
|
// RunChecks runs each check, displays it's warnings/errors, and once all
|
||||||
// are processed will exit if any errors occurred.
|
// are processed will exit if any errors occurred.
|
||||||
func RunChecks(checks []Checker, ww io.Writer, ignorePreflightErrors sets.String) error {
|
func RunChecks(checks []Checker, ww io.Writer, ignorePreflightErrors sets.String) error {
|
||||||
type checkErrors struct {
|
|
||||||
Name string
|
|
||||||
Errors []error
|
|
||||||
}
|
|
||||||
var errsBuffer bytes.Buffer
|
var errsBuffer bytes.Buffer
|
||||||
|
|
||||||
for _, c := range checks {
|
for _, c := range checks {
|
||||||
|
@ -268,9 +268,3 @@ func collectSecretPaths(t *testing.T, path *field.Path, name string, tp reflect.
|
|||||||
|
|
||||||
return secretPaths
|
return secretPaths
|
||||||
}
|
}
|
||||||
|
|
||||||
func newHostPathType(pathType string) *corev1.HostPathType {
|
|
||||||
hostPathType := new(corev1.HostPathType)
|
|
||||||
*hostPathType = corev1.HostPathType(pathType)
|
|
||||||
return hostPathType
|
|
||||||
}
|
|
||||||
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||||||
package validation
|
package validation
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@ -68,12 +67,6 @@ func getValidPodTemplateSpecForGenerated(selector *metav1.LabelSelector) api.Pod
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func featureToggle(feature utilfeature.Feature) []string {
|
|
||||||
enabled := fmt.Sprintf("%s=%t", feature, true)
|
|
||||||
disabled := fmt.Sprintf("%s=%t", feature, false)
|
|
||||||
return []string{enabled, disabled}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestValidateJob(t *testing.T) {
|
func TestValidateJob(t *testing.T) {
|
||||||
validManualSelector := getValidManualSelector()
|
validManualSelector := getValidManualSelector()
|
||||||
validPodTemplateSpecForManual := getValidPodTemplateSpecForManual(validManualSelector)
|
validPodTemplateSpecForManual := getValidPodTemplateSpecForManual(validManualSelector)
|
||||||
|
@ -18,13 +18,8 @@ package v1beta1
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
policyv1beta1 "k8s.io/api/policy/v1beta1"
|
policyv1beta1 "k8s.io/api/policy/v1beta1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func addDefaultingFuncs(scheme *runtime.Scheme) error {
|
|
||||||
return RegisterDefaults(scheme)
|
|
||||||
}
|
|
||||||
|
|
||||||
func SetDefaults_PodSecurityPolicySpec(obj *policyv1beta1.PodSecurityPolicySpec) {
|
func SetDefaults_PodSecurityPolicySpec(obj *policyv1beta1.PodSecurityPolicySpec) {
|
||||||
// This field was added after PodSecurityPolicy was released.
|
// This field was added after PodSecurityPolicy was released.
|
||||||
// Policies that do not include this field must remain as permissive as they were prior to the introduction of this field.
|
// Policies that do not include this field must remain as permissive as they were prior to the introduction of this field.
|
||||||
|
@ -568,16 +568,6 @@ func extractResourceGroupByNicID(nicID string) (string, error) {
|
|||||||
return matches[1], nil
|
return matches[1], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// extractResourceGroupByPipID extracts the resource group name by publicIP ID.
|
|
||||||
func extractResourceGroupByPipID(pipID string) (string, error) {
|
|
||||||
matches := publicIPResourceGroupRE.FindStringSubmatch(pipID)
|
|
||||||
if len(matches) != 2 {
|
|
||||||
return "", fmt.Errorf("error of extracting resourceGroup from pipID %q", pipID)
|
|
||||||
}
|
|
||||||
|
|
||||||
return matches[1], nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// getPrimaryInterfaceWithVMSet gets machine primary network interface by node name and vmSet.
|
// getPrimaryInterfaceWithVMSet gets machine primary network interface by node name and vmSet.
|
||||||
func (as *availabilitySet) getPrimaryInterfaceWithVMSet(nodeName, vmSetName string) (network.Interface, error) {
|
func (as *availabilitySet) getPrimaryInterfaceWithVMSet(nodeName, vmSetName string) (network.Interface, error) {
|
||||||
var machine compute.VirtualMachine
|
var machine compute.VirtualMachine
|
||||||
|
@ -81,11 +81,6 @@ const (
|
|||||||
gceComputeAPIEndpointBeta = "https://www.googleapis.com/compute/beta/"
|
gceComputeAPIEndpointBeta = "https://www.googleapis.com/compute/beta/"
|
||||||
)
|
)
|
||||||
|
|
||||||
// gceObject is an abstraction of all GCE API object in go client
|
|
||||||
type gceObject interface {
|
|
||||||
MarshalJSON() ([]byte, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ cloudprovider.Interface = (*Cloud)(nil)
|
var _ cloudprovider.Interface = (*Cloud)(nil)
|
||||||
var _ cloudprovider.Instances = (*Cloud)(nil)
|
var _ cloudprovider.Instances = (*Cloud)(nil)
|
||||||
var _ cloudprovider.LoadBalancer = (*Cloud)(nil)
|
var _ cloudprovider.LoadBalancer = (*Cloud)(nil)
|
||||||
|
@ -244,10 +244,6 @@ func makeGoogleAPINotFoundError(message string) error {
|
|||||||
return &googleapi.Error{Code: http.StatusNotFound, Message: message}
|
return &googleapi.Error{Code: http.StatusNotFound, Message: message}
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeGoogleAPIError(code int, message string) error {
|
|
||||||
return &googleapi.Error{Code: code, Message: message}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO(#51665): Remove this once Network Tiers becomes Beta in GCP.
|
// TODO(#51665): Remove this once Network Tiers becomes Beta in GCP.
|
||||||
func handleAlphaNetworkTierGetError(err error) (string, error) {
|
func handleAlphaNetworkTierGetError(err error) (string, error) {
|
||||||
if isForbidden(err) {
|
if isForbidden(err) {
|
||||||
|
@ -85,8 +85,6 @@ type LbaasV2 struct {
|
|||||||
LoadBalancer
|
LoadBalancer
|
||||||
}
|
}
|
||||||
|
|
||||||
type empty struct{}
|
|
||||||
|
|
||||||
func networkExtensions(client *gophercloud.ServiceClient) (map[string]bool, error) {
|
func networkExtensions(client *gophercloud.ServiceClient) (map[string]bool, error) {
|
||||||
seen := make(map[string]bool)
|
seen := make(map[string]bool)
|
||||||
|
|
||||||
|
@ -389,22 +389,6 @@ func TestCPUEmptyMetricsForOnePod(t *testing.T) {
|
|||||||
tc.runTest(t)
|
tc.runTest(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testCollapseTimeSamples(t *testing.T) {
|
|
||||||
now := time.Now()
|
|
||||||
metrics := heapster.MetricResult{
|
|
||||||
Metrics: []heapster.MetricPoint{
|
|
||||||
{Timestamp: now, Value: 50, FloatValue: nil},
|
|
||||||
{Timestamp: now.Add(-15 * time.Second), Value: 100, FloatValue: nil},
|
|
||||||
{Timestamp: now.Add(-60 * time.Second), Value: 100000, FloatValue: nil}},
|
|
||||||
LatestTimestamp: now,
|
|
||||||
}
|
|
||||||
|
|
||||||
val, timestamp, hadMetrics := collapseTimeSamples(metrics, time.Minute)
|
|
||||||
assert.True(t, hadMetrics, "should report that it received a populated list of metrics")
|
|
||||||
assert.InEpsilon(t, float64(75), val, 0.1, "collapsed sample value should be as expected")
|
|
||||||
assert.True(t, timestamp.Equal(now), "timestamp should be the current time (the newest)")
|
|
||||||
}
|
|
||||||
|
|
||||||
func offsetTimestampBy(t int) time.Time {
|
func offsetTimestampBy(t int) time.Time {
|
||||||
return fixedTimestamp.Add(time.Duration(t) * time.Minute)
|
return fixedTimestamp.Add(time.Duration(t) * time.Minute)
|
||||||
}
|
}
|
||||||
|
@ -702,16 +702,6 @@ func (e *TokensController) listTokenSecrets(serviceAccount *v1.ServiceAccount) (
|
|||||||
return items, nil
|
return items, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// serviceAccountNameAndUID is a helper method to get the ServiceAccount Name and UID from the given secret
|
|
||||||
// Returns "","" if the secret is not a ServiceAccountToken secret
|
|
||||||
// If the name or uid annotation is missing, "" is returned instead
|
|
||||||
func serviceAccountNameAndUID(secret *v1.Secret) (string, string) {
|
|
||||||
if secret.Type != v1.SecretTypeServiceAccountToken {
|
|
||||||
return "", ""
|
|
||||||
}
|
|
||||||
return secret.Annotations[v1.ServiceAccountNameKey], secret.Annotations[v1.ServiceAccountUIDKey]
|
|
||||||
}
|
|
||||||
|
|
||||||
func getSecretReferences(serviceAccount *v1.ServiceAccount) sets.String {
|
func getSecretReferences(serviceAccount *v1.ServiceAccount) sets.String {
|
||||||
references := sets.NewString()
|
references := sets.NewString()
|
||||||
for _, secret := range serviceAccount.Secrets {
|
for _, secret := range serviceAccount.Secrets {
|
||||||
|
@ -234,14 +234,6 @@ func TestControllerCacheParsingError(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func addVolumeAnnotation(volume *v1.PersistentVolume, annName, annValue string) *v1.PersistentVolume {
|
|
||||||
if volume.Annotations == nil {
|
|
||||||
volume.Annotations = make(map[string]string)
|
|
||||||
}
|
|
||||||
volume.Annotations[annName] = annValue
|
|
||||||
return volume
|
|
||||||
}
|
|
||||||
|
|
||||||
func makePVCClass(scName *string, hasSelectNodeAnno bool) *v1.PersistentVolumeClaim {
|
func makePVCClass(scName *string, hasSelectNodeAnno bool) *v1.PersistentVolumeClaim {
|
||||||
claim := &v1.PersistentVolumeClaim{
|
claim := &v1.PersistentVolumeClaim{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
@ -63,16 +63,6 @@ type authDirective struct {
|
|||||||
realm string
|
realm string
|
||||||
}
|
}
|
||||||
|
|
||||||
type accessTokenPayload struct {
|
|
||||||
TenantID string `json:"tid"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type acrTokenPayload struct {
|
|
||||||
Expiration int64 `json:"exp"`
|
|
||||||
TenantID string `json:"tenant"`
|
|
||||||
Credential string `json:"credential"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type acrAuthResponse struct {
|
type acrAuthResponse struct {
|
||||||
RefreshToken string `json:"refresh_token"`
|
RefreshToken string `json:"refresh_token"`
|
||||||
}
|
}
|
||||||
|
@ -151,8 +151,6 @@ func (mk MergeKeys) GetMergeKeyValue(i interface{}) (MergeKeyValue, error) {
|
|||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type source int
|
|
||||||
|
|
||||||
// CombinedPrimitiveSlice implements a slice of primitives
|
// CombinedPrimitiveSlice implements a slice of primitives
|
||||||
type CombinedPrimitiveSlice struct {
|
type CombinedPrimitiveSlice struct {
|
||||||
Items []*PrimitiveListItem
|
Items []*PrimitiveListItem
|
||||||
|
@ -28,7 +28,6 @@ go_library(
|
|||||||
"//pkg/kubectl/util/templates:go_default_library",
|
"//pkg/kubectl/util/templates:go_default_library",
|
||||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/api/rbac/v1:go_default_library",
|
"//staging/src/k8s.io/api/rbac/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/api/meta:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/api/meta:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
|
@ -17,17 +17,13 @@ limitations under the License.
|
|||||||
package set
|
package set
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
"k8s.io/apimachinery/pkg/util/strategicpatch"
|
"k8s.io/apimachinery/pkg/util/strategicpatch"
|
||||||
"k8s.io/cli-runtime/pkg/resource"
|
"k8s.io/cli-runtime/pkg/resource"
|
||||||
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// selectContainers allows one or more containers to be matched against a string or wildcard
|
// selectContainers allows one or more containers to be matched against a string or wildcard
|
||||||
@ -44,33 +40,6 @@ func selectContainers(containers []v1.Container, spec string) ([]*v1.Container,
|
|||||||
return out, skipped
|
return out, skipped
|
||||||
}
|
}
|
||||||
|
|
||||||
// handlePodUpdateError prints a more useful error to the end user when mutating a pod.
|
|
||||||
func handlePodUpdateError(out io.Writer, err error, resource string) {
|
|
||||||
if statusError, ok := err.(*errors.StatusError); ok && errors.IsInvalid(err) {
|
|
||||||
errorDetails := statusError.Status().Details
|
|
||||||
if errorDetails.Kind == "Pod" {
|
|
||||||
all, match := true, false
|
|
||||||
for _, cause := range errorDetails.Causes {
|
|
||||||
if cause.Field == "spec" && strings.Contains(cause.Message, "may not update fields other than") {
|
|
||||||
fmt.Fprintf(out, "error: may not update %s in pod %q directly\n", resource, errorDetails.Name)
|
|
||||||
match = true
|
|
||||||
} else {
|
|
||||||
all = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if all && match {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ok := cmdutil.PrintErrorWithCauses(err, out); ok {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Fprintf(out, "error: %v\n", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// selectString returns true if the provided string matches spec, where spec is a string with
|
// selectString returns true if the provided string matches spec, where spec is a string with
|
||||||
// a non-greedy '*' wildcard operator.
|
// a non-greedy '*' wildcard operator.
|
||||||
// TODO: turn into a regex and handle greedy matches and backtracking.
|
// TODO: turn into a regex and handle greedy matches and backtracking.
|
||||||
|
@ -212,13 +212,6 @@ func NewInternalNamespacedType(kind, apiversion, name, namespace string) *Intern
|
|||||||
|
|
||||||
var errInvalidVersion = errors.New("not a version")
|
var errInvalidVersion = errors.New("not a version")
|
||||||
|
|
||||||
func versionErrIfFalse(b bool) error {
|
|
||||||
if b {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return errInvalidVersion
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidVersion of API
|
// ValidVersion of API
|
||||||
var ValidVersion = "v1"
|
var ValidVersion = "v1"
|
||||||
|
|
||||||
|
@ -4393,16 +4393,6 @@ func shorten(s string, maxLength int) string {
|
|||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
// translateTimestampUntil returns the elapsed time until timestamp in
|
|
||||||
// human-readable approximation.
|
|
||||||
func translateTimestampUntil(timestamp metav1.Time) string {
|
|
||||||
if timestamp.IsZero() {
|
|
||||||
return "<unknown>"
|
|
||||||
}
|
|
||||||
|
|
||||||
return duration.HumanDuration(time.Until(timestamp.Time))
|
|
||||||
}
|
|
||||||
|
|
||||||
// translateTimestampSince returns the elapsed time since timestamp in
|
// translateTimestampSince returns the elapsed time since timestamp in
|
||||||
// human-readable approximation.
|
// human-readable approximation.
|
||||||
func translateTimestampSince(timestamp metav1.Time) string {
|
func translateTimestampSince(timestamp metav1.Time) string {
|
||||||
|
@ -109,7 +109,6 @@ func rsListFromClient(c appsclient.AppsV1Interface) rsListFunc {
|
|||||||
|
|
||||||
// TODO: switch this to full namespacers
|
// TODO: switch this to full namespacers
|
||||||
type rsListFunc func(string, metav1.ListOptions) ([]*appsv1.ReplicaSet, error)
|
type rsListFunc func(string, metav1.ListOptions) ([]*appsv1.ReplicaSet, error)
|
||||||
type podListFunc func(string, metav1.ListOptions) (*corev1.PodList, error)
|
|
||||||
|
|
||||||
// listReplicaSets returns a slice of RSes the given deployment targets.
|
// listReplicaSets returns a slice of RSes the given deployment targets.
|
||||||
// Note that this does NOT attempt to reconcile ControllerRef (adopt/orphan),
|
// Note that this does NOT attempt to reconcile ControllerRef (adopt/orphan),
|
||||||
|
@ -18,9 +18,6 @@ package dockershim
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
dockertypes "github.com/docker/docker/api/types"
|
dockertypes "github.com/docker/docker/api/types"
|
||||||
@ -128,20 +125,6 @@ func TestParsingCreationConflictError(t *testing.T) {
|
|||||||
require.Equal(t, matches[1], "24666ab8c814d16f986449e504ea0159468ddf8da01897144a770f66dce0e14e")
|
require.Equal(t, matches[1], "24666ab8c814d16f986449e504ea0159468ddf8da01897144a770f66dce0e14e")
|
||||||
}
|
}
|
||||||
|
|
||||||
// writeDockerConfig will write a config file into a temporary dir, and return that dir.
|
|
||||||
// Caller is responsible for deleting the dir and its contents.
|
|
||||||
func writeDockerConfig(cfg string) (string, error) {
|
|
||||||
tmpdir, err := ioutil.TempDir("", "dockershim=helpers_test.go=")
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
dir := filepath.Join(tmpdir, ".docker")
|
|
||||||
if err := os.Mkdir(dir, 0755); err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
return tmpdir, ioutil.WriteFile(filepath.Join(dir, "config.json"), []byte(cfg), 0644)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestEnsureSandboxImageExists(t *testing.T) {
|
func TestEnsureSandboxImageExists(t *testing.T) {
|
||||||
sandboxImage := "gcr.io/test/image"
|
sandboxImage := "gcr.io/test/image"
|
||||||
authConfig := dockertypes.AuthConfig{Username: "user", Password: "pass"}
|
authConfig := dockertypes.AuthConfig{Username: "user", Password: "pass"}
|
||||||
|
@ -434,14 +434,6 @@ func formatThreshold(threshold evictionapi.Threshold) string {
|
|||||||
return fmt.Sprintf("threshold(signal=%v, operator=%v, value=%v, gracePeriod=%v)", threshold.Signal, threshold.Operator, evictionapi.ThresholdValue(threshold.Value), threshold.GracePeriod)
|
return fmt.Sprintf("threshold(signal=%v, operator=%v, value=%v, gracePeriod=%v)", threshold.Signal, threshold.Operator, evictionapi.ThresholdValue(threshold.Value), threshold.GracePeriod)
|
||||||
}
|
}
|
||||||
|
|
||||||
// formatevictionapi.ThresholdValue formats a thresholdValue for logging.
|
|
||||||
func formatThresholdValue(value evictionapi.ThresholdValue) string {
|
|
||||||
if value.Quantity != nil {
|
|
||||||
return value.Quantity.String()
|
|
||||||
}
|
|
||||||
return fmt.Sprintf("%f%%", value.Percentage*float32(100))
|
|
||||||
}
|
|
||||||
|
|
||||||
// cachedStatsFunc returns a statsFunc based on the provided pod stats.
|
// cachedStatsFunc returns a statsFunc based on the provided pod stats.
|
||||||
func cachedStatsFunc(podStats []statsapi.PodStats) statsFunc {
|
func cachedStatsFunc(podStats []statsapi.PodStats) statsFunc {
|
||||||
uid2PodStats := map[string]statsapi.PodStats{}
|
uid2PodStats := map[string]statsapi.PodStats{}
|
||||||
|
@ -167,10 +167,6 @@ func (s sortableNodeAddress) Less(i, j int) bool {
|
|||||||
}
|
}
|
||||||
func (s sortableNodeAddress) Swap(i, j int) { s[j], s[i] = s[i], s[j] }
|
func (s sortableNodeAddress) Swap(i, j int) { s[j], s[i] = s[i], s[j] }
|
||||||
|
|
||||||
func sortNodeAddresses(addrs sortableNodeAddress) {
|
|
||||||
sort.Sort(addrs)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestUpdateNewNodeStatus(t *testing.T) {
|
func TestUpdateNewNodeStatus(t *testing.T) {
|
||||||
cases := []struct {
|
cases := []struct {
|
||||||
desc string
|
desc string
|
||||||
|
@ -2018,20 +2018,6 @@ func TestPodPhaseWithRestartOnFailure(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type fakeReadWriteCloser struct{}
|
|
||||||
|
|
||||||
func (f *fakeReadWriteCloser) Write(data []byte) (int, error) {
|
|
||||||
return 0, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *fakeReadWriteCloser) Read(data []byte) (int, error) {
|
|
||||||
return 0, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *fakeReadWriteCloser) Close() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestGetExec(t *testing.T) {
|
func TestGetExec(t *testing.T) {
|
||||||
const (
|
const (
|
||||||
podName = "podFoo"
|
podName = "podFoo"
|
||||||
|
@ -136,22 +136,6 @@ func newTestKubelet(t *testing.T, controllerAttachDetachEnabled bool) *TestKubel
|
|||||||
return newTestKubeletWithImageList(t, imageList, controllerAttachDetachEnabled, true /*initFakeVolumePlugin*/)
|
return newTestKubeletWithImageList(t, imageList, controllerAttachDetachEnabled, true /*initFakeVolumePlugin*/)
|
||||||
}
|
}
|
||||||
|
|
||||||
func newTestKubeletWithoutFakeVolumePlugin(t *testing.T, controllerAttachDetachEnabled bool) *TestKubelet {
|
|
||||||
imageList := []kubecontainer.Image{
|
|
||||||
{
|
|
||||||
ID: "abc",
|
|
||||||
RepoTags: []string{"k8s.gcr.io:v1", "k8s.gcr.io:v2"},
|
|
||||||
Size: 123,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ID: "efg",
|
|
||||||
RepoTags: []string{"k8s.gcr.io:v3", "k8s.gcr.io:v4"},
|
|
||||||
Size: 456,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
return newTestKubeletWithImageList(t, imageList, controllerAttachDetachEnabled, false /*initFakeVolumePlugin*/)
|
|
||||||
}
|
|
||||||
|
|
||||||
func newTestKubeletWithImageList(
|
func newTestKubeletWithImageList(
|
||||||
t *testing.T,
|
t *testing.T,
|
||||||
imageList []kubecontainer.Image,
|
imageList []kubecontainer.Image,
|
||||||
|
@ -257,19 +257,6 @@ func (kl *simpleFakeKubelet) syncPodWithWaitGroup(options syncPodOptions) error
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// byContainerName sort the containers in a running pod by their names.
|
|
||||||
type byContainerName kubecontainer.Pod
|
|
||||||
|
|
||||||
func (b byContainerName) Len() int { return len(b.Containers) }
|
|
||||||
|
|
||||||
func (b byContainerName) Swap(i, j int) {
|
|
||||||
b.Containers[i], b.Containers[j] = b.Containers[j], b.Containers[i]
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b byContainerName) Less(i, j int) bool {
|
|
||||||
return b.Containers[i].Name < b.Containers[j].Name
|
|
||||||
}
|
|
||||||
|
|
||||||
// TestFakePodWorkers verifies that the fakePodWorkers behaves the same way as the real podWorkers
|
// TestFakePodWorkers verifies that the fakePodWorkers behaves the same way as the real podWorkers
|
||||||
// for their invocation of the syncPodFn.
|
// for their invocation of the syncPodFn.
|
||||||
func TestFakePodWorkers(t *testing.T) {
|
func TestFakePodWorkers(t *testing.T) {
|
||||||
|
@ -883,10 +883,6 @@ func getAction() core.GetAction {
|
|||||||
return core.GetActionImpl{ActionImpl: core.ActionImpl{Verb: "get", Resource: schema.GroupVersionResource{Resource: "pods"}}}
|
return core.GetActionImpl{ActionImpl: core.ActionImpl{Verb: "get", Resource: schema.GroupVersionResource{Resource: "pods"}}}
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateAction() core.UpdateAction {
|
|
||||||
return core.UpdateActionImpl{ActionImpl: core.ActionImpl{Verb: "update", Resource: schema.GroupVersionResource{Resource: "pods"}, Subresource: "status"}}
|
|
||||||
}
|
|
||||||
|
|
||||||
func patchAction() core.PatchAction {
|
func patchAction() core.PatchAction {
|
||||||
return core.PatchActionImpl{ActionImpl: core.ActionImpl{Verb: "patch", Resource: schema.GroupVersionResource{Resource: "pods"}, Subresource: "status"}}
|
return core.PatchActionImpl{ActionImpl: core.ActionImpl{Verb: "patch", Resource: schema.GroupVersionResource{Resource: "pods"}, Subresource: "status"}}
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,6 @@ go_test(
|
|||||||
"//pkg/api/legacyscheme:go_default_library",
|
"//pkg/api/legacyscheme:go_default_library",
|
||||||
"//pkg/api/testapi:go_default_library",
|
"//pkg/api/testapi:go_default_library",
|
||||||
"//pkg/apis/batch:go_default_library",
|
"//pkg/apis/batch:go_default_library",
|
||||||
"//pkg/apis/core:go_default_library",
|
|
||||||
"//pkg/apis/storage:go_default_library",
|
"//pkg/apis/storage:go_default_library",
|
||||||
"//pkg/generated/openapi:go_default_library",
|
"//pkg/generated/openapi:go_default_library",
|
||||||
"//pkg/kubelet/client:go_default_library",
|
"//pkg/kubelet/client:go_default_library",
|
||||||
|
@ -52,7 +52,6 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
"k8s.io/kubernetes/pkg/apis/batch"
|
"k8s.io/kubernetes/pkg/apis/batch"
|
||||||
api "k8s.io/kubernetes/pkg/apis/core"
|
|
||||||
apisstorage "k8s.io/kubernetes/pkg/apis/storage"
|
apisstorage "k8s.io/kubernetes/pkg/apis/storage"
|
||||||
kubeletclient "k8s.io/kubernetes/pkg/kubelet/client"
|
kubeletclient "k8s.io/kubernetes/pkg/kubelet/client"
|
||||||
"k8s.io/kubernetes/pkg/master/reconcilers"
|
"k8s.io/kubernetes/pkg/master/reconcilers"
|
||||||
@ -233,12 +232,6 @@ func TestVersion(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type fakeEndpointReconciler struct{}
|
|
||||||
|
|
||||||
func (*fakeEndpointReconciler) ReconcileEndpoints(serviceName string, ip net.IP, endpointPorts []api.EndpointPort, reconcilePorts bool) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func makeNodeList(nodes []string, nodeResources apiv1.NodeResources) *apiv1.NodeList {
|
func makeNodeList(nodes []string, nodeResources apiv1.NodeResources) *apiv1.NodeList {
|
||||||
list := apiv1.NodeList{
|
list := apiv1.NodeList{
|
||||||
Items: make([]apiv1.Node, len(nodes)),
|
Items: make([]apiv1.Node, len(nodes)),
|
||||||
|
@ -1010,14 +1010,6 @@ func printServiceList(list *api.ServiceList, options printers.PrintOptions) ([]m
|
|||||||
return rows, nil
|
return rows, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// backendStringer behaves just like a string interface and converts the given backend to a string.
|
|
||||||
func backendStringer(backend *networking.IngressBackend) string {
|
|
||||||
if backend == nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return fmt.Sprintf("%v:%v", backend.ServiceName, backend.ServicePort.String())
|
|
||||||
}
|
|
||||||
|
|
||||||
func formatHosts(rules []networking.IngressRule) string {
|
func formatHosts(rules []networking.IngressRule) string {
|
||||||
list := []string{}
|
list := []string{}
|
||||||
max := 3
|
max := 3
|
||||||
|
@ -327,15 +327,6 @@ func TestDeleteEndpointConnections(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type fakeClosable struct {
|
|
||||||
closed bool
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *fakeClosable) Close() error {
|
|
||||||
c.closed = true
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// fakePortOpener implements portOpener.
|
// fakePortOpener implements portOpener.
|
||||||
type fakePortOpener struct {
|
type fakePortOpener struct {
|
||||||
openPorts []*utilproxy.LocalPort
|
openPorts []*utilproxy.LocalPort
|
||||||
|
@ -18,7 +18,6 @@ package componentstatus
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"net/http"
|
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -31,11 +30,6 @@ const (
|
|||||||
probeTimeOut = 20 * time.Second
|
probeTimeOut = 20 * time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: this basic interface is duplicated in N places. consolidate?
|
|
||||||
type httpGet interface {
|
|
||||||
Get(url string) (*http.Response, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
type ValidatorFn func([]byte) error
|
type ValidatorFn func([]byte) error
|
||||||
|
|
||||||
type Server struct {
|
type Server struct {
|
||||||
|
@ -9,7 +9,6 @@ go_library(
|
|||||||
importpath = "k8s.io/kubernetes/pkg/scheduler/internal/queue",
|
importpath = "k8s.io/kubernetes/pkg/scheduler/internal/queue",
|
||||||
visibility = ["//pkg/scheduler:__subpackages__"],
|
visibility = ["//pkg/scheduler:__subpackages__"],
|
||||||
deps = [
|
deps = [
|
||||||
"//pkg/api/v1/pod:go_default_library",
|
|
||||||
"//pkg/scheduler/algorithm/predicates:go_default_library",
|
"//pkg/scheduler/algorithm/predicates:go_default_library",
|
||||||
"//pkg/scheduler/algorithm/priorities/util:go_default_library",
|
"//pkg/scheduler/algorithm/priorities/util:go_default_library",
|
||||||
"//pkg/scheduler/metrics:go_default_library",
|
"//pkg/scheduler/metrics:go_default_library",
|
||||||
|
@ -39,7 +39,6 @@ import (
|
|||||||
ktypes "k8s.io/apimachinery/pkg/types"
|
ktypes "k8s.io/apimachinery/pkg/types"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
"k8s.io/client-go/tools/cache"
|
"k8s.io/client-go/tools/cache"
|
||||||
podutil "k8s.io/kubernetes/pkg/api/v1/pod"
|
|
||||||
"k8s.io/kubernetes/pkg/scheduler/algorithm/predicates"
|
"k8s.io/kubernetes/pkg/scheduler/algorithm/predicates"
|
||||||
priorityutil "k8s.io/kubernetes/pkg/scheduler/algorithm/priorities/util"
|
priorityutil "k8s.io/kubernetes/pkg/scheduler/algorithm/priorities/util"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/metrics"
|
"k8s.io/kubernetes/pkg/scheduler/metrics"
|
||||||
@ -353,11 +352,6 @@ func (p *PriorityQueue) AddIfNotPresent(pod *v1.Pod) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func isPodUnschedulable(pod *v1.Pod) bool {
|
|
||||||
_, cond := podutil.GetPodCondition(&pod.Status, v1.PodScheduled)
|
|
||||||
return cond != nil && cond.Status == v1.ConditionFalse && cond.Reason == v1.PodReasonUnschedulable
|
|
||||||
}
|
|
||||||
|
|
||||||
// nsNameForPod returns a namespacedname for a pod
|
// nsNameForPod returns a namespacedname for a pod
|
||||||
func nsNameForPod(pod *v1.Pod) ktypes.NamespacedName {
|
func nsNameForPod(pod *v1.Pod) ktypes.NamespacedName {
|
||||||
return ktypes.NamespacedName{
|
return ktypes.NamespacedName{
|
||||||
|
@ -113,18 +113,6 @@ func TestDoCleanupMountPoint(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateDirEmpty(dir string) error {
|
|
||||||
files, err := ioutil.ReadDir(dir)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(files) != 0 {
|
|
||||||
return fmt.Errorf("Directory %q is not empty", dir)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func validateDirExists(dir string) error {
|
func validateDirExists(dir string) error {
|
||||||
_, err := ioutil.ReadDir(dir)
|
_, err := ioutil.ReadDir(dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -143,10 +131,3 @@ func validateDirNotExists(dir string) error {
|
|||||||
}
|
}
|
||||||
return fmt.Errorf("dir %q still exists", dir)
|
return fmt.Errorf("dir %q still exists", dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateFileExists(file string) error {
|
|
||||||
if _, err := os.Stat(file); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
@ -205,13 +205,6 @@ type detachCall struct {
|
|||||||
ret error
|
ret error
|
||||||
}
|
}
|
||||||
|
|
||||||
type diskIsAttachedCall struct {
|
|
||||||
diskName aws.KubernetesVolumeID
|
|
||||||
nodeName types.NodeName
|
|
||||||
isAttached bool
|
|
||||||
ret error
|
|
||||||
}
|
|
||||||
|
|
||||||
func (testcase *testcase) AttachDisk(diskName aws.KubernetesVolumeID, nodeName types.NodeName) (string, error) {
|
func (testcase *testcase) AttachDisk(diskName aws.KubernetesVolumeID, nodeName types.NodeName) (string, error) {
|
||||||
expected := &testcase.attach
|
expected := &testcase.attach
|
||||||
|
|
||||||
|
@ -454,27 +454,6 @@ func makeGlobalPDPath(host volume.VolumeHost, volumeID aws.KubernetesVolumeID) s
|
|||||||
return filepath.Join(host.GetPluginDir(awsElasticBlockStorePluginName), mount.MountsInGlobalPDPath, name)
|
return filepath.Join(host.GetPluginDir(awsElasticBlockStorePluginName), mount.MountsInGlobalPDPath, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reverses the mapping done in makeGlobalPDPath
|
|
||||||
func getVolumeIDFromGlobalMount(host volume.VolumeHost, globalPath string) (string, error) {
|
|
||||||
basePath := filepath.Join(host.GetPluginDir(awsElasticBlockStorePluginName), mount.MountsInGlobalPDPath)
|
|
||||||
rel, err := filepath.Rel(basePath, globalPath)
|
|
||||||
if err != nil {
|
|
||||||
klog.Errorf("Failed to get volume id from global mount %s - %v", globalPath, err)
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
if strings.Contains(rel, "../") {
|
|
||||||
klog.Errorf("Unexpected mount path: %s", globalPath)
|
|
||||||
return "", fmt.Errorf("unexpected mount path: " + globalPath)
|
|
||||||
}
|
|
||||||
// Reverse the :// replacement done in makeGlobalPDPath
|
|
||||||
volumeID := rel
|
|
||||||
if strings.HasPrefix(volumeID, "aws/") {
|
|
||||||
volumeID = strings.Replace(volumeID, "aws/", "aws://", 1)
|
|
||||||
}
|
|
||||||
klog.V(2).Info("Mapping mount dir ", globalPath, " to volumeID ", volumeID)
|
|
||||||
return volumeID, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ebs *awsElasticBlockStore) GetPath() string {
|
func (ebs *awsElasticBlockStore) GetPath() string {
|
||||||
return getPath(ebs.podUID, ebs.volName, ebs.plugin.host)
|
return getPath(ebs.podUID, ebs.volName, ebs.plugin.host)
|
||||||
}
|
}
|
||||||
|
@ -201,20 +201,6 @@ func verifyDevicePath(devicePaths []string) (string, error) {
|
|||||||
return "", nil
|
return "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the first path that exists, or empty string if none exist.
|
|
||||||
func verifyAllPathsRemoved(devicePaths []string) (bool, error) {
|
|
||||||
allPathsRemoved := true
|
|
||||||
for _, path := range devicePaths {
|
|
||||||
exists, err := mount.PathExists(path)
|
|
||||||
if err != nil {
|
|
||||||
return false, fmt.Errorf("Error checking if path exists: %v", err)
|
|
||||||
}
|
|
||||||
allPathsRemoved = allPathsRemoved && !exists
|
|
||||||
}
|
|
||||||
|
|
||||||
return allPathsRemoved, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns list of all paths for given EBS mount
|
// Returns list of all paths for given EBS mount
|
||||||
// This is more interesting on GCE (where we are able to identify volumes under /dev/disk-by-id)
|
// This is more interesting on GCE (where we are able to identify volumes under /dev/disk-by-id)
|
||||||
// Here it is mostly about applying the partition path
|
// Here it is mostly about applying the partition path
|
||||||
|
@ -894,12 +894,3 @@ func isV0Version(version string) bool {
|
|||||||
|
|
||||||
return parsedVersion.Major() == 0
|
return parsedVersion.Major() == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func isV1Version(version string) bool {
|
|
||||||
parsedVersion, err := utilversion.ParseGeneric(version)
|
|
||||||
if err != nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return parsedVersion.Major() == 1
|
|
||||||
}
|
|
||||||
|
@ -20,7 +20,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
"k8s.io/kubernetes/pkg/volume"
|
"k8s.io/kubernetes/pkg/volume"
|
||||||
volumetesting "k8s.io/kubernetes/pkg/volume/testing"
|
volumetesting "k8s.io/kubernetes/pkg/volume/testing"
|
||||||
"k8s.io/kubernetes/test/utils/harness"
|
"k8s.io/kubernetes/test/utils/harness"
|
||||||
@ -108,23 +107,6 @@ func fakeVolumeSpec() *volume.Spec {
|
|||||||
return volume.NewSpecFromVolume(vol)
|
return volume.NewSpecFromVolume(vol)
|
||||||
}
|
}
|
||||||
|
|
||||||
func fakePersistentVolumeSpec() *volume.Spec {
|
|
||||||
vol := &v1.PersistentVolume{
|
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
|
||||||
Name: "vol1",
|
|
||||||
},
|
|
||||||
Spec: v1.PersistentVolumeSpec{
|
|
||||||
PersistentVolumeSource: v1.PersistentVolumeSource{
|
|
||||||
FlexVolume: &v1.FlexPersistentVolumeSource{
|
|
||||||
Driver: "kubernetes.io/fakeAttacher",
|
|
||||||
ReadOnly: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
return volume.NewSpecFromPersistentVolume(vol, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
func specJSON(plugin *flexVolumeAttachablePlugin, spec *volume.Spec, extraOptions map[string]string) string {
|
func specJSON(plugin *flexVolumeAttachablePlugin, spec *volume.Spec, extraOptions map[string]string) string {
|
||||||
o, err := NewOptionsForDriver(spec, plugin.host, extraOptions)
|
o, err := NewOptionsForDriver(spec, plugin.host, extraOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -302,62 +302,3 @@ func TestIsReadOnly(t *testing.T) {
|
|||||||
b := &flockerVolumeMounter{readOnly: true}
|
b := &flockerVolumeMounter{readOnly: true}
|
||||||
assert.True(t, b.GetAttributes().ReadOnly)
|
assert.True(t, b.GetAttributes().ReadOnly)
|
||||||
}
|
}
|
||||||
|
|
||||||
type mockFlockerClient struct {
|
|
||||||
datasetID, primaryUUID, path string
|
|
||||||
datasetState *flockerapi.DatasetState
|
|
||||||
}
|
|
||||||
|
|
||||||
func newMockFlockerClient(mockDatasetID, mockPrimaryUUID, mockPath string) *mockFlockerClient {
|
|
||||||
return &mockFlockerClient{
|
|
||||||
datasetID: mockDatasetID,
|
|
||||||
primaryUUID: mockPrimaryUUID,
|
|
||||||
path: mockPath,
|
|
||||||
datasetState: &flockerapi.DatasetState{
|
|
||||||
Path: mockPath,
|
|
||||||
DatasetID: mockDatasetID,
|
|
||||||
Primary: mockPrimaryUUID,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m mockFlockerClient) CreateDataset(metaName string) (*flockerapi.DatasetState, error) {
|
|
||||||
return m.datasetState, nil
|
|
||||||
}
|
|
||||||
func (m mockFlockerClient) GetDatasetState(datasetID string) (*flockerapi.DatasetState, error) {
|
|
||||||
return m.datasetState, nil
|
|
||||||
}
|
|
||||||
func (m mockFlockerClient) GetDatasetID(metaName string) (string, error) {
|
|
||||||
return m.datasetID, nil
|
|
||||||
}
|
|
||||||
func (m mockFlockerClient) GetPrimaryUUID() (string, error) {
|
|
||||||
return m.primaryUUID, nil
|
|
||||||
}
|
|
||||||
func (m mockFlockerClient) UpdatePrimaryForDataset(primaryUUID, datasetID string) (*flockerapi.DatasetState, error) {
|
|
||||||
return m.datasetState, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
TODO: re-enable after refactor
|
|
||||||
func TestSetUpAtInternal(t *testing.T) {
|
|
||||||
const dir = "dir"
|
|
||||||
mockPath := "expected-to-be-set-properly" // package var
|
|
||||||
expectedPath := mockPath
|
|
||||||
|
|
||||||
assert := assert.New(t)
|
|
||||||
|
|
||||||
plugMgr, rootDir := newInitializedVolumePlugMgr(t)
|
|
||||||
if rootDir != "" {
|
|
||||||
defer os.RemoveAll(rootDir)
|
|
||||||
}
|
|
||||||
plug, err := plugMgr.FindPluginByName(flockerPluginName)
|
|
||||||
assert.NoError(err)
|
|
||||||
|
|
||||||
pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}}
|
|
||||||
b := flockerVolumeMounter{flockerVolume: &flockerVolume{pod: pod, plugin: plug.(*flockerPlugin)}}
|
|
||||||
b.client = newMockFlockerClient("dataset-id", "primary-uid", mockPath)
|
|
||||||
|
|
||||||
assert.NoError(b.SetUpAt(dir, nil))
|
|
||||||
assert.Equal(expectedPath, b.flocker.path)
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
@ -594,15 +594,6 @@ func createSecretMap(spec *volume.Spec, plugin *iscsiPlugin, namespace string) (
|
|||||||
return secret, err
|
return secret, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func createVolumeFromISCSIVolumeSource(volumeName string, iscsi v1.ISCSIVolumeSource) *v1.Volume {
|
|
||||||
return &v1.Volume{
|
|
||||||
Name: volumeName,
|
|
||||||
VolumeSource: v1.VolumeSource{
|
|
||||||
ISCSI: &iscsi,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func createPersistentVolumeFromISCSIPVSource(volumeName string, iscsi v1.ISCSIPersistentVolumeSource) *v1.PersistentVolume {
|
func createPersistentVolumeFromISCSIPVSource(volumeName string, iscsi v1.ISCSIPersistentVolumeSource) *v1.PersistentVolume {
|
||||||
block := v1.PersistentVolumeBlock
|
block := v1.PersistentVolumeBlock
|
||||||
return &v1.PersistentVolume{
|
return &v1.PersistentVolume{
|
||||||
|
@ -1193,20 +1193,6 @@ func makeSecret(namespace, name string) v1.Secret {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func configMap(namespace, name string) v1.ConfigMap {
|
|
||||||
return v1.ConfigMap{
|
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
|
||||||
Namespace: namespace,
|
|
||||||
Name: name,
|
|
||||||
},
|
|
||||||
Data: map[string]string{
|
|
||||||
"data-1": "value-1",
|
|
||||||
"data-2": "value-2",
|
|
||||||
"data-3": "value-3",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func makeProjection(name string, defaultMode int32, kind string) *v1.ProjectedVolumeSource {
|
func makeProjection(name string, defaultMode int32, kind string) *v1.ProjectedVolumeSource {
|
||||||
var item v1.VolumeProjection
|
var item v1.VolumeProjection
|
||||||
|
|
||||||
|
@ -1081,15 +1081,6 @@ func getVolumeAccessModes(spec *volume.Spec) ([]v1.PersistentVolumeAccessMode, e
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func parsePodSecret(pod *v1.Pod, secretName string, kubeClient clientset.Interface) (string, error) {
|
|
||||||
secret, err := volutil.GetSecretForPod(pod, secretName, kubeClient)
|
|
||||||
if err != nil {
|
|
||||||
klog.Errorf("failed to get secret from [%q/%q]: %+v", pod.Namespace, secretName, err)
|
|
||||||
return "", fmt.Errorf("failed to get secret from [%q/%q]: %+v", pod.Namespace, secretName, err)
|
|
||||||
}
|
|
||||||
return parseSecretMap(secret)
|
|
||||||
}
|
|
||||||
|
|
||||||
func parsePVSecret(namespace, secretName string, kubeClient clientset.Interface) (string, error) {
|
func parsePVSecret(namespace, secretName string, kubeClient clientset.Interface) (string, error) {
|
||||||
secret, err := volutil.GetSecretForPV(namespace, secretName, rbdPluginName, kubeClient)
|
secret, err := volutil.GetSecretForPV(namespace, secretName, rbdPluginName, kubeClient)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -27,14 +27,6 @@ import (
|
|||||||
siotypes "github.com/codedellemc/goscaleio/types/v1"
|
siotypes "github.com/codedellemc/goscaleio/types/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
type storageInterface interface {
|
|
||||||
CreateVolume(string, int64) (*siotypes.Volume, error)
|
|
||||||
AttachVolume(string, bool) (string, error)
|
|
||||||
IsAttached(string) (bool, error)
|
|
||||||
DetachVolume(string) error
|
|
||||||
DeleteVolume(string) error
|
|
||||||
}
|
|
||||||
|
|
||||||
type sioMgr struct {
|
type sioMgr struct {
|
||||||
client sioInterface
|
client sioInterface
|
||||||
configData map[string]string
|
configData map[string]string
|
||||||
|
@ -62,10 +62,6 @@ func TestCanSupport(t *testing.T) {
|
|||||||
type fakePDManager struct {
|
type fakePDManager struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func getFakeDeviceName(host volume.VolumeHost, volPath string) string {
|
|
||||||
return path.Join(host.GetPluginDir(vsphereVolumePluginName), "device", volPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (fake *fakePDManager) CreateVolume(v *vsphereVolumeProvisioner, selectedZone []string) (volSpec *VolumeSpec, err error) {
|
func (fake *fakePDManager) CreateVolume(v *vsphereVolumeProvisioner, selectedZone []string) (volSpec *VolumeSpec, err error) {
|
||||||
volSpec = &VolumeSpec{
|
volSpec = &VolumeSpec{
|
||||||
Path: "[local] test-volume-name.vmdk",
|
Path: "[local] test-volume-name.vmdk",
|
||||||
|
@ -80,13 +80,3 @@ func SetDefaults_ServiceReference(obj *ServiceReference) {
|
|||||||
obj.Port = utilpointer.Int32Ptr(443)
|
obj.Port = utilpointer.Int32Ptr(443)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// hasPerVersionColumns returns true if a CRD uses per-version columns.
|
|
||||||
func hasPerVersionColumns(versions []CustomResourceDefinitionVersion) bool {
|
|
||||||
for _, v := range versions {
|
|
||||||
if len(v.AdditionalPrinterColumns) > 0 {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
@ -54,10 +54,6 @@ func jsonTag(field reflect.StructField) (string, bool) {
|
|||||||
return tag, omitempty
|
return tag, omitempty
|
||||||
}
|
}
|
||||||
|
|
||||||
func formatValue(value interface{}) string {
|
|
||||||
return fmt.Sprintf("%v", value)
|
|
||||||
}
|
|
||||||
|
|
||||||
func isPointerKind(kind reflect.Kind) bool {
|
func isPointerKind(kind reflect.Kind) bool {
|
||||||
return kind == reflect.Ptr
|
return kind == reflect.Ptr
|
||||||
}
|
}
|
||||||
|
@ -211,10 +211,6 @@ func ResourceFinderForResult(result resource.Visitor) ResourceFinder {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func strPtr(val string) *string {
|
|
||||||
return &val
|
|
||||||
}
|
|
||||||
|
|
||||||
func boolPtr(val bool) *bool {
|
func boolPtr(val bool) *bool {
|
||||||
return &val
|
return &val
|
||||||
}
|
}
|
||||||
|
@ -30,10 +30,6 @@ import (
|
|||||||
var scaleConverter = NewScaleConverter()
|
var scaleConverter = NewScaleConverter()
|
||||||
var codecs = serializer.NewCodecFactory(scaleConverter.Scheme())
|
var codecs = serializer.NewCodecFactory(scaleConverter.Scheme())
|
||||||
|
|
||||||
// restInterfaceProvider turns a restclient.Config into a restclient.Interface.
|
|
||||||
// It's overridable for the purposes of testing.
|
|
||||||
type restInterfaceProvider func(*restclient.Config) (restclient.Interface, error)
|
|
||||||
|
|
||||||
// scaleClient is an implementation of ScalesGetter
|
// scaleClient is an implementation of ScalesGetter
|
||||||
// which makes use of a RESTMapper and a generic REST
|
// which makes use of a RESTMapper and a generic REST
|
||||||
// client to support an discoverable resource.
|
// client to support an discoverable resource.
|
||||||
|
@ -25,7 +25,6 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
@ -113,11 +112,6 @@ func NewNamedReflector(name string, lw ListerWatcher, expectedType interface{},
|
|||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeValidPrometheusMetricLabel(in string) string {
|
|
||||||
// this isn't perfect, but it removes our common characters
|
|
||||||
return strings.NewReplacer("/", "_", ".", "_", "-", "_", ":", "_").Replace(in)
|
|
||||||
}
|
|
||||||
|
|
||||||
// internalPackages are packages that ignored when creating a default reflector name. These packages are in the common
|
// internalPackages are packages that ignored when creating a default reflector name. These packages are in the common
|
||||||
// call chains to NewReflector, so they'd be low entropy names for reflectors
|
// call chains to NewReflector, so they'd be low entropy names for reflectors
|
||||||
var internalPackages = []string{"client-go/tools/cache/"}
|
var internalPackages = []string{"client-go/tools/cache/"}
|
||||||
|
@ -94,23 +94,6 @@ var metricsFactory = struct {
|
|||||||
metricsProvider: noopMetricsProvider{},
|
metricsProvider: noopMetricsProvider{},
|
||||||
}
|
}
|
||||||
|
|
||||||
func newReflectorMetrics(name string) *reflectorMetrics {
|
|
||||||
var ret *reflectorMetrics
|
|
||||||
if len(name) == 0 {
|
|
||||||
return ret
|
|
||||||
}
|
|
||||||
return &reflectorMetrics{
|
|
||||||
numberOfLists: metricsFactory.metricsProvider.NewListsMetric(name),
|
|
||||||
listDuration: metricsFactory.metricsProvider.NewListDurationMetric(name),
|
|
||||||
numberOfItemsInList: metricsFactory.metricsProvider.NewItemsInListMetric(name),
|
|
||||||
numberOfWatches: metricsFactory.metricsProvider.NewWatchesMetric(name),
|
|
||||||
numberOfShortWatches: metricsFactory.metricsProvider.NewShortWatchesMetric(name),
|
|
||||||
watchDuration: metricsFactory.metricsProvider.NewWatchDurationMetric(name),
|
|
||||||
numberOfItemsInWatch: metricsFactory.metricsProvider.NewItemsInWatchMetric(name),
|
|
||||||
lastResourceVersion: metricsFactory.metricsProvider.NewLastResourceVersionMetric(name),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetReflectorMetricsProvider sets the metrics provider
|
// SetReflectorMetricsProvider sets the metrics provider
|
||||||
func SetReflectorMetricsProvider(metricsProvider MetricsProvider) {
|
func SetReflectorMetricsProvider(metricsProvider MetricsProvider) {
|
||||||
metricsFactory.setProviders.Do(func() {
|
metricsFactory.setProviders.Do(func() {
|
||||||
|
@ -296,16 +296,6 @@ func makeUserIdentificationConfig(info clientauth.Info) *restclient.Config {
|
|||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
|
||||||
// makeUserIdentificationFieldsConfig returns a client.Config capable of being merged using mergo for only server identification information
|
|
||||||
func makeServerIdentificationConfig(info clientauth.Info) restclient.Config {
|
|
||||||
config := restclient.Config{}
|
|
||||||
config.CAFile = info.CAFile
|
|
||||||
if info.Insecure != nil {
|
|
||||||
config.Insecure = *info.Insecure
|
|
||||||
}
|
|
||||||
return config
|
|
||||||
}
|
|
||||||
|
|
||||||
func canIdentifyUser(config restclient.Config) bool {
|
func canIdentifyUser(config restclient.Config) bool {
|
||||||
return len(config.Username) > 0 ||
|
return len(config.Username) > 0 ||
|
||||||
(len(config.CertFile) > 0 || len(config.CertData) > 0) ||
|
(len(config.CertFile) > 0 || len(config.CertData) > 0) ||
|
||||||
|
@ -23,7 +23,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
@ -289,12 +288,6 @@ func (s *fileStore) filename(qualifier string) string {
|
|||||||
return s.pairNamePrefix + "-" + qualifier + pemExtension
|
return s.pairNamePrefix + "-" + qualifier + pemExtension
|
||||||
}
|
}
|
||||||
|
|
||||||
// withoutExt returns the given filename after removing the extension. The
|
|
||||||
// extension to remove will be the result of filepath.Ext().
|
|
||||||
func withoutExt(filename string) string {
|
|
||||||
return strings.TrimSuffix(filename, filepath.Ext(filename))
|
|
||||||
}
|
|
||||||
|
|
||||||
func loadX509KeyPair(certFile, keyFile string) (*tls.Certificate, error) {
|
func loadX509KeyPair(certFile, keyFile string) (*tls.Certificate, error) {
|
||||||
cert, err := tls.LoadX509KeyPair(certFile, keyFile)
|
cert, err := tls.LoadX509KeyPair(certFile, keyFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -14,7 +14,6 @@ go_library(
|
|||||||
"groupinterface.go",
|
"groupinterface.go",
|
||||||
"informer.go",
|
"informer.go",
|
||||||
"packages.go",
|
"packages.go",
|
||||||
"tags.go",
|
|
||||||
"types.go",
|
"types.go",
|
||||||
"versioninterface.go",
|
"versioninterface.go",
|
||||||
],
|
],
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
/*
|
|
||||||
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 generators
|
|
||||||
|
|
||||||
import (
|
|
||||||
"k8s.io/gengo/types"
|
|
||||||
"k8s.io/klog"
|
|
||||||
)
|
|
||||||
|
|
||||||
// extractBoolTagOrDie gets the comment-tags for the key and asserts that, if
|
|
||||||
// it exists, the value is boolean. If the tag did not exist, it returns
|
|
||||||
// false.
|
|
||||||
func extractBoolTagOrDie(key string, lines []string) bool {
|
|
||||||
val, err := types.ExtractSingleBoolCommentTag("+", key, false, lines)
|
|
||||||
if err != nil {
|
|
||||||
klog.Fatal(err)
|
|
||||||
}
|
|
||||||
return val
|
|
||||||
}
|
|
@ -10,7 +10,6 @@ go_library(
|
|||||||
srcs = [
|
srcs = [
|
||||||
"expansion.go",
|
"expansion.go",
|
||||||
"lister.go",
|
"lister.go",
|
||||||
"tags.go",
|
|
||||||
],
|
],
|
||||||
importmap = "k8s.io/kubernetes/vendor/k8s.io/code-generator/cmd/lister-gen/generators",
|
importmap = "k8s.io/kubernetes/vendor/k8s.io/code-generator/cmd/lister-gen/generators",
|
||||||
importpath = "k8s.io/code-generator/cmd/lister-gen/generators",
|
importpath = "k8s.io/code-generator/cmd/lister-gen/generators",
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
/*
|
|
||||||
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 generators
|
|
||||||
|
|
||||||
import (
|
|
||||||
"k8s.io/gengo/types"
|
|
||||||
"k8s.io/klog"
|
|
||||||
)
|
|
||||||
|
|
||||||
// extractBoolTagOrDie gets the comment-tags for the key and asserts that, if
|
|
||||||
// it exists, the value is boolean. If the tag did not exist, it returns
|
|
||||||
// false.
|
|
||||||
func extractBoolTagOrDie(key string, lines []string) bool {
|
|
||||||
val, err := types.ExtractSingleBoolCommentTag("+", key, false, lines)
|
|
||||||
if err != nil {
|
|
||||||
klog.Fatal(err)
|
|
||||||
}
|
|
||||||
return val
|
|
||||||
}
|
|
@ -300,18 +300,6 @@ func (v *visitor) Visit(node ast.Node) (w ast.Visitor) {
|
|||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
func scandir(dir string) {
|
|
||||||
v := newVisitor()
|
|
||||||
pkg, err := parser.ParseDir(v.FileSet, dir, nil, parser.ParseComments)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, p := range pkg {
|
|
||||||
ast.Walk(v, p)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func scanfile(path string, src interface{}) []conformanceData {
|
func scanfile(path string, src interface{}) []conformanceData {
|
||||||
v := newVisitor()
|
v := newVisitor()
|
||||||
file, err := parser.ParseFile(v.FileSet, path, src, parser.ParseComments)
|
file, err := parser.ParseFile(v.FileSet, path, src, parser.ParseComments)
|
||||||
|
@ -36,27 +36,6 @@ import (
|
|||||||
imageutils "k8s.io/kubernetes/test/utils/image"
|
imageutils "k8s.io/kubernetes/test/utils/image"
|
||||||
)
|
)
|
||||||
|
|
||||||
func stagingClientPod(name, value string) v1.Pod {
|
|
||||||
return v1.Pod{
|
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
|
||||||
Name: name,
|
|
||||||
Labels: map[string]string{
|
|
||||||
"name": "foo",
|
|
||||||
"time": value,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Spec: v1.PodSpec{
|
|
||||||
Containers: []v1.Container{
|
|
||||||
{
|
|
||||||
Name: "nginx",
|
|
||||||
Image: imageutils.GetE2EImage(imageutils.Nginx),
|
|
||||||
Ports: []v1.ContainerPort{{ContainerPort: 80}},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func testingPod(name, value string) v1.Pod {
|
func testingPod(name, value string) v1.Pod {
|
||||||
return v1.Pod{
|
return v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
@ -98,34 +77,6 @@ func observeCreation(w watch.Interface) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func observeObjectDeletion(w watch.Interface) (obj runtime.Object) {
|
|
||||||
// output to give us a duration to failure. Maybe we aren't getting the
|
|
||||||
// full timeout for some reason. My guess would be watch failure
|
|
||||||
framework.Logf("Starting to observe pod deletion")
|
|
||||||
deleted := false
|
|
||||||
timeout := false
|
|
||||||
timer := time.After(framework.DefaultPodDeletionTimeout)
|
|
||||||
for !deleted && !timeout {
|
|
||||||
select {
|
|
||||||
case event, normal := <-w.ResultChan():
|
|
||||||
if !normal {
|
|
||||||
framework.Failf("The channel was closed unexpectedly")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if event.Type == watch.Deleted {
|
|
||||||
obj = event.Object
|
|
||||||
deleted = true
|
|
||||||
}
|
|
||||||
case <-timer:
|
|
||||||
timeout = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !deleted {
|
|
||||||
framework.Failf("Failed to observe pod deletion")
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func observerUpdate(w watch.Interface, expectedUpdate func(runtime.Object) bool) {
|
func observerUpdate(w watch.Interface, expectedUpdate func(runtime.Object) bool) {
|
||||||
timer := time.After(30 * time.Second)
|
timer := time.After(30 * time.Second)
|
||||||
updated := false
|
updated := false
|
||||||
|
@ -27,7 +27,6 @@ import (
|
|||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/intstr"
|
"k8s.io/apimachinery/pkg/util/intstr"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
|
||||||
"k8s.io/kubernetes/test/e2e/framework"
|
"k8s.io/kubernetes/test/e2e/framework"
|
||||||
imageutils "k8s.io/kubernetes/test/utils/image"
|
imageutils "k8s.io/kubernetes/test/utils/image"
|
||||||
|
|
||||||
@ -82,23 +81,6 @@ func extinguish(f *framework.Framework, totalNS int, maxAllowedAfterDel int, max
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
func waitForPodInNamespace(c clientset.Interface, ns, podName string) *v1.Pod {
|
|
||||||
var pod *v1.Pod
|
|
||||||
var err error
|
|
||||||
err = wait.PollImmediate(2*time.Second, 15*time.Second, func() (bool, error) {
|
|
||||||
pod, err = c.CoreV1().Pods(ns).Get(podName, metav1.GetOptions{})
|
|
||||||
if errors.IsNotFound(err) {
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
return true, nil
|
|
||||||
})
|
|
||||||
gomega.Expect(err).NotTo(gomega.HaveOccurred(), "failed to get pod %s in namespace: %s", podName, ns)
|
|
||||||
return pod
|
|
||||||
}
|
|
||||||
|
|
||||||
func ensurePodsAreRemovedWhenNamespaceIsDeleted(f *framework.Framework) {
|
func ensurePodsAreRemovedWhenNamespaceIsDeleted(f *framework.Framework) {
|
||||||
ginkgo.By("Creating a test namespace")
|
ginkgo.By("Creating a test namespace")
|
||||||
namespaceName := "nsdeletetest"
|
namespaceName := "nsdeletetest"
|
||||||
|
@ -1362,17 +1362,6 @@ func newTestResourceQuotaWithScopeForPriorityClass(name string, hard v1.Resource
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// newTestResourceQuotaForEphemeralStorage returns a quota that enforces default constraints for testing feature LocalStorageCapacityIsolation
|
|
||||||
func newTestResourceQuotaForEphemeralStorage(name string) *v1.ResourceQuota {
|
|
||||||
hard := v1.ResourceList{}
|
|
||||||
hard[v1.ResourceEphemeralStorage] = resource.MustParse("500Mi")
|
|
||||||
hard[v1.ResourceQuotas] = resource.MustParse("1")
|
|
||||||
return &v1.ResourceQuota{
|
|
||||||
ObjectMeta: metav1.ObjectMeta{Name: name},
|
|
||||||
Spec: v1.ResourceQuotaSpec{Hard: hard},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// newTestResourceQuota returns a quota that enforces default constraints for testing
|
// newTestResourceQuota returns a quota that enforces default constraints for testing
|
||||||
func newTestResourceQuota(name string) *v1.ResourceQuota {
|
func newTestResourceQuota(name string) *v1.ResourceQuota {
|
||||||
hard := v1.ResourceList{}
|
hard := v1.ResourceList{}
|
||||||
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||||||
package autoscaling
|
package autoscaling
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"math"
|
"math"
|
||||||
@ -1187,30 +1186,6 @@ func disableAutoscaler(nodePool string, minCount, maxCount int) error {
|
|||||||
return fmt.Errorf("autoscaler still enabled, last error: %v", finalErr)
|
return fmt.Errorf("autoscaler still enabled, last error: %v", finalErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func executeHTTPRequest(method string, url string, body string) (string, error) {
|
|
||||||
client := &http.Client{}
|
|
||||||
req, err := http.NewRequest(method, url, strings.NewReader(body))
|
|
||||||
if err != nil {
|
|
||||||
By(fmt.Sprintf("Can't create request: %s", err.Error()))
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
resp, err := client.Do(req)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
respBody, err := ioutil.ReadAll(resp.Body)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
if resp.StatusCode != http.StatusOK {
|
|
||||||
return "", fmt.Errorf("error: %s %s", resp.Status, string(respBody))
|
|
||||||
}
|
|
||||||
|
|
||||||
return string(respBody), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func addNodePool(name string, machineType string, numNodes int) {
|
func addNodePool(name string, machineType string, numNodes int) {
|
||||||
args := []string{"container", "node-pools", "create", name, "--quiet",
|
args := []string{"container", "node-pools", "create", name, "--quiet",
|
||||||
"--machine-type=" + machineType,
|
"--machine-type=" + machineType,
|
||||||
@ -1297,26 +1272,6 @@ func getPoolSize(f *framework.Framework, poolName string) int {
|
|||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
func doPut(url, content string) (string, error) {
|
|
||||||
req, err := http.NewRequest("PUT", url, bytes.NewBuffer([]byte(content)))
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
req.Header.Set("Content-Type", "application/json")
|
|
||||||
client := &http.Client{}
|
|
||||||
resp, err := client.Do(req)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
body, err := ioutil.ReadAll(resp.Body)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
strBody := string(body)
|
|
||||||
return strBody, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func reserveMemory(f *framework.Framework, id string, replicas, megabytes int, expectRunning bool, timeout time.Duration, selector map[string]string, tolerations []v1.Toleration, priorityClassName string) func() error {
|
func reserveMemory(f *framework.Framework, id string, replicas, megabytes int, expectRunning bool, timeout time.Duration, selector map[string]string, tolerations []v1.Toleration, priorityClassName string) func() error {
|
||||||
By(fmt.Sprintf("Running RC which reserves %v MB of memory", megabytes))
|
By(fmt.Sprintf("Running RC which reserves %v MB of memory", megabytes))
|
||||||
request := int64(1024 * 1024 * megabytes / replicas)
|
request := int64(1024 * 1024 * megabytes / replicas)
|
||||||
@ -1750,14 +1705,6 @@ func runReplicatedPodOnEachNode(f *framework.Framework, nodes []v1.Node, namespa
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// wrap runReplicatedPodOnEachNode to return cleanup
|
|
||||||
func runReplicatedPodOnEachNodeWithCleanup(f *framework.Framework, nodes []v1.Node, namespace string, podsPerNode int, id string, labels map[string]string, memRequest int64) (func(), error) {
|
|
||||||
err := runReplicatedPodOnEachNode(f, nodes, namespace, podsPerNode, id, labels, memRequest)
|
|
||||||
return func() {
|
|
||||||
framework.DeleteRCAndWaitForGC(f.ClientSet, namespace, id)
|
|
||||||
}, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Increase cluster size by newNodesForScaledownTests to create some unused nodes
|
// Increase cluster size by newNodesForScaledownTests to create some unused nodes
|
||||||
// that can be later removed by cluster autoscaler.
|
// that can be later removed by cluster autoscaler.
|
||||||
func manuallyIncreaseClusterSize(f *framework.Framework, originalSizes map[string]int) int {
|
func manuallyIncreaseClusterSize(f *framework.Framework, originalSizes map[string]int) int {
|
||||||
|
@ -39,14 +39,6 @@ func nodeNames(nodes []v1.Node) []string {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func podNames(pods []v1.Pod) []string {
|
|
||||||
result := make([]string, 0, len(pods))
|
|
||||||
for i := range pods {
|
|
||||||
result = append(result, pods[i].Name)
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ = Describe("Recreate [Feature:Recreate]", func() {
|
var _ = Describe("Recreate [Feature:Recreate]", func() {
|
||||||
f := framework.NewDefaultFramework("recreate")
|
f := framework.NewDefaultFramework("recreate")
|
||||||
var originalNodes []v1.Node
|
var originalNodes []v1.Node
|
||||||
|
@ -858,29 +858,6 @@ func executeBacksideBacksideHTTPSTest(f *framework.Framework, jig *ingress.TestJ
|
|||||||
Expect(err).NotTo(HaveOccurred(), "Failed to verify backside re-encryption ingress")
|
Expect(err).NotTo(HaveOccurred(), "Failed to verify backside re-encryption ingress")
|
||||||
}
|
}
|
||||||
|
|
||||||
func detectHTTPVersionAndSchemeTest(f *framework.Framework, jig *ingress.TestJig, address, version, scheme string) {
|
|
||||||
timeoutClient := &http.Client{Timeout: ingress.IngressReqTimeout}
|
|
||||||
resp := ""
|
|
||||||
err := wait.PollImmediate(framework.LoadBalancerPollInterval, framework.LoadBalancerPollTimeout, func() (bool, error) {
|
|
||||||
var err error
|
|
||||||
resp, err = framework.SimpleGET(timeoutClient, fmt.Sprintf("http://%s", address), "")
|
|
||||||
if err != nil {
|
|
||||||
framework.Logf("SimpleGET failed: %v", err)
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
if !strings.Contains(resp, version) {
|
|
||||||
framework.Logf("Waiting for transition to HTTP/2")
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
if !strings.Contains(resp, scheme) {
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
framework.Logf("Poll succeeded, request was served by HTTP2")
|
|
||||||
return true, nil
|
|
||||||
})
|
|
||||||
Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("Failed to get %s or %s, response body: %s", version, scheme, resp))
|
|
||||||
}
|
|
||||||
|
|
||||||
func detectNegAnnotation(f *framework.Framework, jig *ingress.TestJig, gceController *gce.IngressController, ns, name string, negs int) {
|
func detectNegAnnotation(f *framework.Framework, jig *ingress.TestJig, gceController *gce.IngressController, ns, name string, negs int) {
|
||||||
if err := wait.Poll(5*time.Second, negUpdateTimeout, func() (bool, error) {
|
if err := wait.Poll(5*time.Second, negUpdateTimeout, func() (bool, error) {
|
||||||
svc, err := f.ClientSet.CoreV1().Services(ns).Get(name, metav1.GetOptions{})
|
svc, err := f.ClientSet.CoreV1().Services(ns).Get(name, metav1.GetOptions{})
|
||||||
|
@ -287,18 +287,6 @@ var _ = SIGDescribe("[Feature:PodPreset] PodPreset", func() {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
func getPodPreset(c clientset.Interface, ns, name string) (*settings.PodPreset, error) {
|
|
||||||
return c.SettingsV1alpha1().PodPresets(ns).Get(name, metav1.GetOptions{})
|
|
||||||
}
|
|
||||||
|
|
||||||
func createPodPreset(c clientset.Interface, ns string, job *settings.PodPreset) (*settings.PodPreset, error) {
|
func createPodPreset(c clientset.Interface, ns string, job *settings.PodPreset) (*settings.PodPreset, error) {
|
||||||
return c.SettingsV1alpha1().PodPresets(ns).Create(job)
|
return c.SettingsV1alpha1().PodPresets(ns).Create(job)
|
||||||
}
|
}
|
||||||
|
|
||||||
func updatePodPreset(c clientset.Interface, ns string, job *settings.PodPreset) (*settings.PodPreset, error) {
|
|
||||||
return c.SettingsV1alpha1().PodPresets(ns).Update(job)
|
|
||||||
}
|
|
||||||
|
|
||||||
func deletePodPreset(c clientset.Interface, ns, name string) error {
|
|
||||||
return c.SettingsV1alpha1().PodPresets(ns).Delete(name, nil)
|
|
||||||
}
|
|
||||||
|
@ -57,9 +57,7 @@ go_library(
|
|||||||
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/strategicpatch:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/strategicpatch:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/uuid:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/uuid:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/version:go_default_library",
|
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/version:go_default_library",
|
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/watch:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/watch:go_default_library",
|
||||||
"//staging/src/k8s.io/apiserver/pkg/authentication/serviceaccount:go_default_library",
|
"//staging/src/k8s.io/apiserver/pkg/authentication/serviceaccount:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||||
|
@ -47,17 +47,6 @@ var (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func csiContainerImage(image string) string {
|
|
||||||
var fullName string
|
|
||||||
fullName += *csiImageRegistry + "/" + image + ":"
|
|
||||||
if *csiImageVersion != "" {
|
|
||||||
fullName += *csiImageVersion
|
|
||||||
} else {
|
|
||||||
fullName += csiImageVersions[image]
|
|
||||||
}
|
|
||||||
return fullName
|
|
||||||
}
|
|
||||||
|
|
||||||
func shredFile(filePath string) {
|
func shredFile(filePath string) {
|
||||||
if _, err := os.Stat(filePath); os.IsNotExist(err) {
|
if _, err := os.Stat(filePath); os.IsNotExist(err) {
|
||||||
framework.Logf("File %v was not found, skipping shredding", filePath)
|
framework.Logf("File %v was not found, skipping shredding", filePath)
|
||||||
|
@ -27,9 +27,6 @@ import (
|
|||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
apierrs "k8s.io/apimachinery/pkg/api/errors"
|
apierrs "k8s.io/apimachinery/pkg/api/errors"
|
||||||
versionutil "k8s.io/apimachinery/pkg/util/version"
|
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
|
||||||
"k8s.io/apimachinery/pkg/version"
|
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
"k8s.io/kubernetes/test/e2e/framework"
|
"k8s.io/kubernetes/test/e2e/framework"
|
||||||
"k8s.io/kubernetes/test/e2e/framework/testfiles"
|
"k8s.io/kubernetes/test/e2e/framework/testfiles"
|
||||||
@ -144,24 +141,6 @@ func sshAndLog(cmd, host string, failOnError bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func getMasterVersion(c clientset.Interface) (*versionutil.Version, error) {
|
|
||||||
var err error
|
|
||||||
var v *version.Info
|
|
||||||
waitErr := wait.PollImmediate(5*time.Second, 2*time.Minute, func() (bool, error) {
|
|
||||||
v, err = c.Discovery().ServerVersion()
|
|
||||||
return err == nil, nil
|
|
||||||
})
|
|
||||||
if waitErr != nil {
|
|
||||||
return nil, fmt.Errorf("Could not get the master version: %v", waitErr)
|
|
||||||
}
|
|
||||||
|
|
||||||
return versionutil.MustParseSemantic(v.GitVersion), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func getNodeVersion(node *v1.Node) *versionutil.Version {
|
|
||||||
return versionutil.MustParseSemantic(node.Status.NodeInfo.KubeletVersion)
|
|
||||||
}
|
|
||||||
|
|
||||||
func getHostFromHostPort(hostPort string) string {
|
func getHostFromHostPort(hostPort string) string {
|
||||||
// try to split host and port
|
// try to split host and port
|
||||||
var host string
|
var host string
|
||||||
|
@ -542,30 +542,6 @@ func getTwoRandomZones(c clientset.Interface) []string {
|
|||||||
return []string{zone1, zone2}
|
return []string{zone1, zone2}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Waits for at least 1 replica of a StatefulSet to become not ready or until timeout occurs, whichever comes first.
|
|
||||||
func waitForStatefulSetReplicasNotReady(statefulSetName, ns string, c clientset.Interface) error {
|
|
||||||
const poll = 3 * time.Second
|
|
||||||
const timeout = statefulSetReadyTimeout
|
|
||||||
|
|
||||||
framework.Logf("Waiting up to %v for StatefulSet %s to have at least 1 replica to become not ready", timeout, statefulSetName)
|
|
||||||
for start := time.Now(); time.Since(start) < timeout; time.Sleep(poll) {
|
|
||||||
sts, err := c.AppsV1().StatefulSets(ns).Get(statefulSetName, metav1.GetOptions{})
|
|
||||||
if err != nil {
|
|
||||||
framework.Logf("Get StatefulSet %s failed, ignoring for %v: %v", statefulSetName, poll, err)
|
|
||||||
continue
|
|
||||||
} else {
|
|
||||||
if sts.Status.ReadyReplicas < *sts.Spec.Replicas {
|
|
||||||
framework.Logf("%d replicas are ready out of a total of %d replicas in StatefulSet %s. (%v)",
|
|
||||||
sts.Status.ReadyReplicas, *sts.Spec.Replicas, statefulSetName, time.Since(start))
|
|
||||||
return nil
|
|
||||||
} else {
|
|
||||||
framework.Logf("StatefulSet %s found but there are %d ready replicas and %d total replicas.", statefulSetName, sts.Status.ReadyReplicas, *sts.Spec.Replicas)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return fmt.Errorf("All replicas in StatefulSet %s are still ready within %v", statefulSetName, timeout)
|
|
||||||
}
|
|
||||||
|
|
||||||
// If match is true, check if zones in PV exactly match zones given.
|
// If match is true, check if zones in PV exactly match zones given.
|
||||||
// Otherwise, check whether zones in PV is superset of zones given.
|
// Otherwise, check whether zones in PV is superset of zones given.
|
||||||
func verifyZonesInPV(volume *v1.PersistentVolume, zones sets.String, match bool) error {
|
func verifyZonesInPV(volume *v1.PersistentVolume, zones sets.String, match bool) error {
|
||||||
|
@ -641,14 +641,6 @@ func volumeFormatPod(f *framework.Framework, volumeSource *v1.VolumeSource) *v1.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func clearSubpathPodCommands(pod *v1.Pod) {
|
|
||||||
pod.Spec.InitContainers[0].Command = nil
|
|
||||||
pod.Spec.InitContainers[1].Args = nil
|
|
||||||
pod.Spec.InitContainers[2].Args = nil
|
|
||||||
pod.Spec.Containers[0].Args = nil
|
|
||||||
pod.Spec.Containers[1].Args = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func setInitCommand(pod *v1.Pod, command string) {
|
func setInitCommand(pod *v1.Pod, command string) {
|
||||||
pod.Spec.InitContainers[0].Command = []string{"/bin/sh", "-ec", command}
|
pod.Spec.InitContainers[0].Command = []string{"/bin/sh", "-ec", command}
|
||||||
}
|
}
|
||||||
|
@ -53,16 +53,6 @@ func isSharedPIDNamespaceSupported() (bool, error) {
|
|||||||
return version.GTE(semver.MustParse("1.26.0")), nil
|
return version.GTE(semver.MustParse("1.26.0")), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// isDockerNoNewPrivilegesSupported returns true if Docker version is 1.11+
|
|
||||||
// (API version 1.23+), and false otherwise.
|
|
||||||
func isDockerNoNewPrivilegesSupported() (bool, error) {
|
|
||||||
version, err := getDockerAPIVersion()
|
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
return version.GTE(semver.MustParse("1.23.0")), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// isDockerLiveRestoreSupported returns true if live-restore is supported in
|
// isDockerLiveRestoreSupported returns true if live-restore is supported in
|
||||||
// the current Docker version.
|
// the current Docker version.
|
||||||
func isDockerLiveRestoreSupported() (bool, error) {
|
func isDockerLiveRestoreSupported() (bool, error) {
|
||||||
|
@ -85,23 +85,6 @@ func (n *NodeE2ERemote) SetupTestPackage(tardir, systemSpecName string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// dest is relative to the root of the tar
|
|
||||||
func tarAddFile(tar, source, dest string) error {
|
|
||||||
dir := filepath.Dir(dest)
|
|
||||||
tardir := filepath.Join(tar, dir)
|
|
||||||
tardest := filepath.Join(tar, dest)
|
|
||||||
|
|
||||||
out, err := exec.Command("mkdir", "-p", tardir).CombinedOutput()
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to create archive bin subdir %q, was dest for file %q. Err: %v. Output:\n%s", tardir, source, err, out)
|
|
||||||
}
|
|
||||||
out, err = exec.Command("cp", source, tardest).CombinedOutput()
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to copy file %q to the archive bin subdir %q. Err: %v. Output:\n%s", source, tardir, err, out)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// prependCOSMounterFlag prepends the flag for setting the GCI mounter path to
|
// prependCOSMounterFlag prepends the flag for setting the GCI mounter path to
|
||||||
// args and returns the result.
|
// args and returns the result.
|
||||||
func prependCOSMounterFlag(args, host, workspace string) (string, error) {
|
func prependCOSMounterFlag(args, host, workspace string) (string, error) {
|
||||||
|
@ -33,11 +33,6 @@ import (
|
|||||||
|
|
||||||
type runnerMap map[string]common.Runner
|
type runnerMap map[string]common.Runner
|
||||||
|
|
||||||
type runRequestJSON struct {
|
|
||||||
runner string
|
|
||||||
options interface{}
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// flags for the command line. See usage args below for
|
// flags for the command line. See usage args below for
|
||||||
// descriptions.
|
// descriptions.
|
||||||
@ -157,6 +152,3 @@ func handleRunRequest(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
fmt.Fprintf(w, "ok\noutput:\n\n"+output.b.String())
|
fmt.Fprintf(w, "ok\noutput:\n\n"+output.b.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
func setupLogger() {
|
|
||||||
}
|
|
||||||
|
@ -62,11 +62,6 @@ func (a *atomicBool) get() bool {
|
|||||||
return atomic.LoadInt32(&a.v) == 1
|
return atomic.LoadInt32(&a.v) == 1
|
||||||
}
|
}
|
||||||
|
|
||||||
type output struct {
|
|
||||||
responses []string
|
|
||||||
errors []string
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
flag.IntVar(&httpPort, "http-port", 8080, "HTTP Listen Port")
|
flag.IntVar(&httpPort, "http-port", 8080, "HTTP Listen Port")
|
||||||
flag.IntVar(&udpPort, "udp-port", 8081, "UDP Listen Port")
|
flag.IntVar(&udpPort, "udp-port", 8081, "UDP Listen Port")
|
||||||
|
@ -21,7 +21,6 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
cliflag "k8s.io/component-base/cli/flag"
|
cliflag "k8s.io/component-base/cli/flag"
|
||||||
@ -66,16 +65,6 @@ func (m *masqTestProxy) Run() error {
|
|||||||
return http.ListenAndServe(":"+m.Port, nil)
|
return http.ListenAndServe(":"+m.Port, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
type handler func(http.ResponseWriter, *http.Request)
|
|
||||||
|
|
||||||
func joinErrors(errs []error, sep string) string {
|
|
||||||
strs := make([]string, len(errs))
|
|
||||||
for i, err := range errs {
|
|
||||||
strs[i] = err.Error()
|
|
||||||
}
|
|
||||||
return strings.Join(strs, sep)
|
|
||||||
}
|
|
||||||
|
|
||||||
func checknosnatURL(pip, ips string) string {
|
func checknosnatURL(pip, ips string) string {
|
||||||
return fmt.Sprintf("http://%s/checknosnat?ips=%s", pip, ips)
|
return fmt.Sprintf("http://%s/checknosnat?ips=%s", pip, ips)
|
||||||
}
|
}
|
||||||
|
@ -258,12 +258,3 @@ func (e *transformTest) printMetrics() error {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func contains(s []string, e string) bool {
|
|
||||||
for _, a := range s {
|
|
||||||
if a == e {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
@ -589,17 +589,6 @@ func podScheduled(c clientset.Interface, podNamespace, podName string) wait.Cond
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// podUnschedulable returns a condition function that returns true if the given pod
|
|
||||||
// gets unschedulable status.
|
|
||||||
func podSchedulableCondition(c clientset.Interface, podNamespace, podName string) (*v1.PodCondition, error) {
|
|
||||||
pod, err := c.CoreV1().Pods(podNamespace).Get(podName, metav1.GetOptions{})
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
_, cond := podutil.GetPodCondition(&pod.Status, v1.PodScheduled)
|
|
||||||
return cond, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// podUnschedulable returns a condition function that returns true if the given pod
|
// podUnschedulable returns a condition function that returns true if the given pod
|
||||||
// gets unschedulable status.
|
// gets unschedulable status.
|
||||||
func podUnschedulable(c clientset.Interface, podNamespace, podName string) wait.ConditionFunc {
|
func podUnschedulable(c clientset.Interface, podNamespace, podName string) wait.ConditionFunc {
|
||||||
|
@ -48,13 +48,6 @@ const (
|
|||||||
fakeImage = "fakeimage"
|
fakeImage = "fakeimage"
|
||||||
)
|
)
|
||||||
|
|
||||||
type statefulsetTester struct {
|
|
||||||
t *testing.T
|
|
||||||
c clientset.Interface
|
|
||||||
service *v1.Service
|
|
||||||
statefulset *appsv1.StatefulSet
|
|
||||||
}
|
|
||||||
|
|
||||||
func labelMap() map[string]string {
|
func labelMap() map[string]string {
|
||||||
return map[string]string{"foo": "bar"}
|
return map[string]string{"foo": "bar"}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user