Skip to content

Commit 97b4f9c

Browse files
♻️ change annotation domain (#10)
1 parent 23d0280 commit 97b4f9c

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

PROJECT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
domain: auto.request.operator
1+
domain: reqsizer.jatalocks.github.io
22
layout:
33
- go.kubebuilder.io/v3
44
projectName: kube-reqsizer

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ logLevel: info
4242
have the annotation set to "true".
4343
If "false", will ignore annotations and work on all pods in the cluster.
4444

45-
# auto.request.operator/optimize=true
46-
# auto.request.operator/optimize=false
45+
# reqsizer.jatalocks.github.io/optimize=true
46+
# reqsizer.jatalocks.github.io/optimize=false
4747

4848
--sample-size int (default 1)
4949

@@ -77,15 +77,15 @@ logLevel: info
7777
### Annotations
7878
*If **annotation-filter** is **true**:*
7979
```
80-
auto.request.operator/optimize=true # Optimize Pod/Namespace
81-
auto.request.operator/optimize=false # Ignore Pod/Namespace
80+
reqsizer.jatalocks.github.io/optimize=true # Optimize Pod/Namespace
81+
reqsizer.jatalocks.github.io/optimize=false # Ignore Pod/Namespace
8282
```
8383
These are available POD/Namespace annotations *Regardless of **annotation-filter**:*
8484
```
85-
auto.request.operator/optimize=false # Ignore Pod/Namespace when optimizing entire cluster
86-
auto.request.operator/mode=average # Default Mode. Optimizes based on average. If ommited, mode is average
87-
auto.request.operator/mode=max # Sets the request to the MAXIMUM of all sample points
88-
auto.request.operator/mode=min # Sets the request to the MINIMUM of all sample points
85+
reqsizer.jatalocks.github.io/optimize=false # Ignore Pod/Namespace when optimizing entire cluster
86+
reqsizer.jatalocks.github.io/mode=average # Default Mode. Optimizes based on average. If ommited, mode is average
87+
reqsizer.jatalocks.github.io/mode=max # Sets the request to the MAXIMUM of all sample points
88+
reqsizer.jatalocks.github.io/mode=min # Sets the request to the MINIMUM of all sample points
8989
```
9090
### Disclaimer
9191

controllers/pod_controller.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ import (
3535
// +kubebuilder:rbac:groups=core,resources=pods,verbs=get;list;watch;update;patch
3636

3737
const (
38-
operatorAnnotation = "auto.request.operator/optimize"
39-
operatorModeAnnotation = "auto.request.operator/mode"
38+
operatorAnnotation = "reqsizer.jatalocks.github.io/optimize"
39+
operatorModeAnnotation = "reqsizer.jatalocks.github.io/mode"
4040
)
4141

4242
func cacheKeyFunc(obj interface{}) (string, error) {
@@ -205,7 +205,7 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
205205
}
206206
}
207207
if PodChange {
208-
pod.Annotations["auto.request.operator/changed"] = "true"
208+
pod.Annotations["reqsizer.jatalocks.github.io/changed"] = "true"
209209
log.Info("Pod Requests Will Change")
210210

211211
if len(pod.OwnerReferences) == 0 {
@@ -231,7 +231,7 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
231231
return ctrl.Result{}, err
232232
}
233233
UpdatePodController(&deployment.Spec.Template.Spec, Requests, ctx)
234-
deployment.Annotations["auto.request.operator/changed"] = "true"
234+
deployment.Annotations["reqsizer.jatalocks.github.io/changed"] = "true"
235235

236236
return r.UpdateKubeObject(deployment, ctx)
237237
} else {
@@ -248,7 +248,7 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
248248
return ctrl.Result{}, err
249249
}
250250
UpdatePodController(&deployment.Spec.Template.Spec, Requests, ctx)
251-
deployment.Annotations["auto.request.operator/changed"] = "true"
251+
deployment.Annotations["reqsizer.jatalocks.github.io/changed"] = "true"
252252
return r.UpdateKubeObject(deployment, ctx)
253253
case "StatefulSet":
254254
log.Info("Is Owned by StatefulSet")
@@ -261,7 +261,7 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
261261
}
262262

263263
UpdatePodController(&deployment.Spec.Template.Spec, Requests, ctx)
264-
deployment.Annotations["auto.request.operator/changed"] = "true"
264+
deployment.Annotations["reqsizer.jatalocks.github.io/changed"] = "true"
265265
return r.UpdateKubeObject(deployment, ctx)
266266
default:
267267
fmt.Printf("Could not find resource manager for type %s\n", pod.OwnerReferences[0].Kind)

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func main() {
8181
flag.BoolVar(&enableAnnotation, "annotation-filter", true,
8282
"Enable a annotation filter for pod scraping. "+
8383
"Enabling this will ensure that the controller only sets requests of controllers of which PODS or NAMESPACE have the annotation. "+
84-
"(auto.request.operator/optimize=true)")
84+
"(reqsizer.jatalocks.github.io/optimize=true/false)")
8585
opts := zap.Options{
8686
Development: true,
8787
}

0 commit comments

Comments
 (0)