Use config instead of controller
This commit is contained in:
parent
7afe58c700
commit
bfd486568a
@ -62,6 +62,7 @@ func (e *EnvironmentsServer) Create(ctx context.Context, in *proto.CreateOptions
|
|||||||
|
|
||||||
environment := &controllers.Environemnt{
|
environment := &controllers.Environemnt{
|
||||||
UserID: in.GetOwnerId().GetUuid(),
|
UserID: in.GetOwnerId().GetUuid(),
|
||||||
|
Config: ctrl.GetConfigOrDie(),
|
||||||
Controller: e.controller,
|
Controller: e.controller,
|
||||||
Data: data,
|
Data: data,
|
||||||
Token: in.GetToken().GetToken(),
|
Token: in.GetToken().GetToken(),
|
||||||
@ -81,6 +82,10 @@ func (e *EnvironmentsServer) Create(ctx context.Context, in *proto.CreateOptions
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e *EnvironmentsServer) Update(ctx context.Context, in *proto.UpdateOptions) (*proto.EnvironmentFull, error) {
|
func (e *EnvironmentsServer) Update(ctx context.Context, in *proto.UpdateOptions) (*proto.EnvironmentFull, error) {
|
||||||
|
log := e.logInstance
|
||||||
|
log.WithValues("user_id", in.GetOwnerId().GetUuid())
|
||||||
|
ctx = logr.NewContext(ctx, log)
|
||||||
|
|
||||||
provider, err := infra.GetProvider(in.GetSpec().GetProvider().String())
|
provider, err := infra.GetProvider(in.GetSpec().GetProvider().String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -112,6 +117,7 @@ func (e *EnvironmentsServer) Update(ctx context.Context, in *proto.UpdateOptions
|
|||||||
}
|
}
|
||||||
|
|
||||||
environment := &controllers.Environemnt{
|
environment := &controllers.Environemnt{
|
||||||
|
Config: ctrl.GetConfigOrDie(),
|
||||||
UserID: in.GetOwnerId().GetUuid(),
|
UserID: in.GetOwnerId().GetUuid(),
|
||||||
Controller: e.controller,
|
Controller: e.controller,
|
||||||
Data: data,
|
Data: data,
|
||||||
@ -132,12 +138,17 @@ func (e *EnvironmentsServer) Update(ctx context.Context, in *proto.UpdateOptions
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e *EnvironmentsServer) Delete(ctx context.Context, in *proto.DeleteOptions) (*empty.Empty, error) {
|
func (e *EnvironmentsServer) Delete(ctx context.Context, in *proto.DeleteOptions) (*empty.Empty, error) {
|
||||||
|
log := e.logInstance
|
||||||
|
log.WithValues("user_id", in.GetOwnerId().GetUuid())
|
||||||
|
ctx = logr.NewContext(ctx, log)
|
||||||
|
|
||||||
data := &controllers.EnvironemntData{
|
data := &controllers.EnvironemntData{
|
||||||
Name: in.GetMetadata().GetName(),
|
Name: in.GetMetadata().GetName(),
|
||||||
UUID: in.GetId().GetUuid(),
|
UUID: in.GetId().GetUuid(),
|
||||||
}
|
}
|
||||||
|
|
||||||
environment := &controllers.Environemnt{
|
environment := &controllers.Environemnt{
|
||||||
|
Config: ctrl.GetConfigOrDie(),
|
||||||
UserID: in.GetOwnerId().GetUuid(),
|
UserID: in.GetOwnerId().GetUuid(),
|
||||||
Controller: e.controller,
|
Controller: e.controller,
|
||||||
Data: data,
|
Data: data,
|
||||||
@ -151,11 +162,16 @@ func (e *EnvironmentsServer) Delete(ctx context.Context, in *proto.DeleteOptions
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e *EnvironmentsServer) Get(ctx context.Context, in *proto.GetOptions) (*proto.EnvironmentFull, error) {
|
func (e *EnvironmentsServer) Get(ctx context.Context, in *proto.GetOptions) (*proto.EnvironmentFull, error) {
|
||||||
|
log := e.logInstance
|
||||||
|
log.WithValues("user_id", in.GetOwnerId().GetUuid())
|
||||||
|
ctx = logr.NewContext(ctx, log)
|
||||||
|
|
||||||
data := &controllers.EnvironemntData{
|
data := &controllers.EnvironemntData{
|
||||||
UUID: in.GetId().GetUuid(),
|
UUID: in.GetId().GetUuid(),
|
||||||
}
|
}
|
||||||
|
|
||||||
environment := &controllers.Environemnt{
|
environment := &controllers.Environemnt{
|
||||||
|
Config: ctrl.GetConfigOrDie(),
|
||||||
UserID: in.GetOwnerId().GetUuid(),
|
UserID: in.GetOwnerId().GetUuid(),
|
||||||
Controller: e.controller,
|
Controller: e.controller,
|
||||||
Data: data,
|
Data: data,
|
||||||
@ -197,6 +213,7 @@ func (e *EnvironmentsServer) List(in *proto.ListOptions, stream proto.Environmen
|
|||||||
ctx := logr.NewContext(stream.Context(), log)
|
ctx := logr.NewContext(stream.Context(), log)
|
||||||
|
|
||||||
environment := &controllers.Environemnt{
|
environment := &controllers.Environemnt{
|
||||||
|
Config: ctrl.GetConfigOrDie(),
|
||||||
UserID: in.GetOwnerId().GetUuid(),
|
UserID: in.GetOwnerId().GetUuid(),
|
||||||
Controller: e.controller,
|
Controller: e.controller,
|
||||||
Token: in.GetToken().GetToken(),
|
Token: in.GetToken().GetToken(),
|
||||||
|
@ -43,6 +43,7 @@ type EnvironemntData struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e *EnvironemntData) buildVars() (string, error) {
|
func (e *EnvironemntData) buildVars() (string, error) {
|
||||||
|
// Please make sure that the same variables are used by ansible
|
||||||
vars := fmt.Sprintf(`# -- Generated by the softplayer controller
|
vars := fmt.Sprintf(`# -- Generated by the softplayer controller
|
||||||
SP_PROVIDER=%s
|
SP_PROVIDER=%s
|
||||||
SP_KUBERNETES=%s
|
SP_KUBERNETES=%s
|
||||||
|
Loading…
Reference in New Issue
Block a user