From 483ffdad4ee6dc80be3422525c184f8b9a7beb0f Mon Sep 17 00:00:00 2001 From: michaeljguarino Date: Mon, 8 Jul 2024 11:46:46 -0400 Subject: [PATCH] Add chartVersion to graphql schema for compatibilities (#1153) --- assets/src/components/cd/clusters/runtime/columns.tsx | 2 +- assets/src/generated/graphql.ts | 11 +++++++---- assets/src/graph/cdClusters.graphql | 1 + lib/console/deployments/compatibilities/schema.ex | 2 +- lib/console/graphql/deployments/cluster.ex | 1 + schema/schema.graphql | 3 +++ 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/assets/src/components/cd/clusters/runtime/columns.tsx b/assets/src/components/cd/clusters/runtime/columns.tsx index e368f0608c..269c3d3534 100644 --- a/assets/src/components/cd/clusters/runtime/columns.tsx +++ b/assets/src/components/cd/clusters/runtime/columns.tsx @@ -79,7 +79,7 @@ const colName = columnHelperRuntime.accessor((row) => row?.addon, { }, }) const colChartVersion = columnHelperRuntime.accessor( - (row) => row?.service?.helm?.version, + (row) => row?.addonVersion?.chartVersion, { id: 'chartVersion', header: 'Chart version', diff --git a/assets/src/generated/graphql.ts b/assets/src/generated/graphql.ts index 34086075f5..9b601e40d8 100644 --- a/assets/src/generated/graphql.ts +++ b/assets/src/generated/graphql.ts @@ -131,6 +131,8 @@ export type AddonVersion = { __typename?: 'AddonVersion'; /** checks if this is blocking a specific kubernetes upgrade */ blocking?: Maybe; + /** the version of the helm chart to install for this version */ + chartVersion?: Maybe; /** any add-ons this might break */ incompatibilities?: Maybe>>; /** kubernetes versions this add-on works with */ @@ -8052,9 +8054,9 @@ export type NodePoolFragment = { __typename?: 'NodePool', id: string, name: stri export type ApiDeprecationFragment = { __typename?: 'ApiDeprecation', availableIn?: string | null, blocking?: boolean | null, deprecatedIn?: string | null, removedIn?: string | null, replacement?: string | null, component?: { __typename?: 'ServiceComponent', group?: string | null, version?: string | null, kind: string, name: string, namespace?: string | null, service?: { __typename?: 'ServiceDeployment', git?: { __typename?: 'GitRef', ref: string, folder: string } | null, repository?: { __typename?: 'GitRepository', httpsPath?: string | null, urlFormat?: string | null } | null } | null } | null }; -export type RuntimeServiceFragment = { __typename?: 'RuntimeService', id: string, name: string, version: string, addon?: { __typename?: 'RuntimeAddon', icon?: string | null, versions?: Array<{ __typename?: 'AddonVersion', version?: string | null, kube?: Array | null, incompatibilities?: Array<{ __typename?: 'VersionReference', version: string, name: string } | null> | null, requirements?: Array<{ __typename?: 'VersionReference', version: string, name: string } | null> | null } | null> | null } | null, service?: { __typename?: 'ServiceDeployment', git?: { __typename?: 'GitRef', ref: string, folder: string } | null, repository?: { __typename?: 'GitRepository', httpsPath?: string | null, urlFormat?: string | null } | null, helm?: { __typename?: 'HelmSpec', version?: string | null } | null } | null, addonVersion?: { __typename?: 'AddonVersion', blocking?: boolean | null, version?: string | null, kube?: Array | null, incompatibilities?: Array<{ __typename?: 'VersionReference', version: string, name: string } | null> | null, requirements?: Array<{ __typename?: 'VersionReference', version: string, name: string } | null> | null } | null }; +export type RuntimeServiceFragment = { __typename?: 'RuntimeService', id: string, name: string, version: string, addon?: { __typename?: 'RuntimeAddon', icon?: string | null, versions?: Array<{ __typename?: 'AddonVersion', version?: string | null, kube?: Array | null, chartVersion?: string | null, incompatibilities?: Array<{ __typename?: 'VersionReference', version: string, name: string } | null> | null, requirements?: Array<{ __typename?: 'VersionReference', version: string, name: string } | null> | null } | null> | null } | null, service?: { __typename?: 'ServiceDeployment', git?: { __typename?: 'GitRef', ref: string, folder: string } | null, repository?: { __typename?: 'GitRepository', httpsPath?: string | null, urlFormat?: string | null } | null, helm?: { __typename?: 'HelmSpec', version?: string | null } | null } | null, addonVersion?: { __typename?: 'AddonVersion', blocking?: boolean | null, version?: string | null, kube?: Array | null, chartVersion?: string | null, incompatibilities?: Array<{ __typename?: 'VersionReference', version: string, name: string } | null> | null, requirements?: Array<{ __typename?: 'VersionReference', version: string, name: string } | null> | null } | null }; -export type AddonVersionFragment = { __typename?: 'AddonVersion', version?: string | null, kube?: Array | null, incompatibilities?: Array<{ __typename?: 'VersionReference', version: string, name: string } | null> | null, requirements?: Array<{ __typename?: 'VersionReference', version: string, name: string } | null> | null }; +export type AddonVersionFragment = { __typename?: 'AddonVersion', version?: string | null, kube?: Array | null, chartVersion?: string | null, incompatibilities?: Array<{ __typename?: 'VersionReference', version: string, name: string } | null> | null, requirements?: Array<{ __typename?: 'VersionReference', version: string, name: string } | null> | null }; export type AddonVersionBlockingFragment = { __typename?: 'AddonVersion', blocking?: boolean | null }; @@ -8143,7 +8145,7 @@ export type RuntimeServicesQueryVariables = Exact<{ }>; -export type RuntimeServicesQuery = { __typename?: 'RootQueryType', cluster?: { __typename?: 'Cluster', id: string, name: string, currentVersion?: string | null, version?: string | null, runtimeServices?: Array<{ __typename?: 'RuntimeService', id: string, name: string, version: string, addon?: { __typename?: 'RuntimeAddon', icon?: string | null, versions?: Array<{ __typename?: 'AddonVersion', version?: string | null, kube?: Array | null, incompatibilities?: Array<{ __typename?: 'VersionReference', version: string, name: string } | null> | null, requirements?: Array<{ __typename?: 'VersionReference', version: string, name: string } | null> | null } | null> | null } | null, service?: { __typename?: 'ServiceDeployment', git?: { __typename?: 'GitRef', ref: string, folder: string } | null, repository?: { __typename?: 'GitRepository', httpsPath?: string | null, urlFormat?: string | null } | null, helm?: { __typename?: 'HelmSpec', version?: string | null } | null } | null, addonVersion?: { __typename?: 'AddonVersion', blocking?: boolean | null, version?: string | null, kube?: Array | null, incompatibilities?: Array<{ __typename?: 'VersionReference', version: string, name: string } | null> | null, requirements?: Array<{ __typename?: 'VersionReference', version: string, name: string } | null> | null } | null } | null> | null, apiDeprecations?: Array<{ __typename?: 'ApiDeprecation', availableIn?: string | null, blocking?: boolean | null, deprecatedIn?: string | null, removedIn?: string | null, replacement?: string | null, component?: { __typename?: 'ServiceComponent', group?: string | null, version?: string | null, kind: string, name: string, namespace?: string | null, service?: { __typename?: 'ServiceDeployment', git?: { __typename?: 'GitRef', ref: string, folder: string } | null, repository?: { __typename?: 'GitRepository', httpsPath?: string | null, urlFormat?: string | null } | null } | null } | null } | null> | null } | null }; +export type RuntimeServicesQuery = { __typename?: 'RootQueryType', cluster?: { __typename?: 'Cluster', id: string, name: string, currentVersion?: string | null, version?: string | null, runtimeServices?: Array<{ __typename?: 'RuntimeService', id: string, name: string, version: string, addon?: { __typename?: 'RuntimeAddon', icon?: string | null, versions?: Array<{ __typename?: 'AddonVersion', version?: string | null, kube?: Array | null, chartVersion?: string | null, incompatibilities?: Array<{ __typename?: 'VersionReference', version: string, name: string } | null> | null, requirements?: Array<{ __typename?: 'VersionReference', version: string, name: string } | null> | null } | null> | null } | null, service?: { __typename?: 'ServiceDeployment', git?: { __typename?: 'GitRef', ref: string, folder: string } | null, repository?: { __typename?: 'GitRepository', httpsPath?: string | null, urlFormat?: string | null } | null, helm?: { __typename?: 'HelmSpec', version?: string | null } | null } | null, addonVersion?: { __typename?: 'AddonVersion', blocking?: boolean | null, version?: string | null, kube?: Array | null, chartVersion?: string | null, incompatibilities?: Array<{ __typename?: 'VersionReference', version: string, name: string } | null> | null, requirements?: Array<{ __typename?: 'VersionReference', version: string, name: string } | null> | null } | null } | null> | null, apiDeprecations?: Array<{ __typename?: 'ApiDeprecation', availableIn?: string | null, blocking?: boolean | null, deprecatedIn?: string | null, removedIn?: string | null, replacement?: string | null, component?: { __typename?: 'ServiceComponent', group?: string | null, version?: string | null, kind: string, name: string, namespace?: string | null, service?: { __typename?: 'ServiceDeployment', git?: { __typename?: 'GitRef', ref: string, folder: string } | null, repository?: { __typename?: 'GitRepository', httpsPath?: string | null, urlFormat?: string | null } | null } | null } | null } | null> | null } | null }; export type RuntimeServiceQueryVariables = Exact<{ id: Scalars['ID']['input']; @@ -8151,7 +8153,7 @@ export type RuntimeServiceQueryVariables = Exact<{ }>; -export type RuntimeServiceQuery = { __typename?: 'RootQueryType', runtimeService?: { __typename?: 'RuntimeService', id: string, addon?: { __typename?: 'RuntimeAddon', icon?: string | null, releaseUrl?: string | null, readme?: string | null, versions?: Array<{ __typename?: 'AddonVersion', version?: string | null, kube?: Array | null, incompatibilities?: Array<{ __typename?: 'VersionReference', version: string, name: string } | null> | null, requirements?: Array<{ __typename?: 'VersionReference', version: string, name: string } | null> | null } | null> | null } | null } | null }; +export type RuntimeServiceQuery = { __typename?: 'RootQueryType', runtimeService?: { __typename?: 'RuntimeService', id: string, addon?: { __typename?: 'RuntimeAddon', icon?: string | null, releaseUrl?: string | null, readme?: string | null, versions?: Array<{ __typename?: 'AddonVersion', version?: string | null, kube?: Array | null, chartVersion?: string | null, incompatibilities?: Array<{ __typename?: 'VersionReference', version: string, name: string } | null> | null, requirements?: Array<{ __typename?: 'VersionReference', version: string, name: string } | null> | null } | null> | null } | null } | null }; export type UpdateClusterBindingsMutationVariables = Exact<{ id: Scalars['ID']['input']; @@ -9909,6 +9911,7 @@ export const AddonVersionFragmentDoc = gql` fragment AddonVersion on AddonVersion { version kube + chartVersion incompatibilities { version name diff --git a/assets/src/graph/cdClusters.graphql b/assets/src/graph/cdClusters.graphql index 3a0e955f96..0e76f22b6a 100644 --- a/assets/src/graph/cdClusters.graphql +++ b/assets/src/graph/cdClusters.graphql @@ -103,6 +103,7 @@ fragment RuntimeService on RuntimeService { fragment AddonVersion on AddonVersion { version kube + chartVersion incompatibilities { version name diff --git a/lib/console/deployments/compatibilities/schema.ex b/lib/console/deployments/compatibilities/schema.ex index 63cd510bcd..115e4a0e25 100644 --- a/lib/console/deployments/compatibilities/schema.ex +++ b/lib/console/deployments/compatibilities/schema.ex @@ -10,7 +10,7 @@ defmodule Console.Deployments.Compatibilities.Version do @type t :: %__MODULE__{requirements: [%Reference{}], incompatibilities: [%Reference{}]} - defstruct [:version, :kube, :requirements, :incompatibilities] + defstruct [:version, :kube, :chart_version, :requirements, :incompatibilities] def blocking?(%__MODULE__{kube: kube_vsns}, kube_version, inc \\ 1) do with {:ok, %{major: maj, minor: min}} <- Version.parse(clean_version(kube_version)) do diff --git a/lib/console/graphql/deployments/cluster.ex b/lib/console/graphql/deployments/cluster.ex index 00aca6034e..a83f3bf844 100644 --- a/lib/console/graphql/deployments/cluster.ex +++ b/lib/console/graphql/deployments/cluster.ex @@ -489,6 +489,7 @@ defmodule Console.GraphQl.Deployments.Cluster do field :kube, list_of(:string), description: "kubernetes versions this add-on works with" field :requirements, list_of(:version_reference), description: "any other add-ons this might require" field :incompatibilities, list_of(:version_reference), description: "any add-ons this might break" + field :chart_version, :string, description: "the version of the helm chart to install for this version" @desc "the release page for a runtime service at a version, this is a heavy operation not suitable for lists" field :release_url, :string do diff --git a/schema/schema.graphql b/schema/schema.graphql index 7ce327a2a6..6d961b8296 100644 --- a/schema/schema.graphql +++ b/schema/schema.graphql @@ -3945,6 +3945,9 @@ type AddonVersion { "any add-ons this might break" incompatibilities: [VersionReference] + "the version of the helm chart to install for this version" + chartVersion: String + "the release page for a runtime service at a version, this is a heavy operation not suitable for lists" releaseUrl(version: String!): String