Commit b86db507 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch '231463-gitlab-ci-aws-eks-integration-kubernetes-version-update' into 'master'

Gitlab CI - AWS EKS Integration - Kubernetes version update

Closes #238462 and #231463

See merge request gitlab-org/gitlab!38644
parents 5579c05e 1892c8fb
export const KUBERNETES_VERSIONS = [{ name: '1.14', value: '1.14' }];
export const KUBERNETES_VERSIONS = [
{ name: '1.14', value: '1.14' },
{ name: '1.15', value: '1.15' },
{ name: '1.16', value: '1.16', default: true },
{ name: '1.17', value: '1.17' },
];
......@@ -56,6 +56,7 @@ export const createCluster = ({ dispatch, state }) => {
environment_scope: state.environmentScope,
managed: state.gitlabManagedCluster,
provider_aws_attributes: {
kubernetes_version: state.kubernetesVersion,
region: state.selectedRegion,
vpc_id: state.selectedVpc,
subnet_ids: state.selectedSubnet,
......
import { KUBERNETES_VERSIONS } from '../constants';
const [{ value: kubernetesVersion }] = KUBERNETES_VERSIONS;
const kubernetesVersion = KUBERNETES_VERSIONS.find(version => version.default).value;
export default () => ({
createRolePath: null,
......
......@@ -238,6 +238,7 @@ class Clusters::ClustersController < Clusters::BaseController
:environment_scope,
:managed,
provider_aws_attributes: [
:kubernetes_version,
:key_name,
:role_arn,
:region,
......
......@@ -37,7 +37,7 @@ module Clusters
greater_than: 0
}
validates :key_name, :region, :instance_type, :security_group_id, length: { in: 1..255 }
validates :kubernetes_version, :key_name, :region, :instance_type, :security_group_id, length: { in: 1..255 }
validates :subnet_ids, presence: true
def nullify_credentials
......
......@@ -63,6 +63,7 @@ module Clusters
[
parameter('ClusterName', provider.cluster.name),
parameter('ClusterRole', provider.role_arn),
parameter('KubernetesVersion', provider.kubernetes_version),
parameter('ClusterControlPlaneSecurityGroup', provider.security_group_id),
parameter('VpcId', provider.vpc_id),
parameter('Subnets', provider.subnet_ids.join(',')),
......
---
title: Update EKS Kubernetes versions
merge_request: 38644
author:
type: fixed
# frozen_string_literal: true
# See https://docs.gitlab.com/ee/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class AddKubernetesVersionToClusterProvidersAws < ActiveRecord::Migration[6.0]
# Uncomment the following include if you require helper functions:
include Gitlab::Database::MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME = false
disable_ddl_transaction!
def up
unless column_exists?(:cluster_providers_aws, :kubernetes_version)
add_column :cluster_providers_aws, :kubernetes_version, :text, null: false, default: '1.14'
end
add_text_limit :cluster_providers_aws, :kubernetes_version, 30
end
def down
if column_exists?(:cluster_providers_aws, :kubernetes_version)
remove_column :cluster_providers_aws, :kubernetes_version
end
end
end
94b494b5f8e351cf453699debf03aa28f8a9136c829cb7410c90590b5106cdd5
\ No newline at end of file
......@@ -10593,7 +10593,9 @@ CREATE TABLE public.cluster_providers_aws (
encrypted_secret_access_key_iv character varying(255),
encrypted_secret_access_key text,
session_token text,
status_reason text
status_reason text,
kubernetes_version text DEFAULT '1.14'::text NOT NULL,
CONSTRAINT check_f1f42cd85e CHECK ((char_length(kubernetes_version) <= 30))
);
CREATE SEQUENCE public.cluster_providers_aws_id_seq
......
......@@ -4,6 +4,7 @@ FactoryBot.define do
factory :cluster_provider_aws, class: 'Clusters::Providers::Aws' do
association :cluster, platform_type: :kubernetes, provider_type: :aws
kubernetes_version { '1.16' }
role_arn { 'arn:aws:iam::123456789012:role/role-name' }
vpc_id { 'vpc-00000000000000000' }
subnet_ids { %w(subnet-00000000000000000 subnet-11111111111111111) }
......
......@@ -147,6 +147,7 @@ describe('EksClusterConfigurationForm', () => {
initialState: {
clusterName: 'cluster name',
environmentScope: '*',
kubernetesVersion: '1.16',
selectedRegion: 'region',
selectedRole: 'role',
selectedKeyPair: 'key pair',
......
......@@ -47,7 +47,7 @@ describe('EKS Cluster Store Actions', () => {
beforeEach(() => {
clusterName = 'my cluster';
environmentScope = 'production';
kubernetesVersion = '11.1';
kubernetesVersion = '1.16';
region = 'regions-1';
vpc = 'vpc-1';
subnet = 'subnet-1';
......@@ -180,6 +180,7 @@ describe('EKS Cluster Store Actions', () => {
environment_scope: environmentScope,
managed: gitlabManagedCluster,
provider_aws_attributes: {
kubernetes_version: kubernetesVersion,
region,
vpc_id: vpc,
subnet_ids: subnet,
......
......@@ -22,6 +22,7 @@ RSpec.describe Clusters::Aws::ProvisionService do
[
{ parameter_key: 'ClusterName', parameter_value: provider.cluster.name },
{ parameter_key: 'ClusterRole', parameter_value: provider.role_arn },
{ parameter_key: 'KubernetesVersion', parameter_value: provider.kubernetes_version },
{ parameter_key: 'ClusterControlPlaneSecurityGroup', parameter_value: provider.security_group_id },
{ parameter_key: 'VpcId', parameter_value: provider.vpc_id },
{ parameter_key: 'Subnets', parameter_value: provider.subnet_ids.join(',') },
......
......@@ -7,11 +7,12 @@ Parameters:
KubernetesVersion:
Description: The Kubernetes version to install
Type: String
Default: 1.14
Default: 1.16
AllowedValues:
- 1.12
- 1.13
- 1.14
- 1.15
- 1.16
- 1.17
KeyName:
Description: The EC2 Key Pair to allow SSH access to the node instances
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment