diff --git a/docs/huawei-cloud-controller-manager-configuration.md b/docs/huawei-cloud-controller-manager-configuration.md index 8a67cdf73..f9385ea69 100644 --- a/docs/huawei-cloud-controller-manager-configuration.md +++ b/docs/huawei-cloud-controller-manager-configuration.md @@ -63,7 +63,11 @@ This section contains network configuration information. ## Loadbalancer Configuration These arguments will be applied when the annotation in the service is empty. -It needs to be stored in the `loadbalancer-config` ConfigMap under the `huawei-cloud-provider` namespace. +It needs to be stored in the `loadbalancer-config` ConfigMap in `kube-system` namespace. + +> Since v0.26.4, the `huawei-cloud-provider` namespace is no longer used, and `kube-system` is used instead. +> If you created the `loadbalancer-config` in the `huawei-cloud-provider` namespace, +> it will still work, but we recommend that you migrate it to `kube-system`. Here's an example: @@ -71,7 +75,7 @@ Here's an example: apiVersion: v1 kind: ConfigMap metadata: - namespace: huawei-cloud-provider + namespace: kube-system name: loadbalancer-config data: loadBalancerOption: |- diff --git a/examples/loadbalancers/config.yaml b/examples/loadbalancers/config.yaml index 3750bf51c..ae2df79ed 100644 --- a/examples/loadbalancers/config.yaml +++ b/examples/loadbalancers/config.yaml @@ -1,8 +1,3 @@ -kind: Namespace -apiVersion: v1 -metadata: - name: huawei-cloud-provider ---- apiVersion: v1 kind: Secret metadata: @@ -16,7 +11,7 @@ data: apiVersion: v1 kind: ConfigMap metadata: - namespace: huawei-cloud-provider + namespace: kube-system name: loadbalancer-config data: loadBalancerOption: |- diff --git a/hack/deploy/huawei-cloud-controller-manager.yaml b/hack/deploy/huawei-cloud-controller-manager.yaml index 7b91857db..e36833b77 100644 --- a/hack/deploy/huawei-cloud-controller-manager.yaml +++ b/hack/deploy/huawei-cloud-controller-manager.yaml @@ -1,8 +1,3 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: huawei-cloud-provider ---- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: diff --git a/manifests/huawei-cloud-controller-manager.yaml b/manifests/huawei-cloud-controller-manager.yaml index 8ec07c02d..6eb3696f9 100644 --- a/manifests/huawei-cloud-controller-manager.yaml +++ b/manifests/huawei-cloud-controller-manager.yaml @@ -1,8 +1,3 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: huawei-cloud-provider ---- apiVersion: apps/v1 kind: Deployment metadata: @@ -71,6 +66,10 @@ spec: resources: requests: cpu: 200m + memory: 100Mi + limits: + cpu: 2 + memory: 2Gi hostNetwork: true volumes: - hostPath: diff --git a/pkg/cloudprovider/huaweicloud/huaweicloud.go b/pkg/cloudprovider/huaweicloud/huaweicloud.go index bfe78c4bc..26a1e3431 100644 --- a/pkg/cloudprovider/huaweicloud/huaweicloud.go +++ b/pkg/cloudprovider/huaweicloud/huaweicloud.go @@ -632,7 +632,7 @@ func (h *CloudProvider) Master(ctx context.Context, clusterName string) (string, return "", nil } -//util functions +// util functions func IsPodActive(p v1.Pod) bool { if v1.PodSucceeded != p.Status.Phase && @@ -979,7 +979,7 @@ func leaderElection(id string, restConfig *rest.Config, recorder record.EventRec retryPeriod := 30 * time.Second configmapLock, err := resourcelock.NewFromKubeconfig(resourcelock.ConfigMapsLeasesResourceLock, - config.ProviderNamespace, + "kube-system", leaseName, resourcelock.ResourceLockConfig{ Identity: fmt.Sprintf("%s_%s", id, string(uuid.NewUUID())), diff --git a/pkg/config/loadbalancerconfig.go b/pkg/config/loadbalancerconfig.go index bb9113123..6f2c38fc5 100644 --- a/pkg/config/loadbalancerconfig.go +++ b/pkg/config/loadbalancerconfig.go @@ -21,12 +21,13 @@ import ( "encoding/json" "fmt" - elbmodel "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v2/model" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" corev1 "k8s.io/client-go/kubernetes/typed/core/v1" "k8s.io/client-go/rest" "k8s.io/klog/v2" + elbmodel "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v2/model" + "sigs.k8s.io/cloud-provider-huaweicloud/pkg/utils/metadata" ) @@ -104,10 +105,12 @@ func LoadElbConfigFromCM() (*LoadbalancerConfig, error) { return defaultCfg, err } - configMap, err := kubeClient.ConfigMaps(ProviderNamespace). - Get(context.TODO(), loadbalancerConfigMap, metav1.GetOptions{}) + configMap, err := kubeClient.ConfigMaps(ProviderNamespace).Get(context.TODO(), loadbalancerConfigMap, metav1.GetOptions{}) if err != nil { - return defaultCfg, err + configMap, err = kubeClient.ConfigMaps("kube-system").Get(context.TODO(), loadbalancerConfigMap, metav1.GetOptions{}) + if err != nil { + return defaultCfg, err + } } klog.Infof("get loadbalancer options: %v", configMap.Data)