Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

delete guest cluster nodes from Kubernetes API #484

Merged
merged 31 commits into from
Jun 8, 2018
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 36 additions & 15 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,20 @@



required = [
"github.com/docker/distribution/reference",
]



[[constraint]]
name = "github.com/cenkalti/backoff"
version = "1.1.0"

[[constraint]]
branch = "master"
name = "github.com/docker/distribution"

[[constraint]]
branch = "master"
name = "github.com/giantswarm/apiextensions"
Expand Down Expand Up @@ -93,6 +103,10 @@
name = "k8s.io/client-go"
version = "kubernetes-1.9.3"

[[constraint]]
branch = "release-1.9"
name = "k8s.io/kubernetes"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to pin this. There was no other way I found to get the stupid deps right. This maybe improves again with the move to 1.10.4.




[prune]
Expand Down
75 changes: 43 additions & 32 deletions service/controller/cluster.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package controller

import (
"time"

"github.com/giantswarm/apiextensions/pkg/apis/provider/v1alpha1"
"github.com/giantswarm/apiextensions/pkg/clientset/versioned"
"github.com/giantswarm/certs"
Expand All @@ -19,6 +17,8 @@ import (
"github.com/giantswarm/kvm-operator/service/controller/v11"
"github.com/giantswarm/kvm-operator/service/controller/v12"
v12cloudconfig "github.com/giantswarm/kvm-operator/service/controller/v12/cloudconfig"
"github.com/giantswarm/kvm-operator/service/controller/v13"
v13cloudconfig "github.com/giantswarm/kvm-operator/service/controller/v13/cloudconfig"
"github.com/giantswarm/kvm-operator/service/controller/v2"
"github.com/giantswarm/kvm-operator/service/controller/v3"
"github.com/giantswarm/kvm-operator/service/controller/v4"
Expand All @@ -30,10 +30,11 @@ import (
)

type ClusterConfig struct {
G8sClient versioned.Interface
K8sClient kubernetes.Interface
K8sExtClient apiextensionsclient.Interface
Logger micrologger.Logger
CertsSearcher certs.Interface
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is some refactoring because of the injection of the certs searcher. This is because different controllers need it.

G8sClient versioned.Interface
K8sClient kubernetes.Interface
K8sExtClient apiextensionsclient.Interface
Logger micrologger.Logger

GuestUpdateEnabled bool
OIDC ClusterConfigOIDC
Expand Down Expand Up @@ -73,21 +74,6 @@ func NewCluster(config ClusterConfig) (*Cluster, error) {
}
}

var certsSearcher certs.Interface
{
c := certs.Config{
K8sClient: config.K8sClient,
Logger: config.Logger,

WatchTimeout: 5 * time.Second,
}

certsSearcher, err = certs.NewSearcher(c)
if err != nil {
return nil, microerror.Mask(err)
}
}

var randomkeysSearcher randomkeys.Interface
{
keyConfig := randomkeys.DefaultConfig()
Expand Down Expand Up @@ -118,7 +104,7 @@ func NewCluster(config ClusterConfig) (*Cluster, error) {
var resourceSetV2 *controller.ResourceSet
{
c := v2.ResourceSetConfig{
CertsSearcher: certsSearcher,
CertsSearcher: config.CertsSearcher,
K8sClient: config.K8sClient,
Logger: config.Logger,
RandomkeysSearcher: randomkeysSearcher,
Expand All @@ -140,7 +126,7 @@ func NewCluster(config ClusterConfig) (*Cluster, error) {
var resourceSetV3 *controller.ResourceSet
{
c := v3.ResourceSetConfig{
CertsSearcher: certsSearcher,
CertsSearcher: config.CertsSearcher,
K8sClient: config.K8sClient,
Logger: config.Logger,
RandomkeysSearcher: randomkeysSearcher,
Expand All @@ -158,7 +144,7 @@ func NewCluster(config ClusterConfig) (*Cluster, error) {
var resourceSetV4 *controller.ResourceSet
{
c := v4.ResourceSetConfig{
CertsSearcher: certsSearcher,
CertsSearcher: config.CertsSearcher,
K8sClient: config.K8sClient,
Logger: config.Logger,
RandomkeysSearcher: randomkeysSearcher,
Expand All @@ -176,7 +162,7 @@ func NewCluster(config ClusterConfig) (*Cluster, error) {
var resourceSetV5 *controller.ResourceSet
{
c := v5.ResourceSetConfig{
CertsSearcher: certsSearcher,
CertsSearcher: config.CertsSearcher,
K8sClient: config.K8sClient,
Logger: config.Logger,
RandomkeysSearcher: randomkeysSearcher,
Expand All @@ -194,7 +180,7 @@ func NewCluster(config ClusterConfig) (*Cluster, error) {
var resourceSetV6 *controller.ResourceSet
{
c := v6.ResourceSetConfig{
CertsSearcher: certsSearcher,
CertsSearcher: config.CertsSearcher,
K8sClient: config.K8sClient,
Logger: config.Logger,
RandomkeysSearcher: randomkeysSearcher,
Expand All @@ -212,7 +198,7 @@ func NewCluster(config ClusterConfig) (*Cluster, error) {
var resourceSetV7 *controller.ResourceSet
{
c := v7.ResourceSetConfig{
CertsSearcher: certsSearcher,
CertsSearcher: config.CertsSearcher,
K8sClient: config.K8sClient,
Logger: config.Logger,
RandomkeysSearcher: randomkeysSearcher,
Expand All @@ -230,7 +216,7 @@ func NewCluster(config ClusterConfig) (*Cluster, error) {
var resourceSetV8 *controller.ResourceSet
{
c := v8.ResourceSetConfig{
CertsSearcher: certsSearcher,
CertsSearcher: config.CertsSearcher,
K8sClient: config.K8sClient,
Logger: config.Logger,
RandomkeysSearcher: randomkeysSearcher,
Expand All @@ -248,7 +234,7 @@ func NewCluster(config ClusterConfig) (*Cluster, error) {
var resourceSetV9 *controller.ResourceSet
{
c := v9.ResourceSetConfig{
CertsSearcher: certsSearcher,
CertsSearcher: config.CertsSearcher,
K8sClient: config.K8sClient,
Logger: config.Logger,
RandomkeysSearcher: randomkeysSearcher,
Expand All @@ -266,7 +252,7 @@ func NewCluster(config ClusterConfig) (*Cluster, error) {
var resourceSetV10 *controller.ResourceSet
{
c := v10.ResourceSetConfig{
CertsSearcher: certsSearcher,
CertsSearcher: config.CertsSearcher,
K8sClient: config.K8sClient,
Logger: config.Logger,
RandomkeysSearcher: randomkeysSearcher,
Expand All @@ -284,7 +270,7 @@ func NewCluster(config ClusterConfig) (*Cluster, error) {
var resourceSetV11 *controller.ResourceSet
{
c := v11.ClusterResourceSetConfig{
CertsSearcher: certsSearcher,
CertsSearcher: config.CertsSearcher,
K8sClient: config.K8sClient,
Logger: config.Logger,
RandomkeysSearcher: randomkeysSearcher,
Expand All @@ -302,7 +288,7 @@ func NewCluster(config ClusterConfig) (*Cluster, error) {
var resourceSetV12 *controller.ResourceSet
{
c := v12.ClusterResourceSetConfig{
CertsSearcher: certsSearcher,
CertsSearcher: config.CertsSearcher,
K8sClient: config.K8sClient,
Logger: config.Logger,
RandomkeysSearcher: randomkeysSearcher,
Expand All @@ -323,6 +309,30 @@ func NewCluster(config ClusterConfig) (*Cluster, error) {
}
}

var resourceSetV13 *controller.ResourceSet
{
c := v13.ClusterResourceSetConfig{
CertsSearcher: config.CertsSearcher,
K8sClient: config.K8sClient,
Logger: config.Logger,
RandomkeysSearcher: randomkeysSearcher,

GuestUpdateEnabled: config.GuestUpdateEnabled,
ProjectName: config.ProjectName,
OIDC: v13cloudconfig.OIDCConfig{
ClientID: config.OIDC.ClientID,
IssuerURL: config.OIDC.IssuerURL,
UsernameClaim: config.OIDC.UsernameClaim,
GroupsClaim: config.OIDC.GroupsClaim,
},
}

resourceSetV13, err = v13.NewClusterResourceSet(c)
if err != nil {
return nil, microerror.Mask(err)
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the latest resource package got introduced it was not properly wired. Doing this here to get going.


var resourceRouter *controller.ResourceRouter
{
c := controller.ResourceRouterConfig{
Expand All @@ -340,6 +350,7 @@ func NewCluster(config ClusterConfig) (*Cluster, error) {
resourceSetV10,
resourceSetV11,
resourceSetV12,
resourceSetV13,
},
}

Expand Down
Loading