Kubernetes: detect changes for resources other than endpoints
This commit is contained in:
parent
4b456f3b76
commit
7f307d60c4
2 changed files with 30 additions and 4 deletions
|
@ -48,12 +48,10 @@ func objChanged(oldObj, newObj interface{}) bool {
|
|||
}
|
||||
|
||||
if _, ok := oldObj.(*corev1.Endpoints); ok {
|
||||
if endpointsChanged(oldObj.(*corev1.Endpoints), newObj.(*corev1.Endpoints)) {
|
||||
return true
|
||||
}
|
||||
return endpointsChanged(oldObj.(*corev1.Endpoints), newObj.(*corev1.Endpoints))
|
||||
}
|
||||
|
||||
return false
|
||||
return true
|
||||
}
|
||||
|
||||
func endpointsChanged(a, b *corev1.Endpoints) bool {
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/assert"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/networking/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
|
@ -60,6 +61,33 @@ func Test_detectChanges(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Ingress With same version",
|
||||
oldObj: &v1.Ingress{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ResourceVersion: "1",
|
||||
},
|
||||
},
|
||||
newObj: &v1.Ingress{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ResourceVersion: "1",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Ingress With different version",
|
||||
oldObj: &v1.Ingress{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ResourceVersion: "1",
|
||||
},
|
||||
},
|
||||
newObj: &v1.Ingress{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ResourceVersion: "2",
|
||||
},
|
||||
},
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "With same annotations",
|
||||
oldObj: &corev1.Endpoints{
|
||||
|
|
Loading…
Reference in a new issue