Skip to content

Commit

Permalink
Merge pull request #235 from chengxiangdong/fix_sid
Browse files Browse the repository at this point in the history
Remove huawei-cloud-provider namespace
  • Loading branch information
k8s-ci-robot authored Nov 14, 2023
2 parents 675dce8 + ed39f31 commit 789e8db
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 24 deletions.
8 changes: 6 additions & 2 deletions docs/huawei-cloud-controller-manager-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,19 @@ 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:

```yaml
apiVersion: v1
kind: ConfigMap
metadata:
namespace: huawei-cloud-provider
namespace: kube-system
name: loadbalancer-config
data:
loadBalancerOption: |-
Expand Down
7 changes: 1 addition & 6 deletions examples/loadbalancers/config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
kind: Namespace
apiVersion: v1
metadata:
name: huawei-cloud-provider
---
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -16,7 +11,7 @@ data:
apiVersion: v1
kind: ConfigMap
metadata:
namespace: huawei-cloud-provider
namespace: kube-system
name: loadbalancer-config
data:
loadBalancerOption: |-
Expand Down
5 changes: 0 additions & 5 deletions hack/deploy/huawei-cloud-controller-manager.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
apiVersion: v1
kind: Namespace
metadata:
name: huawei-cloud-provider
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
Expand Down
9 changes: 4 additions & 5 deletions manifests/huawei-cloud-controller-manager.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
apiVersion: v1
kind: Namespace
metadata:
name: huawei-cloud-provider
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -71,6 +66,10 @@ spec:
resources:
requests:
cpu: 200m
memory: 100Mi
limits:
cpu: 2
memory: 2Gi
hostNetwork: true
volumes:
- hostPath:
Expand Down
4 changes: 2 additions & 2 deletions pkg/cloudprovider/huaweicloud/huaweicloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down Expand Up @@ -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())),
Expand Down
11 changes: 7 additions & 4 deletions pkg/config/loadbalancerconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 789e8db

Please sign in to comment.