Commit 480096d5 authored by sfang97's avatar sfang97

Update EKS K8s supported versions

The following k8s versions are currently available for new clusteres in
EKS: 1.14 (can't deploy via AWS management console), 1.15, 1.16, 1.17,
so update the eks_cluster.yaml to support these versions and default to
1.16

Add k8s versions to form constants

Set default version to 1.16

Make default version an array

Remove unused imported variable

Add kubernetes version column to aws table

Add kubernetes version to cf parameters

Revert "Add kubernetes version to cf parameters"

This reverts commit 6032881714103a7c7007fce63fea6d260accd0ac.

Fixing failing jest and rspec

Use text instead of string

Add text limit to db

Change table name back

At some point I'd changed the table name to singular which was breaking
spesc, so change name back. Also use string in column, disable prevent
strings

Add kubernetes version to request payload

Move k8s version within provider attributes

Remove unused migration

I added an extra column because pg was complaining, but now that I've
moved the parameter there is no longer an undefined table error so
remove the unused column

Remove trailing blank line

Remove unwanted db changes
parent 6713ee24
export const KUBERNETES_VERSIONS = [{ name: '1.14', value: '1.14' }];
// eslint-disable-next-line import/prefer-default-export
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 [{ value: kubernetesVersion }] = [{ name: '1.16', value: '1.16' }];
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(',')),
......
# 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