Documentation ¶
Index ¶
- Constants
- Variables
- func Generate(name, namespace string, data *Data) (*core.ConfigMap, error)
- func GetLatest(c client.Client, ctx context.Context, namespace string) (*core.ConfigMap, error)
- func List(c client.Client, ctx context.Context, namespace string) ([]core.ConfigMap, error)
- type Data
- type FileInfo
- type NodeCmdArg
- type PowershellPreScript
- type Service
Constants ¶
const ( // NamePrefix is the prefix of all Windows services ConfigMap names NamePrefix = "windows-services-" // CMDataAnnotation is a Node annotation whose value is the base64 encoded data of current version's service CM // TODO: Remove this when the WICD controller has permissions to watch ConfigMaps CMDataAnnotation = "windowsmachineconfig.openshift.io/cmdata" )
Variables ¶
var ( // Name is the full name of the Windows services ConfigMap, detailing the service config for a specific WMCO version Name string )
Functions ¶
func Generate ¶
Generate creates an immutable service ConfigMap which provides WICD with the specifications for each Windows service that must be created on a Windows instance.
Types ¶
type Data ¶
type Data struct { // Services contains information required to start all required Windows services with proper arguments and order Services []Service `json:"services"` // Files contains the path and checksum of all the files copied to a Windows VM by WMCO Files []FileInfo `json:"files"` // EnvironmentVars will be set as system-level environment variables on each Windows instance EnvironmentVars map[string]string `json:"environmentVars,omitempty"` // WatchedEnvironmentVars contains information about the WMCO watched environment variables WatchedEnvironmentVars []string `json:"watchedEnvironmentVars,omitempty"` }
Data represents the Data field of a `windows-services` ConfigMap resource, which is all the required information to configure a Windows instance as a Node
func NewData ¶
func NewData(services *[]Service, files *[]FileInfo, envVars map[string]string, watchedEnvVars []string) (*Data, error)
NewData returns a new 'Data' object with the given services, files, watched ENV vars and ENV vars if they exist. Validates given object contents on creation.
func Parse ¶
Parse converts ConfigMap data into the objects representing a Windows services ConfigMap schema Returns error if the given data is invalid in structure
func (*Data) GetBootstrapServices ¶
GetBootstrapServices filters the cmData object's services list and returns only the bootstrap services
func (*Data) ValidateExpectedContent ¶
ValidateExpectedContent ensures that the given slices are all comprised of only the expected services, files, and environment variables
type FileInfo ¶
type FileInfo struct { // Path is the filepath of a file on an instance Path string `json:"path"` // Checksum is the checksum of the file specified at Path. It is used to validate that a file has not been changed Checksum string `json:"checksum"` }
FileInfo contains the path and checksum of a file copied to an instance by WMCO
type NodeCmdArg ¶
type NodeCmdArg struct { // Name is the variable name as it appears in commands Name string `json:"name"` // NodeObjectJsonPath is the JSON path of a field within an instance's Node object. // The value of this field is the value of the variable NodeObjectJsonPath string `json:"nodeObjectJsonPath"` }
NodeCmdArg describes a Windows command variable and how its value can be populated
type PowershellPreScript ¶
type PowershellPreScript struct { // VariableName is the name of a variable which should be replaced by the output of the script. An empty value will // cause no variable replacement to occur, but the script will still be ran. VariableName string `json:"variableName,omitempty"` // Path is the location of a PowerShell script to be ran Path string `json:"path"` }
PowershellPreScript describes a PowerShell script to be ran and an optional variable to be populated
type Service ¶
type Service struct { // Name is the name of the Windows service Name string `json:"name"` // Command is the command that will launch the Windows service. This could potentially include strings whose values // will be derived from NodeVariablesInCommand and PowershellPreScripts. // Before the command is run on an instance, all node and PowerShell variables will be replaced by their values Command string `json:"path"` // NodeVariablesInCommand holds all variables in the service command whose values are sourced from a node object NodeVariablesInCommand []NodeCmdArg `json:"nodeVariablesInCommand,omitempty"` // PowershellPreScripts is a list of PowerShell scripts which must run successfully before the service is started PowershellPreScripts []PowershellPreScript `json:"powershellPreScripts,omitempty"` // Dependencies is a list of service names that this service is dependent on Dependencies []string `json:"dependencies,omitempty"` // Bootstrap is a boolean flag indicating whether this service should be handled as part of node bootstrapping Bootstrap bool `json:"bootstrap"` // Priority is a non-negative integer that will be used to order the creation of the services. // Priority 0 is created first Priority uint `json:"priority"` }
Service represents the configuration spec of a Windows service