mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-02-28 09:39:12 +03:00
Cleanup: remove all cloud_provider related tasks & files
Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
---
|
||||
|
||||
oci_security_list_management: All
|
||||
oci_use_instance_principals: false
|
||||
oci_cloud_controller_version: 0.7.0
|
||||
oci_cloud_controller_pull_source: iad.ocir.io/oracle/cloud-provider-oci
|
||||
@@ -1,67 +0,0 @@
|
||||
---
|
||||
|
||||
- name: "OCI Cloud Controller | Credentials Check | oci_private_key"
|
||||
fail:
|
||||
msg: "oci_private_key is missing"
|
||||
when:
|
||||
- not oci_use_instance_principals
|
||||
- oci_private_key is not defined or not oci_private_key
|
||||
|
||||
- name: "OCI Cloud Controller | Credentials Check | oci_region_id"
|
||||
fail:
|
||||
msg: "oci_region_id is missing"
|
||||
when:
|
||||
- not oci_use_instance_principals
|
||||
- oci_region_id is not defined or not oci_region_id
|
||||
|
||||
- name: "OCI Cloud Controller | Credentials Check | oci_tenancy_id"
|
||||
fail:
|
||||
msg: "oci_tenancy_id is missing"
|
||||
when:
|
||||
- not oci_use_instance_principals
|
||||
- oci_tenancy_id is not defined or not oci_tenancy_id
|
||||
|
||||
- name: "OCI Cloud Controller | Credentials Check | oci_user_id"
|
||||
fail:
|
||||
msg: "oci_user_id is missing"
|
||||
when:
|
||||
- not oci_use_instance_principals
|
||||
- oci_user_id is not defined or not oci_user_id
|
||||
|
||||
- name: "OCI Cloud Controller | Credentials Check | oci_user_fingerprint"
|
||||
fail:
|
||||
msg: "oci_user_fingerprint is missing"
|
||||
when:
|
||||
- not oci_use_instance_principals
|
||||
- oci_user_fingerprint is not defined or not oci_user_fingerprint
|
||||
|
||||
- name: "OCI Cloud Controller | Credentials Check | oci_compartment_id"
|
||||
fail:
|
||||
msg: "oci_compartment_id is missing. This is the compartment in which the cluster resides"
|
||||
when:
|
||||
- oci_compartment_id is not defined or not oci_compartment_id
|
||||
|
||||
- name: "OCI Cloud Controller | Credentials Check | oci_vnc_id"
|
||||
fail:
|
||||
msg: "oci_vnc_id is missing. This is the Virtual Cloud Network in which the cluster resides"
|
||||
when:
|
||||
- oci_vnc_id is not defined or not oci_vnc_id
|
||||
|
||||
- name: "OCI Cloud Controller | Credentials Check | oci_subnet1_id"
|
||||
fail:
|
||||
msg: "oci_subnet1_id is missingg. This is the first subnet to which loadbalancers will be added"
|
||||
when:
|
||||
- oci_subnet1_id is not defined or not oci_subnet1_id
|
||||
|
||||
- name: "OCI Cloud Controller | Credentials Check | oci_subnet2_id"
|
||||
fail:
|
||||
msg: "oci_subnet2_id is missing. Two subnets are required for load balancer high availability"
|
||||
when:
|
||||
- oci_cloud_controller_version is version_compare('0.7.0', '<')
|
||||
- oci_subnet2_id is not defined or not oci_subnet2_id
|
||||
|
||||
- name: "OCI Cloud Controller | Credentials Check | oci_security_list_management"
|
||||
fail:
|
||||
msg: "oci_security_list_management is missing, or not defined correctly. Valid options are (All, Frontend, None)."
|
||||
when:
|
||||
- oci_security_list_management is not defined or oci_security_list_management not in ["All", "Frontend", "None"]
|
||||
@@ -1,35 +0,0 @@
|
||||
---
|
||||
|
||||
- name: OCI Cloud Controller | Check Oracle Cloud credentials
|
||||
import_tasks: credentials-check.yml
|
||||
|
||||
- name: "OCI Cloud Controller | Generate Cloud Provider Configuration"
|
||||
template:
|
||||
src: controller-manager-config.yml.j2
|
||||
dest: "{{ kube_config_dir }}/controller-manager-config.yml"
|
||||
mode: "0644"
|
||||
when: inventory_hostname == groups['kube_control_plane'][0]
|
||||
|
||||
- name: "OCI Cloud Controller | Slurp Configuration"
|
||||
slurp:
|
||||
src: "{{ kube_config_dir }}/controller-manager-config.yml"
|
||||
register: controller_manager_config
|
||||
|
||||
- name: "OCI Cloud Controller | Encode Configuration"
|
||||
set_fact:
|
||||
controller_manager_config_base64: "{{ controller_manager_config.content }}"
|
||||
when: inventory_hostname == groups['kube_control_plane'][0]
|
||||
|
||||
- name: "OCI Cloud Controller | Generate Manifests"
|
||||
template:
|
||||
src: oci-cloud-provider.yml.j2
|
||||
dest: "{{ kube_config_dir }}/oci-cloud-provider.yml"
|
||||
mode: "0644"
|
||||
when: inventory_hostname == groups['kube_control_plane'][0]
|
||||
|
||||
- name: "OCI Cloud Controller | Apply Manifests"
|
||||
kube:
|
||||
kubectl: "{{ bin_dir }}/kubectl"
|
||||
filename: "{{ kube_config_dir }}/oci-cloud-provider.yml"
|
||||
state: latest
|
||||
when: inventory_hostname == groups['kube_control_plane'][0]
|
||||
@@ -1,89 +0,0 @@
|
||||
{% macro private_key() %}{{ oci_private_key }}{% endmacro %}
|
||||
|
||||
{% if oci_use_instance_principals %}
|
||||
# (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Tasks/callingservicesfrominstances.htm).
|
||||
# Ensure you have setup the following OCI policies and your kubernetes nodes are running within them
|
||||
# allow dynamic-group [your dynamic group name] to read instance-family in compartment [your compartment name]
|
||||
# allow dynamic-group [your dynamic group name] to use virtual-network-family in compartment [your compartment name]
|
||||
# allow dynamic-group [your dynamic group name] to manage load-balancers in compartment [your compartment name]
|
||||
useInstancePrincipals: true
|
||||
{% else %}
|
||||
useInstancePrincipals: false
|
||||
{% endif %}
|
||||
|
||||
auth:
|
||||
|
||||
{% if oci_use_instance_principals %}
|
||||
# This key is put here too for backwards compatibility
|
||||
useInstancePrincipals: true
|
||||
{% else %}
|
||||
useInstancePrincipals: false
|
||||
|
||||
region: {{ oci_region_id }}
|
||||
tenancy: {{ oci_tenancy_id }}
|
||||
user: {{ oci_user_id }}
|
||||
key: |
|
||||
{{ oci_private_key }}
|
||||
|
||||
{% if oci_private_key_passphrase is defined %}
|
||||
passphrase: {{ oci_private_key_passphrase }}
|
||||
{% endif %}
|
||||
|
||||
|
||||
fingerprint: {{ oci_user_fingerprint }}
|
||||
{% endif %}
|
||||
|
||||
# compartment configures Compartment within which the cluster resides.
|
||||
compartment: {{ oci_compartment_id }}
|
||||
|
||||
# vcn configures the Virtual Cloud Network (VCN) within which the cluster resides.
|
||||
vcn: {{ oci_vnc_id }}
|
||||
|
||||
loadBalancer:
|
||||
# subnet1 configures one of two subnets to which load balancers will be added.
|
||||
# OCI load balancers require two subnets to ensure high availability.
|
||||
subnet1: {{ oci_subnet1_id }}
|
||||
{% if oci_subnet2_id is defined %}
|
||||
# subnet2 configures the second of two subnets to which load balancers will be
|
||||
# added. OCI load balancers require two subnets to ensure high availability.
|
||||
subnet2: {{ oci_subnet2_id }}
|
||||
{% endif %}
|
||||
# SecurityListManagementMode configures how security lists are managed by the CCM.
|
||||
# "All" (default): Manage all required security list rules for load balancer services.
|
||||
# "Frontend": Manage only security list rules for ingress to the load
|
||||
# balancer. Requires that the user has setup a rule that
|
||||
# allows inbound traffic to the appropriate ports for kube
|
||||
# proxy health port, node port ranges, and health check port ranges.
|
||||
# E.g. 10.82.0.0/16 30000-32000.
|
||||
# "None": Disables all security list management. Requires that the
|
||||
# user has setup a rule that allows inbound traffic to the
|
||||
# appropriate ports for kube proxy health port, node port
|
||||
# ranges, and health check port ranges. E.g. 10.82.0.0/16 30000-32000.
|
||||
# Additionally requires the user to mange rules to allow
|
||||
# inbound traffic to load balancers.
|
||||
securityListManagementMode: {{ oci_security_list_management }}
|
||||
|
||||
{% if oci_security_lists is defined and oci_security_lists | length > 0 %}
|
||||
# Optional specification of which security lists to modify per subnet. This does not apply if security list management is off.
|
||||
securityLists:
|
||||
{% for subnet_ocid, list_ocid in oci_security_lists.items() %}
|
||||
{{ subnet_ocid }}: {{ list_ocid }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if oci_rate_limit is defined and oci_rate_limit | length > 0 %}
|
||||
# Optional rate limit controls for accessing OCI API
|
||||
rateLimiter:
|
||||
{% if oci_rate_limit.rate_limit_qps_read %}
|
||||
rateLimitQPSRead: {{ oci_rate_limit.rate_limit_qps_read }}
|
||||
{% endif %}
|
||||
{% if oci_rate_limit.rate_limit_qps_write %}
|
||||
rateLimitQPSWrite: {{ oci_rate_limit.rate_limit_qps_write }}
|
||||
{% endif %}
|
||||
{% if oci_rate_limit.rate_limit_bucket_read %}
|
||||
rateLimitBucketRead: {{ oci_rate_limit.rate_limit_bucket_read }}
|
||||
{% endif %}
|
||||
{% if oci_rate_limit.rate_limit_bucket_write %}
|
||||
rateLimitBucketWrite: {{ oci_rate_limit.rate_limit_bucket_write }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
@@ -1,69 +0,0 @@
|
||||
apiVersion: v1
|
||||
data:
|
||||
cloud-provider.yaml: {{ controller_manager_config_base64 }}
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: oci-cloud-controller-manager
|
||||
namespace: kube-system
|
||||
type: Opaque
|
||||
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: oci-cloud-controller-manager
|
||||
namespace: kube-system
|
||||
labels:
|
||||
k8s-app: oci-cloud-controller-manager
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
component: oci-cloud-controller-manager
|
||||
tier: control-plane
|
||||
updateStrategy:
|
||||
type: RollingUpdate
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
component: oci-cloud-controller-manager
|
||||
tier: control-plane
|
||||
spec:
|
||||
{% if oci_cloud_controller_pull_secret is defined %}
|
||||
imagePullSecrets:
|
||||
- name: {{ oci_cloud_controller_pull_secret }}
|
||||
{% endif %}
|
||||
serviceAccountName: cloud-controller-manager
|
||||
hostNetwork: true
|
||||
dnsPolicy: ClusterFirstWithHostNet
|
||||
nodeSelector:
|
||||
node-role.kubernetes.io/control-plane: ""
|
||||
tolerations:
|
||||
- key: node.cloudprovider.kubernetes.io/uninitialized
|
||||
value: "true"
|
||||
effect: NoSchedule
|
||||
- key: node-role.kubernetes.io/control-plane
|
||||
operator: Exists
|
||||
effect: NoSchedule
|
||||
volumes:
|
||||
- name: cfg
|
||||
secret:
|
||||
secretName: oci-cloud-controller-manager
|
||||
- name: kubernetes
|
||||
hostPath:
|
||||
path: /etc/kubernetes
|
||||
containers:
|
||||
- name: oci-cloud-controller-manager
|
||||
image: {{ oci_cloud_controller_pull_source }}:{{ oci_cloud_controller_version }}
|
||||
command: ["/usr/local/bin/oci-cloud-controller-manager"]
|
||||
args:
|
||||
- --cloud-config=/etc/oci/cloud-provider.yaml
|
||||
- --cloud-provider=oci
|
||||
- --leader-elect-resource-lock=configmaps
|
||||
- -v=2
|
||||
volumeMounts:
|
||||
- name: cfg
|
||||
mountPath: /etc/oci
|
||||
readOnly: true
|
||||
- name: kubernetes
|
||||
mountPath: /etc/kubernetes
|
||||
readOnly: true
|
||||
@@ -1,124 +0,0 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: cloud-controller-manager
|
||||
namespace: kube-system
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: system:cloud-controller-manager
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- nodes
|
||||
verbs:
|
||||
- '*'
|
||||
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- nodes/status
|
||||
verbs:
|
||||
- patch
|
||||
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- services
|
||||
verbs:
|
||||
- list
|
||||
- watch
|
||||
- patch
|
||||
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- services/status
|
||||
verbs:
|
||||
- update
|
||||
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- events
|
||||
verbs:
|
||||
- create
|
||||
- patch
|
||||
- update
|
||||
|
||||
# For leader election
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- endpoints
|
||||
verbs:
|
||||
- create
|
||||
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- endpoints
|
||||
resourceNames:
|
||||
- "cloud-controller-manager"
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- update
|
||||
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- configmaps
|
||||
verbs:
|
||||
- create
|
||||
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- configmaps
|
||||
resourceNames:
|
||||
- "cloud-controller-manager"
|
||||
verbs:
|
||||
- get
|
||||
- update
|
||||
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- serviceaccounts
|
||||
verbs:
|
||||
- create
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- secrets
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
|
||||
# For the PVL
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- persistentvolumes
|
||||
verbs:
|
||||
- list
|
||||
- watch
|
||||
- patch
|
||||
---
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: oci-cloud-controller-manager
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: system:cloud-controller-manager
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: cloud-controller-manager
|
||||
namespace: kube-system
|
||||
@@ -59,13 +59,6 @@
|
||||
- inventory_hostname == groups['kube_control_plane'][0]
|
||||
tags: node-webhook
|
||||
|
||||
- name: Configure Oracle Cloud provider
|
||||
include_tasks: oci.yml
|
||||
tags: oci
|
||||
when:
|
||||
- cloud_provider is defined
|
||||
- cloud_provider == 'oci'
|
||||
|
||||
- name: PriorityClass | Copy k8s-cluster-critical-pc.yml file
|
||||
copy:
|
||||
src: k8s-cluster-critical-pc.yml
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
---
|
||||
- name: Copy OCI RBAC Manifest
|
||||
copy:
|
||||
src: "oci-rbac.yml"
|
||||
dest: "{{ kube_config_dir }}/oci-rbac.yml"
|
||||
mode: "0640"
|
||||
when:
|
||||
- cloud_provider is defined
|
||||
- cloud_provider == 'oci'
|
||||
- inventory_hostname == groups['kube_control_plane'][0]
|
||||
|
||||
- name: Apply OCI RBAC
|
||||
kube:
|
||||
kubectl: "{{ bin_dir }}/kubectl"
|
||||
filename: "{{ kube_config_dir }}/oci-rbac.yml"
|
||||
when:
|
||||
- cloud_provider is defined
|
||||
- cloud_provider == 'oci'
|
||||
- inventory_hostname == groups['kube_control_plane'][0]
|
||||
@@ -103,14 +103,6 @@ dependencies:
|
||||
tags:
|
||||
- container_engine_accelerator
|
||||
|
||||
- role: kubernetes-apps/cloud_controller/oci
|
||||
when:
|
||||
- cloud_provider is defined
|
||||
- cloud_provider == "oci"
|
||||
- inventory_hostname == groups['kube_control_plane'][0]
|
||||
tags:
|
||||
- oci
|
||||
|
||||
- role: kubernetes-apps/gateway_api
|
||||
when:
|
||||
- gateway_api_enabled
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
---
|
||||
dependencies:
|
||||
- role: kubernetes-apps/persistent_volumes/openstack
|
||||
when:
|
||||
- cloud_provider is defined
|
||||
- cloud_provider in [ 'openstack' ]
|
||||
tags:
|
||||
- persistent_volumes_openstack
|
||||
|
||||
- role: kubernetes-apps/persistent_volumes/cinder-csi
|
||||
when:
|
||||
- cinder_csi_enabled
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
---
|
||||
persistent_volumes_enabled: false
|
||||
storage_classes:
|
||||
- name: standard
|
||||
is_default: true
|
||||
parameters:
|
||||
availability: nova
|
||||
@@ -1,20 +0,0 @@
|
||||
---
|
||||
- name: Kubernetes Persistent Volumes | Lay down OpenStack Cinder Storage Class template
|
||||
template:
|
||||
src: "openstack-storage-class.yml.j2"
|
||||
dest: "{{ kube_config_dir }}/openstack-storage-class.yml"
|
||||
mode: "0644"
|
||||
register: manifests
|
||||
when:
|
||||
- inventory_hostname == groups['kube_control_plane'][0]
|
||||
|
||||
- name: Kubernetes Persistent Volumes | Add OpenStack Cinder Storage Class
|
||||
kube:
|
||||
name: storage-class
|
||||
kubectl: "{{ bin_dir }}/kubectl"
|
||||
resource: StorageClass
|
||||
filename: "{{ kube_config_dir }}/openstack-storage-class.yml"
|
||||
state: "latest"
|
||||
when:
|
||||
- inventory_hostname == groups['kube_control_plane'][0]
|
||||
- manifests.changed
|
||||
@@ -1,27 +0,0 @@
|
||||
{% for class in storage_classes %}
|
||||
---
|
||||
kind: StorageClass
|
||||
apiVersion: storage.k8s.io/v1
|
||||
metadata:
|
||||
name: "{{ class.name }}"
|
||||
annotations:
|
||||
storageclass.kubernetes.io/is-default-class: "{{ class.is_default | default(false) | ternary("true","false") }}"
|
||||
provisioner: kubernetes.io/cinder
|
||||
{% if class.mount_options is defined %}
|
||||
mountOptions:
|
||||
{% for option in class.mount_options | default([]) %}
|
||||
- "{{ option }}"
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
parameters:
|
||||
{% for key, value in (class.parameters | default({})).items() %}
|
||||
"{{ key }}": "{{ value }}"
|
||||
{% endfor %}
|
||||
{% if class.reclaim_policy is defined %}
|
||||
reclaimPolicy: "{{ class.reclaim_policy }}"
|
||||
{% endif %}
|
||||
{% if class.volume_binding_mode is defined %}
|
||||
volumeBindingMode: "{{ class.volume_binding_mode }}"
|
||||
{% endif %}
|
||||
allowVolumeExpansion: {{ expand_persistent_volumes }}
|
||||
{% endfor %}
|
||||
Reference in New Issue
Block a user