Created
November 28, 2019 11:46
-
-
Save selcukusta/f69e67c42444b87d81c83ec01a00bff2 to your computer and use it in GitHub Desktop.
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
currentConfigMap := &corev1.ConfigMap{} | |
newConfigMap := r.createConfigMap(instance, map[string]string{instance.Spec.Config.ConfigMapKey: instance.Spec.Config.ConfigMapValue}) | |
err = r.client.Get(context.TODO(), types.NamespacedName{Name: instance.Spec.Config.ConfigMapName, Namespace: request.Namespace}, currentConfigMap) | |
if err == nil { | |
if !reflect.DeepEqual(currentConfigMap.Data, newConfigMap.Data) { | |
reqLogger.Info(fmt.Sprintf("ConfigMap will be changed: %v", instance.Spec.Config.ConfigMapName)) | |
if r.client.Update(context.TODO(), newConfigMap) != nil { | |
return reconcile.Result{}, err | |
} | |
for _, deployment := range instance.Spec.LinkedDeployments { | |
reqLogger.Info(fmt.Sprintf("Deployment will be restarted: %v", deployment)) | |
if r.restartDeployment(deployment, request.Namespace) != nil { | |
return reconcile.Result{}, err | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment