Skip to content

Commit

Permalink
HEL-2715 Changed Selector nil pointer check
Browse files Browse the repository at this point in the history
  • Loading branch information
rajeshmohanty-leanix committed May 22, 2023
1 parent d12e5b9 commit 5aedc26
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/iris/workloads/services/mapper/cronjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (m *mapworkload) CreateCronjobEcst(clusterName string, cronJob batchv1.Cron

func ResolveK8sServiceForK8sCronJob(services *v1.ServiceList, cronJob batchv1.CronJob) string {
cronJobService := ""
if cronJob.Spec.JobTemplate.Spec.Selector.MatchLabels != nil {
if cronJob.Spec.JobTemplate.Spec.Selector != nil {
for _, service := range services.Items {
sharedLabelsCronJob := map[string]string{}
sharedLabelsService := map[string]string{}
Expand Down
2 changes: 1 addition & 1 deletion pkg/iris/workloads/services/mapper/daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (m *mapworkload) CreateDaemonSetEcst(clusterName string, daemonSet appsv1.D

func ResolveK8sServiceForK8sDaemonSet(services *v1.ServiceList, daemonSet appsv1.DaemonSet) string {
daemonSetService := ""
if daemonSet.Spec.Selector.MatchLabels != nil {
if daemonSet.Spec.Selector != nil {
for _, service := range services.Items {
sharedLabelsStatefulSet := map[string]string{}
sharedLabelsService := map[string]string{}
Expand Down
2 changes: 1 addition & 1 deletion pkg/iris/workloads/services/mapper/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func CreateK8sResources(resourceList v1.ResourceList) models.K8sResources {

func ResolveK8sServiceForK8sDeployment(services *v1.ServiceList, deployment appsv1.Deployment) string {
deploymentService := ""
if deployment.Spec.Selector.MatchLabels != nil {
if deployment.Spec.Selector != nil {

for _, service := range services.Items {
sharedLabelsDeployment := map[string]string{}
Expand Down
2 changes: 1 addition & 1 deletion pkg/iris/workloads/services/mapper/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (m *mapworkload) CreateStatefulSetEcst(clusterName string, statefulSet apps

func ResolveK8sServiceForK8sStatefulSet(services *v1.ServiceList, statefulSet appsv1.StatefulSet) string {
statefulSetService := ""
if statefulSet.Spec.Selector.MatchLabels != nil {
if statefulSet.Spec.Selector != nil {

for _, service := range services.Items {
sharedLabelsStatefulSet := map[string]string{}
Expand Down

0 comments on commit 5aedc26

Please sign in to comment.