Skip to content

Commit 789e8db

Browse files
authored
Merge pull request #235 from chengxiangdong/fix_sid
Remove huawei-cloud-provider namespace
2 parents 675dce8 + ed39f31 commit 789e8db

File tree

6 files changed

+20
-24
lines changed

6 files changed

+20
-24
lines changed

docs/huawei-cloud-controller-manager-configuration.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,19 @@ This section contains network configuration information.
6363
## Loadbalancer Configuration
6464

6565
These arguments will be applied when the annotation in the service is empty.
66-
It needs to be stored in the `loadbalancer-config` ConfigMap under the `huawei-cloud-provider` namespace.
66+
It needs to be stored in the `loadbalancer-config` ConfigMap in `kube-system` namespace.
67+
68+
> Since v0.26.4, the `huawei-cloud-provider` namespace is no longer used, and `kube-system` is used instead.
69+
> If you created the `loadbalancer-config` in the `huawei-cloud-provider` namespace,
70+
> it will still work, but we recommend that you migrate it to `kube-system`.
6771
6872
Here's an example:
6973

7074
```yaml
7175
apiVersion: v1
7276
kind: ConfigMap
7377
metadata:
74-
namespace: huawei-cloud-provider
78+
namespace: kube-system
7579
name: loadbalancer-config
7680
data:
7781
loadBalancerOption: |-

examples/loadbalancers/config.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
kind: Namespace
2-
apiVersion: v1
3-
metadata:
4-
name: huawei-cloud-provider
5-
---
61
apiVersion: v1
72
kind: Secret
83
metadata:
@@ -16,7 +11,7 @@ data:
1611
apiVersion: v1
1712
kind: ConfigMap
1813
metadata:
19-
namespace: huawei-cloud-provider
14+
namespace: kube-system
2015
name: loadbalancer-config
2116
data:
2217
loadBalancerOption: |-

hack/deploy/huawei-cloud-controller-manager.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
apiVersion: v1
2-
kind: Namespace
3-
metadata:
4-
name: huawei-cloud-provider
5-
---
61
apiVersion: rbac.authorization.k8s.io/v1
72
kind: ClusterRole
83
metadata:

manifests/huawei-cloud-controller-manager.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
apiVersion: v1
2-
kind: Namespace
3-
metadata:
4-
name: huawei-cloud-provider
5-
---
61
apiVersion: apps/v1
72
kind: Deployment
83
metadata:
@@ -71,6 +66,10 @@ spec:
7166
resources:
7267
requests:
7368
cpu: 200m
69+
memory: 100Mi
70+
limits:
71+
cpu: 2
72+
memory: 2Gi
7473
hostNetwork: true
7574
volumes:
7675
- hostPath:

pkg/cloudprovider/huaweicloud/huaweicloud.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ func (h *CloudProvider) Master(ctx context.Context, clusterName string) (string,
632632
return "", nil
633633
}
634634

635-
//util functions
635+
// util functions
636636

637637
func IsPodActive(p v1.Pod) bool {
638638
if v1.PodSucceeded != p.Status.Phase &&
@@ -979,7 +979,7 @@ func leaderElection(id string, restConfig *rest.Config, recorder record.EventRec
979979
retryPeriod := 30 * time.Second
980980

981981
configmapLock, err := resourcelock.NewFromKubeconfig(resourcelock.ConfigMapsLeasesResourceLock,
982-
config.ProviderNamespace,
982+
"kube-system",
983983
leaseName,
984984
resourcelock.ResourceLockConfig{
985985
Identity: fmt.Sprintf("%s_%s", id, string(uuid.NewUUID())),

pkg/config/loadbalancerconfig.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ import (
2121
"encoding/json"
2222
"fmt"
2323

24-
elbmodel "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v2/model"
2524
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2625
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
2726
"k8s.io/client-go/rest"
2827
"k8s.io/klog/v2"
2928

29+
elbmodel "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v2/model"
30+
3031
"sigs.k8s.io/cloud-provider-huaweicloud/pkg/utils/metadata"
3132
)
3233

@@ -104,10 +105,12 @@ func LoadElbConfigFromCM() (*LoadbalancerConfig, error) {
104105
return defaultCfg, err
105106
}
106107

107-
configMap, err := kubeClient.ConfigMaps(ProviderNamespace).
108-
Get(context.TODO(), loadbalancerConfigMap, metav1.GetOptions{})
108+
configMap, err := kubeClient.ConfigMaps(ProviderNamespace).Get(context.TODO(), loadbalancerConfigMap, metav1.GetOptions{})
109109
if err != nil {
110-
return defaultCfg, err
110+
configMap, err = kubeClient.ConfigMaps("kube-system").Get(context.TODO(), loadbalancerConfigMap, metav1.GetOptions{})
111+
if err != nil {
112+
return defaultCfg, err
113+
}
111114
}
112115

113116
klog.Infof("get loadbalancer options: %v", configMap.Data)

0 commit comments

Comments
 (0)