Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace ReplicationController with Deployment in addons #19254

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions deploy/addons/efk/elasticsearch-rc.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
10 changes: 8 additions & 2 deletions deploy/addons/efk/fluentd-es-rc.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
7 changes: 5 additions & 2 deletions deploy/addons/efk/kibana-rc.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
11 changes: 7 additions & 4 deletions deploy/addons/freshpod/freshpod-rc.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
8 changes: 5 additions & 3 deletions deploy/addons/registry/registry-rc.yaml.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v1
kind: ReplicationController
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
kubernetes.io/minikube-addons: registry
Expand All @@ -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:
Expand Down
34 changes: 0 additions & 34 deletions pkg/kapi/kapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
4 changes: 2 additions & 2 deletions test/integration/addons_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down