Skip to content

Commit

Permalink
feat(ds): transform deployment to daemonset
Browse files Browse the repository at this point in the history
  • Loading branch information
Zippo-Wang committed Apr 11, 2024
1 parent 52aa6a9 commit d3d008e
Show file tree
Hide file tree
Showing 9 changed files with 259 additions and 263 deletions.
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/cloud-provid
- Install the Huawei Cloud Provider Manager

```shell
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/cloud-provider-huaweicloud/master/manifests/huawei-cloud-controller-manager.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/cloud-provider-huaweicloud/master/manifests/huawei-cloud-controller-manager-daemonset.yaml
```

- Check the running status
Expand Down
2 changes: 1 addition & 1 deletion hack/deploy/huawei-cloud-controller-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -217,4 +217,4 @@ spec:
name: ca-certs
- name: cloud-config-volume
secret:
secretName: cloud-config
secretName: cloud-config
4 changes: 2 additions & 2 deletions hack/pre-run-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ echo -e "\nDeploy huawei-cloud-controller-manager"

REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
image_url=${REGISTRY}/huawei-cloud-controller-manager:${VERSION}
cp -rf ${REPO_ROOT}/hack/deploy/huawei-cloud-controller-manager.yaml ${tmpPath}
cp -rf ${REPO_ROOT}/hack/deploy/huawei-cloud-controller-manager-daemonset.yaml ${tmpPath}

sed -i'' -e "s|{{image_url}}|${image_url}|g" "${tmpPath}"/huawei-cloud-controller-manager.yaml
sed -i'' -e "s|{{image_url}}|${image_url}|g" "${tmpPath}"/huawei-cloud-controller-manager-daemonset.yaml

kubectl apply -f "${tmpPath}/huawei-cloud-controller-manager.yaml"
rm -rf "${tmpPath}/huawei-cloud-controller-manager.yaml"
Expand Down
79 changes: 79 additions & 0 deletions manifests/huawei-cloud-controller-manager-daemonset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: huawei-cloud-controller-manager
namespace: kube-system
labels:
k8s-app: huawei-cloud-controller-manager
spec:
selector:
matchLabels:
k8s-app: huawei-cloud-controller-manager
template:
metadata:
labels:
k8s-app: huawei-cloud-controller-manager
spec:
nodeSelector:
kubernetes.io/os: linux
securityContext:
runAsUser: 1001
tolerations:
- key: node.cloudprovider.kubernetes.io/uninitialized
value: "true"
effect: NoSchedule
- key: node-role.kubernetes.io/master
effect: NoSchedule
- key: node-role.kubernetes.io/control-plane
effect: NoSchedule
serviceAccountName: cloud-controller-manager
containers:
- name: huawei-cloud-controller-manager
image: swr.cn-north-4.myhuaweicloud.com/k8s-cloudprovider/huawei-cloud-controller-manager:v0.26.7
args:
- /bin/huawei-cloud-controller-manager
- --v=5
- --cloud-config=/etc/config/cloud-config
- --cloud-provider=huaweicloud
- --use-service-account-credentials=true
- --node-status-update-frequency=5s
- --node-monitor-period=5s
- --leader-elect-lease-duration=30s
- --leader-elect-renew-deadline=20s
- --leader-elect-retry-period=2s
volumeMounts:
- mountPath: /etc/kubernetes
name: k8s-certs
readOnly: true
- mountPath: /etc/ssl/certs
name: ca-certs
readOnly: true
- mountPath: /etc/config
name: cloud-config-volume
readOnly: true
- mountPath: /usr/libexec/kubernetes/kubelet-plugins/volume/exec
name: flexvolume-dir
resources:
requests:
cpu: 200m
memory: 100Mi
limits:
cpu: 2
memory: 2Gi
hostNetwork: true
volumes:
- hostPath:
path: /usr/libexec/kubernetes/kubelet-plugins/volume/exec
type: DirectoryOrCreate
name: flexvolume-dir
- hostPath:
path: /etc/kubernetes
type: DirectoryOrCreate
name: k8s-certs
- hostPath:
path: /etc/ssl/certs
type: DirectoryOrCreate
name: ca-certs
- name: cloud-config-volume
secret:
secretName: cloud-config
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@ spec:
name: ca-certs
- name: cloud-config-volume
secret:
secretName: cloud-config
secretName: cloud-config
7 changes: 0 additions & 7 deletions pkg/cloudprovider/huaweicloud/dedicatedloadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -720,13 +720,6 @@ func (d *DedicatedLoadBalancer) ensureHealthCheck(loadbalancerID string, pool *e
monitorID := pool.HealthmonitorId
klog.Infof("add or update or remove health check: %s : %#v", monitorID, healthCheckOpts)

if healthCheckOpts.Enable {
err := d.allowHealthCheckRule(node)
if err != nil {
return err
}
}

// create health monitor
if monitorID == "" && healthCheckOpts.Enable {
_, err := d.createHealthMonitor(loadbalancerID, pool.Id, pool.Protocol, healthCheckOpts)
Expand Down
Loading

0 comments on commit d3d008e

Please sign in to comment.