-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
operator: fix bugs on reading configuration from config-map #10520
Changes from all commits
d049557
e0a5ecf
2d7a8fc
4f32b64
72a6c02
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1493,6 +1493,43 @@ func (kub *Kubectl) GetPublicIface() (string, error) { | |
return kub.getIfaceByIPAddr(K8s1, ipAddr) | ||
} | ||
|
||
func (kub *Kubectl) DeleteCiliumOperator() error { | ||
// Do not assert on success in AfterEach intentionally to avoid | ||
// incomplete teardown. | ||
|
||
_ = kub.DeleteResource("deployment", fmt.Sprintf("-n %s cilium-operator", GetCiliumNamespace(GetCurrentIntegration()))) | ||
return kub.waitToDeleteCiliumOperator() | ||
} | ||
|
||
func (kub *Kubectl) waitToDeleteCiliumOperator() error { | ||
var ( | ||
pods []string | ||
err error | ||
) | ||
|
||
ctx, cancel := context.WithTimeout(context.Background(), HelperTimeout) | ||
defer cancel() | ||
|
||
status := 1 | ||
for status > 0 { | ||
|
||
select { | ||
case <-ctx.Done(): | ||
return fmt.Errorf("timed out waiting to delete Cilium Operator: pods still remaining: %s", pods) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nebril I'm going to fix this in another PR as this PR is blocking some of my work. |
||
default: | ||
} | ||
|
||
pods, err = kub.GetPodNamesContext(ctx, GetCiliumNamespace(GetCurrentIntegration()), "io.cilium/app=cilium") | ||
status = len(pods) | ||
kub.Logger().Infof("Cilium Operator pods terminating '%d' err='%v' pods='%v'", status, err, pods) | ||
if status == 0 { | ||
return nil | ||
} | ||
time.Sleep(1 * time.Second) | ||
} | ||
return nil | ||
} | ||
|
||
func (kub *Kubectl) DeleteCiliumDS() error { | ||
// Do not assert on success in AfterEach intentionally to avoid | ||
// incomplete teardown. | ||
|
@@ -1557,6 +1594,13 @@ func (kub *Kubectl) CiliumInstall(filename string, options map[string]string) er | |
return err | ||
} | ||
|
||
// Remove cilium operator to ensure that new instances of cilium-operator are started | ||
// for the newly generated ConfigMap. Otherwise, the CM changes will stay | ||
// inactive until each cilium-operator has been restarted. | ||
if err := kub.DeleteCiliumOperator(); err != nil { | ||
return err | ||
} | ||
|
||
res := kub.Apply(ApplyOptions{FilePath: filename, Force: true, Namespace: GetCiliumNamespace(GetCurrentIntegration())}) | ||
if !res.WasSuccessful() { | ||
return res.GetErr("Unable to apply YAML") | ||
|
@@ -2757,7 +2801,7 @@ func (kub *Kubectl) ciliumHealthPreFlightCheck() error { | |
if len(ciliumPods) != len(nodeCount) { | ||
return fmt.Errorf( | ||
"cilium-agent '%s': Only %d/%d nodes appeared in cilium-health status. nodes = '%+v'", | ||
pod, len(nodeCount), len(ciliumPods), nodeCount) | ||
pod, len(ciliumPods), len(nodeCount), nodeCount) | ||
} | ||
|
||
healthStatus, err := status.Filter(statusFilter) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported method Kubectl.DeleteCiliumOperator should have comment or be unexported