-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: prepare production readiness (#10)
* feat: add a confirmation to not forget to disable ArgoCD autosync * feat: add a guard to prevent to start the migration when the targeted label is the only one. * docs: start the analyze of resource
- Loading branch information
1 parent
384adf7
commit f31362f
Showing
4 changed files
with
81 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
|
||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/client-go/kubernetes" | ||
) | ||
|
||
func isTheEditedLabelTheOnlyOne( | ||
namespace string, | ||
clientset *kubernetes.Clientset, | ||
deploymentName string, | ||
changingLabelKey string, | ||
) bool { | ||
deployment, _ := clientset.AppsV1().Deployments(namespace).Get(context.TODO(), deploymentName, v1.GetOptions{}) | ||
labels := deployment.Spec.Template.ObjectMeta.Labels | ||
return len(labels) == 1 && labels[changingLabelKey] != "" | ||
} |
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,33 @@ | ||
# Service is not the only resource that target pods | ||
|
||
We did the base migration considering pods are matched by service. But for a complexe app, there is a lot of resources that can match pods. | ||
|
||
## Identify resources | ||
|
||
- Kubernetes | ||
- PodDisruptionBudget | ||
|
||
- Keda | ||
- ❌ ScaledObject: — `.spec.scaleTargetRef.name` (equal to the deployment name) | ||
- ➡️ It is acceptable to not manage this as the migration will be fast. | ||
- Istio | ||
- AuthorizationPolicy | ||
- RequestAuthentication | ||
- DestinationRule | ||
- Virtual service (host match the DNS name, means it match the deployment name [docs](https://istio.io/latest/docs/reference/config/networking/virtual-service/#VirtualService)) | ||
- Monitoring | ||
- PrometheusRule (rules could match pod or deployment in the query) | ||
- PodMonitor — `.spec.selector.matchLabels` | ||
|
||
## Tips | ||
|
||
```bash | ||
# Display existing resources in the cluster | ||
kubectl api-resources --verbs=list --namespaced -o name | ||
``` | ||
|
||
export KUBERNETES_RESOURCE=ScaledObject | ||
export NAME= | ||
export NAMESPACE= | ||
|
||
kubectl get $KUBERNETES_RESOURCE $NAME -n $NAMESPACE -o yaml | yq '.spec.selector.matchLabels' |
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