-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
201 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
vendor | ||
tools/vendor | ||
VERSION | ||
bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package worker | ||
|
||
import ( | ||
"context" | ||
|
||
api "github.com/metal-stack/gardener-extension-provider-metal/pkg/apis/metal" | ||
"github.com/metal-stack/gardener-extension-provider-metal/pkg/apis/metal/v1alpha1" | ||
|
||
"github.com/gardener/gardener/extensions/pkg/controller" | ||
kutil "github.com/gardener/gardener/pkg/utils/kubernetes" | ||
"github.com/pkg/errors" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/client-go/util/retry" | ||
) | ||
|
||
func (w *workerDelegate) decodeWorkerProviderStatus() (*api.WorkerStatus, error) { | ||
workerStatus := &api.WorkerStatus{} | ||
|
||
if w.worker.Status.ProviderStatus == nil { | ||
return workerStatus, nil | ||
} | ||
|
||
if _, _, err := w.decoder.Decode(w.worker.Status.ProviderStatus.Raw, nil, workerStatus); err != nil { | ||
return nil, errors.Wrapf(err, "could not decode WorkerStatus '%s'", kutil.ObjectName(w.worker)) | ||
} | ||
|
||
return workerStatus, nil | ||
} | ||
|
||
func (w *workerDelegate) updateWorkerProviderStatus(ctx context.Context, workerStatus *api.WorkerStatus) error { | ||
var workerStatusV1alpha1 = &v1alpha1.WorkerStatus{ | ||
TypeMeta: metav1.TypeMeta{ | ||
APIVersion: v1alpha1.SchemeGroupVersion.String(), | ||
Kind: "WorkerStatus", | ||
}, | ||
} | ||
|
||
if err := w.scheme.Convert(workerStatus, workerStatusV1alpha1, nil); err != nil { | ||
return err | ||
} | ||
|
||
return controller.TryUpdateStatus(ctx, retry.DefaultBackoff, w.client, w.worker, func() error { | ||
w.worker.Status.ProviderStatus = &runtime.RawExtension{Object: workerStatusV1alpha1} | ||
return nil | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package worker | ||
|
||
import "context" | ||
|
||
// DeployMachineDependencies implements genericactuator.WorkerDelegate. | ||
func (w *workerDelegate) DeployMachineDependencies(_ context.Context) error { | ||
return nil | ||
} | ||
|
||
// CleanupMachineDependencies implements genericactuator.WorkerDelegate. | ||
func (w *workerDelegate) CleanupMachineDependencies(_ context.Context) error { | ||
return nil | ||
} |
Oops, something went wrong.