Skip to content

Commit

Permalink
[services] Move service manifest gen to new pkg
Browse files Browse the repository at this point in the history
Introduces a new package `services` which will contain functions related
to service manifest generation.
  • Loading branch information
sebsoto committed Aug 3, 2022
1 parent d0a949b commit e6d163a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
20 changes: 2 additions & 18 deletions controllers/configmap_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ import (
"github.com/openshift/windows-machine-config-operator/pkg/metrics"
"github.com/openshift/windows-machine-config-operator/pkg/nodeconfig"
"github.com/openshift/windows-machine-config-operator/pkg/secrets"
"github.com/openshift/windows-machine-config-operator/pkg/services"
"github.com/openshift/windows-machine-config-operator/pkg/servicescm"
"github.com/openshift/windows-machine-config-operator/pkg/signer"
"github.com/openshift/windows-machine-config-operator/pkg/windows"
"github.com/openshift/windows-machine-config-operator/pkg/wiparser"
"github.com/openshift/windows-machine-config-operator/version"
)
Expand Down Expand Up @@ -88,7 +88,7 @@ func NewConfigMapReconciler(mgr manager.Manager, clusterConfig cluster.Config, w
}

// Get expected state of the Windows service ConfigMap
svcData, err := generateServicesManifest()
svcData, err := services.GenerateManifest()
if err != nil {
return nil, errors.Wrap(err, "error generating expected Windows service state")
}
Expand Down Expand Up @@ -474,19 +474,3 @@ func (r *ConfigMapReconciler) isKubeAPIServerServingCAConfigMap(obj client.Objec
return obj.GetNamespace() == certificates.KubeApiServerOperatorNamespace &&
obj.GetName() == certificates.KubeAPIServerServingCAConfigMapName
}

// generateServicesManifest returns the expected state of the Windows service configmap
func generateServicesManifest() (*servicescm.Data, error) {
services := &[]servicescm.Service{{
Name: windows.WindowsExporterServiceName,
Command: windows.WindowsExporterServiceCommand,
NodeVariablesInCommand: nil,
PowershellVariablesInCommand: nil,
Dependencies: nil,
Bootstrap: false,
Priority: 1,
}}
// TODO: All payload filenames and checksums must be added here https://issues.redhat.com/browse/WINC-847
files := &[]servicescm.FileInfo{}
return servicescm.NewData(services, files)
}
22 changes: 22 additions & 0 deletions pkg/services/services.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package services

import (
"github.com/openshift/windows-machine-config-operator/pkg/servicescm"
"github.com/openshift/windows-machine-config-operator/pkg/windows"
)

// GenerateManifest returns the expected state of the Windows service configmap
func GenerateManifest() (*servicescm.Data, error) {
services := &[]servicescm.Service{{
Name: windows.WindowsExporterServiceName,
Command: windows.WindowsExporterServiceCommand,
NodeVariablesInCommand: nil,
PowershellVariablesInCommand: nil,
Dependencies: nil,
Bootstrap: false,
Priority: 1,
}}
// TODO: All payload filenames and checksums must be added here https://issues.redhat.com/browse/WINC-847
files := &[]servicescm.FileInfo{}
return servicescm.NewData(services, files)
}

0 comments on commit e6d163a

Please sign in to comment.