Skip to content
This repository has been archived by the owner on Apr 7, 2020. It is now read-only.

Commit

Permalink
Add Alicloud controlplane webhooks
Browse files Browse the repository at this point in the history
  • Loading branch information
stoyanr committed Jun 6, 2019
1 parent 7e79fe2 commit e24ab96
Show file tree
Hide file tree
Showing 26 changed files with 1,632 additions and 4 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ start-provider-alicloud:
./controllers/provider-alicloud/cmd/gardener-extension-provider-alicloud \
--config-file=./controllers/provider-alicloud/example/00-componentconfig.yaml \
--infrastructure-ignore-operation-annotation=$(IGNORE_OPERATION_ANNOTATION) \
--leader-election=$(LEADER_ELECTION)
--leader-election=$(LEADER_ELECTION) \
--webhook-config-mode=url \
--webhook-config-name=alicloud-webhooks \
--webhook-config-host=$(HOSTNAME)

.PHONY: start-provider-packet
start-provider-packet:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ data:
machineImages:
{{ toYaml .Values.config.machineImages | indent 4 }}
{{- end }}
etcd:
storage:
className: {{ .Values.config.etcd.storage.className }}
capacity: {{ .Values.config.etcd.storage.capacity }}
backup:
schedule: {{ .Values.config.etcd.backup.schedule }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: {{ .Values.config.etcd.storage.className }}
provisioner: diskplugin.csi.alibabacloud.com
allowVolumeExpansion: true
parameters:
csi.storage.k8s.io/fstype: ext4
type: cloud_ssd
readOnly: false
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,29 @@ image:
resources: {}

controllers:
controlplane:
concurrentSyncs: 5
infrastructure:
concurrentSyncs: 5
ignoreOperationAnnotation: false
worker:
concurrentSyncs: 5

disableControllers: []
disableControllers:
- controlplane-controller
disableWebhooks:
- controlplane
- controlplaneexposure
- controlplanebackup

config:
machineImages:
- name: coreos
version: 2023.5.0
id: coreos_2023_4_0_64_30G_alibase_20190319.vhd
etcd:
storage:
className: gardener.cloud-fast
capacity: 25Gi
backup:
schedule: "0 */24 * * *"
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ import (
alicloudcontrolplane "github.com/gardener/gardener-extensions/controllers/provider-alicloud/pkg/controller/controlplane"
alicloudinfrastructure "github.com/gardener/gardener-extensions/controllers/provider-alicloud/pkg/controller/infrastructure"
alicloudworker "github.com/gardener/gardener-extensions/controllers/provider-alicloud/pkg/controller/worker"
alicloudcontrolplanebackup "github.com/gardener/gardener-extensions/controllers/provider-alicloud/pkg/webhook/controlplanebackup"
alicloudcontrolplaneexposure "github.com/gardener/gardener-extensions/controllers/provider-alicloud/pkg/webhook/controlplaneexposure"
"github.com/gardener/gardener-extensions/pkg/controller"
controllercmd "github.com/gardener/gardener-extensions/pkg/controller/cmd"
"github.com/gardener/gardener-extensions/pkg/controller/infrastructure"
webhookcmd "github.com/gardener/gardener-extensions/pkg/webhook/cmd"

"github.com/spf13/cobra"
"sigs.k8s.io/controller-runtime/pkg/manager"
Expand Down Expand Up @@ -63,7 +66,18 @@ func NewControllerManagerCommand(ctx context.Context) *cobra.Command {
MaxConcurrentReconciles: 5,
}

controllerSwitches = alicloudcmd.ControllerSwitchOptions()
controllerSwitches = alicloudcmd.ControllerSwitchOptions()
webhookSwitches = alicloudcmd.WebhookSwitchOptions()
webhookServerOptions = &webhookcmd.ServerOptions{
Port: 7890,
CertDir: "/tmp/cert",
Mode: webhookcmd.ServiceMode,
Name: "webhooks",
Namespace: os.Getenv("WEBHOOK_CONFIG_NAMESPACE"),
ServiceSelectors: "{}",
Host: "localhost",
}
webhookOptions = webhookcmd.NewAddToManagerOptions("alicloud-webhooks", webhookServerOptions, webhookSwitches)

aggOption = controllercmd.NewOptionAggregator(
restOpts,
Expand All @@ -73,6 +87,7 @@ func NewControllerManagerCommand(ctx context.Context) *cobra.Command {
controllercmd.PrefixOption("worker-", workerCtrlOpts),
configFileOpts,
controllerSwitches,
webhookOptions,
)
)

Expand All @@ -98,6 +113,8 @@ func NewControllerManagerCommand(ctx context.Context) *cobra.Command {
}

configFileOpts.Completed().ApplyMachineImages(&alicloudworker.DefaultAddOptions.MachineImages)
configFileOpts.Completed().ApplyETCDStorage(&alicloudcontrolplaneexposure.DefaultAddOptions.ETCDStorage)
configFileOpts.Completed().ApplyETCDBackup(&alicloudcontrolplanebackup.DefaultAddOptions.ETCDBackup)
controlPlaneCtrlOpts.Completed().Apply(&alicloudcontrolplane.Options)
infraCtrlOpts.Completed().Apply(&alicloudinfrastructure.DefaultAddOptions.Controller)
infraReconcileOpts.Completed().Apply(&alicloudinfrastructure.DefaultAddOptions.IgnoreOperationAnnotation)
Expand All @@ -107,6 +124,10 @@ func NewControllerManagerCommand(ctx context.Context) *cobra.Command {
controllercmd.LogErrAndExit(err, "Could not add controllers to manager")
}

if err := webhookOptions.Completed().AddToManager(mgr); err != nil {
controllercmd.LogErrAndExit(err, "Could not add webhooks to manager")
}

if err := mgr.Start(ctx.Done()); err != nil {
controllercmd.LogErrAndExit(err, "Error running manager")
}
Expand Down
6 changes: 6 additions & 0 deletions controllers/provider-alicloud/example/00-componentconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ machineImages:
- name: coreos
version: 2023.5.0
id: coreos_2023_4_0_64_30G_alibase_20190319.vhd
etcd:
storage:
className: gardener.cloud-fast
capacity: 25Gi
backup:
schedule: "0 */24 * * *"
11 changes: 11 additions & 0 deletions controllers/provider-alicloud/example/30-etcd-backup-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Secret
metadata:
name: etcd-backup
namespace: shoot--foo--bar
type: Opaque
data:
bucketName: YnVja2V0MTIz # bucket123
storageEndpoint: ZXUtd2VzdC0x # eu-west-1
accessKeyID: YWRtaW4= # admin
accessKeySecret: YWRtaW4= # admin
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
deployment:
type: helm
providerConfig:
chart: H4sIAAAAA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43M2WY0pU8zDJcO+12ASB5WYn+7AlYBbiLXG6xEhtHyX1BE2eaehHmJskbwWlOLDZLEkRTQlQeCG2HpB5S8C8h5YaJrjQWDiz7ZsepU8f+cQ+RNzfPDQCPrMUkSBfpLJiAGYhM+VccT7qz+tlhSd7hq4kkd3s3KU3jVkm9U0u5aWV72fzLCh5ko6m87BHcbVsDznnih+kJhlPPuLSNM7MkhoXStbvsdHzo0NdBTtgX/5X9FpfnwkeOv/tnm6d/7ZbrWa7yv8eA3ae/235gmr7t+ywf/S8HQv2rn97HGfO8r6lDjy4/lut7fOfXq9a/48C+fWfHr9uZ2dj236m7WCHM3jIUbAxNz0aFX19z/A2CuIZC11PMhctcEIw5THZpscXNRIEfPXObFid30UktFxiaURrERFIUSU75Bp7i/mpVOsImcN139UHHebFkL6R0tZlxL8Ig3UfpiSQ9P9mQT8Qyut/aafyiH8Acuj+T7tTuv/VOanOfx8F7BmRPcdMzoRw0cTuzBN6GWXxE+1EFwxZw76DHEVmfTAhRNcRUe7gaDgdcXWpr4tjWlHbFJPw6UutljsjSC7j6NfIXIqtJbvS+bOGPvSwubhfsqcjdr3vTCT1AZBsq9xLpVY+sNAVVJ7V3FFH2vs9ncw5vy113XqldzgDKMNWs73JYtSjD1BrpWs/+V18Qbk0zGd/U9Nutjtuz21aDfhppxvdftO9ad6cdG86zdc3xvtKeqPv/zc7rV/c5Vy7yc19oK3bQLm7QMU9L2dKzLybTtmNn3bvNTONxZs8m3s89SY8b7S78Fz/q/+s7riCCiqooIIKKqigggoqqKCCCiqooIIKKqigggqOAv8DOHt21ABQAAA=
values:
image:
tag: 0.7.0-dev
2 changes: 2 additions & 0 deletions controllers/provider-alicloud/pkg/alicloud/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ const (
AccessKeyID = "accessKeyID"
// AccessKeySecret is the data field in a secret where the access key secret is stored at.
AccessKeySecret = "accessKeySecret"
// StorageEndpoint is the data field in a secret where the storage endpoint is stored at.
StorageEndpoint = "storageEndpoint"
)

// ReadSecretCredentials reads the Credentials from the given secret.
Expand Down
11 changes: 11 additions & 0 deletions controllers/provider-alicloud/pkg/alicloud/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ import "path/filepath"
const (
// Name is the name of the Alicloud provider.
Name = "provider-alicloud"
// StorageProviderName is the name of the Alicloud storage provider.
StorageProviderName = "OSS"

// InfraRelease is the name of the alicloud-infra chart.
InfraRelease = "alicloud-infra"
// ETCDBackupRestoreImageName is the name of the etcd backup and restore image.
ETCDBackupRestoreImageName = "etcd-backup-restore"

// MachineControllerManagerImageName is the name of the MachineControllerManager image.
MachineControllerManagerImageName = "machine-controller-manager"
Expand All @@ -38,10 +42,17 @@ const (
// CSIPluginImageName is the name of the CSI plugin image.
CSIPluginImageName = "csi-plugin-alicloud"

// BucketName is a constant for the key in a backup secret that holds the bucket name.
// The bucket name is written to the backup secret by Gardener as a temporary solution.
// TODO In the future, the bucket name should come from a BackupBucket resource (see https://github.com/gardener/gardener/blob/master/docs/proposals/02-backupinfra.md)
BucketName = "bucketName"

// CloudProviderConfigName is the name of the configmap containing the cloud provider config.
CloudProviderConfigName = "cloud-provider-config"
// MachineControllerManagerName is a constant for the name of the machine-controller-manager.
MachineControllerManagerName = "machine-controller-manager"
// BackupSecretName is the name of the secret containing the credentials for storing the backups of Shoot clusters.
BackupSecretName = "etcd-backup"
)

var (
Expand Down
25 changes: 25 additions & 0 deletions controllers/provider-alicloud/pkg/apis/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package config

import (
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand All @@ -27,6 +28,8 @@ type ControllerConfiguration struct {
// MachineImages is the list of machine images that are understood by the controller. It maps
// logical names and versions to Alicloud-specific identifiers.
MachineImages []MachineImage
// ETCD is the etcd configuration.
ETCD ETCD
}

// MachineImage is a mapping from logical names and versions to Alicloud-specific identifiers.
Expand All @@ -38,3 +41,25 @@ type MachineImage struct {
// ID is the id of the image.
ID string
}

// ETCD is an etcd configuration.
type ETCD struct {
// ETCDStorage is the etcd storage configuration.
Storage ETCDStorage
// ETCDBackup is the etcd backup configuration.
Backup ETCDBackup
}

// ETCDStorage is an etcd storage configuration.
type ETCDStorage struct {
// ClassName is the name of the storage class used in etcd-main volume claims.
ClassName *string
// Capacity is the storage capacity used in etcd-main volume claims.
Capacity *resource.Quantity
}

// ETCDBackup is an etcd backup configuration.
type ETCDBackup struct {
// Schedule is the etcd backup schedule.
Schedule *string
}
28 changes: 28 additions & 0 deletions controllers/provider-alicloud/pkg/apis/config/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package v1alpha1

import (
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand All @@ -27,6 +28,8 @@ type ControllerConfiguration struct {
// MachineImages is the list of machine images that are understood by the controller. It maps
// logical names and versions to Alicloud-specific identifiers.
MachineImages []MachineImage `json:"machineImages,omitempty"`
// ETCD is the etcd configuration.
ETCD ETCD `json:"etcd"`
}

// MachineImage is a mapping from logical names and versions to Alicloud-specific identifiers.
Expand All @@ -38,3 +41,28 @@ type MachineImage struct {
// ID is the id of the image.
ID string `json:"id"`
}

// ETCD is an etcd configuration.
type ETCD struct {
// ETCDStorage is the etcd storage configuration.
Storage ETCDStorage `json:"storage"`
// ETCDBackup is the etcd backup configuration.
Backup ETCDBackup `json:"backup"`
}

// ETCDStorage is an etcd storage configuration.
type ETCDStorage struct {
// ClassName is the name of the storage class used in etcd-main volume claims.
// +optional
ClassName *string `json:"className,omitempty"`
// Capacity is the storage capacity used in etcd-main volume claims.
// +optional
Capacity *resource.Quantity `json:"capacity,omitempty"`
}

// ETCDBackup is an etcd backup configuration.
type ETCDBackup struct {
// Schedule is the etcd backup schedule.
// +optional
Schedule *string `json:"schedule,omitempty"`
}
Loading

0 comments on commit e24ab96

Please sign in to comment.