-
Notifications
You must be signed in to change notification settings - Fork 79
Azure CCM assets #62
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
Azure CCM assets #62
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| kind: Deployment | ||
| apiVersion: apps/v1 | ||
| metadata: | ||
| name: azure-cloud-controller-manager | ||
| namespace: openshift-cloud-controller-manager | ||
| labels: | ||
| app: azure-cloud-controller-manager | ||
| spec: | ||
| selector: | ||
| matchLabels: | ||
| app: azure-cloud-controller-manager | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: azure-cloud-controller-manager | ||
| spec: | ||
| hostNetwork: true | ||
| serviceAccountName: cloud-controller-manager | ||
| priorityClassName: system-cluster-critical | ||
| nodeSelector: | ||
| node-role.kubernetes.io/master: "" | ||
| affinity: | ||
| podAntiAffinity: | ||
| requiredDuringSchedulingIgnoredDuringExecution: | ||
| - topologyKey: "kubernetes.io/hostname" | ||
| labelSelector: | ||
| matchLabels: | ||
| app: azure-cloud-controller-manager | ||
| tolerations: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this also need to tolerate seems like aws does, https://github.com/openshift/cluster-cloud-controller-manager-operator/blob/master/pkg/cloud/aws/assets/deployment.yaml#L55
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. None of our components should be tolerating that taint, if we do, we will schedule onto a node without networking, which will likely cause our pods to crash loop as they can't contact the APIs they need to contact
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It will now need to tolerate the not-ready based on the additions made in #76 |
||
| - effect: NoSchedule | ||
| key: node-role.kubernetes.io/master | ||
| operator: Exists | ||
| - effect: NoExecute | ||
| key: node.kubernetes.io/unreachable | ||
| operator: Exists | ||
| tolerationSeconds: 120 | ||
| - effect: NoExecute | ||
| key: node.kubernetes.io/not-ready | ||
| operator: Exists | ||
| tolerationSeconds: 120 | ||
| - effect: NoSchedule | ||
| key: node.cloudprovider.kubernetes.io/uninitialized | ||
| operator: Exists | ||
| - effect: NoSchedule | ||
| key: node.kubernetes.io/not-ready | ||
| operator: Exists | ||
| containers: | ||
| - name: azure-cloud-controller-manager | ||
| image: quay.io/openshift/origin-azure-cloud-controller-manager:4.8.0 | ||
| imagePullPolicy: "IfNotPresent" | ||
| env: | ||
| - name: CLOUD_CONFIG | ||
| value: /etc/kubernetes-cloud-config/cloud.conf | ||
| - name: OCP_INFRASTRUCTURE_NAME | ||
| value: kubernetes # default cluster name in ccm | ||
| resources: | ||
| requests: | ||
| cpu: 200m | ||
| memory: 50Mi | ||
| command: | ||
| - /bin/bash | ||
| - -c | ||
| - | | ||
| #!/bin/bash | ||
| set -o allexport | ||
| if [[ -f /etc/kubernetes/apiserver-url.env ]]; then | ||
| source /etc/kubernetes/apiserver-url.env | ||
| fi | ||
| exec /bin/azure-cloud-controller-manager \ | ||
| --v=3 \ | ||
| --cloud-config=$(CLOUD_CONFIG) \ | ||
| --cloud-provider=azure \ | ||
| --controllers=*,-cloud-node,-route \ | ||
| --allocate-node-cidrs=false \ | ||
| --configure-cloud-routes=false \ | ||
| --use-service-account-credentials=true \ | ||
| --bind-address=127.0.0.1 \ | ||
| --cluster-name=$(OCP_INFRASTRUCTURE_NAME) \ | ||
| --leader-elect-resource-namespace=openshift-cloud-controller-manager | ||
| volumeMounts: | ||
| - name: host-etc-kube | ||
| mountPath: /etc/kubernetes | ||
| readOnly: true | ||
| - name: config-accm | ||
| mountPath: /etc/kubernetes-cloud-config | ||
| readOnly: true | ||
| volumes: | ||
| - name: config-accm | ||
| configMap: | ||
| name: cloud-conf | ||
| items: | ||
| - key: cloud.conf | ||
| path: cloud.conf | ||
| - name: host-etc-kube | ||
| hostPath: | ||
| path: /etc/kubernetes | ||
| type: Directory | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| apiVersion: apps/v1 | ||
| kind: DaemonSet | ||
| metadata: | ||
| name: azure-cloud-node-manager | ||
| namespace: openshift-cloud-controller-manager | ||
| labels: | ||
| component: azure-cloud-node-manager | ||
| kubernetes.io/cluster-service: "true" | ||
| spec: | ||
| selector: | ||
| matchLabels: | ||
| app: azure-cloud-node-manager | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: azure-cloud-node-manager | ||
| annotations: | ||
| cluster-autoscaler.kubernetes.io/daemonset-pod: "true" | ||
| spec: | ||
| priorityClassName: system-node-critical | ||
| serviceAccountName: cloud-node-manager | ||
| hostNetwork: true | ||
| nodeSelector: | ||
| kubernetes.io/os: linux | ||
| tolerations: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same question here, i'm guessing since this uses the host network that it will need to tolerate
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Host network maybe means we can allow it to tolerate the taint, though IMO, we should only add the toleration if we are certain we need it. I'd suggest being conservative initially |
||
| - effect: NoSchedule | ||
| key: node-role.kubernetes.io/master | ||
| operator: Exists | ||
| - effect: NoExecute | ||
| key: node.kubernetes.io/unreachable | ||
| operator: Exists | ||
| tolerationSeconds: 120 | ||
| - effect: NoExecute | ||
| key: node.kubernetes.io/not-ready | ||
| operator: Exists | ||
| tolerationSeconds: 120 | ||
| - effect: NoSchedule | ||
| key: node.cloudprovider.kubernetes.io/uninitialized | ||
| operator: Exists | ||
| - effect: NoSchedule | ||
| key: node.kubernetes.io/not-ready | ||
| operator: Exists | ||
| containers: | ||
| - name: azure-cloud-node-manager | ||
| image: quay.io/openshift/origin-azure-cloud-node-manager:4.8.0 | ||
| imagePullPolicy: IfNotPresent | ||
| command: | ||
| - /bin/bash | ||
| - -c | ||
| - | | ||
| #!/bin/bash | ||
| set -o allexport | ||
| if [[ -f /etc/kubernetes/apiserver-url.env ]]; then | ||
| source /etc/kubernetes/apiserver-url.env | ||
| fi | ||
| exec /bin/azure-cloud-node-manager \ | ||
| --node-name=$(NODE_NAME) \ | ||
| --wait-routes=false | ||
| env: | ||
| - name: NODE_NAME | ||
| valueFrom: | ||
| fieldRef: | ||
| fieldPath: spec.nodeName | ||
| volumeMounts: | ||
| - name: host-etc-kube | ||
| mountPath: /etc/kubernetes | ||
| readOnly: true | ||
| resources: | ||
| requests: | ||
| cpu: 50m | ||
| memory: 50Mi | ||
| volumes: | ||
| - name: host-etc-kube | ||
| hostPath: | ||
| path: /etc/kubernetes | ||
| type: Directory | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,38 @@ | ||
| package azure | ||
|
|
||
| import ( | ||
| "embed" | ||
|
|
||
| "github.com/openshift/cluster-cloud-controller-manager-operator/pkg/cloud/common" | ||
| appsv1 "k8s.io/api/apps/v1" | ||
| utilruntime "k8s.io/apimachinery/pkg/util/runtime" | ||
| "sigs.k8s.io/controller-runtime/pkg/client" | ||
| ) | ||
|
|
||
| var ( | ||
| //go:embed assets/* | ||
| azureFs embed.FS | ||
|
|
||
| azureResources []client.Object | ||
|
|
||
| azureSources = []common.ObjectSource{ | ||
| {Object: &appsv1.DaemonSet{}, Path: "assets/cloud-node-manager-daemonset.yaml"}, | ||
| {Object: &appsv1.Deployment{}, Path: "assets/cloud-controller-manager-deployment.yaml"}, | ||
| } | ||
| ) | ||
|
|
||
| func init() { | ||
| var err error | ||
| azureResources, err = common.ReadResources(azureFs, azureSources) | ||
| utilruntime.Must(err) | ||
| } | ||
|
|
||
| // GetResources returns a list of AWS resources for provisioning CCM in running cluster | ||
| func GetResources() []client.Object { | ||
| resources := make([]client.Object, len(azureResources)) | ||
| for i := range azureResources { | ||
| resources[i] = azureResources[i].DeepCopyObject().(client.Object) | ||
| } | ||
|
|
||
| return resources | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,24 @@ | ||
| package azure | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/assert" | ||
| ) | ||
|
|
||
| func TestGetResources(t *testing.T) { | ||
| resources := GetResources() | ||
| assert.Len(t, resources, 2) | ||
|
|
||
| var names, kinds []string | ||
| for _, r := range resources { | ||
| names = append(names, r.GetName()) | ||
| kinds = append(kinds, r.GetObjectKind().GroupVersionKind().Kind) | ||
| } | ||
|
|
||
| assert.Contains(t, names, "azure-cloud-controller-manager") | ||
| assert.Contains(t, kinds, "Deployment") | ||
|
|
||
| assert.Contains(t, names, "azure-cloud-node-manager") | ||
| assert.Contains(t, kinds, "DaemonSet") | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suppose hostNetwork is not required for other controllers except
cloud-node