diff --git a/capm.yaml b/capm.yaml index 4c79f3334..d43a02629 100644 --- a/capm.yaml +++ b/capm.yaml @@ -10,7 +10,7 @@ kind: CustomResourceDefinition metadata: annotations: cert-manager.io/inject-ca-from: cluster-api-provider-outscale-system/cluster-api-provider-outscale-serving-cert - controller-gen.kubebuilder.io/version: v0.11.1-0.20230203165829-9084e41bb752 + controller-gen.kubebuilder.io/version: v0.11.1-0.20230221131557-73391d1c6f3e labels: cluster.x-k8s.io/v1alpha3: v1alpha3 cluster.x-k8s.io/v1beta1: v1beta1 @@ -25,7 +25,8 @@ spec: namespace: cluster-api-provider-outscale-system path: /convert conversionReviewVersions: - - v1 + - v1beta1 + - v1beta2 group: infrastructure.cluster.x-k8s.io names: kind: OscCluster @@ -70,79 +71,12 @@ spec: type: object network: properties: - bastion: - description: The bastion configuration - properties: - clusterName: - type: string - deviceName: - type: string - enable: - type: boolean - imageId: - type: string - imageName: - type: string - keypairName: - type: string - name: - type: string - privateIps: - items: - properties: - name: - type: string - privateIp: - type: string - required: - - privateIp - type: object - type: array - publicIpName: - type: string - resourceId: - type: string - rootDisk: - properties: - rootDiskIops: - format: int32 - type: integer - rootDiskSize: - format: int32 - type: integer - rootDiskType: - type: string - type: object - securityGroupNames: - items: - properties: - name: - type: string - type: object - type: array - subnetName: - type: string - subregionName: - type: string - vmType: - type: string - type: object clusterName: - description: The name of the cluster type: string - image: - description: The image configuration - properties: - name: - type: string - resourceId: - type: string - type: object internetService: description: The Internet Service configuration properties: clusterName: - description: the name of the cluster type: string name: description: The tag name associate with the Subnet @@ -222,7 +156,6 @@ spec: description: The Nat Service configuration properties: clusterName: - description: The name of the cluster type: string name: description: The tag name associate with the Nat Service @@ -242,7 +175,6 @@ spec: description: The Net configuration properties: clusterName: - description: the name of the cluster type: string ipRange: description: the net ip range with CIDR notation @@ -302,11 +234,9 @@ spec: type: string type: object type: array - subnets: + subnetname: description: The subnet tag name associate with a Subnet - items: - type: string - type: array + type: string type: object type: array securityGroups: @@ -372,9 +302,6 @@ spec: type: string type: object type: array - subregionName: - description: The subregion name - type: string type: object type: object status: @@ -437,15 +364,6 @@ spec: type: string type: object type: object - bastionref: - description: Map between InstanceId and BastionName (Bastion - tag Name with cluster UID) - properties: - resourceMap: - additionalProperties: - type: string - type: object - type: object internetserviceref: description: Map between InternetServiceId and InternetServiceName (Internet Service tag Name with cluster UID) @@ -455,23 +373,15 @@ spec: type: string type: object type: object - linkPublicIpRef: - description: Map between LinkPublicIpId and PublicIpName (Public - IP tag Name with cluster UID) + linkroutetableref: + description: Map between resourceId and resourceName (tag Name + with cluster UID) properties: resourceMap: additionalProperties: type: string type: object type: object - linkroutetableref: - additionalProperties: - items: - type: string - type: array - description: Map between LinkRouteTableId and RouteTablesName - (Route Table tag Name with cluster UID) - type: object natref: description: Map between NatServiceId and NatServiceName (Nat Service tag Name with cluster UID) @@ -491,8 +401,8 @@ spec: type: object type: object publicipref: - description: Map between PublicIpId and PublicIpName (Public - IP tag Name with cluster UID) + description: Map between resourceId and resourceName (tag Name + with cluster UID) properties: resourceMap: additionalProperties: @@ -518,8 +428,8 @@ spec: type: object type: object securitygroupref: - description: Map between SecurityGroupId and SecurityGroupName - (Security Group tag Name with cluster UID) + description: Map between PublicIpId and PublicIpName (Public + IP tag Name with cluster UID) properties: resourceMap: additionalProperties: @@ -527,8 +437,8 @@ spec: type: object type: object securitygroupruleref: - description: Map between SecurityGroupRuleId and SecurityGroupName - (Security Group Rule tag Name with cluster UID) + description: Map between resourceId and resourceName (tag Name + with cluster UID) properties: resourceMap: additionalProperties: @@ -547,48 +457,16 @@ spec: type: object ready: type: boolean - vmState: - type: string type: object type: object served: true - storage: true + storage: false subresources: status: {} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - cert-manager.io/inject-ca-from: cluster-api-provider-outscale-system/cluster-api-provider-outscale-serving-cert - controller-gen.kubebuilder.io/version: v0.11.1-0.20230203165829-9084e41bb752 - labels: - cluster.x-k8s.io/v1alpha3: v1alpha3 - cluster.x-k8s.io/v1beta1: v1beta1 - name: oscmachines.infrastructure.cluster.x-k8s.io -spec: - conversion: - strategy: Webhook - webhook: - clientConfig: - service: - name: cluster-api-provider-outscale-webhook-service - namespace: cluster-api-provider-outscale-system - path: /convert - conversionReviewVersions: - - v1 - group: infrastructure.cluster.x-k8s.io - names: - kind: OscMachine - listKind: OscMachineList - plural: oscmachines - singular: oscmachine - scope: Namespaced - versions: - - name: v1beta1 + - name: v1beta2 schema: openAPIV3Schema: - description: OscMachine is the Schema for the oscmachines API + description: OscCluster is the Schema for the oscclusters API properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -603,43 +481,38 @@ spec: metadata: type: object spec: - description: OscMachineSpec defines the desired state of OscMachine + description: OscClusterSpec defines the desired state of OscCluster properties: - node: + controlPlaneEndpoint: + description: APIEndpoint represents a reachable Kubernetes API endpoint. properties: - clusterName: + host: + description: The hostname on which the API server is serving. type: string - image: - properties: - name: - type: string - resourceId: - type: string - type: object - keypair: - properties: - clusterName: - type: string - deleteKeypair: - type: boolean - name: - type: string - publicKey: - type: string - resourceId: - type: string - type: object - vm: + port: + description: The port on which the API server is serving. + format: int32 + type: integer + required: + - host + - port + type: object + network: + properties: + bastion: + description: The bastion configuration properties: clusterName: type: string deviceName: type: string + enable: + type: boolean imageId: type: string - keypairName: + imageName: type: string - loadBalancerName: + keypairName: type: string name: type: string @@ -656,13 +529,8 @@ spec: type: array publicIpName: type: string - replica: - format: int32 - type: integer resourceId: type: string - role: - type: string rootDisk: properties: rootDiskIops: @@ -674,66 +542,1198 @@ spec: rootDiskType: type: string type: object - securityGroupNames: - items: - properties: - name: - type: string - type: object - type: array - subnetName: - type: string - subregionName: - type: string - vmType: - type: string - volumeDeviceName: - type: string - volumeName: + securityGroupNames: + items: + properties: + name: + type: string + type: object + type: array + subnetName: + type: string + subregionName: + type: string + vmType: + type: string + type: object + clusterName: + description: The name of the cluster + type: string + internetService: + description: The Internet Service configuration + properties: + clusterName: + description: the name of the cluster + type: string + name: + description: The tag name associate with the Subnet + type: string + resourceId: + description: the Internet Service response + type: string + type: object + loadBalancer: + description: The Load Balancer configuration + properties: + clusterName: + type: string + healthCheck: + description: The healthCheck configuration of the Load Balancer + properties: + checkinterval: + description: the time in second between two pings + format: int32 + type: integer + healthythreshold: + description: the consecutive number of pings which are + sucessful to consider the vm healthy + format: int32 + type: integer + port: + description: the HealthCheck port number + format: int32 + type: integer + protocol: + description: The HealthCheck protocol ('HTTP'|'TCP') + type: string + timeout: + description: the Timeout to consider VM unhealthy + format: int32 + type: integer + unhealthythreshold: + description: the consecutive number of pings which are + failed to consider the vm unhealthy + format: int32 + type: integer + type: object + listener: + description: The Listener cofiguration of the loadBalancer + properties: + backendport: + description: The port on which the backend vm will listen + format: int32 + type: integer + backendprotocol: + description: The protocol ('HTTP'|'TCP') to route the + traffic to the backend vm + type: string + loadbalancerport: + description: The port on which the loadbalancer will listen + format: int32 + type: integer + loadbalancerprotocol: + description: the routing protocol ('HTTP'|'TCP') + type: string + type: object + loadbalancername: + description: The Load Balancer unique name + type: string + loadbalancertype: + description: The Load Balancer Type internet-facing or internal + type: string + securitygroupname: + description: The security group tag name associate with a + security group + type: string + subnetname: + description: The subnet tag name associate with a Subnet + type: string + type: object + natService: + description: The Nat Service configuration + properties: + clusterName: + description: The name of the cluster + type: string + name: + description: The tag name associate with the Nat Service + type: string + publicipname: + description: The Public Ip tag name associated wtih a Public + Ip + type: string + resourceId: + description: The Nat Service Id response + type: string + subnetname: + description: The subnet tag name associate with a Subnet + type: string + type: object + net: + description: The Net configuration + properties: + clusterName: + description: the name of the cluster + type: string + ipRange: + description: the net ip range with CIDR notation + type: string + name: + description: the tag name associate with the Net + type: string + resourceId: + description: The Net Id response + type: string + type: object + publicIps: + description: The Public Ip configuration + items: + properties: + clusterName: + type: string + name: + description: The tag name associate with the Public Ip + type: string + resourceId: + description: The Public Ip Id response + type: string + type: object + type: array + routeTables: + description: The Route Table configuration + items: + properties: + name: + description: The tag name associate with the Route Table + type: string + resourceId: + description: The Route Table Id response + type: string + routes: + description: The Route configuration + items: + properties: + destination: + description: the destination match Ip range with CIDR + notation + type: string + name: + description: The tag name associate with the Route + type: string + resourceId: + description: The Route Id response + type: string + targetName: + description: The tag name associate with the target + resource type + type: string + targetType: + description: The target resource type which can be + Internet Service (gateway) or Nat Service (nat-service) + type: string + type: object + type: array + subnets: + description: The subnet tag name associate with a Subnet + items: + type: string + type: array + type: object + type: array + securityGroups: + items: + properties: + description: + description: The description of the security group + type: string + name: + description: The tag name associate with the security group + type: string + resourceId: + description: The Security Group Id response + type: string + securityGroupRules: + description: The Security Group Rules configuration + items: + properties: + flow: + description: The flow of the security group (inbound + or outbound) + type: string + fromPortRange: + description: The beginning of the port range + format: int32 + type: integer + ipProtocol: + description: The ip protocol name (tcp, udp, icmp + or -1) + type: string + ipRange: + description: The ip range of the security group rule + type: string + name: + description: The tag name associate with the security + group + type: string + resourceId: + description: The security group rule id + type: string + toPortRange: + description: The end of the port range + format: int32 + type: integer + type: object + type: array + tag: + type: string + type: object + type: array + subnets: + description: The Subnet configuration + items: + properties: + ipSubnetRange: + description: Subnet Ip range with CIDR notation + type: string + name: + description: The tag name associate with the Subnet + type: string + resourceId: + description: The Subnet Id response + type: string + type: object + type: array + subregionName: + description: The subregion name + type: string + type: object + type: object + status: + description: OscClusterStatus defines the observed state of OscCluster + properties: + conditions: + description: Conditions provide observations of the operational state + of a Cluster API resource. + items: + description: Condition defines an observation of a Cluster API resource + operational state. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status + to another. This should be when the underlying condition changed. + If that is not known, then using the time when the API field + changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about + the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition + in CamelCase. The specific API may choose whether or not this + field is considered a guaranteed API. This field may not be + empty. + type: string + severity: + description: Severity provides an explicit classification of + Reason code, so the users or machines can immediately understand + the current situation and act accordingly. The Severity field + MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. + type: string + required: + - lastTransitionTime + - status + - type + type: object + type: array + network: + properties: + bastionref: + description: Map between InstanceId and BastionName (Bastion + tag Name with cluster UID) + properties: + resourceMap: + additionalProperties: + type: string + type: object + type: object + internetserviceref: + description: Map between InternetServiceId and InternetServiceName + (Internet Service tag Name with cluster UID) + properties: + resourceMap: + additionalProperties: + type: string + type: object + type: object + linkPublicIpRef: + description: Map between LinkPublicIpId and PublicIpName (Public + IP tag Name with cluster UID) + properties: + resourceMap: + additionalProperties: + type: string + type: object + type: object + linkroutetableref: + additionalProperties: + items: + type: string + type: array + description: Map between LinkRouteTableId and RouteTablesName + (Route Table tag Name with cluster UID) + type: object + natref: + description: Map between NatServiceId and NatServiceName (Nat + Service tag Name with cluster UID) + properties: + resourceMap: + additionalProperties: + type: string + type: object + type: object + netref: + description: Map between NetId and NetName (Net tag Name with + cluster UID) + properties: + resourceMap: + additionalProperties: + type: string + type: object + type: object + publicipref: + description: Map between PublicIpId and PublicIpName (Public + IP tag Name with cluster UID) + properties: + resourceMap: + additionalProperties: + type: string + type: object + type: object + routeref: + description: Map between RouteId and RouteName (Route tag Name + with cluster UID) + properties: + resourceMap: + additionalProperties: + type: string + type: object + type: object + routetableref: + description: Map between RouteTablesId and RouteTablesName (Route + Tables tag Name with cluster UID) + properties: + resourceMap: + additionalProperties: + type: string + type: object + type: object + securitygroupref: + description: Map between SecurityGroupId and SecurityGroupName + (Security Group tag Name with cluster UID) + properties: + resourceMap: + additionalProperties: + type: string + type: object + type: object + securitygroupruleref: + description: Map between SecurityGroupRuleId and SecurityGroupName + (Security Group Rule tag Name with cluster UID) + properties: + resourceMap: + additionalProperties: + type: string + type: object + type: object + subnetref: + description: Map between SubnetId and SubnetName (Subnet tag + Name with cluster UID) + properties: + resourceMap: + additionalProperties: + type: string + type: object + type: object + type: object + ready: + type: boolean + vmState: + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + cert-manager.io/inject-ca-from: cluster-api-provider-outscale-system/cluster-api-provider-outscale-serving-cert + controller-gen.kubebuilder.io/version: v0.11.1-0.20230221131557-73391d1c6f3e + labels: + cluster.x-k8s.io/v1alpha3: v1alpha3 + cluster.x-k8s.io/v1beta1: v1beta1 + name: oscmachines.infrastructure.cluster.x-k8s.io +spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + name: cluster-api-provider-outscale-webhook-service + namespace: cluster-api-provider-outscale-system + path: /convert + conversionReviewVersions: + - v1beta1 + - v1beta2 + group: infrastructure.cluster.x-k8s.io + names: + kind: OscMachine + listKind: OscMachineList + plural: oscmachines + singular: oscmachine + scope: Namespaced + versions: + - name: v1beta1 + schema: + openAPIV3Schema: + description: OscMachine is the Schema for the oscmachines API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: OscMachineSpec defines the desired state of OscMachine + properties: + node: + properties: + clusterName: + type: string + image: + properties: + name: + type: string + resourceId: + type: string + type: object + keypair: + properties: + clusterName: + type: string + deleteKeypair: + type: boolean + name: + type: string + publicKey: + type: string + resourceId: + type: string + type: object + vm: + properties: + clusterName: + type: string + deviceName: + type: string + imageId: + type: string + keypairName: + type: string + loadBalancerName: + type: string + name: + type: string + privateIps: + items: + properties: + name: + type: string + privateIp: + type: string + required: + - privateIp + type: object + type: array + publicIpName: + type: string + replica: + format: int32 + type: integer + resourceId: + type: string + role: + type: string + rootDisk: + properties: + rootDiskIops: + format: int32 + type: integer + rootDiskSize: + format: int32 + type: integer + rootDiskType: + type: string + type: object + securityGroupNames: + items: + properties: + name: + type: string + type: object + type: array + subnetName: + type: string + subregionName: + type: string + vmType: + type: string + volumeDeviceName: + type: string + volumeName: + type: string + type: object + volumes: + items: + properties: + iops: + format: int32 + type: integer + name: + type: string + resourceId: + type: string + size: + format: int32 + type: integer + subregionName: + type: string + volumeType: + type: string + type: object + type: array + type: object + providerID: + type: string + type: object + status: + description: OscMachineStatus defines the observed state of OscMachine + properties: + addresses: + items: + description: NodeAddress contains information for the node's address. + properties: + address: + description: The node address. + type: string + type: + description: Node address type, one of Hostname, ExternalIP + or InternalIP. + type: string + required: + - address + - type + type: object + type: array + conditions: + description: Conditions provide observations of the operational state + of a Cluster API resource. + items: + description: Condition defines an observation of a Cluster API resource + operational state. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status + to another. This should be when the underlying condition changed. + If that is not known, then using the time when the API field + changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about + the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition + in CamelCase. The specific API may choose whether or not this + field is considered a guaranteed API. This field may not be + empty. + type: string + severity: + description: Severity provides an explicit classification of + Reason code, so the users or machines can immediately understand + the current situation and act accordingly. The Severity field + MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. + type: string + required: + - lastTransitionTime + - status + - type + type: object + type: array + failureMessage: + type: string + failureReason: + description: MachineStatusError defines errors states for Machine + objects. + type: string + node: + properties: + imageRef: + description: Map between resourceId and resourceName (tag Name + with cluster UID) + properties: + resourceMap: + additionalProperties: + type: string + type: object + type: object + keypairRef: + description: Map between resourceId and resourceName (tag Name + with cluster UID) + properties: + resourceMap: + additionalProperties: + type: string + type: object + type: object + linkPublicIpRef: + description: Map between resourceId and resourceName (tag Name + with cluster UID) + properties: + resourceMap: + additionalProperties: + type: string + type: object + type: object + vmRef: + description: Map between resourceId and resourceName (tag Name + with cluster UID) + properties: + resourceMap: + additionalProperties: + type: string + type: object + type: object + volumeRef: + description: Map between resourceId and resourceName (tag Name + with cluster UID) + properties: + resourceMap: + additionalProperties: + type: string + type: object + type: object + type: object + ready: + type: boolean + vmState: + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1beta2 + schema: + openAPIV3Schema: + description: OscMachine is the Schema for the oscmachines API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: OscMachineSpec defines the desired state of OscMachine + properties: + node: + properties: + clusterName: + type: string + image: + properties: + name: + type: string + resourceId: + type: string + type: object + keypair: + properties: + clusterName: + type: string + deleteKeypair: + type: boolean + name: + type: string + publicKey: + type: string + resourceId: + type: string + type: object + vm: + properties: + clusterName: + type: string + deviceName: + type: string + imageId: + type: string + keypairName: + type: string + loadBalancerName: + type: string + name: + type: string + privateIps: + items: + properties: + name: + type: string + privateIp: + type: string + required: + - privateIp + type: object + type: array + publicIpName: + type: string + replica: + format: int32 + type: integer + resourceId: + type: string + role: + type: string + rootDisk: + properties: + rootDiskIops: + format: int32 + type: integer + rootDiskSize: + format: int32 + type: integer + rootDiskType: + type: string + type: object + securityGroupNames: + items: + properties: + name: + type: string + type: object + type: array + subnetName: + type: string + subregionName: + type: string + vmType: + type: string + volumeDeviceName: + type: string + volumeName: + type: string + type: object + volumes: + items: + properties: + iops: + format: int32 + type: integer + name: + type: string + resourceId: + type: string + size: + format: int32 + type: integer + subregionName: + type: string + volumeType: + type: string + type: object + type: array + type: object + providerID: + type: string + type: object + status: + description: OscMachineStatus defines the observed state of OscMachine + properties: + addresses: + items: + description: NodeAddress contains information for the node's address. + properties: + address: + description: The node address. + type: string + type: + description: Node address type, one of Hostname, ExternalIP + or InternalIP. + type: string + required: + - address + - type + type: object + type: array + conditions: + description: Conditions provide observations of the operational state + of a Cluster API resource. + items: + description: Condition defines an observation of a Cluster API resource + operational state. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status + to another. This should be when the underlying condition changed. + If that is not known, then using the time when the API field + changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about + the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition + in CamelCase. The specific API may choose whether or not this + field is considered a guaranteed API. This field may not be + empty. + type: string + severity: + description: Severity provides an explicit classification of + Reason code, so the users or machines can immediately understand + the current situation and act accordingly. The Severity field + MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. + type: string + required: + - lastTransitionTime + - status + - type + type: object + type: array + failureMessage: + type: string + failureReason: + description: MachineStatusError defines errors states for Machine + objects. + type: string + node: + properties: + imageRef: + description: Map between resourceId and resourceName (tag Name + with cluster UID) + properties: + resourceMap: + additionalProperties: + type: string + type: object + type: object + keypairRef: + description: Map between resourceId and resourceName (tag Name + with cluster UID) + properties: + resourceMap: + additionalProperties: + type: string + type: object + type: object + linkPublicIpRef: + description: Map between resourceId and resourceName (tag Name + with cluster UID) + properties: + resourceMap: + additionalProperties: + type: string + type: object + type: object + vmRef: + description: Map between resourceId and resourceName (tag Name + with cluster UID) + properties: + resourceMap: + additionalProperties: + type: string + type: object + type: object + volumeRef: + description: Map between resourceId and resourceName (tag Name + with cluster UID) + properties: + resourceMap: + additionalProperties: + type: string + type: object + type: object + type: object + ready: + type: boolean + vmState: + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.11.1-0.20230221131557-73391d1c6f3e + creationTimestamp: null + labels: + cluster.x-k8s.io/v1alpha3: v1alpha3 + cluster.x-k8s.io/v1beta1: v1beta1 + name: oscmachinetemplates.infrastructure.cluster.x-k8s.io +spec: + group: infrastructure.cluster.x-k8s.io + names: + categories: + - cluster-api + kind: OscMachineTemplate + listKind: OscMachineTemplateList + plural: oscmachinetemplates + singular: oscmachinetemplate + scope: Namespaced + versions: + - name: v1beta1 + schema: + openAPIV3Schema: + description: OscMachineTemplate is the Schema for the OscMachineTemplate API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: OscMachineTemplateSpec define oscMachine template + properties: + template: + description: OscMachineTemplateResource is the Schema for the OscMachineTemplate + api + properties: + metadata: + description: "ObjectMeta is metadata that all persisted resources + must have, which includes all objects users must create. This + is a copy of customizable fields from metav1.ObjectMeta. \n + ObjectMeta is embedded in `Machine.Spec`, `MachineDeployment.Template` + and `MachineSet.Template`, which are not top-level Kubernetes + objects. Given that metav1.ObjectMeta has lots of special cases + and read-only fields which end up in the generated CRD validation, + having it as a subset simplifies the API and some issues that + can impact user experience. \n During the [upgrade to controller-tools@v2](https://github.com/kubernetes-sigs/cluster-api/pull/1054) + for v1alpha2, we noticed a failure would occur running Cluster + API test suite against the new CRDs, specifically `spec.metadata.creationTimestamp + in body must be of type string: \"null\"`. The investigation + showed that `controller-tools@v2` behaves differently than its + previous version when handling types from [metav1](k8s.io/apimachinery/pkg/apis/meta/v1) + package. \n In more details, we found that embedded (non-top + level) types that embedded `metav1.ObjectMeta` had validation + properties, including for `creationTimestamp` (metav1.Time). + The `metav1.Time` type specifies a custom json marshaller that, + when IsZero() is true, returns `null` which breaks validation + because the field isn't marked as nullable. \n In future versions, + controller-tools@v2 might allow overriding the type and validation + for embedded types. When that happens, this hack should be revisited." + properties: + annotations: + additionalProperties: + type: string + description: 'Annotations is an unstructured key value map + stored with a resource that may be set by external tools + to store and retrieve arbitrary metadata. They are not queryable + and should be preserved when modifying objects. More info: + http://kubernetes.io/docs/user-guide/annotations' + type: object + labels: + additionalProperties: + type: string + description: 'Map of string keys and values that can be used + to organize and categorize (scope and select) objects. May + match selectors of replication controllers and services. + More info: http://kubernetes.io/docs/user-guide/labels' + type: object + type: object + spec: + description: OscMachineSpec defines the desired state of OscMachine + properties: + node: + properties: + clusterName: + type: string + image: + properties: + name: + type: string + resourceId: + type: string + type: object + keypair: + properties: + clusterName: + type: string + deleteKeypair: + type: boolean + name: + type: string + publicKey: + type: string + resourceId: + type: string + type: object + vm: + properties: + clusterName: + type: string + deviceName: + type: string + imageId: + type: string + keypairName: + type: string + loadBalancerName: + type: string + name: + type: string + privateIps: + items: + properties: + name: + type: string + privateIp: + type: string + required: + - privateIp + type: object + type: array + publicIpName: + type: string + replica: + format: int32 + type: integer + resourceId: + type: string + role: + type: string + rootDisk: + properties: + rootDiskIops: + format: int32 + type: integer + rootDiskSize: + format: int32 + type: integer + rootDiskType: + type: string + type: object + securityGroupNames: + items: + properties: + name: + type: string + type: object + type: array + subnetName: + type: string + subregionName: + type: string + vmType: + type: string + volumeDeviceName: + type: string + volumeName: + type: string + type: object + volumes: + items: + properties: + iops: + format: int32 + type: integer + name: + type: string + resourceId: + type: string + size: + format: int32 + type: integer + subregionName: + type: string + volumeType: + type: string + type: object + type: array + type: object + providerID: type: string type: object - volumes: - items: - properties: - iops: - format: int32 - type: integer - name: - type: string - resourceId: - type: string - size: - format: int32 - type: integer - subregionName: - type: string - volumeType: - type: string - type: object - type: array + required: + - spec type: object - providerID: - type: string + required: + - template type: object status: - description: OscMachineStatus defines the observed state of OscMachine properties: - addresses: - items: - description: NodeAddress contains information for the node's address. - properties: - address: - description: The node address. - type: string - type: - description: Node address type, one of Hostname, ExternalIP - or InternalIP. - type: string - required: - - address - - type - type: object - type: array + capacity: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: ResourceList is a set of (resource name, quantity) pairs. + type: object conditions: description: Conditions provide observations of the operational state of a Cluster API resource. @@ -780,93 +1780,13 @@ spec: - type type: object type: array - failureMessage: - type: string - failureReason: - description: MachineStatusError defines errors states for Machine - objects. - type: string - node: - properties: - imageRef: - description: Map between resourceId and resourceName (tag Name - with cluster UID) - properties: - resourceMap: - additionalProperties: - type: string - type: object - type: object - keypairRef: - description: Map between resourceId and resourceName (tag Name - with cluster UID) - properties: - resourceMap: - additionalProperties: - type: string - type: object - type: object - linkPublicIpRef: - description: Map between resourceId and resourceName (tag Name - with cluster UID) - properties: - resourceMap: - additionalProperties: - type: string - type: object - type: object - vmRef: - description: Map between resourceId and resourceName (tag Name - with cluster UID) - properties: - resourceMap: - additionalProperties: - type: string - type: object - type: object - volumeRef: - description: Map between resourceId and resourceName (tag Name - with cluster UID) - properties: - resourceMap: - additionalProperties: - type: string - type: object - type: object - type: object - ready: - type: boolean - vmState: - type: string type: object type: object served: true - storage: true + storage: false subresources: status: {} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.11.1-0.20230203165829-9084e41bb752 - creationTimestamp: null - labels: - cluster.x-k8s.io/v1alpha3: v1alpha3 - cluster.x-k8s.io/v1beta1: v1beta1 - name: oscmachinetemplates.infrastructure.cluster.x-k8s.io -spec: - group: infrastructure.cluster.x-k8s.io - names: - categories: - - cluster-api - kind: OscMachineTemplate - listKind: OscMachineTemplateList - plural: oscmachinetemplates - singular: oscmachinetemplate - scope: Namespaced - versions: - - name: v1beta1 + - name: v1beta2 schema: openAPIV3Schema: description: OscMachineTemplate is the Schema for the OscMachineTemplate API @@ -1451,7 +2371,7 @@ spec: key: region name: cluster-api-provider-outscale optional: true - image: outscale/cluster-api-provider-osc:dev + image: core.harbor-dev.148-253-74-240.sslip.io/osc/cluster-api-outscale-controllers:latest imagePullPolicy: IfNotPresent livenessProbe: httpGet: @@ -1544,18 +2464,40 @@ metadata: webhooks: - admissionReviewVersions: - v1 + - v1beta1 + clientConfig: + service: + name: cluster-api-provider-outscale-webhook-service + namespace: cluster-api-provider-outscale-system + path: /mutate-infrastructure-cluster-x-k8s-io-v1beta2-osccluster + failurePolicy: Fail + name: mosccluster.kb.io + rules: + - apiGroups: + - infrastructure.cluster.x-k8s.io + apiVersions: + - v1beta2 + operations: + - CREATE + - UPDATE + resources: + - oscclusters + sideEffects: None +- admissionReviewVersions: + - v1 + - v1beta1 clientConfig: service: name: cluster-api-provider-outscale-webhook-service namespace: cluster-api-provider-outscale-system - path: /mutate-infrastructure-cluster-x-k8s-io-v1beta1-oscclustertemplate + path: /mutate-infrastructure-cluster-x-k8s-io-v1beta2-oscclustertemplate failurePolicy: Fail name: moscclustertemplate.kb.io rules: - apiGroups: - infrastructure.cluster.x-k8s.io apiVersions: - - v1beta1 + - v1beta2 operations: - CREATE - UPDATE @@ -1564,18 +2506,19 @@ webhooks: sideEffects: None - admissionReviewVersions: - v1 + - v1beta1 clientConfig: service: name: cluster-api-provider-outscale-webhook-service namespace: cluster-api-provider-outscale-system - path: /mutate-infrastructure-cluster-x-k8s-io-v1beta1-oscmachine + path: /mutate-infrastructure-cluster-x-k8s-io-v1beta2-oscmachine failurePolicy: Fail name: moscmachine.kb.io rules: - apiGroups: - infrastructure.cluster.x-k8s.io apiVersions: - - v1beta1 + - v1beta2 operations: - CREATE - UPDATE @@ -1584,18 +2527,19 @@ webhooks: sideEffects: None - admissionReviewVersions: - v1 + - v1beta1 clientConfig: service: name: cluster-api-provider-outscale-webhook-service namespace: cluster-api-provider-outscale-system - path: /mutate-infrastructure-cluster-x-k8s-io-v1beta1-oscmachinetemplate + path: /mutate-infrastructure-cluster-x-k8s-io-v1beta2-oscmachinetemplate failurePolicy: Fail name: moscmachinetemplate.kb.io rules: - apiGroups: - infrastructure.cluster.x-k8s.io apiVersions: - - v1beta1 + - v1beta2 operations: - CREATE - UPDATE @@ -1612,18 +2556,19 @@ metadata: webhooks: - admissionReviewVersions: - v1 + - v1beta1 clientConfig: service: name: cluster-api-provider-outscale-webhook-service namespace: cluster-api-provider-outscale-system - path: /validate-infrastructure-cluster-x-k8s-io-v1beta1-osccluster + path: /validate-infrastructure-cluster-x-k8s-io-v1beta2-osccluster failurePolicy: Fail name: vosccluster.kb.io rules: - apiGroups: - infrastructure.cluster.x-k8s.io apiVersions: - - v1beta1 + - v1beta2 operations: - CREATE - UPDATE @@ -1632,18 +2577,19 @@ webhooks: sideEffects: None - admissionReviewVersions: - v1 + - v1beta1 clientConfig: service: name: cluster-api-provider-outscale-webhook-service namespace: cluster-api-provider-outscale-system - path: /validate-infrastructure-cluster-x-k8s-io-v1beta1-oscclustertemplate + path: /validate-infrastructure-cluster-x-k8s-io-v1beta2-oscclustertemplate failurePolicy: Fail name: voscclustertemplate.kb.io rules: - apiGroups: - infrastructure.cluster.x-k8s.io apiVersions: - - v1beta1 + - v1beta2 operations: - CREATE - UPDATE @@ -1652,18 +2598,19 @@ webhooks: sideEffects: None - admissionReviewVersions: - v1 + - v1beta1 clientConfig: service: name: cluster-api-provider-outscale-webhook-service namespace: cluster-api-provider-outscale-system - path: /validate-infrastructure-cluster-x-k8s-io-v1beta1-oscmachine + path: /validate-infrastructure-cluster-x-k8s-io-v1beta2-oscmachine failurePolicy: Fail name: voscmachine.kb.io rules: - apiGroups: - infrastructure.cluster.x-k8s.io apiVersions: - - v1beta1 + - v1beta2 operations: - CREATE - UPDATE @@ -1672,18 +2619,19 @@ webhooks: sideEffects: None - admissionReviewVersions: - v1 + - v1beta1 clientConfig: service: name: cluster-api-provider-outscale-webhook-service namespace: cluster-api-provider-outscale-system - path: /validate-infrastructure-cluster-x-k8s-io-v1beta1-oscmachinetemplate + path: /validate-infrastructure-cluster-x-k8s-io-v1beta2-oscmachinetemplate failurePolicy: Fail name: voscmachinetemplate.kb.io rules: - apiGroups: - infrastructure.cluster.x-k8s.io apiVersions: - - v1beta1 + - v1beta2 operations: - CREATE - UPDATE diff --git a/example/cluster-machine-template-bastion.yaml b/example/cluster-machine-template-bastion.yaml index 09c69a2fa..49b9ee1d3 100644 --- a/example/cluster-machine-template-bastion.yaml +++ b/example/cluster-machine-template-bastion.yaml @@ -21,14 +21,31 @@ spec: name: "cluster-api-control-plane" namespace: default --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscCluster metadata: name: cluster-api namespace: default spec: network: + bastion: + clusterName: cluster-api + enable: true + name: cluster-api-vm-bastion + keypairName: cluster-api + deviceName: /dev/sda1 + imageName: ubuntu-2004-2004-kubernetes-v1.22.11-2022-08-22 + rootDisk: + rootDiskSize: 15 + rootDiskIops: 1000 + rootDiskType: io1 + subnetName: cluster-api-subnet-public + subregionName: eu-west-2a + securityGroupNames: + - name: cluster-api-securitygroup-lb + vmType: "tinav4.c2r4p2" clusterName: cluster-api + subregionName: eu-west-2a loadBalancer: loadbalancername: osc-k8s loadbalancertype: internet-facing @@ -38,16 +55,14 @@ spec: net: name: cluster-api-net clusterName: cluster-api - ipRange: "10.0.0.0/24" + ipRange: "10.0.0.0/16" subnets: - name: cluster-api-subnet-kcp - ipSubnetRange: "10.0.0.32/28" + ipSubnetRange: "10.0.4.0/24" - name: cluster-api-subnet-kw - ipSubnetRange: "10.0.0.128/26" + ipSubnetRange: "10.0.3.0/24" - name: cluster-api-subnet-public - ipSubnetRange: "10.0.0.8/29" - - name: cluster-api-subnet-nat - ipSubnetRange: "10.0.0.0/29" + ipSubnetRange: "10.0.2.0/24" publicIps: - name: cluster-api-publicip-nat internetService: @@ -57,28 +72,14 @@ spec: clusterName: cluster-api name: cluster-api-natservice publicipname: cluster-api-publicip-nat - subnetname: cluster-api-subnet-nat - + subnetname: cluster-api-subnet-public bastion: clusterName: cluster-api - enable: true - name: cluster-api-vm-bastion - keypairName: cluster-api - deviceName: /dev/sda1 - imageName: ubuntu-2004-2004-kubernetes-v1.22.11-2022-08-22 - rootDisk: - rootDiskSize: 15 - rootDiskIops: 1000 - rootDiskType: io1 - subnetName: cluster-api-subnet-public - subregionName: eu-west-2a - securityGroupNames: - - name: cluster-api-securitygroup-lb - vmType: "tinav4.c2r4p2" + enable: false routeTables: - name: cluster-api-routetable-kw subnets: - - cluster-api-subnet-kw + - cluster-api-subnet-kw routes: - name: cluster-api-routes-kw targetName: cluster-api-natservice @@ -86,23 +87,15 @@ spec: destination: "0.0.0.0/0" - name: cluster-api-routetable-kcp subnets: - - cluster-api-subnet-kcp + - cluster-api-subnet-kcp routes: - name: cluster-api-routes-kcp - targetName: cluster-api-natservice + targetName: cluster-api-natservice targetType: nat destination: "0.0.0.0/0" - - name: cluster-api-routetable-nat - subnets: - - cluster-api-subnet-nat - routes: - - name: cluster-api-routes-nat - targetName: cluster-api-internetservice - targetType: gateway - destination: "0.0.0.0/0" - name: cluster-api-routetable-public subnets: - - cluster-api-subnet-public + - cluster-api-subnet-public routes: - name: cluster-api-routes-public targetName: cluster-api-internetservice @@ -116,30 +109,36 @@ spec: flow: Inbound ipProtocol: tcp # IpRange to authorize access to kubernetes endpoints (kube-apiserver), you must keep it and change it with a CIDR that best suits with your environment. - ipRange: "10.0.0.128/26" + ipRange: "10.0.3.0/24" fromPortRange: 10250 toPortRange: 10250 - name: cluster-api-securitygrouprule-api-kubelet-kcp flow: Inbound ipProtocol: tcp # IpRange to authorize access to kubernetes endpoints (kube-apiserver), you must keep it and change it with a CIDR that best suits with your environment. - ipRange: "10.0.0.32/28" + ipRange: "10.0.4.0/24" fromPortRange: 10250 toPortRange: 10250 - - name: cluster-api-securitygrouprule-nodeip-kw + - name: cluster-api-securitygrouprule-kcp-nodeip-kw flow: Inbound ipProtocol: tcp # IpRange to authorize access to kubernetes endpoints (kube-apiserver), you must keep it and change it with a CIDR that best suits with your environment. - ipRange: "10.0.0.128/26" + ipRange: "10.0.3.0/24" fromPortRange: 30000 toPortRange: 32767 - - name: cluster-api-securitygrouprule-nodeip-kcp + - name: cluster-api-securitygrouprule-kcp-nodeip-kcp flow: Inbound ipProtocol: tcp # IpRange to authorize access to kubernetes endpoints (kube-apiserver), you must keep it and change it with a CIDR that best suits with your environment. - ipRange: "10.0.0.32/28" + ipRange: "10.0.4.0/24" fromPortRange: 30000 toPortRange: 32767 + - name: cluster-api-securitygrouprule-kw-bgp + flow: Inbound + ipProtocol: tcp + ipRange: "10.0.0.0/16" + fromPortRange: 179 + toPortRange: 179 - name: cluster-api-securitygroups-kcp description: Security Group with cluster-api securityGroupRules: @@ -147,30 +146,50 @@ spec: flow: Inbound ipProtocol: tcp # IpRange to authorize access to kubernetes endpoints (kube-apiserver), you must keep it and change it with a CIDR that best suits with your environment. - ipRange: "10.0.0.128/26" + ipRange: "10.0.3.0/24" fromPortRange: 6443 toPortRange: 6443 - name: cluster-api-securitygrouprule-api-kcp flow: Inbound ipProtocol: tcp # IpRange to authorize access to kubernetes endpoints (kube-apiserver), you must keep it and change it with a CIDR that best suits with your environment. - ipRange: "10.0.0.32/28" + ipRange: "10.0.4.0/24" fromPortRange: 6443 toPortRange: 6443 - name: cluster-api-securitygrouprule-etcd flow: Inbound ipProtocol: tcp # IpRange to authorize access to kubernetes endpoints (kube-apiserver), you must keep it and change it with a CIDR that best suits with your environment. - ipRange: "10.0.0.32/28" + ipRange: "10.0.4.0/24" fromPortRange: 2378 toPortRange: 2379 - name: cluster-api-securitygrouprule-kubelet-kcp flow: Inbound ipProtocol: tcp # IpRange to authorize access to kubernetes endpoints (kube-apiserver), you must keep it and change it with a CIDR that best suits with your environment. - ipRange: "10.0.0.32/28" + ipRange: "10.0.4.0/24" fromPortRange: 10250 toPortRange: 10252 + - name: cluster-api-securitygrouprule-kcp-bgp + flow: Inbound + ipProtocol: tcp + ipRange: "10.0.0.0/16" + fromPortRange: 179 + toPortRange: 179 + - name: cluster-api-securitygrouprule-kw-nodeip-kw + flow: Inbound + ipProtocol: tcp +# IpRange to authorize access to kubernetes endpoints (kube-apiserver), you must keep it and change it with a CIDR that best suits with your environment. + ipRange: "10.0.3.0/24" + fromPortRange: 30000 + toPortRange: 32767 + - name: cluster-api-securitygrouprule-kw-nodeip-kcp + flow: Inbound + ipProtocol: tcp +# IpRange to authorize access to kubernetes endpoints (kube-apiserver), you must keep it and change it with a CIDR that best suits with your environment. + ipRange: "10.0.4.0/24" + fromPortRange: 30000 + toPortRange: 32767 - name: cluster-api-securitygroup-lb description: Security Group lb with cluster-api securityGroupRules: @@ -184,6 +203,7 @@ spec: - name: cluster-api-securitygroups-node description: Security Group node with cluster-api tag: OscK8sMainSG + --- apiVersion: cluster.x-k8s.io/v1beta1 kind: MachineDeployment @@ -211,7 +231,7 @@ spec: kind: OscMachineTemplate namespace: default --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscMachineTemplate metadata: name: "cluster-api-md-0" @@ -242,7 +262,7 @@ spec: - name: cluster-api-securitygroups-node vmType: "tinav4.c2r4p2" --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscMachineTemplate metadata: name: "cluster-api-control-plane" @@ -298,7 +318,7 @@ spec: name: "{{ ds.meta_data.local_hostname }}" kubeletExtraArgs: cloud-provider: external - provider-id: osc://'{{ ds.meta_data.instance_id }}' + provider-id: aws://'{{ ds.meta_data.placement.availability_zone }}'/'{{ ds.meta_data.instance_id }}' preKubeadmCommands: - sh /tmp/set_runc.sh --- @@ -319,7 +339,7 @@ spec: nodeRegistration: kubeletExtraArgs: cloud-provider: external - provider-id: osc://'{{ ds.meta_data.instance_id }}' + provider-id: aws://'{{ ds.meta_data.placement.availability_zone }}'/'{{ ds.meta_data.instance_id }}' name: '{{ ds.meta_data.local_hostname }}' files: - content: | @@ -334,7 +354,7 @@ spec: nodeRegistration: kubeletExtraArgs: cloud-provider: external - provider-id: osc://'{{ ds.meta_data.instance_id }}' + provider-id: aws://'{{ ds.meta_data.placement.availability_zone }}'/'{{ ds.meta_data.instance_id }}' preKubeadmCommands: - sh /tmp/set_runc.sh version: "1.22.11" diff --git a/example/cluster-machine-template-default.yaml b/example/cluster-machine-template-default.yaml index 698c1487f..a251db300 100644 --- a/example/cluster-machine-template-default.yaml +++ b/example/cluster-machine-template-default.yaml @@ -21,7 +21,7 @@ spec: name: "capo-quickstart-control-plane" namespace: default --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscCluster metadata: name: capo-quickstart @@ -94,7 +94,7 @@ spec: subregionName: eu-west-2a vmType: "tinav4.c2r4p2" --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscMachineTemplate metadata: name: "capo-quickstart-control-plane" diff --git a/example/cluster-machine-template-simple.yaml b/example/cluster-machine-template-simple.yaml index 8dc0704e5..d85b2b48c 100644 --- a/example/cluster-machine-template-simple.yaml +++ b/example/cluster-machine-template-simple.yaml @@ -21,13 +21,15 @@ spec: name: "cluster-api-control-plane" namespace: default --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscCluster metadata: name: cluster-api namespace: default spec: network: + bastion: + enable: false clusterName: cluster-api subregionName: eu-west-2a loadBalancer: @@ -214,7 +216,7 @@ spec: kind: OscMachineTemplate namespace: default --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscMachineTemplate metadata: name: "cluster-api-md-0" @@ -245,7 +247,7 @@ spec: - name: cluster-api-securitygroups-node vmType: "tinav4.c2r4p2" --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscMachineTemplate metadata: name: "cluster-api-control-plane" diff --git a/example/clusterctl.yaml b/example/clusterctl.yaml new file mode 100644 index 000000000..252a8761d --- /dev/null +++ b/example/clusterctl.yaml @@ -0,0 +1,8 @@ +providers: +- name: "k3s" + url: /home/outscale/cluster-api-k3s/samples/deployment/bootstrap-k3s/v1.2.2/bootstrap-components.yaml + type: "BootstrapProvider" +- name: "k3s" + url: /home/outscale/cluster-api-k3s/samples/deployment/control-plane-k3s/v1.2.2/control-plane-components.yaml + type: "ControlPlaneProvider" +# override a pre-defined provider \ No newline at end of file diff --git a/example/hello-osc.yaml b/example/hello-osc.yaml index a3b722dd1..6a67f738c 100644 --- a/example/hello-osc.yaml +++ b/example/hello-osc.yaml @@ -28,7 +28,6 @@ metadata: spec: network: clusterName: hello-osc - subregionName: eu-west-2a internetService: clusterName: hello-osc loadBalancer: diff --git a/hack/boilerplate/boilerplate.py b/hack/boilerplate/boilerplate.py index 465af474d..8dad1d21e 100755 --- a/hack/boilerplate/boilerplate.py +++ b/hack/boilerplate/boilerplate.py @@ -123,6 +123,7 @@ def file_passes(filename, refs, regexs): else: print('File %s has the YEAR field, but missing the year of date' % filename, file=verbose_out) return False + if not generated: # Replace all occurrences of the regex "2014|2015|2016|2017|2018" with "YEAR" p = regexs["date"] @@ -219,6 +220,7 @@ def main(): regexs = get_regexs() refs = get_refs() filenames = get_files(refs.keys()) + for filename in filenames: if not file_passes(filename, refs, regexs): if sys.version_info[0] < 3: diff --git a/hack/ensure-clusterctl.sh b/hack/ensure-clusterctl.sh index 9771f7ce9..8aa9eb7dd 100755 --- a/hack/ensure-clusterctl.sh +++ b/hack/ensure-clusterctl.sh @@ -46,7 +46,8 @@ EOF install_clusterctl() { if [[ "${OSTYPE}" == "linux"* ]]; then - curl -sLo "clusterctl" "https://github.com/kubernetes-sigs/cluster-api/releases/download/v${MINIMUM_CLUSTERCTL_VERSION}/clusterctl-linux-amd64" + echo "https://github.com/kubernetes-sigs/cluster-api/releases/download/v${MINIMUM_CLUSTERCTL_VERSION}/clusterctl-linux-amd64" + curl -sLo "clusterctl" "https://github.com/kubernetes-sigs/cluster-api/releases/download/v${MINIMUM_CLUSTERCTL_VERSION}/clusterctl-linux-amd64" copy_binary else set +x diff --git a/metadata.yaml b/metadata.yaml index a087e9986..01e7313ab 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -3,3 +3,6 @@ releaseSeries: - major: 0 minor: 1 contract: v1beta1 + - major: 0 + minor: 2 + contract: v1beta2 diff --git a/templates/cluster-template.yaml b/templates/cluster-template.yaml index c789293d1..23e9f8399 100644 --- a/templates/cluster-template.yaml +++ b/templates/cluster-template.yaml @@ -18,7 +18,7 @@ spec: apiVersion: controlplane.cluster.x-k8s.io/v1beta1 name: "${CLUSTER_NAME}-control-plane" --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscCluster metadata: name: "${CLUSTER_NAME}" @@ -62,7 +62,7 @@ spec: apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: OscMachineTemplate --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscMachineTemplate metadata: name: "${CLUSTER_NAME}-md-0" @@ -85,7 +85,7 @@ spec: subregionName: ${OSC_SUBREGION_NAME} vmType: "${OSC_VM_TYPE}" --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscMachineTemplate metadata: name: "${CLUSTER_NAME}-control-plane" diff --git a/test/e2e/config/outscale-envsubst.yaml b/test/e2e/config/outscale-envsubst.yaml new file mode 100644 index 000000000..90a16d9dc --- /dev/null +++ b/test/e2e/config/outscale-envsubst.yaml @@ -0,0 +1,116 @@ +images: + - name: core.harbor-dev.148-253-74-240.sslip.io/osc/cluster-api-outscale-controllers:tilt-8a56a34ca5e25c7f + loadBehavior: mustLoad +providers: + - name: cluster-api + type: CoreProvider + versions: + - name: v1.1.4 + value: https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.1.4/core-components.yaml + type: "url" + contract: v1beta1 + files: + - sourcePath: "../data/shared/v1beta1/metadata.yaml" + replacements: + - old: "imagePullPolicy: Always" + new: "imagePullPolicy: IfNotPresent" + - old: "--leader-elect" + new: "--leader-elect=false" + - name: kubeadm + type: BootstrapProvider + versions: + - name: v1.1.4 + value: https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.1.4/bootstrap-components.yaml + type: "url" + contract: v1beta1 + files: + - sourcePath: "../data/shared/v1beta1/metadata.yaml" + replacements: + - old: "imagePullPolicy: Always" + new: "imagePullPolicy: IfNotPresent" + - old: "--leader-elect" + new: "--leader-elect=false" + - name: kubeadm + type: ControlPlaneProvider + versions: + - name: v1.1.4 + value: https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.1.4/control-plane-components.yaml + type: "url" + contract: v1beta1 + files: + - sourcePath: "../data/shared/v1beta1/metadata.yaml" + replacements: + - old: "imagePullPolicy: Always" + new: "imagePullPolicy: IfNotPresent" + - old: "--leader-elect" + new: "--leader-elect=false" + - name: outscale + type: InfrastructureProvider + versions: + - name: v0.1.99 + value: "../../../config/default" + contract: v1beta1 + replacements: + - old: controller:latest + new: core.harbor-dev.148-253-74-240.sslip.io/osc/cluster-api-outscale-controllers:tilt-8a56a34ca5e25c7f + - old: "imagePullPolicy: Always" + new: "imagePullPolicy: IfNotPresent" + files: + - sourcePath: "../../../metadata.yaml" + targetName: "metadata.yaml" + - sourcePath: "../data/infrastructure-outscale/cluster-template-with-clusterclass.yaml" + - sourcePath: "../data/infrastructure-outscale/cluster-template-upgrade.yaml" + - sourcePath: "../data/infrastructure-outscale/cluster-template-upgrade-scale-in.yaml" + - sourcePath: "../data/infrastructure-outscale/cluster-template-node-drain.yaml" + - sourcePath: "../data/infrastructure-outscale/cluster-template-kcp-remediation.yaml" + - sourcePath: "../data/infrastructure-outscale/cluster-template-md-remediation.yaml" +variables: + # Outscale Provider Variable + CLUSTER_NAME: "capo-e2e" + OSC_IOPS: 1000 + OSC_VOLUME_SIZE: 10 + OSC_VOLUME_TYPE: "gp2" + OSC_KEYPAIR_NAME: "cluster-api-keypair" + OSC_SUBREGION_NAME: "" + OSC_VM_TYPE: "tinav3.c2r2p1" + OSC_LOADBALANCER_NAME: "capo-e2e-k8s" + WORKER_MACHINE_COUNT: 1 + CONTROL_PLANE_MACHINE_COUNT: 1 + CNI: "/home/outscale/test-vbr-old/cluster-api-provider-outscale/test/e2e/data/cni/calico/calico.yaml" + CCM: "/home/outscale/test-vbr-old/cluster-api-provider-outscale/test/e2e/data/ccm/ccm.yaml" + EXP_CLUSTER_RESOURCE_SET: "true" + EXP_MACHINE_POOL: "true" + CLUSTER_TOPOLOGY: "true" + EXP_RUNTIME_SDK: "true" + ETCD_VERSION_UPGRADE_TO: "3.5.3-0" + COREDNS_VERSION_UPGRADE_TO: "v1.8.6" + IP_FAMILY: "IPv4" + KUBERNETES_VERSION_MANAGEMENT: "v1.22.11" + KUBERNETES_VERSION: "v1.22.11" + KUBERNETES_VERSION_UPGRADE_FROM: "v1.22.11" + KUBERNETES_VERSION_UPGRADE_TO: "v1.23.8" + TEMPLATE_PATH: "/home/outscale/test-vbr-old/cluster-api-provider-outscale/test/e2e/data/infrastructure-outscale/cluster-template-with-clusterclass.yaml" + KUBERNETES_IMAGE_UPGRADE_FROM: "" + KUBERNETES_IMAGE_UPGRADE_TO: "" + CONTROL_PLANE_MACHINE_TEMPLATE_UPGRADE_TO: "cp-k8s-upgrade-and-conformance" + WORKERS_MACHINE_TEMPLATE_UPGRADE_TO: "worker-k8s-upgrade-and-conformance" + CONFORMANCE_WORKER_MACHINE_COUNT: 2 + CONFORMANCE_CONTROL_PLANE_MACHINE_COUNT: 3 + KUBETEST_CONFIGURATION: "./data/kubetest/conformance.yaml" + NODE_DRAIN_TIMEOUT: "60s" +intervals: + default/wait-cluster: ["20m", "10s"] + default/wait-control-plane: ["30m", "10s"] + default/wait-worker-nodes: ["15m", "10s"] + default/wait-controllers: ["5m", "10s"] + default/wait-delete-cluster: ["20m", "10s"] + default/wait-machine-upgrade: ["20m", "10s"] + default/wait-machine-status: ["20m", "10s"] + default/wait-failed-machine-status: ["2m", "10s"] + default/wait-machine-remediation: ["15m", "10s"] + default/wait-deployment: ["5m", "10s"] + default/wait-job: ["5m", "10s"] + default/wait-nodes-ready: ["15m", "10s"] + default/wait-service: ["3m", "10s"] + node-drain/wait-deployment-available: ["3m", "10s"] + node-drain/wait-machine-deleted: ["15m", "10s"] diff --git a/test/e2e/data/infrastructure-outscale/cluster-template-kcp-remediation.yaml b/test/e2e/data/infrastructure-outscale/cluster-template-kcp-remediation.yaml index dd6f6cc54..92547f0b3 100644 --- a/test/e2e/data/infrastructure-outscale/cluster-template-kcp-remediation.yaml +++ b/test/e2e/data/infrastructure-outscale/cluster-template-kcp-remediation.yaml @@ -18,7 +18,7 @@ spec: apiVersion: controlplane.cluster.x-k8s.io/v1beta1 name: "${CLUSTER_NAME}-control-plane" --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscCluster metadata: name: "${CLUSTER_NAME}" @@ -39,7 +39,7 @@ spec: clusterName: "${CLUSTER_NAME}" enable: false --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscMachineTemplate metadata: name: "${CLUSTER_NAME}-md-0" @@ -86,7 +86,7 @@ spec: apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: OscMachineTemplate --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscMachineTemplate metadata: name: "${CLUSTER_NAME}-control-plane" diff --git a/test/e2e/data/infrastructure-outscale/cluster-template-md-remediation.yaml b/test/e2e/data/infrastructure-outscale/cluster-template-md-remediation.yaml index 104ef1a74..a966d0760 100644 --- a/test/e2e/data/infrastructure-outscale/cluster-template-md-remediation.yaml +++ b/test/e2e/data/infrastructure-outscale/cluster-template-md-remediation.yaml @@ -10,7 +10,7 @@ spec: pods: cidrBlocks: ["10.42.0.0/16"] infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscCluster name: "${CLUSTER_NAME}" controlPlaneRef: @@ -18,7 +18,7 @@ spec: apiVersion: controlplane.cluster.x-k8s.io/v1beta1 name: "${CLUSTER_NAME}-control-plane" --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscCluster metadata: name: "${CLUSTER_NAME}" @@ -39,7 +39,7 @@ spec: clusterName: "${CLUSTER_NAME}" enable: false --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscMachineTemplate metadata: name: "${CLUSTER_NAME}-md-0" @@ -83,7 +83,7 @@ spec: apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: OscMachineTemplate --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscMachineTemplate metadata: name: "${CLUSTER_NAME}-control-plane" diff --git a/test/e2e/data/infrastructure-outscale/cluster-template-node-drain.yaml b/test/e2e/data/infrastructure-outscale/cluster-template-node-drain.yaml index 0b258c793..f3beff813 100644 --- a/test/e2e/data/infrastructure-outscale/cluster-template-node-drain.yaml +++ b/test/e2e/data/infrastructure-outscale/cluster-template-node-drain.yaml @@ -10,7 +10,7 @@ spec: pods: cidrBlocks: ["10.42.0.0/16"] infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscCluster name: "${CLUSTER_NAME}" controlPlaneRef: @@ -18,7 +18,7 @@ spec: apiVersion: controlplane.cluster.x-k8s.io/v1beta1 name: "${CLUSTER_NAME}-control-plane" --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscCluster metadata: name: "${CLUSTER_NAME}" @@ -39,7 +39,7 @@ spec: clusterName: "${CLUSTER_NAME}" enable: false --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscMachineTemplate metadata: name: "${CLUSTER_NAME}-md-0" diff --git a/test/e2e/data/infrastructure-outscale/cluster-template-upgrade-scale-in.yaml b/test/e2e/data/infrastructure-outscale/cluster-template-upgrade-scale-in.yaml index 5990bae73..db1d26d05 100644 --- a/test/e2e/data/infrastructure-outscale/cluster-template-upgrade-scale-in.yaml +++ b/test/e2e/data/infrastructure-outscale/cluster-template-upgrade-scale-in.yaml @@ -10,7 +10,7 @@ spec: pods: cidrBlocks: ["10.42.0.0/16"] infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscCluster name: "${CLUSTER_NAME}" controlPlaneRef: @@ -18,7 +18,7 @@ spec: apiVersion: controlplane.cluster.x-k8s.io/v1beta1 name: "${CLUSTER_NAME}-control-plane" --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscCluster metadata: name: "${CLUSTER_NAME}" @@ -62,7 +62,7 @@ spec: apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: OscMachineTemplate --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscMachineTemplate metadata: name: "${CLUSTER_NAME}-md-0" @@ -89,7 +89,7 @@ spec: subregionName: ${OSC_SUBREGION_NAME} vmType: "${OSC_VM_TYPE}" --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscMachineTemplate metadata: name: "worker-k8s-upgrade-and-conformance" diff --git a/test/e2e/data/infrastructure-outscale/cluster-template-upgrade.yaml b/test/e2e/data/infrastructure-outscale/cluster-template-upgrade.yaml index bb512d6bc..2ed5dd3db 100644 --- a/test/e2e/data/infrastructure-outscale/cluster-template-upgrade.yaml +++ b/test/e2e/data/infrastructure-outscale/cluster-template-upgrade.yaml @@ -10,7 +10,7 @@ spec: pods: cidrBlocks: ["10.42.0.0/16"] infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscCluster name: "${CLUSTER_NAME}" controlPlaneRef: @@ -18,7 +18,7 @@ spec: apiVersion: controlplane.cluster.x-k8s.io/v1beta1 name: "${CLUSTER_NAME}-control-plane" --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscCluster metadata: name: "${CLUSTER_NAME}" @@ -59,10 +59,10 @@ spec: kind: KubeadmConfigTemplate infrastructureRef: name: "${CLUSTER_NAME}-md-0" - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + apiVersion: infrastructure.cluster.x-k8s.io/v1beta kind: OscMachineTemplate --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscMachineTemplate metadata: name: "${CLUSTER_NAME}-md-0" @@ -83,7 +83,6 @@ spec: rootDiskIops: ${OSC_IOPS} rootDiskType: "${OSC_VOLUME_TYPE}" subregionName: ${OSC_SUBREGION_NAME} - keypairName: "${OSC_KEYPAIR_NAME}" vmType: "${OSC_VM_TYPE}" --- apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 diff --git a/test/e2e/data/infrastructure-outscale/cluster-template-with-clusterclass.yaml b/test/e2e/data/infrastructure-outscale/cluster-template-with-clusterclass.yaml index c3496f674..e4621d9f6 100644 --- a/test/e2e/data/infrastructure-outscale/cluster-template-with-clusterclass.yaml +++ b/test/e2e/data/infrastructure-outscale/cluster-template-with-clusterclass.yaml @@ -18,7 +18,7 @@ spec: apiVersion: controlplane.cluster.x-k8s.io/v1beta1 name: "${CLUSTER_NAME}-control-plane" --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscCluster metadata: name: "${CLUSTER_NAME}" @@ -59,10 +59,10 @@ spec: kind: KubeadmConfigTemplate infrastructureRef: name: "${CLUSTER_NAME}-md-0" - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscMachineTemplate --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscMachineTemplate metadata: name: "${CLUSTER_NAME}-md-0" @@ -85,7 +85,7 @@ spec: subregionName: ${OSC_SUBREGION_NAME} vmType: "${OSC_VM_TYPE}" --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscMachineTemplate metadata: name: "${CLUSTER_NAME}-control-plane" diff --git a/test/e2e/data/infrastructure-outscale/cluster-template.yaml b/test/e2e/data/infrastructure-outscale/cluster-template.yaml index 40529c063..654f5081d 100644 --- a/test/e2e/data/infrastructure-outscale/cluster-template.yaml +++ b/test/e2e/data/infrastructure-outscale/cluster-template.yaml @@ -4,11 +4,11 @@ metadata: name: ${CLUSTER_NAME} spec: infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscCluster name: ${CLUSTER_NAME} --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OscCluster metadata: name: ${CLUSTER_NAME} diff --git a/test/e2e/suite_test.go b/test/e2e/suite_test.go index 735d502a9..0c922a67a 100644 --- a/test/e2e/suite_test.go +++ b/test/e2e/suite_test.go @@ -122,7 +122,7 @@ func TestE2E(t *testing.T) { func getK8sClient() { if os.Getenv(kubeconfigEnvVar) == "" { - kubeconfig := filepath.Join("/root", ".kube", "config") + kubeconfig := filepath.Join("/home", "outscale", ".kube", "config") os.Setenv(kubeconfigEnvVar, kubeconfig) } logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true))) diff --git a/testclean/osccluster.go b/testclean/osccluster.go index 6be4c75e2..f99f9411b 100644 --- a/testclean/osccluster.go +++ b/testclean/osccluster.go @@ -20,7 +20,7 @@ import ( "fmt" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - infrastructurev1beta1 "github.com/outscale-dev/cluster-api-provider-outscale.git/api/v1beta1" + infrastructurev1beta2 "github.com/outscale-dev/cluster-api-provider-outscale.git/api/v1beta2" "golang.org/x/net/context" "sigs.k8s.io/controller-runtime/pkg/client" "time" @@ -45,7 +45,7 @@ type OscInfraClusterDeleteListInput struct { func GetOscInfraCluster(ctx context.Context, input OscInfraClusterInput) bool { Expect(input.Namespace).ToNot(BeNil(), "Need a namespace in GetOscInfraCluster") Expect(input.Name).ToNot(BeNil(), "Need a name in GetOscInfraCluster") - oscInfraCluster := &infrastructurev1beta1.OscCluster{} + oscInfraCluster := &infrastructurev1beta2.OscCluster{} key := client.ObjectKey{ Namespace: input.Namespace, Name: input.Name, @@ -60,7 +60,7 @@ func GetOscInfraCluster(ctx context.Context, input OscInfraClusterInput) bool { // GetOscInfraClusterList get oscCluster. func GetOscInfraClusterList(ctx context.Context, input OscInfraClusterListInput) bool { - oscInfraClusterList := &infrastructurev1beta1.OscClusterList{} + oscInfraClusterList := &infrastructurev1beta2.OscClusterList{} if err := input.Lister.List(ctx, oscInfraClusterList, input.ListOptions); err != nil { By(fmt.Sprintf("Can not list OscInfraClusterList %s\n", err)) return false @@ -73,16 +73,16 @@ func GetOscInfraClusterList(ctx context.Context, input OscInfraClusterListInput) // DeleteOscInfraClusterList delete oscCluster. func DeleteOscInfraClusterList(ctx context.Context, input OscInfraClusterDeleteListInput) bool { - oscInfraClusterList := &infrastructurev1beta1.OscClusterList{} + oscInfraClusterList := &infrastructurev1beta2.OscClusterList{} if err := input.Deleter.List(ctx, oscInfraClusterList, input.ListOptions); err != nil { By(fmt.Sprintf("Can not list oscInfraClusterList %s", err)) return false } var key client.ObjectKey - var oscInfraClusterGet *infrastructurev1beta1.OscCluster + var oscInfraClusterGet *infrastructurev1beta2.OscCluster for _, oscInfraCluster := range oscInfraClusterList.Items { By(fmt.Sprintf("Find oscInfraCluster %s in namespace to be deleted %s\n", oscInfraCluster.Name, oscInfraCluster.Namespace)) - oscInfraClusterGet = &infrastructurev1beta1.OscCluster{} + oscInfraClusterGet = &infrastructurev1beta2.OscCluster{} key = client.ObjectKey{ Namespace: oscInfraCluster.Namespace, Name: oscInfraCluster.Name, diff --git a/testclean/oscmachine.go b/testclean/oscmachine.go index 6a7f47334..ad9c19bd2 100644 --- a/testclean/oscmachine.go +++ b/testclean/oscmachine.go @@ -20,7 +20,7 @@ import ( "fmt" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - infrastructurev1beta1 "github.com/outscale-dev/cluster-api-provider-outscale.git/api/v1beta1" + infrastructurev1beta2 "github.com/outscale-dev/cluster-api-provider-outscale.git/api/v1beta2" "golang.org/x/net/context" "sigs.k8s.io/controller-runtime/pkg/client" "time" @@ -45,7 +45,7 @@ type OscInfraMachineListDeleteInput struct { func GetOscInfraMachine(ctx context.Context, input OscInfraMachineInput) bool { Expect(input.Namespace).ToNot(BeNil(), "Need a namespace in GetOscInfraMachine") Expect(input.Name).ToNot(BeNil(), "Need a name in GetOscInfraMachine") - oscInfraMachine := &infrastructurev1beta1.OscMachine{} + oscInfraMachine := &infrastructurev1beta2.OscMachine{} key := client.ObjectKey{ Namespace: input.Namespace, Name: input.Name, @@ -60,7 +60,7 @@ func GetOscInfraMachine(ctx context.Context, input OscInfraMachineInput) bool { // GetOscInfraMachineList get oscMachine. func GetOscInfraMachineList(ctx context.Context, input OscInfraMachineListInput) bool { - oscInfraMachineList := &infrastructurev1beta1.OscMachineList{} + oscInfraMachineList := &infrastructurev1beta2.OscMachineList{} if err := input.Lister.List(ctx, oscInfraMachineList, input.ListOptions); err != nil { By(fmt.Sprintf("Can not list OscInfraMachineList %s\n", err)) return false @@ -73,16 +73,16 @@ func GetOscInfraMachineList(ctx context.Context, input OscInfraMachineListInput) // DeleteOscInfraMachineList delete oscMachine. func DeleteOscInfraMachineList(ctx context.Context, input OscInfraMachineListDeleteInput) bool { - oscInfraMachineList := &infrastructurev1beta1.OscMachineList{} + oscInfraMachineList := &infrastructurev1beta2.OscMachineList{} if err := input.Deleter.List(ctx, oscInfraMachineList, input.ListOptions); err != nil { By(fmt.Sprintf("Can not list infraMachine %s", err)) return false } var key client.ObjectKey - var oscInfraMachineGet *infrastructurev1beta1.OscMachine + var oscInfraMachineGet *infrastructurev1beta2.OscMachine for _, oscInfraMachine := range oscInfraMachineList.Items { By(fmt.Sprintf("Find oscInfraMachine %s in namespace %s to be deleted \n", oscInfraMachine.Name, oscInfraMachine.Namespace)) - oscInfraMachineGet = &infrastructurev1beta1.OscMachine{} + oscInfraMachineGet = &infrastructurev1beta2.OscMachine{} key = client.ObjectKey{ Namespace: oscInfraMachine.Namespace, Name: oscInfraMachine.Name, @@ -103,7 +103,7 @@ func DeleteOscInfraMachineList(ctx context.Context, input OscInfraMachineListDel Expect(input.Deleter.Update(ctx, oscInfraMachineGet)).Should(Succeed()) fmt.Fprintf(GinkgoWriter, "Patch machine \n") } - oscInfraMachineGet = &infrastructurev1beta1.OscMachine{} + oscInfraMachineGet = &infrastructurev1beta2.OscMachine{} EventuallyWithOffset(1, func() error { fmt.Fprintf(GinkgoWriter, "Wait OscInfraMachine %s in namespace %s to be deleted \n", oscInfraMachine.Name, oscInfraMachine.Namespace) return input.Deleter.Get(ctx, key, oscInfraMachineGet) diff --git a/testclean/oscmachinetemplate.go b/testclean/oscmachinetemplate.go index cff422a5d..3c81d502c 100644 --- a/testclean/oscmachinetemplate.go +++ b/testclean/oscmachinetemplate.go @@ -20,7 +20,7 @@ import ( "fmt" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - infrastructurev1beta1 "github.com/outscale-dev/cluster-api-provider-outscale.git/api/v1beta1" + infrastructurev1beta2 "github.com/outscale-dev/cluster-api-provider-outscale.git/api/v1beta2" "golang.org/x/net/context" "sigs.k8s.io/controller-runtime/pkg/client" "time" @@ -45,7 +45,7 @@ type OscInfraMachineTemplateListDeleteInput struct { func GetOscInfraMachineTemplate(ctx context.Context, input OscInfraMachineTemplateInput) bool { Expect(input.Namespace).ToNot(BeNil(), "Need a namespace in GetOscInfraMachineTemplate") Expect(input.Name).ToNot(BeNil(), "Need a name in GetOscInfraMachineTemplate") - oscInfraMachineTemplate := &infrastructurev1beta1.OscMachineTemplate{} + oscInfraMachineTemplate := &infrastructurev1beta2.OscMachineTemplate{} key := client.ObjectKey{ Namespace: input.Namespace, Name: input.Name, @@ -60,7 +60,7 @@ func GetOscInfraMachineTemplate(ctx context.Context, input OscInfraMachineTempla // GetOscInfraMachineTemplateList get oscMachineTemplate func GetOscInfraMachineTemplateList(ctx context.Context, input OscInfraMachineTemplateListInput) bool { - oscInfraMachineTemplateList := &infrastructurev1beta1.OscMachineTemplateList{} + oscInfraMachineTemplateList := &infrastructurev1beta2.OscMachineTemplateList{} if err := input.Lister.List(ctx, oscInfraMachineTemplateList, input.ListOptions); err != nil { By(fmt.Sprintf("Can not list OscInfraMachineTemplateList %s\n", err)) return false @@ -73,16 +73,16 @@ func GetOscInfraMachineTemplateList(ctx context.Context, input OscInfraMachineTe // DeleteOscInfraMachineTemplateList delete oscMachineTemplate func DeleteOscInfraMachineTemplateList(ctx context.Context, input OscInfraMachineTemplateListDeleteInput) bool { - oscInfraMachineTemplateList := &infrastructurev1beta1.OscMachineTemplateList{} + oscInfraMachineTemplateList := &infrastructurev1beta2.OscMachineTemplateList{} if err := input.Deleter.List(ctx, oscInfraMachineTemplateList, input.ListOptions); err != nil { By(fmt.Sprintf("Can not list infraMachine %s", err)) return false } var key client.ObjectKey - var oscInfraMachineTemplateGet *infrastructurev1beta1.OscMachineTemplate + var oscInfraMachineTemplateGet *infrastructurev1beta2.OscMachineTemplate for _, oscInfraMachineTemplate := range oscInfraMachineTemplateList.Items { By(fmt.Sprintf("Find oscInfraMachineTemplate %s in namespaace %s to be deleted \n", oscInfraMachineTemplate.Name, oscInfraMachineTemplate.Namespace)) - oscInfraMachineTemplateGet = &infrastructurev1beta1.OscMachineTemplate{} + oscInfraMachineTemplateGet = &infrastructurev1beta2.OscMachineTemplate{} key = client.ObjectKey{ Namespace: oscInfraMachineTemplate.Namespace, Name: oscInfraMachineTemplate.Name, @@ -104,7 +104,7 @@ func DeleteOscInfraMachineTemplateList(ctx context.Context, input OscInfraMachin Expect(input.Deleter.Update(ctx, oscInfraMachineTemplateGet)).Should(Succeed()) fmt.Fprintf(GinkgoWriter, "Patch machineTemplate \n") } - oscInfraMachineTemplateGet = &infrastructurev1beta1.OscMachineTemplate{} + oscInfraMachineTemplateGet = &infrastructurev1beta2.OscMachineTemplate{} EventuallyWithOffset(1, func() error { fmt.Fprintf(GinkgoWriter, "Wait OscInfraMachineTemplate %s in namespace %s to be deleted \n", oscInfraMachineTemplate.Name, oscInfraMachineTemplate.Namespace) return input.Deleter.Get(ctx, key, oscInfraMachineTemplateGet) diff --git a/testenv/osccluster_controller_test.go b/testenv/osccluster_controller_test.go index 4de6653d4..35640bbcc 100644 --- a/testenv/osccluster_controller_test.go +++ b/testenv/osccluster_controller_test.go @@ -29,7 +29,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - infrastructurev1beta1 "github.com/outscale-dev/cluster-api-provider-outscale.git/api/v1beta1" + infrastructurev1beta2 "github.com/outscale-dev/cluster-api-provider-outscale.git/api/v1beta2" "github.com/outscale-dev/cluster-api-provider-outscale.git/cloud/scope" "github.com/outscale-dev/cluster-api-provider-outscale.git/cloud/services/compute" "github.com/outscale-dev/cluster-api-provider-outscale.git/cloud/services/net" @@ -47,9 +47,9 @@ import ( ) // deployOscInfraCluster will deploy OscInfraCluster (create osccluster object) -func deployOscInfraCluster(ctx context.Context, infraClusterSpec infrastructurev1beta1.OscClusterSpec, name string, namespace string) (client.Object, client.ObjectKey) { +func deployOscInfraCluster(ctx context.Context, infraClusterSpec infrastructurev1beta2.OscClusterSpec, name string, namespace string) (client.Object, client.ObjectKey) { By("Deploy oscInfraCluster") - oscInfraCluster := &infrastructurev1beta1.OscCluster{ + oscInfraCluster := &infrastructurev1beta2.OscCluster{ Spec: infraClusterSpec, ObjectMeta: metav1.ObjectMeta{ Name: name, @@ -62,9 +62,9 @@ func deployOscInfraCluster(ctx context.Context, infraClusterSpec infrastructurev } // deployOscInfraMachine will deploy OscInfraMachine (create oscmachine object) -func deployOscInfraMachine(ctx context.Context, infraMachineSpec infrastructurev1beta1.OscMachineSpec, name string, namespace string) (client.Object, client.ObjectKey) { +func deployOscInfraMachine(ctx context.Context, infraMachineSpec infrastructurev1beta2.OscMachineSpec, name string, namespace string) (client.Object, client.ObjectKey) { By("Deploy oscInfraMachine") - oscInfraMachine := &infrastructurev1beta1.OscMachine{ + oscInfraMachine := &infrastructurev1beta2.OscMachine{ Spec: infraMachineSpec, ObjectMeta: metav1.ObjectMeta{ Name: name, @@ -77,7 +77,7 @@ func deployOscInfraMachine(ctx context.Context, infraMachineSpec infrastructurev } // createCheckDeleteOscCluster will deploy oscInfraCluster (create osccluster object), deploy capoCluster (create cluster object), will validate each OscInfraCluster component is provisioned and then will delelete OscInfraCluster (delete osccluster) and capoCluster (delete cluster) -func createCheckDeleteOscCluster(ctx context.Context, infraClusterSpec infrastructurev1beta1.OscClusterSpec) { +func createCheckDeleteOscCluster(ctx context.Context, infraClusterSpec infrastructurev1beta2.OscClusterSpec) { oscInfraCluster, oscInfraClusterKey := deployOscInfraCluster(ctx, infraClusterSpec, "cluster-api-test", "default") capoCluster, capoClusterKey := deployCapoCluster(ctx, "cluster-api-test", "default") waitOscInfraClusterToBeReady(ctx, oscInfraClusterKey) @@ -100,7 +100,7 @@ func createCheckDeleteOscCluster(ctx context.Context, infraClusterSpec infrastru } // createCheckDeleteOscClusterMachine will deploy oscInfraCluster (create osccluster object), deploy oscInfraMachine (create oscmachine object), deploy capoCluster (create cluster object), deploy capoMachine (create machine object), will validate each OscInfraCluster component is provisioned and then will delelete OscInfraCluster (delete osccluster) and capoCluster (delete cluster) -func createCheckDeleteOscClusterMachine(ctx context.Context, infraClusterSpec infrastructurev1beta1.OscClusterSpec, infraMachineSpec infrastructurev1beta1.OscMachineSpec) { +func createCheckDeleteOscClusterMachine(ctx context.Context, infraClusterSpec infrastructurev1beta2.OscClusterSpec, infraMachineSpec infrastructurev1beta2.OscMachineSpec) { oscInfraCluster, oscInfraClusterKey := deployOscInfraCluster(ctx, infraClusterSpec, "cluster-api-test", "default") capoCluster, capoClusterKey := deployCapoCluster(ctx, "cluster-api-test", "default") waitOscInfraClusterToBeReady(ctx, oscInfraClusterKey) @@ -323,7 +323,7 @@ func waitOscMachineToProvision(ctx context.Context, capoMachineKey client.Object func waitOscInfraClusterToBeReady(ctx context.Context, oscInfraClusterKey client.ObjectKey) { By("Wait OscInfraCluster to be in ready status") EventuallyWithOffset(1, func() bool { - oscInfraCluster := &infrastructurev1beta1.OscCluster{} + oscInfraCluster := &infrastructurev1beta2.OscCluster{} k8sClient.Get(ctx, oscInfraClusterKey, oscInfraCluster) fmt.Fprintf(GinkgoWriter, "oscInfraClusterReady: %v\n", oscInfraCluster.Status.Ready) return oscInfraCluster.Status.Ready @@ -334,7 +334,7 @@ func waitOscInfraClusterToBeReady(ctx context.Context, oscInfraClusterKey client func waitOscInfraMachineToBeReady(ctx context.Context, oscInfraMachineKey client.ObjectKey) { By("Wait OscInfraMachine to be in ready status") EventuallyWithOffset(1, func() bool { - oscInfraMachine := &infrastructurev1beta1.OscMachine{} + oscInfraMachine := &infrastructurev1beta2.OscMachine{} k8sClient.Get(ctx, oscInfraMachineKey, oscInfraMachine) fmt.Fprintf(GinkgoWriter, "oscInfraMachineReady: %v\n", oscInfraMachine.Status.Ready) return oscInfraMachine.Status.Ready @@ -457,7 +457,7 @@ func checkOscPublicIpToBeProvisioned(ctx context.Context, oscInfraClusterKey cli By("Check OscPublicIp is provisioned") Eventually(func() error { securitysvc := security.NewService(ctx, clusterScope) - var publicIpsSpec []*infrastructurev1beta1.OscPublicIp + var publicIpsSpec []*infrastructurev1beta2.OscPublicIp publicIpsSpec = clusterScope.GetPublicIp() var publicIpId string var publicIpIds []string @@ -487,7 +487,7 @@ func checkOscVolumeToBeProvisioned(ctx context.Context, oscInfraMachineKey clien By("Check OscVolume is provisioned") Eventually(func() error { volumeSvc := storage.NewService(ctx, clusterScope) - var volumesSpec []*infrastructurev1beta1.OscVolume + var volumesSpec []*infrastructurev1beta2.OscVolume volumesSpec = machineScope.GetVolume() var volumeId string var volumeIds []string @@ -666,7 +666,7 @@ func getClusterScope(ctx context.Context, capoClusterKey client.ObjectKey, oscIn By("Get ClusterScope") capoCluster := &clusterv1.Cluster{} k8sClient.Get(ctx, capoClusterKey, capoCluster) - oscInfraCluster := &infrastructurev1beta1.OscCluster{} + oscInfraCluster := &infrastructurev1beta2.OscCluster{} k8sClient.Get(ctx, oscInfraClusterKey, oscInfraCluster) clusterScope, err = scope.NewClusterScope(scope.ClusterScopeParams{ Client: k8sClient, @@ -683,9 +683,9 @@ func getMachineScope(ctx context.Context, capoMachineKey client.ObjectKey, capoC k8sClient.Get(ctx, capoClusterKey, capoCluster) capoMachine := &clusterv1.Machine{} k8sClient.Get(ctx, capoMachineKey, capoMachine) - oscInfraCluster := &infrastructurev1beta1.OscCluster{} + oscInfraCluster := &infrastructurev1beta2.OscCluster{} k8sClient.Get(ctx, oscInfraClusterKey, oscInfraCluster) - oscInfraMachine := &infrastructurev1beta1.OscMachine{} + oscInfraMachine := &infrastructurev1beta2.OscMachine{} k8sClient.Get(ctx, oscInfraMachineKey, oscInfraMachine) machineScope, err = scope.NewMachineScope(scope.MachineScopeParams{ Client: k8sClient, @@ -701,7 +701,8 @@ var _ = Describe("Outscale Cluster Reconciler", func() { BeforeEach(func() {}) AfterEach(func() {}) Context("Reconcile an Outscale cluster", func() { - It("should create a simple cluster", func() { + + It("should create a simple cluster with multi subnet, routeTable, securityGroup", func() { ctx := context.Background() osc_region, ok := os.LookupEnv("OSC_REGION") if !ok { @@ -711,177 +712,188 @@ var _ = Describe("Outscale Cluster Reconciler", func() { if !ok { osc_subregion = osc_region + "a" } - infraClusterSpec := infrastructurev1beta1.OscClusterSpec{ - - Network: infrastructurev1beta1.OscNetwork{ + infraClusterSpec := infrastructurev1beta2.OscClusterSpec{ + Network: infrastructurev1beta2.OscNetwork{ SubregionName: osc_subregion, - Net: infrastructurev1beta1.OscNet{ - Name: "cluster-api-net", - IpRange: "10.0.0.0/16", + Net: infrastructurev1beta2.OscNet{ + Name: "cluster-api-net", + ClusterName: "cluster-api", + IpRange: "10.0.0.0/16", }, - Subnets: []*infrastructurev1beta1.OscSubnet{ + Subnets: []*infrastructurev1beta2.OscSubnet{ + { + Name: "cluster-api-subnet-kcp", + IpSubnetRange: "10.0.4.0/24", + }, + { + Name: "cluster-api-subnet-kw", + IpSubnetRange: "10.0.3.0/24", + }, { - Name: "cluster-api-subnet", - IpSubnetRange: "10.0.0.0/24", + Name: "cluster-api-subnet-public", + IpSubnetRange: "10.0.2.0/24", }, }, - InternetService: infrastructurev1beta1.OscInternetService{ - Name: "cluster-api-internetservice", + InternetService: infrastructurev1beta2.OscInternetService{ + ClusterName: "cluster-api", + Name: "cluster-api-internetservice", }, - NatService: infrastructurev1beta1.OscNatService{ + NatService: infrastructurev1beta2.OscNatService{ + ClusterName: "cluster-api", Name: "cluster-api-natservice", - PublicIpName: "cluster-api-publicip", - SubnetName: "cluster-api-subnet", + PublicIpName: "cluster-api-publicip-nat", + SubnetName: "cluster-api-subnet-public", }, - Bastion: infrastructurev1beta1.OscBastion{ - Enable: false, + Bastion: infrastructurev1beta2.OscBastion{ + ClusterName: "cluster-api", + Enable: false, }, - RouteTables: []*infrastructurev1beta1.OscRouteTable{ + RouteTables: []*infrastructurev1beta2.OscRouteTable{ { - Name: "cluster-api-routetable", + Name: "cluster-api-routable-kw", Subnets: []string{ - "cluster-api-subnet", + "cluster-api-subnet-kw", }, - Routes: []infrastructurev1beta1.OscRoute{ + Routes: []infrastructurev1beta2.OscRoute{ { - Name: "cluster-api-routes", - TargetName: "cluster-api-internetservice", - TargetType: "gateway", + Name: "cluster-api-routes-kw", + TargetName: "cluster-api-natservice", + TargetType: "nat", Destination: "0.0.0.0/0", }, }, }, - }, - PublicIps: []*infrastructurev1beta1.OscPublicIp{ - { - Name: "cluster-api-publicip", - }, - }, - SecurityGroups: []*infrastructurev1beta1.OscSecurityGroup{ - { - Name: "cluster-api-securitygroups", - Description: "securitygroup", - SecurityGroupRules: []infrastructurev1beta1.OscSecurityGroupRule{ - { - Name: "cluster-api-securitygrouprule", - Flow: "Inbound", - IpProtocol: "tcp", - IpRange: "0.0.0.0/0", - FromPortRange: 6443, - ToPortRange: 6443, - }, - }, - }, - }, - LoadBalancer: infrastructurev1beta1.OscLoadBalancer{ - LoadBalancerName: "OscSdkExample-8", - LoadBalancerType: "internet-facing", - SubnetName: "cluster-api-subnet", - SecurityGroupName: "cluster-api-securitygroups", - }, - }, - } - createCheckDeleteOscCluster(ctx, infraClusterSpec) - }) - It("should create a simple cluster with multi subnet, routeTable, securityGroup", func() { - ctx := context.Background() - osc_region, ok := os.LookupEnv("OSC_REGION") - if !ok { - osc_region = "eu-west-2" - } - osc_subregion, ok := os.LookupEnv("OSC_SUBREGION_NAME") - if !ok { - osc_subregion = osc_region + "a" - } - infraClusterSpec := infrastructurev1beta1.OscClusterSpec{ - Network: infrastructurev1beta1.OscNetwork{ - SubregionName: osc_subregion, - Net: infrastructurev1beta1.OscNet{ - Name: "cluster-api-net", - IpRange: "10.0.0.0/16", - }, - Subnets: []*infrastructurev1beta1.OscSubnet{ - { - Name: "cluster-api-subnet", - IpSubnetRange: "10.0.0.0/24", - }, - { - Name: "cluster-api-sub", - IpSubnetRange: "10.0.1.0/24", - }, - }, - InternetService: infrastructurev1beta1.OscInternetService{ - Name: "cluster-api-internetservice", - }, - NatService: infrastructurev1beta1.OscNatService{ - Name: "cluster-api-natservice", - PublicIpName: "cluster-api-publicip", - SubnetName: "cluster-api-subnet", - }, - RouteTables: []*infrastructurev1beta1.OscRouteTable{ { - Name: "cluster-api-routetable", + Name: "cluster-api-routetable-kcp", Subnets: []string{ - "cluster-api-subnet", + "cluster-api-subnet-kcp", }, - Routes: []infrastructurev1beta1.OscRoute{ + Routes: []infrastructurev1beta2.OscRoute{ { - Name: "cluster-api-routes", - TargetName: "cluster-api-internetservice", - TargetType: "gateway", + Name: "cluster-api-routes-kcp", + TargetName: "cluster-api-natservice", + TargetType: "nat", Destination: "0.0.0.0/0", }, }, }, { - Name: "cluster-api-rt", + Name: "cluster-api-routetable-public", Subnets: []string{ - "cluster-api-sub", + "cluster-api-subnet-public", }, - Routes: []infrastructurev1beta1.OscRoute{ + Routes: []infrastructurev1beta2.OscRoute{ { - Name: "cluster-api-r", - TargetName: "cluster-api-natservice", - TargetType: "nat", + Name: "cluster-api-routes-public", + TargetName: "cluster-api-internetservice", + TargetType: "gateway", Destination: "0.0.0.0/0", }, }, }, }, - PublicIps: []*infrastructurev1beta1.OscPublicIp{ + PublicIps: []*infrastructurev1beta2.OscPublicIp{ { - Name: "cluster-api-publicip", + Name: "cluster-api-publicip-nat", }, }, - SecurityGroups: []*infrastructurev1beta1.OscSecurityGroup{ + SecurityGroups: []*infrastructurev1beta2.OscSecurityGroup{ { - Name: "cluster-api-securitygroups", - Description: "securitygroup", - SecurityGroupRules: []infrastructurev1beta1.OscSecurityGroupRule{ + Name: "cluster-api-securitygroups-kw", + Description: "Security Group with cluster-api", + SecurityGroupRules: []infrastructurev1beta2.OscSecurityGroupRule{ { - Name: "cluster-api-securitygrouprule", + Name: "cluster-api-securitygrouprule-api-kubelet-kw", Flow: "Inbound", IpProtocol: "tcp", - IpRange: "0.0.0.0/0", + IpRange: "10.0.3.0/24", + FromPortRange: 10250, + ToPortRange: 10250, + }, + { + Name: "cluster-api-securitygrouprule-api-kubelet-kcp", + Flow: "Inbound", + IpProtocol: "tcp", + IpRange: "10.0.4.0/24", + FromPortRange: 10250, + ToPortRange: 10250, + }, + { + Name: "cluster-api-securitygrouprule-nodeip-kw", + Flow: "Inbound", + IpProtocol: "tcp", + IpRange: "10.0.3.0/24", + FromPortRange: 30000, + ToPortRange: 32767, + }, + { + Name: "cluster-api-securitygrouprule-nodeip-kcp", + Flow: "Inbound", + IpProtocol: "tcp", + IpRange: "10.0.4.0/24", + FromPortRange: 30000, + ToPortRange: 32767, + }, + }, + }, + { + Name: "cluster-api-securitygroups-kcp", + Description: "Security Group with cluster-api", + SecurityGroupRules: []infrastructurev1beta2.OscSecurityGroupRule{ + { + Name: "cluster-api-securitygrouprule-api-kw", + Flow: "Inbound", + IpProtocol: "tcp", + IpRange: "10.0.3.0/24", FromPortRange: 6443, ToPortRange: 6443, }, { - Name: "cluster-api-securitygrouprule-http", + Name: "cluster-api-securitygrouprule-api-kcp", + Flow: "Inbound", + IpProtocol: "tcp", + IpRange: "10.0.4.0/24", + FromPortRange: 6443, + ToPortRange: 6443, + }, + { + Name: "cluster-api-securitygrouprule-etcd", + Flow: "Inbound", + IpProtocol: "tcp", + IpRange: "10.0.3.0/24", + FromPortRange: 2378, + ToPortRange: 2379, + }, + { + Name: "cluster-api-securitygrouprule-kubelet-kcp", + Flow: "Inbound", + IpProtocol: "tcp", + IpRange: "10.0.4.0/24", + FromPortRange: 10250, + ToPortRange: 10252, + }, + }, + }, + { + Name: "cluster-api-securitygroup-lb", + Description: "Security Group with cluster-api", + SecurityGroupRules: []infrastructurev1beta2.OscSecurityGroupRule{ + { + Name: "cluster-api-securitygrouprule-lb", Flow: "Inbound", IpProtocol: "tcp", IpRange: "0.0.0.0/0", - FromPortRange: 80, - ToPortRange: 80, + FromPortRange: 6443, + ToPortRange: 6443, }, }, }, }, - LoadBalancer: infrastructurev1beta1.OscLoadBalancer{ - LoadBalancerName: "OscSdkExample-10", + LoadBalancer: infrastructurev1beta2.OscLoadBalancer{ + LoadBalancerName: "osc-k8s-machine", LoadBalancerType: "internet-facing", - SubnetName: "cluster-api-subnet", - SecurityGroupName: "cluster-api-securitygroups", + SubnetName: "cluster-api-subnet-public", + SecurityGroupName: "cluster-api-securitygroup-lb", }, }, } @@ -898,14 +910,26 @@ var _ = Describe("Outscale Cluster Reconciler", func() { if !ok { osc_subregion = osc_region + "a" } - infraClusterSpec := infrastructurev1beta1.OscClusterSpec{ - Network: infrastructurev1beta1.OscNetwork{ + infraClusterSpec := infrastructurev1beta2.OscClusterSpec{ + Network: infrastructurev1beta2.OscNetwork{ + ClusterName: "cluster-api", SubregionName: osc_subregion, - Net: infrastructurev1beta1.OscNet{ + Net: infrastructurev1beta2.OscNet{ Name: "cluster-api-net", }, - LoadBalancer: infrastructurev1beta1.OscLoadBalancer{ + LoadBalancer: infrastructurev1beta2.OscLoadBalancer{ LoadBalancerName: "OscSdkExample-10", + ClusterName: "cluster-api", + }, + InternetService: infrastructurev1beta2.OscInternetService{ + ClusterName: "cluster-api", + }, + NatService: infrastructurev1beta2.OscNatService{ + ClusterName: "cluster-api", + }, + Bastion: infrastructurev1beta2.OscBastion{ + ClusterName: "cluster-api", + Enable: false, }, }, } @@ -926,14 +950,15 @@ var _ = Describe("Outscale Cluster Reconciler", func() { if !ok { imageId = "ami-e1a786f1" } - infraClusterSpec := infrastructurev1beta1.OscClusterSpec{ - Network: infrastructurev1beta1.OscNetwork{ + infraClusterSpec := infrastructurev1beta2.OscClusterSpec{ + Network: infrastructurev1beta2.OscNetwork{ SubregionName: osc_subregion, - Net: infrastructurev1beta1.OscNet{ - Name: "cluster-api-net", - IpRange: "10.0.0.0/16", + Net: infrastructurev1beta2.OscNet{ + Name: "cluster-api-net", + ClusterName: "cluster-api", + IpRange: "10.0.0.0/16", }, - Subnets: []*infrastructurev1beta1.OscSubnet{ + Subnets: []*infrastructurev1beta2.OscSubnet{ { Name: "cluster-api-subnet-kcp", IpSubnetRange: "10.0.4.0/24", @@ -947,21 +972,27 @@ var _ = Describe("Outscale Cluster Reconciler", func() { IpSubnetRange: "10.0.2.0/24", }, }, - InternetService: infrastructurev1beta1.OscInternetService{ - Name: "cluster-api-internetservice", + InternetService: infrastructurev1beta2.OscInternetService{ + ClusterName: "cluster-api", + Name: "cluster-api-internetservice", }, - NatService: infrastructurev1beta1.OscNatService{ + NatService: infrastructurev1beta2.OscNatService{ + ClusterName: "cluster-api", Name: "cluster-api-natservice", PublicIpName: "cluster-api-publicip-nat", SubnetName: "cluster-api-subnet-public", }, - RouteTables: []*infrastructurev1beta1.OscRouteTable{ + Bastion: infrastructurev1beta2.OscBastion{ + ClusterName: "cluster-api", + Enable: false, + }, + RouteTables: []*infrastructurev1beta2.OscRouteTable{ { Name: "cluster-api-routable-kw", Subnets: []string{ "cluster-api-subnet-kw", }, - Routes: []infrastructurev1beta1.OscRoute{ + Routes: []infrastructurev1beta2.OscRoute{ { Name: "cluster-api-routes-kw", TargetName: "cluster-api-natservice", @@ -975,7 +1006,7 @@ var _ = Describe("Outscale Cluster Reconciler", func() { Subnets: []string{ "cluster-api-subnet-kcp", }, - Routes: []infrastructurev1beta1.OscRoute{ + Routes: []infrastructurev1beta2.OscRoute{ { Name: "cluster-api-routes-kcp", TargetName: "cluster-api-natservice", @@ -989,7 +1020,7 @@ var _ = Describe("Outscale Cluster Reconciler", func() { Subnets: []string{ "cluster-api-subnet-public", }, - Routes: []infrastructurev1beta1.OscRoute{ + Routes: []infrastructurev1beta2.OscRoute{ { Name: "cluster-api-routes-public", TargetName: "cluster-api-internetservice", @@ -999,16 +1030,16 @@ var _ = Describe("Outscale Cluster Reconciler", func() { }, }, }, - PublicIps: []*infrastructurev1beta1.OscPublicIp{ + PublicIps: []*infrastructurev1beta2.OscPublicIp{ { Name: "cluster-api-publicip-nat", }, }, - SecurityGroups: []*infrastructurev1beta1.OscSecurityGroup{ + SecurityGroups: []*infrastructurev1beta2.OscSecurityGroup{ { Name: "cluster-api-securitygroups-kw", Description: "Security Group with cluster-api", - SecurityGroupRules: []infrastructurev1beta1.OscSecurityGroupRule{ + SecurityGroupRules: []infrastructurev1beta2.OscSecurityGroupRule{ { Name: "cluster-api-securitygrouprule-api-kubelet-kw", Flow: "Inbound", @@ -1046,7 +1077,7 @@ var _ = Describe("Outscale Cluster Reconciler", func() { { Name: "cluster-api-securitygroups-kcp", Description: "Security Group with cluster-api", - SecurityGroupRules: []infrastructurev1beta1.OscSecurityGroupRule{ + SecurityGroupRules: []infrastructurev1beta2.OscSecurityGroupRule{ { Name: "cluster-api-securitygrouprule-api-kw", Flow: "Inbound", @@ -1084,7 +1115,7 @@ var _ = Describe("Outscale Cluster Reconciler", func() { { Name: "cluster-api-securitygroup-lb", Description: "Security Group with cluster-api", - SecurityGroupRules: []infrastructurev1beta1.OscSecurityGroupRule{ + SecurityGroupRules: []infrastructurev1beta2.OscSecurityGroupRule{ { Name: "cluster-api-securitygrouprule-lb", Flow: "Inbound", @@ -1096,7 +1127,7 @@ var _ = Describe("Outscale Cluster Reconciler", func() { }, }, }, - LoadBalancer: infrastructurev1beta1.OscLoadBalancer{ + LoadBalancer: infrastructurev1beta2.OscLoadBalancer{ LoadBalancerName: "osc-k8s-machine", LoadBalancerType: "internet-facing", SubnetName: "cluster-api-subnet-public", @@ -1104,20 +1135,20 @@ var _ = Describe("Outscale Cluster Reconciler", func() { }, }, } - infraMachineSpec := infrastructurev1beta1.OscMachineSpec{ - Node: infrastructurev1beta1.OscNode{ - KeyPair: infrastructurev1beta1.OscKeypair{ + infraMachineSpec := infrastructurev1beta2.OscMachineSpec{ + Node: infrastructurev1beta2.OscNode{ + KeyPair: infrastructurev1beta2.OscKeypair{ Name: "cluster-api-testenv", DeleteKeypair: false, }, - Vm: infrastructurev1beta1.OscVm{ + Vm: infrastructurev1beta2.OscVm{ Name: "cluster-api-vm-kcp", Role: "controlplane", ImageId: imageId, DeviceName: "/dev/sda1", KeypairName: "cluster-api-testenv", SubregionName: osc_subregion, - RootDisk: infrastructurev1beta1.OscRootDisk{ + RootDisk: infrastructurev1beta2.OscRootDisk{ RootDiskSize: 30, RootDiskIops: 1500, RootDiskType: "gp2", @@ -1125,12 +1156,12 @@ var _ = Describe("Outscale Cluster Reconciler", func() { SubnetName: "cluster-api-subnet-kcp", LoadBalancerName: "osc-k8s-machine", VmType: "tinav4.c2r2p2", - SecurityGroupNames: []infrastructurev1beta1.OscSecurityGroupElement{ + SecurityGroupNames: []infrastructurev1beta2.OscSecurityGroupElement{ { Name: "cluster-api-securitygroups-kcp", }, }, - PrivateIps: []infrastructurev1beta1.OscPrivateIpElement{ + PrivateIps: []infrastructurev1beta2.OscPrivateIpElement{ { Name: "cluster-api-privateip-kcp", PrivateIp: "10.0.4.10", diff --git a/testenv/suite_test.go b/testenv/suite_test.go index acdfb52df..1e5005569 100644 --- a/testenv/suite_test.go +++ b/testenv/suite_test.go @@ -36,7 +36,7 @@ import ( "testing" "time" - infrastructurev1beta1 "github.com/outscale-dev/cluster-api-provider-outscale.git/api/v1beta1" + infrastructurev1beta2 "github.com/outscale-dev/cluster-api-provider-outscale.git/api/v1beta2" //+kubebuilder:scaffold:imports ) @@ -68,7 +68,7 @@ const kubeconfigEnvVar = "KUBECONFIG" var _ = BeforeSuite(func() { logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true))) - utilruntime.Must(infrastructurev1beta1.AddToScheme(scheme.Scheme)) + utilruntime.Must(infrastructurev1beta2.AddToScheme(scheme.Scheme)) utilruntime.Must(clusterv1.AddToScheme(scheme.Scheme)) By("bootstrapping test environment") testEnv = &envtest.Environment{} @@ -78,7 +78,7 @@ var _ = BeforeSuite(func() { Expect(cfg).NotTo(BeNil()) Expect(clusterv1.AddToScheme(scheme.Scheme)).To(Succeed()) - Expect(infrastructurev1beta1.AddToScheme(scheme.Scheme)).To(Succeed()) + Expect(infrastructurev1beta2.AddToScheme(scheme.Scheme)).To(Succeed()) //+kubebuilder:scaffold:scheme retryPeriod := 4 * time.Second