MCPcopy Create free account
hub / github.com/devfile/devworkspace-operator / GetCurrentConfigString

Function GetCurrentConfigString

pkg/config/sync.go:625–820  ·  view source on GitHub ↗
(currConfig *controller.OperatorConfiguration)

Source from the content-addressed store, hash-verified

623}
624
625func GetCurrentConfigString(currConfig *controller.OperatorConfiguration) string {
626 if currConfig == nil {
627 return ""
628 }
629
630 routing := currConfig.Routing
631 var config []string
632 if routing != nil {
633 if routing.ClusterHostSuffix != "" && routing.ClusterHostSuffix != defaultConfig.Routing.ClusterHostSuffix {
634 config = append(config, fmt.Sprintf("routing.clusterHostSuffix=%s", routing.ClusterHostSuffix))
635 }
636 if routing.DefaultRoutingClass != defaultConfig.Routing.DefaultRoutingClass {
637 config = append(config, fmt.Sprintf("routing.defaultRoutingClass=%s", routing.DefaultRoutingClass))
638 }
639 }
640 webhook := currConfig.Webhook
641 if webhook != nil {
642 if webhook.NodeSelector != nil {
643 webhookNodeSelectors := make([]string, 0)
644 for label, value := range webhook.NodeSelector {
645 webhookNodeSelectors = append(webhookNodeSelectors, fmt.Sprintf("%s=%s", label, value))
646 }
647 config = append(config, fmt.Sprintf("webhook.nodeSelectors=[%s]", strings.Join(webhookNodeSelectors, ", ")))
648 }
649 if webhook.Tolerations != nil {
650 webhookTolerations := make([]string, 0)
651 for _, toleration := range webhook.Tolerations {
652 webhookTolerations = append(webhookTolerations, toleration.String())
653 }
654 config = append(config, fmt.Sprintf("webhook.tolerations=[%s]", strings.Join(webhookTolerations, ", ")))
655 }
656 if webhook.Replicas != nil && *webhook.Replicas != *defaultConfig.Webhook.Replicas {
657 config = append(config, fmt.Sprintf("webhook.replicas=%d", *webhook.Replicas))
658 }
659 }
660 workspace := currConfig.Workspace
661 if workspace != nil {
662 if workspace.ImagePullPolicy != defaultConfig.Workspace.ImagePullPolicy {
663 config = append(config, fmt.Sprintf("workspace.imagePullPolicy=%s", workspace.ImagePullPolicy))
664 }
665 if workspace.DeploymentStrategy != defaultConfig.Workspace.DeploymentStrategy {
666 config = append(config, fmt.Sprintf("workspace.deploymentStrategy=%s", workspace.DeploymentStrategy))
667 }
668 if workspace.PVCName != defaultConfig.Workspace.PVCName {
669 config = append(config, fmt.Sprintf("workspace.pvcName=%s", workspace.PVCName))
670 }
671 if workspace.ServiceAccount != nil {
672 if workspace.ServiceAccount.ServiceAccountName != defaultConfig.Workspace.ServiceAccount.ServiceAccountName {
673 config = append(config, fmt.Sprintf("workspace.serviceAccount.serviceAccountName=%s", workspace.ServiceAccount.ServiceAccountName))
674 }
675 if workspace.ServiceAccount.DisableCreation != nil && *workspace.ServiceAccount.DisableCreation != *defaultConfig.Workspace.ServiceAccount.DisableCreation {
676 config = append(config, fmt.Sprintf("workspace.serviceAccount.disableCreation=%t", *workspace.ServiceAccount.DisableCreation))
677 }
678 if workspace.ServiceAccount.ServiceAccountTokens != nil {
679 serviceAccountTokens := make([]string, 0)
680 for _, saToken := range workspace.ServiceAccount.ServiceAccountTokens {
681 serviceAccountTokens = append(serviceAccountTokens, saToken.String())
682 }

Callers 1

logCurrentConfigFunction · 0.85

Calls 1

StringMethod · 0.80

Tested by

no test coverage detected