Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6b70891bb0 | |||
|
4452c7e136
|
@@ -2,6 +2,12 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [1.2.0] - 2025-10-01
|
||||
|
||||
### 🚀 Features
|
||||
|
||||
- Improve LimitRange management in namespaces
|
||||
|
||||
## [1.1.14] - 2025-09-10
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
@@ -61,11 +61,13 @@ func main() {
|
||||
}
|
||||
|
||||
for _, ns := range namespaces.Items {
|
||||
if !nsExcluded(ns.Name, excludedNS) {
|
||||
log.Printf("Checking for LimitRange named extreme-request-defaults in namespace '%v'\n", ns.Name)
|
||||
if limitRanges, err := clientset.CoreV1().LimitRanges(ns.Name).List(ctx, metav1.ListOptions{FieldSelector: "metadata.name=extreme-request-defaults"}); err != nil {
|
||||
panic(err)
|
||||
} else {
|
||||
limitRanges, err := clientset.CoreV1().LimitRanges(ns.Name).List(ctx, metav1.ListOptions{FieldSelector: "metadata.name=extreme-request-defaults"})
|
||||
if err != nil {
|
||||
log.Printf("Unable to list LimitRanges in namespace '%v': Error: %v\n", ns.Name, err)
|
||||
continue
|
||||
}
|
||||
if !nsExcluded(ns.Name, excludedNS) {
|
||||
if len(limitRanges.Items) == 0 {
|
||||
log.Printf("Trying to create LimitRange\n")
|
||||
if _, err := clientset.CoreV1().LimitRanges(ns.Name).Create(ctx, &limitRange, metav1.CreateOptions{}); err != nil {
|
||||
@@ -74,6 +76,12 @@ func main() {
|
||||
log.Printf("LimitRange extreme-request-defaults created in namespace '%v'\n", ns.Name)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if len(limitRanges.Items) > 0 {
|
||||
log.Printf("Trying to delete LimitRange\n")
|
||||
if err := clientset.CoreV1().LimitRanges(ns.Name).Delete(ctx, "extreme-request-defaults", metav1.DeleteOptions{}); err != nil {
|
||||
log.Printf("Unable to delete LimitRange in namespace '%v': Error: %v\n", ns.Name, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user