Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSPL-465: Fix the updation of ConfigMap by adding resource version of ConfigMap as annotation in the CR #131

Merged
merged 7 commits into from
Oct 2, 2020
Merged
Prev Previous commit
Fixed MC merge conflicts
  • Loading branch information
gaurav-splunk committed Oct 2, 2020
commit b9fa05f52b0cbb806aea930f1b8ebdd4d66f4e52
14 changes: 5 additions & 9 deletions pkg/splunk/enterprise/monitoringconsole.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,17 @@ func ApplyMonitoringConsole(client splcommon.ControllerClient, cr splcommon.Meta
return err
}

//configMapHash should never be nil, just adding extra check
if configMapHash == "" {
return err
}

deploymentMC, err := getMonitoringConsoleDeployment(client, cr, &spec, SplunkMonitoringConsole, configMapHash, secretName)
mgr := splctrl.DefaultStatefulSetPodManager{}
_, err = mgr.Update(client, statefulsetMC, 1)
if err != nil {
return err
}

return err
}

// GetMonitoringConsoleDeployment returns a Kubernetes Deployment object for Splunk Enterprise monitoring console instance.
func getMonitoringConsoleDeployment(client splcommon.ControllerClient, cr splcommon.MetaObject, spec *enterprisev1.CommonSplunkSpec, instanceType InstanceType, configMapHash string, secretName string) (*appsv1.Deployment, error) {
// getMonitoringConsoleStatefulSet returns a Kubernetes Statefulset object for Splunk Enterprise monitoring console instance.
func getMonitoringConsoleStatefulSet(client splcommon.ControllerClient, cr splcommon.MetaObject, spec *enterprisev1.CommonSplunkSpec, instanceType InstanceType, secretName string) (*appsv1.StatefulSet, error) {
var partOfIdentifier string
// there will be always 1 replica of monitoring console
replicas := int32(1)
Expand Down Expand Up @@ -159,7 +155,7 @@ func getMonitoringConsoleDeployment(client splcommon.ControllerClient, cr splcom
splcommon.AppendParentMeta(statefulSet.Spec.Template.GetObjectMeta(), cr.GetObjectMeta())

// update statefulset's pod template with common splunk pod config
updateSplunkPodTemplateWithConfig(client, &deploymentMC.Spec.Template, cr, spec, instanceType, env, secretName)
updateSplunkPodTemplateWithConfig(client, &statefulSet.Spec.Template, cr, spec, instanceType, env, secretName)

//update podTemplate annotation with configMap resource version
var monitoringConsoleConfigMap *corev1.ConfigMap
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.