Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove zone of controlplane config #64

Merged
merged 1 commit into from
Apr 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 0 additions & 4 deletions charts/internal/cloud-provider-config/Chart.yaml

This file was deleted.

1 change: 0 additions & 1 deletion charts/internal/cloud-provider-config/values.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ spec:
mountPath: /var/lib/cloud-controller-manager
- name: cloud-provider-config
mountPath: /etc/kubernetes/cloudprovider
- name: cloudprovider
mountPath: /srv/cloudprovider
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
Expand All @@ -92,8 +90,5 @@ spec:
secret:
secretName: cloud-controller-manager
- name: cloud-provider-config
configMap:
name: cloud-provider-config
- name: cloudprovider
secret:
secretName: cloudprovider
secretName: cloud-provider-config
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v1
kind: ConfigMap
type: Opaque
kind: Secret
metadata:
name: cloud-provider-config
namespace: {{ .Release.Namespace }}
data:
cloudprovider.conf: |
{{ .Values.cloudConfig | indent 4 }}
cloudprovider.conf: {{ .Values.cloudConfig | b64enc }}
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ resources:
limits:
cpu: 250m
memory: 300Mi
cloudConfig: json-values
6 changes: 0 additions & 6 deletions docs/usage-as-end-user.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,11 @@ An example `ControlPlaneConfig` for the Alicloud extension looks as follows:
```yaml
apiVersion: alicloud.provider.extensions.gardener.cloud/v1alpha1
kind: ControlPlaneConfig
zone: eu-central-1a
cloudControllerManager:
featureGates:
CustomResourceValidation: true
```

The `zone` field tells the cloud-controller-manager in which zone it should mainly operate.
You can still create clusters in multiple availability zones, however, the cloud-controller-manager requires one "main" zone.
:warning: You always have to specify this field!

The `cloudControllerManager.featureGates` contains a map of explicitly enabled or disabled feature gates.
For production usage it's not recommend to use this field at all as you can enable alpha features or disable beta/stable features, potentially impacting the cluster stability.
If you don't want to configure anything for the `cloudControllerManager` simply omit the key in the YAML specification.
Expand Down Expand Up @@ -112,7 +107,6 @@ spec:
controlPlaneConfig:
apiVersion: alicloud.provider.extensions.gardener.cloud/v1alpha1
kind: ControlPlaneConfig
zone: eu-central-1a
workers:
- name: worker-xoluy
machine:
Expand Down
11 changes: 0 additions & 11 deletions hack/api-reference/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,6 @@ string
</tr>
<tr>
<td>
<code>zone</code></br>
<em>
string
</em>
</td>
<td>
<p>Zone is the Alicloud zone</p>
</td>
</tr>
<tr>
<td>
<code>cloudControllerManager</code></br>
<em>
<a href="#alicloud.provider.extensions.gardener.cloud/v1alpha1.CloudControllerManagerConfig">
Expand Down
2 changes: 0 additions & 2 deletions pkg/alicloud/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ const (
// 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"
// MachineControllerManagerVpaName is the name of the VerticalPodAutoscaler of the machine-controller-manager deployment.
Expand Down
12 changes: 12 additions & 0 deletions pkg/apis/alicloud/helper/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ func FindVSwitchForPurposeAndZone(vswitches []api.VSwitch, purpose api.Purpose,
return nil, fmt.Errorf("no vswitch with purpose %q in zone %q found", purpose, zone)
}

// FindVSwitchForPurpose takes a list of vswitches and tries to find the first entry
// whose purpose matches with the given purpose. If no such entry is found then
// an error will be returned.
func FindVSwitchForPurpose(vswitches []api.VSwitch, purpose api.Purpose) (*api.VSwitch, error) {
for _, vswitch := range vswitches {
if vswitch.Purpose == purpose {
return &vswitch, nil
}
}
return nil, fmt.Errorf("no vswitch with purpose %q found", purpose)
}

// FindSecurityGroupByPurpose takes a list of security groups and tries to find the first entry
// whose purpose matches with the given purpose. If no such entry is found then an error will be
// returned.
Expand Down
13 changes: 12 additions & 1 deletion pkg/apis/alicloud/helper/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ var _ = Describe("Helper", func() {
purpose api.Purpose = "foo"
purposeWrong api.Purpose = "baz"
)

DescribeTable("#FindVSwitchForPurposeAndZone",
func(vswitches []api.VSwitch, purpose api.Purpose, zone string, expectedVSwitch *api.VSwitch, expectErr bool) {
subnet, err := FindVSwitchForPurposeAndZone(vswitches, purpose, zone)
Expand All @@ -44,6 +43,18 @@ var _ = Describe("Helper", func() {
Entry("entry exists", []api.VSwitch{{ID: "bar", Purpose: purposeWrong, Zone: "europe"}}, purposeWrong, "europe", &api.VSwitch{ID: "bar", Purpose: purposeWrong, Zone: "europe"}, false),
)

DescribeTable("#FindVSwitchForPurpose",
func(vswitches []api.VSwitch, purpose api.Purpose, expectedVSwitch *api.VSwitch, expectErr bool) {
subnet, err := FindVSwitchForPurpose(vswitches, purpose)
expectResults(subnet, expectedVSwitch, err, expectErr)
},

Entry("list is nil", nil, purpose, nil, true),
Entry("empty list", []api.VSwitch{}, purpose, nil, true),
Entry("entry not found (no purpose)", []api.VSwitch{{ID: "bar", Purpose: purposeWrong, Zone: "europe"}}, purpose, nil, true),
Entry("entry exists", []api.VSwitch{{ID: "bar", Purpose: purposeWrong, Zone: "europe"}}, purposeWrong, &api.VSwitch{ID: "bar", Purpose: purposeWrong, Zone: "europe"}, false),
)

DescribeTable("#FindSecurityGroupByPurpose",
func(securityGroups []api.SecurityGroup, purpose api.Purpose, expectedSecurityGroup *api.SecurityGroup, expectErr bool) {
securityGroup, err := FindSecurityGroupByPurpose(securityGroups, purpose)
Expand Down
3 changes: 0 additions & 3 deletions pkg/apis/alicloud/types_controlplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ import (
type ControlPlaneConfig struct {
metav1.TypeMeta

// Zone is the Alicloud zone
Zone string

// CloudControllerManager contains configuration settings for the cloud-controller-manager.
CloudControllerManager *CloudControllerManagerConfig
}
Expand Down
3 changes: 0 additions & 3 deletions pkg/apis/alicloud/v1alpha1/types_controlplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ import (
type ControlPlaneConfig struct {
metav1.TypeMeta `json:",inline"`

// Zone is the Alicloud zone
Zone string `json:"zone"`

// CloudControllerManager contains configuration settings for the cloud-controller-manager.
// +optional
CloudControllerManager *CloudControllerManagerConfig `json:"cloudControllerManager,omitempty"`
Expand Down
2 changes: 0 additions & 2 deletions pkg/apis/alicloud/v1alpha1/zz_generated.conversion.go

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

68 changes: 0 additions & 68 deletions pkg/apis/alicloud/validation/controlplane.go

This file was deleted.

96 changes: 0 additions & 96 deletions pkg/apis/alicloud/validation/controlplane_test.go

This file was deleted.

4 changes: 2 additions & 2 deletions pkg/controller/controlplane/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ type AddOptions struct {
// The opts.Reconciler is being set with a newly instantiated actuator.
func AddToManagerWithOptions(mgr manager.Manager, opts AddOptions) error {
return controlplane.Add(mgr, controlplane.AddArgs{
Actuator: genericactuator.NewActuator(alicloud.Name, controlPlaneSecrets, nil, configChart, controlPlaneChart, controlPlaneShootChart,
Actuator: genericactuator.NewActuator(alicloud.Name, controlPlaneSecrets, nil, nil, controlPlaneChart, controlPlaneShootChart,
storageClassChart, nil, NewValuesProvider(logger), extensionscontroller.ChartRendererFactoryFunc(util.NewChartRendererForShoot),
imagevector.ImageVector(), alicloud.CloudProviderConfigName, opts.ShootWebhooks, mgr.GetWebhookServer().Port, logger),
imagevector.ImageVector(), "", opts.ShootWebhooks, mgr.GetWebhookServer().Port, logger),
ControllerOptions: opts.Controller,
Predicates: controlplane.DefaultPredicates(opts.IgnoreOperationAnnotation),
Type: alicloud.Type,
Expand Down
33 changes: 33 additions & 0 deletions pkg/controller/controlplane/clean_old_resources.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.package controlplane

package controlplane
jia-jerry marked this conversation as resolved.
Show resolved Hide resolved

import (
"context"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
)

func (vp *valuesProvider) deleteCloudProviderConfig(ctx context.Context, ns string) error {
cm := &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Namespace: ns,
Name: "cloud-provider-config",
},
}

return client.IgnoreNotFound(vp.Client().Delete(ctx, cm))
}
Loading