From 69616aaf1d5e0e894954deddbb6c9a135504d68c Mon Sep 17 00:00:00 2001 From: Josh De Winne Date: Thu, 20 Jun 2024 14:52:08 -0700 Subject: [PATCH 1/5] Adding EC config --- .../config-ec-v1beta1.json | 242 ++++++++++++++++++ 1 file changed, 242 insertions(+) create mode 100644 kubernetes_json_schema/schema/v1.23.6-standalone-strict/config-ec-v1beta1.json diff --git a/kubernetes_json_schema/schema/v1.23.6-standalone-strict/config-ec-v1beta1.json b/kubernetes_json_schema/schema/v1.23.6-standalone-strict/config-ec-v1beta1.json new file mode 100644 index 0000000..28f5ec1 --- /dev/null +++ b/kubernetes_json_schema/schema/v1.23.6-standalone-strict/config-ec-v1beta1.json @@ -0,0 +1,242 @@ +{ + "description": "Config is the Schema for the configs API", + "type": "object", + "properties": { + "apiVersion": { + "description": "APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values.\nMore 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.\nServers may infer this from the endpoint the client submits requests to.\nCannot be updated.\nIn CamelCase.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "type": "object" + }, + "spec": { + "description": "ConfigSpec defines the desired state of Config", + "type": "object", + "properties": { + "extensions": { + "type": "object", + "properties": { + "helm": { + "description": "HelmExtensions specifies settings for cluster helm based extensions", + "type": "object", + "properties": { + "charts": { + "description": "ChartsSettings charts settings", + "type": "array", + "items": { + "description": "Chart single helm addon", + "type": "object", + "properties": { + "chartname": { + "type": "string" + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "order": { + "type": "integer" + }, + "timeout": { + "description": "A Duration represents the elapsed time between two instants\nas an int64 nanosecond count. The representation limits the\nlargest representable duration to approximately 290 years.", + "type": "integer", + "format": "int64" + }, + "values": { + "type": "string" + }, + "version": { + "type": "string" + } + } + } + }, + "concurrencyLevel": { + "type": "integer" + }, + "repositories": { + "description": "RepositoriesSettings repository settings", + "type": "array", + "items": { + "description": "Repository describes single repository entry. Fields map to the CLI flags for the \"helm add\" command", + "type": "object", + "properties": { + "caFile": { + "type": "string" + }, + "certFile": { + "type": "string" + }, + "insecure": { + "type": "boolean" + }, + "keyfile": { + "type": "string" + }, + "name": { + "type": "string" + }, + "password": { + "type": "string" + }, + "url": { + "type": "string" + }, + "username": { + "type": "string" + } + } + } + } + } + } + } + }, + "roles": { + "description": "Roles is the various roles in the cluster.", + "type": "object", + "properties": { + "controller": { + "description": "NodeRole is the role of a node in the cluster.", + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "name": { + "type": "string" + }, + "nodeCount": { + "description": "NodeCount holds a series of rules for a given node role.", + "type": "object", + "properties": { + "range": { + "description": "NodeRange contains a min and max or only one of them (conflicts\nwith Values).", + "type": "object", + "properties": { + "max": { + "description": "Max is the maximum number of nodes.", + "type": "integer" + }, + "min": { + "description": "Min is the minimum number of nodes.", + "type": "integer" + } + } + }, + "values": { + "description": "Values holds a list of allowed node counts.", + "type": "array", + "items": { + "type": "integer" + } + } + } + } + } + }, + "custom": { + "type": "array", + "items": { + "description": "NodeRole is the role of a node in the cluster.", + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "name": { + "type": "string" + }, + "nodeCount": { + "description": "NodeCount holds a series of rules for a given node role.", + "type": "object", + "properties": { + "range": { + "description": "NodeRange contains a min and max or only one of them (conflicts\nwith Values).", + "type": "object", + "properties": { + "max": { + "description": "Max is the maximum number of nodes.", + "type": "integer" + }, + "min": { + "description": "Min is the minimum number of nodes.", + "type": "integer" + } + } + }, + "values": { + "description": "Values holds a list of allowed node counts.", + "type": "array", + "items": { + "type": "integer" + } + } + } + } + } + } + } + } + }, + "unsupportedOverrides": { + "description": "UnsupportedOverrides holds the config overrides used to configure\nthe cluster.", + "type": "object", + "properties": { + "builtInExtensions": { + "description": "BuiltInExtensions holds overrides for the default add-ons we ship\nwith Embedded Cluster.", + "type": "array", + "items": { + "description": "BuiltInExtension holds the override for a built-in extension (add-on).", + "type": "object", + "required": [ + "name", + "values" + ], + "properties": { + "name": { + "description": "The name of the helm chart to override values of, for instance `openebs`.", + "type": "string" + }, + "values": { + "description": "YAML-formatted helm values that will override those provided to the\nchart by Embedded Cluster. Properties are overridden individually -\nsetting a new value for `images.tag` here will not prevent Embedded\nCluster from setting `images.pullPolicy = IfNotPresent`, for example.", + "type": "string" + } + } + } + }, + "k0s": { + "description": "K0s holds the overrides used to configure k0s. These overrides\nare merged on top of the default k0s configuration. As the data\nlayout inside this configuration is very dynamic we have chosen\nto use a string here.", + "type": "string" + } + } + }, + "version": { + "type": "string" + } + } + }, + "status": { + "description": "ConfigStatus defines the observed state of Config", + "type": "object" + } + } +} \ No newline at end of file From 60ac7fd236fd3e46b3b371bc43f3a8c531219aeb Mon Sep 17 00:00:00 2001 From: Josh De Winne Date: Thu, 20 Jun 2024 15:14:44 -0700 Subject: [PATCH 2/5] lint --- ...config-ec-v1beta1.json => config-embeddedcluster-v1beta1.json} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename kubernetes_json_schema/schema/v1.23.6-standalone-strict/{config-ec-v1beta1.json => config-embeddedcluster-v1beta1.json} (100%) diff --git a/kubernetes_json_schema/schema/v1.23.6-standalone-strict/config-ec-v1beta1.json b/kubernetes_json_schema/schema/v1.23.6-standalone-strict/config-embeddedcluster-v1beta1.json similarity index 100% rename from kubernetes_json_schema/schema/v1.23.6-standalone-strict/config-ec-v1beta1.json rename to kubernetes_json_schema/schema/v1.23.6-standalone-strict/config-embeddedcluster-v1beta1.json From 4e2aed2ef3459159a9b13b389876f9d4538dcf7a Mon Sep 17 00:00:00 2001 From: Josh De Winne Date: Fri, 21 Jun 2024 11:30:14 -0700 Subject: [PATCH 3/5] w --- pkg/kots/lint.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/kots/lint.go b/pkg/kots/lint.go index 4356f0e..ef2bb0b 100644 --- a/pkg/kots/lint.go +++ b/pkg/kots/lint.go @@ -17,6 +17,7 @@ import ( "github.com/mitchellh/mapstructure" "github.com/open-policy-agent/opa/rego" "github.com/pkg/errors" + embeddedclusterv1beta1 "github.com/replicatedhq/embedded-cluster-kinds/apis/v1beta1" kjs "github.com/replicatedhq/kots-lint/kubernetes_json_schema" "github.com/replicatedhq/kots-lint/pkg/util" kotsoperatortypes "github.com/replicatedhq/kots/pkg/operator/types" @@ -39,6 +40,7 @@ var kurlLinter *kurllint.Linter func init() { kurlLinter = kurllint.New() kotsscheme.AddToScheme(scheme.Scheme) + embeddedclusterv1beta1.AddToScheme(scheme.Scheme) kotsVersions = make(map[string]bool) } From 76be48fe4d2b01ba3de53551bf54c0db8a04b0c6 Mon Sep 17 00:00:00 2001 From: Josh De Winne Date: Fri, 21 Jun 2024 11:46:02 -0700 Subject: [PATCH 4/5] w --- pkg/kots/lint.go | 2 -- pkg/kots/troubleshoot.go | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/kots/lint.go b/pkg/kots/lint.go index ef2bb0b..4356f0e 100644 --- a/pkg/kots/lint.go +++ b/pkg/kots/lint.go @@ -17,7 +17,6 @@ import ( "github.com/mitchellh/mapstructure" "github.com/open-policy-agent/opa/rego" "github.com/pkg/errors" - embeddedclusterv1beta1 "github.com/replicatedhq/embedded-cluster-kinds/apis/v1beta1" kjs "github.com/replicatedhq/kots-lint/kubernetes_json_schema" "github.com/replicatedhq/kots-lint/pkg/util" kotsoperatortypes "github.com/replicatedhq/kots/pkg/operator/types" @@ -40,7 +39,6 @@ var kurlLinter *kurllint.Linter func init() { kurlLinter = kurllint.New() kotsscheme.AddToScheme(scheme.Scheme) - embeddedclusterv1beta1.AddToScheme(scheme.Scheme) kotsVersions = make(map[string]bool) } diff --git a/pkg/kots/troubleshoot.go b/pkg/kots/troubleshoot.go index d7bf541..909f068 100644 --- a/pkg/kots/troubleshoot.go +++ b/pkg/kots/troubleshoot.go @@ -47,7 +47,7 @@ func findTroubleshootSpecs(ctx context.Context, fileData string) SpecFiles { for _, srcDoc := range srcDocs { obj, _, err := decoder.Decode([]byte(srcDoc), nil, nil) if err != nil { - log.Debugf("failed to decode raw spec: %s", srcDoc) + log.Debugf("failed to decode raw spec test: %s", srcDoc) continue } From 8207f417286fe0ac3f92b6e5a1f2e8c7a24c186e Mon Sep 17 00:00:00 2001 From: Josh De Winne Date: Fri, 21 Jun 2024 13:37:15 -0700 Subject: [PATCH 5/5] test --- pkg/kots/lint_test.go | 23 +++++++++++++++++++++++ pkg/kots/troubleshoot.go | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/pkg/kots/lint_test.go b/pkg/kots/lint_test.go index 3c31c28..59a683c 100644 --- a/pkg/kots/lint_test.go +++ b/pkg/kots/lint_test.go @@ -1642,6 +1642,29 @@ spec: }, expect: []LintExpression{}, }, + { + name: "embedded cluster no errors", + specFiles: SpecFiles{ + { + Name: "ec-config.yaml", + Path: "ec-config.yaml", + Content: `apiVersion: embeddedcluster.replicated.com/v1beta1 +kind: Config +spec: + version: "1.2.2+k8s-1.29" + roles: + controller: + name: management + labels: + management: "true" + custom: + - name: app + labels: + app: "true"`, + }, + }, + expect: []LintExpression{}, + }, } for _, test := range tests { diff --git a/pkg/kots/troubleshoot.go b/pkg/kots/troubleshoot.go index 909f068..d7bf541 100644 --- a/pkg/kots/troubleshoot.go +++ b/pkg/kots/troubleshoot.go @@ -47,7 +47,7 @@ func findTroubleshootSpecs(ctx context.Context, fileData string) SpecFiles { for _, srcDoc := range srcDocs { obj, _, err := decoder.Decode([]byte(srcDoc), nil, nil) if err != nil { - log.Debugf("failed to decode raw spec test: %s", srcDoc) + log.Debugf("failed to decode raw spec: %s", srcDoc) continue }