-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restart the ARO operator upon
az aro update
This ensures that the ARO operator will be working with the latest azure-cloud-credentials Secret content.
- Loading branch information
1 parent
d82c212
commit cf12e47
Showing
5 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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 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 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,35 @@ | ||
package kubernetes | ||
|
||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the Apache License 2.0. | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
appsv1client "k8s.io/client-go/kubernetes/typed/apps/v1" | ||
) | ||
|
||
// Restart restarts the given Deployment by performing the equivalent of a `kubectl rollout restart deployment <deployment-name>` against it. | ||
func Restart(ctx context.Context, cli appsv1client.DeploymentInterface, deploymentName string) error { | ||
d, err := cli.Get(ctx, deploymentName, metav1.GetOptions{}) | ||
|
||
if err != nil { | ||
return err | ||
} | ||
|
||
if d.Spec.Template.ObjectMeta.Annotations == nil { | ||
d.Spec.Template.ObjectMeta.Annotations = make(map[string]string) | ||
} | ||
|
||
d.Spec.Template.ObjectMeta.Annotations["kubectl.kubernetes.io/restartedAt"] = time.Now().Format(time.RFC3339) | ||
|
||
_, err = cli.Update(ctx, d, metav1.UpdateOptions{}) | ||
|
||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.