Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ rules:
- list
- update
- watch
- patch
- apiGroups:
- ""
resources:
Expand Down
20 changes: 4 additions & 16 deletions bindata/v4.1.0/kube-controller-manager/pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,15 @@ metadata:
revision: "REVISION"
spec:
initContainers:
- name: wait-for-host-port
- name: wait-for-host-ports
terminationMessagePolicy: FallbackToLogsOnError
image: ${IMAGE}
imagePullPolicy: IfNotPresent
command: ['/usr/bin/timeout', '30', "/bin/bash", "-c"]
command: ['/usr/bin/timeout', '65', '/bin/bash', '-ec'] # a bit more than 60s for TIME_WAIT, 5s extra cri-o's graceful termination period
args:
- |
echo -n "Waiting for port :10257 to be released."
while [ -n "$(lsof -ni :10257)" ]; do
echo -n "."
sleep 1
done
- name: wait-for-cpc-host-port
terminationMessagePolicy: FallbackToLogsOnError
image: ${IMAGE}
imagePullPolicy: IfNotPresent
command: ['/usr/bin/timeout', '30', "/bin/bash", "-c"]
args:
- |
echo -n "Waiting for port :10357 to be released."
while [ -n "$(lsof -ni :10357)" ]; do
echo -n "Waiting for port :10257 and :10357 to be released."
while [ -n "$(lsof -ni :10257)$(lsof -ni :10357)" ]; do
echo -n "."
sleep 1
done
Expand Down
21 changes: 5 additions & 16 deletions pkg/operator/v411_00_assets/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions test/e2e/satokensigner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,20 @@ func TestSATokenSignerControllerSyncCerts(t *testing.T) {
ctx := context.Background()

// wait for the operator readiness
t.Logf("Waiting for true, false, false")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

t.Log, until 1.14, is not logging until the test finishes but if it panics we don't have logs - I'd do klog.Infof for now (don't forget klog.Init

test.WaitForKubeControllerManagerClusterOperator(t, ctx, configClient, configv1.ConditionTrue, configv1.ConditionFalse, configv1.ConditionFalse)

err = kubeClient.Secrets(operatorclient.TargetNamespace).Delete(ctx, "service-account-private-key", metav1.DeleteOptions{})
require.NoError(t, err)

// wait for the operator reporting progressing
t.Logf("Waiting for true, true, false")
test.WaitForKubeControllerManagerClusterOperator(t, ctx, configClient, configv1.ConditionTrue, configv1.ConditionTrue, configv1.ConditionFalse)

// and check for secret being synced from next-service-private-key
_, err = kubeClient.Secrets(operatorclient.TargetNamespace).Get(ctx, "service-account-private-key", metav1.GetOptions{})
require.NoError(t, err)

t.Logf("Waiting for true, false, false")
test.WaitForKubeControllerManagerClusterOperator(t, ctx, configClient, configv1.ConditionTrue, configv1.ConditionFalse, configv1.ConditionFalse)
}
7 changes: 3 additions & 4 deletions test/library/cluster_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package library

import (
"context"
"fmt"
"testing"
"time"

Expand All @@ -26,19 +25,19 @@ func WaitForKubeControllerManagerClusterOperator(t *testing.T, ctx context.Conte
err := wait.Poll(WaitPollInterval, WaitPollTimeout, func() (bool, error) {
clusterOperator, err := client.ClusterOperators().Get(ctx, "kube-controller-manager", metav1.GetOptions{})
if errors.IsNotFound(err) {
fmt.Println("ClusterOperator/kube-controller-manager does not yet exist.")
t.Log("ClusterOperator/kube-controller-manager does not yet exist.")
return false, nil
}
if err != nil {
fmt.Println("Unable to retrieve ClusterOperator/kube-controller-manager:", err)
t.Log("Unable to retrieve ClusterOperator/kube-controller-manager:", err)
return false, err
}
conditions := clusterOperator.Status.Conditions
availableOK := clusteroperatorhelpers.IsStatusConditionPresentAndEqual(conditions, configv1.OperatorAvailable, available)
progressingOK := clusteroperatorhelpers.IsStatusConditionPresentAndEqual(conditions, configv1.OperatorProgressing, progressing)
degradedOK := clusteroperatorhelpers.IsStatusConditionPresentAndEqual(conditions, configv1.OperatorDegraded, degraded)
done := availableOK && progressingOK && degradedOK
fmt.Printf("ClusterOperator/kube-controller-manager: AvailableOK: %v ProgressingOK: %v DegradedOK: %v\n", availableOK, progressingOK, degradedOK)
t.Logf("ClusterOperator/kube-controller-manager: AvailableOK: %v ProgressingOK: %v DegradedOK: %v", availableOK, progressingOK, degradedOK)
return done, nil
})
if err != nil {
Expand Down