Merge pull request #19254 from Razorr1996/Replace-replicationcontroller-with-deployment-in-addons
Replace ReplicationController with Deployment in addonspull/19275/head
commit
2eec0f8b41
|
|
@ -12,8 +12,8 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
apiVersion: v1
|
||||
kind: ReplicationController
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: elasticsearch-logging
|
||||
namespace: kube-system
|
||||
|
|
@ -24,12 +24,15 @@ metadata:
|
|||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
k8s-app: elasticsearch-logging
|
||||
addonmanager.kubernetes.io/mode: Reconcile
|
||||
matchLabels:
|
||||
k8s-app: elasticsearch-logging
|
||||
kubernetes.io/minikube-addons: efk
|
||||
addonmanager.kubernetes.io/mode: Reconcile
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: elasticsearch-logging
|
||||
kubernetes.io/minikube-addons: efk
|
||||
addonmanager.kubernetes.io/mode: Reconcile
|
||||
spec:
|
||||
containers:
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
apiVersion: v1
|
||||
kind: ReplicationController
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: fluentd-es
|
||||
namespace: kube-system
|
||||
|
|
@ -23,10 +23,16 @@ metadata:
|
|||
addonmanager.kubernetes.io/mode: Reconcile
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
k8s-app: fluentd-es
|
||||
kubernetes.io/minikube-addons: efk
|
||||
addonmanager.kubernetes.io/mode: Reconcile
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: fluentd-es
|
||||
kubernetes.io/minikube-addons: efk
|
||||
addonmanager.kubernetes.io/mode: Reconcile
|
||||
spec:
|
||||
containers:
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
apiVersion: v1
|
||||
kind: ReplicationController
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: kibana-logging
|
||||
namespace: kube-system
|
||||
|
|
@ -24,12 +24,15 @@ metadata:
|
|||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
k8s-app: kibana-logging
|
||||
kubernetes.io/minikube-addons: efk
|
||||
addonmanager.kubernetes.io/mode: Reconcile
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: kibana-logging
|
||||
kubernetes.io/minikube-addons: efk
|
||||
addonmanager.kubernetes.io/mode: Reconcile
|
||||
spec:
|
||||
containers:
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
apiVersion: v1
|
||||
kind: ReplicationController
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: freshpod
|
||||
namespace: kube-system
|
||||
|
|
@ -24,12 +24,15 @@ metadata:
|
|||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
k8s-app: freshpod
|
||||
addonmanager.kubernetes.io/mode: Reconcile
|
||||
matchLabels:
|
||||
k8s-app: freshpod
|
||||
kubernetes.io/minikube-addons: freshpod
|
||||
addonmanager.kubernetes.io/mode: Reconcile
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: freshpod
|
||||
kubernetes.io/minikube-addons: freshpod
|
||||
addonmanager.kubernetes.io/mode: Reconcile
|
||||
spec:
|
||||
containers:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
apiVersion: v1
|
||||
kind: ReplicationController
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
kubernetes.io/minikube-addons: registry
|
||||
|
|
@ -9,7 +9,9 @@ metadata:
|
|||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
kubernetes.io/minikube-addons: registry
|
||||
matchLabels:
|
||||
kubernetes.io/minikube-addons: registry
|
||||
addonmanager.kubernetes.io/mode: Reconcile
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
|
|
|
|||
|
|
@ -108,40 +108,6 @@ func WaitForPods(c kubernetes.Interface, ns string, selector string, timeOut ...
|
|||
return err
|
||||
}
|
||||
|
||||
// WaitForRCToStabilize waits till the RC has a matching generation/replica count between spec and status. used by integration tests
|
||||
func WaitForRCToStabilize(c kubernetes.Interface, ns, name string, timeout time.Duration) error {
|
||||
options := meta.ListOptions{FieldSelector: fields.Set{
|
||||
"metadata.name": name,
|
||||
"metadata.namespace": ns,
|
||||
}.AsSelector().String()}
|
||||
|
||||
ctx, cancel := watchtools.ContextWithOptionalTimeout(context.Background(), timeout)
|
||||
defer cancel()
|
||||
|
||||
w, err := c.CoreV1().ReplicationControllers(ns).Watch(ctx, options)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = watchtools.UntilWithoutRetry(ctx, w, func(event watch.Event) (bool, error) {
|
||||
if event.Type == watch.Deleted {
|
||||
return false, apierr.NewNotFound(schema.GroupResource{Resource: "replicationcontrollers"}, "")
|
||||
}
|
||||
|
||||
rc, ok := event.Object.(*core.ReplicationController)
|
||||
if ok {
|
||||
if rc.Name == name && rc.Namespace == ns &&
|
||||
rc.Generation <= rc.Status.ObservedGeneration &&
|
||||
*(rc.Spec.Replicas) == rc.Status.Replicas {
|
||||
return true, nil
|
||||
}
|
||||
klog.Infof("Waiting for rc %s to stabilize, generation %v observed generation %v spec.replicas %d status.replicas %d",
|
||||
name, rc.Generation, rc.Status.ObservedGeneration, *(rc.Spec.Replicas), rc.Status.Replicas)
|
||||
}
|
||||
return false, nil
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
// WaitForDeploymentToStabilize waits till the Deployment has a matching generation/replica count between spec and status. used by integration tests
|
||||
func WaitForDeploymentToStabilize(c kubernetes.Interface, ns, name string, timeout time.Duration) error {
|
||||
options := meta.ListOptions{FieldSelector: fields.Set{
|
||||
|
|
|
|||
|
|
@ -326,8 +326,8 @@ func validateRegistryAddon(ctx context.Context, t *testing.T, profile string) {
|
|||
}
|
||||
|
||||
start := time.Now()
|
||||
if err := kapi.WaitForRCToStabilize(client, "kube-system", "registry", Minutes(6)); err != nil {
|
||||
t.Errorf("failed waiting for registry replicacontroller to stabilize: %v", err)
|
||||
if err := kapi.WaitForDeploymentToStabilize(client, "kube-system", "registry", Minutes(6)); err != nil {
|
||||
t.Errorf("failed waiting for registry deployment to stabilize: %v", err)
|
||||
}
|
||||
t.Logf("registry stabilized in %s", time.Since(start))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue