mirror of
https://github.com/stakater/Reloader.git
synced 2026-08-23 22:16:45 +00:00
Fix testcase with updated annotation
This commit is contained in:
@@ -172,7 +172,7 @@ func initDeployment(namespace string, deploymentName string) *v1beta1.Deployment
|
||||
Name: deploymentName,
|
||||
Namespace: namespace,
|
||||
Labels: map[string]string{"firstLabel": "temp"},
|
||||
Annotations: map[string]string{"reloader.stakater.com/update-on-change": deploymentName},
|
||||
Annotations: map[string]string{"reloader.stakater.com/configmap.update-on-change": deploymentName},
|
||||
},
|
||||
Spec: v1beta1.DeploymentSpec{
|
||||
Replicas: &replicaset,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/sha1"
|
||||
"io"
|
||||
"sort"
|
||||
"strings"
|
||||
"crypto/sha1"
|
||||
"bytes"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/stakater/Reloader/pkg/kube"
|
||||
"k8s.io/api/core/v1"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -50,7 +50,7 @@ func (r ResourceUpdatedHandler) Handle() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func rollingUpgrade(r ResourceUpdatedHandler, resourceType string, rollingUpgradeType string){
|
||||
func rollingUpgrade(r ResourceUpdatedHandler, resourceType string, rollingUpgradeType string) {
|
||||
client, err := kube.GetClient()
|
||||
if err != nil {
|
||||
logrus.Fatalf("Unable to create Kubernetes client error = %v", err)
|
||||
@@ -92,7 +92,7 @@ func rollingUpgradeForDeployment(client kubernetes.Interface, r ResourceUpdatedH
|
||||
containers := d.Spec.Template.Spec.Containers
|
||||
// match deployments with the correct annotation
|
||||
annotationValue := d.ObjectMeta.Annotations[updateOnChangeAnnotation]
|
||||
|
||||
|
||||
if annotationValue != "" {
|
||||
values := strings.Split(annotationValue, ",")
|
||||
matches := false
|
||||
@@ -121,7 +121,6 @@ func rollingUpgradeForDeployment(client kubernetes.Interface, r ResourceUpdatedH
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
func rollingUpgradeForDaemonSets(client kubernetes.Interface, r ResourceUpdatedHandler, namespace string, name string, sshData string, envName string) error {
|
||||
daemonSets, err := client.ExtensionsV1beta1().DaemonSets(namespace).List(meta_v1.ListOptions{})
|
||||
if err != nil {
|
||||
@@ -181,7 +180,7 @@ func rollingUpgradeForStatefulSets(client kubernetes.Interface, r ResourceUpdate
|
||||
containers := d.Spec.Template.Spec.Containers
|
||||
// match statefulSets with the correct annotation
|
||||
annotationValue := d.ObjectMeta.Annotations[updateOnChangeAnnotation]
|
||||
|
||||
|
||||
if annotationValue != "" {
|
||||
values := strings.Split(annotationValue, ",")
|
||||
matches := false
|
||||
@@ -293,4 +292,4 @@ func generateSHA(data string) string {
|
||||
io.WriteString(hasher, data)
|
||||
sha := hasher.Sum(nil)
|
||||
return string(sha[:])
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user