WIP : Extended Service definition + initial entry point for scheduling

This commit is contained in:
Rodolfo Pacheco
2020-10-27 14:24:05 -04:00
parent 1178764fa6
commit 14f6089fbb
7 changed files with 98 additions and 13 deletions

View File

@@ -23,10 +23,11 @@ type AuthHost struct {
}
func newAuthHost(infraCfg airshipv1.InfraConfig) InfrastructureService {
return &AuthHost{
authhost := &AuthHost{
Service: Service{
serviceName: airshipv1.AuthHostService,
config: infraCfg,
},
}
return authhost
}

View File

@@ -15,6 +15,9 @@
package services
import (
"context"
helm "github.com/fluxcd/helm-controller/api/v2beta1"
"sigs.k8s.io/controller-runtime/pkg/client"
airshipv1 "sipcluster/pkg/api/v1"
airshipvms "sipcluster/pkg/vbmh"
)
@@ -27,7 +30,7 @@ import (
// Validate : will make sure that the deployment is successfull
type InfrastructureService interface {
//
Deploy(airshipvms.MachineList, airshipvms.MachineData) error
Deploy(*airshipvms.MachineList, airshipvms.MachineData, client.Client) error
Validate() error
}
@@ -37,8 +40,18 @@ type Service struct {
config airshipv1.InfraConfig
}
func (s *Service) Deploy(machines airshipvms.MachineList, machineData airshipvms.MachineData) error {
func (s *Service) Deploy(machines *airshipvms.MachineList, machineData airshipvms.MachineData, c client.Client) error {
// do something, might decouple this a bit
// If the serviucces are defined as Helm Chart , then deploy might be simply
// Take the data from teh appropriate Machines
// Prepare the Config
// Prepare the HelmReleasecd
helmRelease := &helm.HelmRelease{}
if err := c.Create(context.TODO(), helmRelease); err != nil {
return err
}
return nil
}