-
Notifications
You must be signed in to change notification settings - Fork 238
Bug 1942657: Ingress operator stays degraded after privateZone fixed in DNS #641
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
85f61cb
Added lmzuccarelli to OWNERS
lmzuccarelli 00a6bd8
Merge branch 'openshift:master' into master
lmzuccarelli 519c742
Merge branch 'openshift:master' into master
lmzuccarelli 3fdb860
Bug 1942657: Ingress operator stays degraded after privateZone fixed …
lmzuccarelli 9f32923
Add e2e test for IngressStatus on DNS config change (degrade status)
lmzuccarelli 5e47482
Add unit test for DNS degrade utility logic
lmzuccarelli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| // +build e2e | ||
|
|
||
| package e2e | ||
|
|
||
| import ( | ||
| "context" | ||
| "fmt" | ||
| "os" | ||
| "testing" | ||
|
|
||
| configv1 "github.com/openshift/api/config/v1" | ||
| operatorclient "github.com/openshift/cluster-ingress-operator/pkg/operator/client" | ||
|
|
||
| "sigs.k8s.io/controller-runtime/pkg/client/config" | ||
|
|
||
| "k8s.io/apimachinery/pkg/types" | ||
| ) | ||
|
|
||
| // TestIngressStatus - degrade/restore status via DNS config | ||
| // This test will check the ingress status | ||
| // | ||
| // Steps :- | ||
| // 1. initial check - should be false | ||
| // 2. update the DNS private zone tags to unknown value | ||
| // 3. check the status should have degraded to true | ||
| // 4. re-instate the original condition | ||
| // 5. check the status should have degraded to false | ||
| func TestIngressStatus(t *testing.T) { | ||
| kubeConfig, err := config.GetConfig() | ||
| if err != nil { | ||
| fmt.Printf("failed to get kube config: %s\n", err) | ||
| os.Exit(1) | ||
|
frobware marked this conversation as resolved.
Outdated
|
||
| } | ||
| kubeClient, err := operatorclient.NewClient(kubeConfig) | ||
|
lmzuccarelli marked this conversation as resolved.
|
||
| if err != nil { | ||
| t.Errorf("failed to create kube client: %v", err) | ||
|
frobware marked this conversation as resolved.
Outdated
|
||
| } | ||
| kclient = kubeClient | ||
|
frobware marked this conversation as resolved.
Outdated
|
||
|
|
||
| if err := kclient.Get(context.TODO(), types.NamespacedName{Name: "cluster"}, &dnsConfig); err != nil { | ||
| t.Errorf("failed to get DNS config: %v", err) | ||
| } | ||
|
|
||
| // step 1 | ||
| expected := []configv1.ClusterOperatorStatusCondition{ | ||
| {Type: configv1.OperatorAvailable, Status: configv1.ConditionTrue}, | ||
| {Type: configv1.OperatorDegraded, Status: configv1.ConditionFalse}, | ||
| } | ||
| if err := waitForClusterOperatorConditions(t, kclient, expected...); err != nil { | ||
| t.Errorf("did not get expected available condition: %v", err) | ||
| } | ||
|
|
||
| // step 2 | ||
| updCfg := dnsConfig.DeepCopy() | ||
| updateDNSConfig(true, updCfg) | ||
| if err := kclient.Update(context.TODO(), updCfg); err != nil { | ||
| t.Errorf("failed to get DNS config: %v", err) | ||
| } | ||
|
|
||
| // step 3 | ||
| expected = []configv1.ClusterOperatorStatusCondition{ | ||
| {Type: configv1.OperatorDegraded, Status: configv1.ConditionTrue}, | ||
| } | ||
| if err := waitForClusterOperatorConditions(t, kclient, expected...); err != nil { | ||
| t.Errorf("did not get expected available condition: %v", err) | ||
| } | ||
|
|
||
| // step 4 | ||
| updateDNSConfig(false, updCfg) | ||
| if err := kclient.Update(context.TODO(), updCfg); err != nil { | ||
| t.Errorf("failed to get DNS config: %v", err) | ||
| } | ||
|
|
||
| // step 5 | ||
| expected = []configv1.ClusterOperatorStatusCondition{ | ||
| {Type: configv1.OperatorAvailable, Status: configv1.ConditionTrue}, | ||
| {Type: configv1.OperatorDegraded, Status: configv1.ConditionFalse}, | ||
| } | ||
| if err := waitForClusterOperatorConditions(t, kclient, expected...); err != nil { | ||
| t.Errorf("did not get expected available condition: %v", err) | ||
| } | ||
| } | ||
|
|
||
| // updateDNSConfig - utility to set/unset PrivateZone Tags/ID | ||
| func updateDNSConfig(set bool, dnsConfig *configv1.DNS) { | ||
| if dnsConfig.Spec.PrivateZone.ID != "" { | ||
| if set { | ||
| dnsConfig.Spec.PrivateZone.ID = "error-" + dnsConfig.Spec.PrivateZone.ID | ||
| } else { | ||
| // remove 'error-' from prefix | ||
| dnsConfig.Spec.PrivateZone.ID = dnsConfig.Spec.PrivateZone.ID[6:] | ||
| } | ||
| } | ||
| if dnsConfig.Spec.PrivateZone.Tags["Name"] != "" { | ||
| if set { | ||
| dnsConfig.Spec.PrivateZone.Tags["Name"] = "error-" + dnsConfig.Spec.PrivateZone.Tags["Name"] | ||
| } else { | ||
| // remove 'error-' from prefix | ||
| dnsConfig.Spec.PrivateZone.Tags["Name"] = dnsConfig.Spec.PrivateZone.Tags["Name"][6:] | ||
| } | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.