Skip to content

Commit 42a0804

Browse files
committed
apiext: wait for CRD using v1beta1 for compatibility on upgrades
This is softening 4ee7b07 (#259) to use the older v1beta1 API version for waiting for CRDs to be established. This fixes the creation of v1beta1 CRDs before kube-apiserver is updated during a 4.2->4.3 update. Note: this will not fix the creation of v1 CRDs before kube-apiserver is upgraded. Hence, we are still restricted in the use of v1 CRDs for early manifests.
1 parent 83f1a16 commit 42a0804

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/resourcebuilder/apiext.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ func (b *crdBuilder) Do(ctx context.Context) error {
7171
}
7272

7373
if updated {
74-
return waitForCustomResourceDefinitionCompletion(ctx, b.clientV1, name)
74+
return waitForCustomResourceDefinitionCompletion(ctx, b.clientV1beta1, name)
7575
}
7676
return nil
7777
}
7878

79-
func waitForCustomResourceDefinitionCompletion(ctx context.Context, client apiextclientv1.CustomResourceDefinitionsGetter, crd string) error {
79+
func waitForCustomResourceDefinitionCompletion(ctx context.Context, client apiextclientv1beta1.CustomResourceDefinitionsGetter, crd string) error {
8080
return wait.PollImmediateUntil(defaultObjectPollInterval, func() (bool, error) {
8181
c, err := client.CustomResourceDefinitions().Get(crd, metav1.GetOptions{})
8282
if errors.IsNotFound(err) {
@@ -89,7 +89,7 @@ func waitForCustomResourceDefinitionCompletion(ctx context.Context, client apiex
8989
}
9090

9191
for _, condition := range c.Status.Conditions {
92-
if condition.Type == apiextv1.Established && condition.Status == apiextv1.ConditionTrue {
92+
if condition.Type == apiextv1beta1.Established && condition.Status == apiextv1beta1.ConditionTrue {
9393
return true, nil
9494
}
9595
}

0 commit comments

Comments
 (0)