diff --git a/.config/api-rules/violation_exceptions.list b/.config/api-rules/violation_exceptions.list index d7f396b8b..a140e8eaa 100644 --- a/.config/api-rules/violation_exceptions.list +++ b/.config/api-rules/violation_exceptions.list @@ -197,4 +197,5 @@ API rule violation: names_match,k8s.io/apimachinery/pkg/util/intstr,IntOrString, API rule violation: names_match,k8s.io/apimachinery/pkg/util/intstr,IntOrString,Type API rule violation: names_match,kmodules.xyz/resource-metadata/apis/shared,Action,OperationID API rule violation: names_match,kmodules.xyz/resource-metadata/apis/shared,ActionTemplate,OperationID +API rule violation: names_match,kmodules.xyz/resource-metadata/apis/shared,RegistryProxies,AppsCode API rule violation: names_match,kmodules.xyz/resource-metadata/apis/ui/v1alpha1,ActionTemplate,OperationID diff --git a/apis/core/v1alpha1/openapi_generated.go b/apis/core/v1alpha1/openapi_generated.go index d14294edd..dcf7ae2eb 100644 --- a/apis/core/v1alpha1/openapi_generated.go +++ b/apis/core/v1alpha1/openapi_generated.go @@ -328,10 +328,17 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kmodules.xyz/resource-metadata/apis/shared.ActionInfo": schema_kmodulesxyz_resource_metadata_apis_shared_ActionInfo(ref), "kmodules.xyz/resource-metadata/apis/shared.ActionTemplate": schema_kmodulesxyz_resource_metadata_apis_shared_ActionTemplate(ref), "kmodules.xyz/resource-metadata/apis/shared.ActionTemplateGroup": schema_kmodulesxyz_resource_metadata_apis_shared_ActionTemplateGroup(ref), + "kmodules.xyz/resource-metadata/apis/shared.BootstrapPresets": schema_kmodulesxyz_resource_metadata_apis_shared_BootstrapPresets(ref), "kmodules.xyz/resource-metadata/apis/shared.Dashboard": schema_kmodulesxyz_resource_metadata_apis_shared_Dashboard(ref), "kmodules.xyz/resource-metadata/apis/shared.DashboardVar": schema_kmodulesxyz_resource_metadata_apis_shared_DashboardVar(ref), "kmodules.xyz/resource-metadata/apis/shared.DeploymentParameters": schema_kmodulesxyz_resource_metadata_apis_shared_DeploymentParameters(ref), + "kmodules.xyz/resource-metadata/apis/shared.HelmInfo": schema_kmodulesxyz_resource_metadata_apis_shared_HelmInfo(ref), + "kmodules.xyz/resource-metadata/apis/shared.HelmRelease": schema_kmodulesxyz_resource_metadata_apis_shared_HelmRelease(ref), + "kmodules.xyz/resource-metadata/apis/shared.HelmRepository": schema_kmodulesxyz_resource_metadata_apis_shared_HelmRepository(ref), "kmodules.xyz/resource-metadata/apis/shared.If": schema_kmodulesxyz_resource_metadata_apis_shared_If(ref), + "kmodules.xyz/resource-metadata/apis/shared.ImageRegistrySpec": schema_kmodulesxyz_resource_metadata_apis_shared_ImageRegistrySpec(ref), + "kmodules.xyz/resource-metadata/apis/shared.RegistryInfo": schema_kmodulesxyz_resource_metadata_apis_shared_RegistryInfo(ref), + "kmodules.xyz/resource-metadata/apis/shared.RegistryProxies": schema_kmodulesxyz_resource_metadata_apis_shared_RegistryProxies(ref), "kmodules.xyz/resource-metadata/apis/shared.ResourceLocator": schema_kmodulesxyz_resource_metadata_apis_shared_ResourceLocator(ref), "kmodules.xyz/resource-metadata/apis/shared.ResourceQuery": schema_kmodulesxyz_resource_metadata_apis_shared_ResourceQuery(ref), "kmodules.xyz/resource-metadata/apis/shared.SourceLocator": schema_kmodulesxyz_resource_metadata_apis_shared_SourceLocator(ref), @@ -16334,6 +16341,39 @@ func schema_kmodulesxyz_resource_metadata_apis_shared_ActionTemplateGroup(ref co } } +func schema_kmodulesxyz_resource_metadata_apis_shared_BootstrapPresets(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "image": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.ImageRegistrySpec"), + }, + }, + "registry": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.RegistryInfo"), + }, + }, + "helm": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.HelmInfo"), + }, + }, + }, + Required: []string{"image", "registry", "helm"}, + }, + }, + Dependencies: []string{ + "kmodules.xyz/resource-metadata/apis/shared.HelmInfo", "kmodules.xyz/resource-metadata/apis/shared.ImageRegistrySpec", "kmodules.xyz/resource-metadata/apis/shared.RegistryInfo"}, + } +} + func schema_kmodulesxyz_resource_metadata_apis_shared_Dashboard(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -16450,6 +16490,137 @@ func schema_kmodulesxyz_resource_metadata_apis_shared_DeploymentParameters(ref c } } +func schema_kmodulesxyz_resource_metadata_apis_shared_HelmInfo(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "repositories": { + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.HelmRepository"), + }, + }, + }, + }, + }, + "releases": { + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.HelmRelease"), + }, + }, + }, + }, + }, + }, + Required: []string{"repositories", "releases"}, + }, + }, + Dependencies: []string{ + "kmodules.xyz/resource-metadata/apis/shared.HelmRelease", "kmodules.xyz/resource-metadata/apis/shared.HelmRepository"}, + } +} + +func schema_kmodulesxyz_resource_metadata_apis_shared_HelmRelease(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "enabled": { + SchemaProps: spec.SchemaProps{ + Default: false, + Type: []string{"boolean"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "values": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), + }, + }, + }, + Required: []string{"enabled", "version"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/runtime.RawExtension"}, + } +} + +func schema_kmodulesxyz_resource_metadata_apis_shared_HelmRepository(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "url": { + SchemaProps: spec.SchemaProps{ + Description: "URL of the Helm repository, a valid URL contains at least a protocol and host.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "secretName": { + SchemaProps: spec.SchemaProps{ + Description: "SecretRef specifies the Secret containing authentication credentials for the HelmRepository. For HTTP/S basic auth the secret must contain 'username' and 'password' fields. For TLS the secret must contain a 'certFile' and 'keyFile', and/or 'caFile' fields.", + Type: []string{"string"}, + Format: "", + }, + }, + "interval": { + SchemaProps: spec.SchemaProps{ + Description: "Interval at which to check the URL for updates.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"), + }, + }, + "timeout": { + SchemaProps: spec.SchemaProps{ + Description: "The timeout of index downloading, defaults to 60s.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"), + }, + }, + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Type of the HelmRepository. When this field is set to \"oci\", the URL field value must be prefixed with \"oci://\".", + Type: []string{"string"}, + Format: "", + }, + }, + "provider": { + SchemaProps: spec.SchemaProps{ + Description: "Provider used for authentication, can be 'aws', 'azure', 'gcp' or 'generic'. This field is optional, and only taken into account if the .spec.type field is set to 'oci'. When not specified, defaults to 'generic'.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"url"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Duration"}, + } +} + func schema_kmodulesxyz_resource_metadata_apis_shared_If(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -16475,6 +16646,122 @@ func schema_kmodulesxyz_resource_metadata_apis_shared_If(ref common.ReferenceCal } } +func schema_kmodulesxyz_resource_metadata_apis_shared_ImageRegistrySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "registryFQDN": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "proxies": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.RegistryProxies"), + }, + }, + }, + Required: []string{"registryFQDN", "proxies"}, + }, + }, + Dependencies: []string{ + "kmodules.xyz/resource-metadata/apis/shared.RegistryProxies"}, + } +} + +func schema_kmodulesxyz_resource_metadata_apis_shared_RegistryInfo(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "credentials": { + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"credentials"}, + }, + }, + } +} + +func schema_kmodulesxyz_resource_metadata_apis_shared_RegistryProxies(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "dockerHub": { + SchemaProps: spec.SchemaProps{ + Description: "company/bin:1.23", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "dockerLibrary": { + SchemaProps: spec.SchemaProps{ + Description: "alpine, nginx etc.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "ghcr": { + SchemaProps: spec.SchemaProps{ + Description: "ghcr.io", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "quay": { + SchemaProps: spec.SchemaProps{ + Description: "quay.io", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "kubernetes": { + SchemaProps: spec.SchemaProps{ + Description: "registry.k8s.io", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "appscode": { + SchemaProps: spec.SchemaProps{ + Description: "r.appscode.com", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + func schema_kmodulesxyz_resource_metadata_apis_shared_ResourceLocator(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/apis/management/v1alpha1/openapi_generated.go b/apis/management/v1alpha1/openapi_generated.go index 79fea5773..6322edf24 100644 --- a/apis/management/v1alpha1/openapi_generated.go +++ b/apis/management/v1alpha1/openapi_generated.go @@ -308,10 +308,17 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kmodules.xyz/resource-metadata/apis/shared.ActionInfo": schema_kmodulesxyz_resource_metadata_apis_shared_ActionInfo(ref), "kmodules.xyz/resource-metadata/apis/shared.ActionTemplate": schema_kmodulesxyz_resource_metadata_apis_shared_ActionTemplate(ref), "kmodules.xyz/resource-metadata/apis/shared.ActionTemplateGroup": schema_kmodulesxyz_resource_metadata_apis_shared_ActionTemplateGroup(ref), + "kmodules.xyz/resource-metadata/apis/shared.BootstrapPresets": schema_kmodulesxyz_resource_metadata_apis_shared_BootstrapPresets(ref), "kmodules.xyz/resource-metadata/apis/shared.Dashboard": schema_kmodulesxyz_resource_metadata_apis_shared_Dashboard(ref), "kmodules.xyz/resource-metadata/apis/shared.DashboardVar": schema_kmodulesxyz_resource_metadata_apis_shared_DashboardVar(ref), "kmodules.xyz/resource-metadata/apis/shared.DeploymentParameters": schema_kmodulesxyz_resource_metadata_apis_shared_DeploymentParameters(ref), + "kmodules.xyz/resource-metadata/apis/shared.HelmInfo": schema_kmodulesxyz_resource_metadata_apis_shared_HelmInfo(ref), + "kmodules.xyz/resource-metadata/apis/shared.HelmRelease": schema_kmodulesxyz_resource_metadata_apis_shared_HelmRelease(ref), + "kmodules.xyz/resource-metadata/apis/shared.HelmRepository": schema_kmodulesxyz_resource_metadata_apis_shared_HelmRepository(ref), "kmodules.xyz/resource-metadata/apis/shared.If": schema_kmodulesxyz_resource_metadata_apis_shared_If(ref), + "kmodules.xyz/resource-metadata/apis/shared.ImageRegistrySpec": schema_kmodulesxyz_resource_metadata_apis_shared_ImageRegistrySpec(ref), + "kmodules.xyz/resource-metadata/apis/shared.RegistryInfo": schema_kmodulesxyz_resource_metadata_apis_shared_RegistryInfo(ref), + "kmodules.xyz/resource-metadata/apis/shared.RegistryProxies": schema_kmodulesxyz_resource_metadata_apis_shared_RegistryProxies(ref), "kmodules.xyz/resource-metadata/apis/shared.ResourceLocator": schema_kmodulesxyz_resource_metadata_apis_shared_ResourceLocator(ref), "kmodules.xyz/resource-metadata/apis/shared.ResourceQuery": schema_kmodulesxyz_resource_metadata_apis_shared_ResourceQuery(ref), "kmodules.xyz/resource-metadata/apis/shared.SourceLocator": schema_kmodulesxyz_resource_metadata_apis_shared_SourceLocator(ref), @@ -15085,6 +15092,39 @@ func schema_kmodulesxyz_resource_metadata_apis_shared_ActionTemplateGroup(ref co } } +func schema_kmodulesxyz_resource_metadata_apis_shared_BootstrapPresets(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "image": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.ImageRegistrySpec"), + }, + }, + "registry": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.RegistryInfo"), + }, + }, + "helm": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.HelmInfo"), + }, + }, + }, + Required: []string{"image", "registry", "helm"}, + }, + }, + Dependencies: []string{ + "kmodules.xyz/resource-metadata/apis/shared.HelmInfo", "kmodules.xyz/resource-metadata/apis/shared.ImageRegistrySpec", "kmodules.xyz/resource-metadata/apis/shared.RegistryInfo"}, + } +} + func schema_kmodulesxyz_resource_metadata_apis_shared_Dashboard(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -15201,6 +15241,137 @@ func schema_kmodulesxyz_resource_metadata_apis_shared_DeploymentParameters(ref c } } +func schema_kmodulesxyz_resource_metadata_apis_shared_HelmInfo(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "repositories": { + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.HelmRepository"), + }, + }, + }, + }, + }, + "releases": { + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.HelmRelease"), + }, + }, + }, + }, + }, + }, + Required: []string{"repositories", "releases"}, + }, + }, + Dependencies: []string{ + "kmodules.xyz/resource-metadata/apis/shared.HelmRelease", "kmodules.xyz/resource-metadata/apis/shared.HelmRepository"}, + } +} + +func schema_kmodulesxyz_resource_metadata_apis_shared_HelmRelease(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "enabled": { + SchemaProps: spec.SchemaProps{ + Default: false, + Type: []string{"boolean"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "values": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), + }, + }, + }, + Required: []string{"enabled", "version"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/runtime.RawExtension"}, + } +} + +func schema_kmodulesxyz_resource_metadata_apis_shared_HelmRepository(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "url": { + SchemaProps: spec.SchemaProps{ + Description: "URL of the Helm repository, a valid URL contains at least a protocol and host.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "secretName": { + SchemaProps: spec.SchemaProps{ + Description: "SecretRef specifies the Secret containing authentication credentials for the HelmRepository. For HTTP/S basic auth the secret must contain 'username' and 'password' fields. For TLS the secret must contain a 'certFile' and 'keyFile', and/or 'caFile' fields.", + Type: []string{"string"}, + Format: "", + }, + }, + "interval": { + SchemaProps: spec.SchemaProps{ + Description: "Interval at which to check the URL for updates.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"), + }, + }, + "timeout": { + SchemaProps: spec.SchemaProps{ + Description: "The timeout of index downloading, defaults to 60s.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"), + }, + }, + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Type of the HelmRepository. When this field is set to \"oci\", the URL field value must be prefixed with \"oci://\".", + Type: []string{"string"}, + Format: "", + }, + }, + "provider": { + SchemaProps: spec.SchemaProps{ + Description: "Provider used for authentication, can be 'aws', 'azure', 'gcp' or 'generic'. This field is optional, and only taken into account if the .spec.type field is set to 'oci'. When not specified, defaults to 'generic'.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"url"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Duration"}, + } +} + func schema_kmodulesxyz_resource_metadata_apis_shared_If(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -15226,6 +15397,122 @@ func schema_kmodulesxyz_resource_metadata_apis_shared_If(ref common.ReferenceCal } } +func schema_kmodulesxyz_resource_metadata_apis_shared_ImageRegistrySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "registryFQDN": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "proxies": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.RegistryProxies"), + }, + }, + }, + Required: []string{"registryFQDN", "proxies"}, + }, + }, + Dependencies: []string{ + "kmodules.xyz/resource-metadata/apis/shared.RegistryProxies"}, + } +} + +func schema_kmodulesxyz_resource_metadata_apis_shared_RegistryInfo(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "credentials": { + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"credentials"}, + }, + }, + } +} + +func schema_kmodulesxyz_resource_metadata_apis_shared_RegistryProxies(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "dockerHub": { + SchemaProps: spec.SchemaProps{ + Description: "company/bin:1.23", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "dockerLibrary": { + SchemaProps: spec.SchemaProps{ + Description: "alpine, nginx etc.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "ghcr": { + SchemaProps: spec.SchemaProps{ + Description: "ghcr.io", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "quay": { + SchemaProps: spec.SchemaProps{ + Description: "quay.io", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "kubernetes": { + SchemaProps: spec.SchemaProps{ + Description: "registry.k8s.io", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "appscode": { + SchemaProps: spec.SchemaProps{ + Description: "r.appscode.com", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + func schema_kmodulesxyz_resource_metadata_apis_shared_ResourceLocator(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/apis/meta/v1alpha1/openapi_generated.go b/apis/meta/v1alpha1/openapi_generated.go index 19ab7a1c1..5ab4ebda8 100644 --- a/apis/meta/v1alpha1/openapi_generated.go +++ b/apis/meta/v1alpha1/openapi_generated.go @@ -393,10 +393,17 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kmodules.xyz/resource-metadata/apis/shared.ActionInfo": schema_kmodulesxyz_resource_metadata_apis_shared_ActionInfo(ref), "kmodules.xyz/resource-metadata/apis/shared.ActionTemplate": schema_kmodulesxyz_resource_metadata_apis_shared_ActionTemplate(ref), "kmodules.xyz/resource-metadata/apis/shared.ActionTemplateGroup": schema_kmodulesxyz_resource_metadata_apis_shared_ActionTemplateGroup(ref), + "kmodules.xyz/resource-metadata/apis/shared.BootstrapPresets": schema_kmodulesxyz_resource_metadata_apis_shared_BootstrapPresets(ref), "kmodules.xyz/resource-metadata/apis/shared.Dashboard": schema_kmodulesxyz_resource_metadata_apis_shared_Dashboard(ref), "kmodules.xyz/resource-metadata/apis/shared.DashboardVar": schema_kmodulesxyz_resource_metadata_apis_shared_DashboardVar(ref), "kmodules.xyz/resource-metadata/apis/shared.DeploymentParameters": schema_kmodulesxyz_resource_metadata_apis_shared_DeploymentParameters(ref), + "kmodules.xyz/resource-metadata/apis/shared.HelmInfo": schema_kmodulesxyz_resource_metadata_apis_shared_HelmInfo(ref), + "kmodules.xyz/resource-metadata/apis/shared.HelmRelease": schema_kmodulesxyz_resource_metadata_apis_shared_HelmRelease(ref), + "kmodules.xyz/resource-metadata/apis/shared.HelmRepository": schema_kmodulesxyz_resource_metadata_apis_shared_HelmRepository(ref), "kmodules.xyz/resource-metadata/apis/shared.If": schema_kmodulesxyz_resource_metadata_apis_shared_If(ref), + "kmodules.xyz/resource-metadata/apis/shared.ImageRegistrySpec": schema_kmodulesxyz_resource_metadata_apis_shared_ImageRegistrySpec(ref), + "kmodules.xyz/resource-metadata/apis/shared.RegistryInfo": schema_kmodulesxyz_resource_metadata_apis_shared_RegistryInfo(ref), + "kmodules.xyz/resource-metadata/apis/shared.RegistryProxies": schema_kmodulesxyz_resource_metadata_apis_shared_RegistryProxies(ref), "kmodules.xyz/resource-metadata/apis/shared.ResourceLocator": schema_kmodulesxyz_resource_metadata_apis_shared_ResourceLocator(ref), "kmodules.xyz/resource-metadata/apis/shared.ResourceQuery": schema_kmodulesxyz_resource_metadata_apis_shared_ResourceQuery(ref), "kmodules.xyz/resource-metadata/apis/shared.SourceLocator": schema_kmodulesxyz_resource_metadata_apis_shared_SourceLocator(ref), @@ -19054,6 +19061,39 @@ func schema_kmodulesxyz_resource_metadata_apis_shared_ActionTemplateGroup(ref co } } +func schema_kmodulesxyz_resource_metadata_apis_shared_BootstrapPresets(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "image": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.ImageRegistrySpec"), + }, + }, + "registry": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.RegistryInfo"), + }, + }, + "helm": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.HelmInfo"), + }, + }, + }, + Required: []string{"image", "registry", "helm"}, + }, + }, + Dependencies: []string{ + "kmodules.xyz/resource-metadata/apis/shared.HelmInfo", "kmodules.xyz/resource-metadata/apis/shared.ImageRegistrySpec", "kmodules.xyz/resource-metadata/apis/shared.RegistryInfo"}, + } +} + func schema_kmodulesxyz_resource_metadata_apis_shared_Dashboard(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -19170,6 +19210,137 @@ func schema_kmodulesxyz_resource_metadata_apis_shared_DeploymentParameters(ref c } } +func schema_kmodulesxyz_resource_metadata_apis_shared_HelmInfo(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "repositories": { + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.HelmRepository"), + }, + }, + }, + }, + }, + "releases": { + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.HelmRelease"), + }, + }, + }, + }, + }, + }, + Required: []string{"repositories", "releases"}, + }, + }, + Dependencies: []string{ + "kmodules.xyz/resource-metadata/apis/shared.HelmRelease", "kmodules.xyz/resource-metadata/apis/shared.HelmRepository"}, + } +} + +func schema_kmodulesxyz_resource_metadata_apis_shared_HelmRelease(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "enabled": { + SchemaProps: spec.SchemaProps{ + Default: false, + Type: []string{"boolean"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "values": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), + }, + }, + }, + Required: []string{"enabled", "version"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/runtime.RawExtension"}, + } +} + +func schema_kmodulesxyz_resource_metadata_apis_shared_HelmRepository(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "url": { + SchemaProps: spec.SchemaProps{ + Description: "URL of the Helm repository, a valid URL contains at least a protocol and host.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "secretName": { + SchemaProps: spec.SchemaProps{ + Description: "SecretRef specifies the Secret containing authentication credentials for the HelmRepository. For HTTP/S basic auth the secret must contain 'username' and 'password' fields. For TLS the secret must contain a 'certFile' and 'keyFile', and/or 'caFile' fields.", + Type: []string{"string"}, + Format: "", + }, + }, + "interval": { + SchemaProps: spec.SchemaProps{ + Description: "Interval at which to check the URL for updates.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"), + }, + }, + "timeout": { + SchemaProps: spec.SchemaProps{ + Description: "The timeout of index downloading, defaults to 60s.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"), + }, + }, + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Type of the HelmRepository. When this field is set to \"oci\", the URL field value must be prefixed with \"oci://\".", + Type: []string{"string"}, + Format: "", + }, + }, + "provider": { + SchemaProps: spec.SchemaProps{ + Description: "Provider used for authentication, can be 'aws', 'azure', 'gcp' or 'generic'. This field is optional, and only taken into account if the .spec.type field is set to 'oci'. When not specified, defaults to 'generic'.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"url"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Duration"}, + } +} + func schema_kmodulesxyz_resource_metadata_apis_shared_If(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -19195,6 +19366,122 @@ func schema_kmodulesxyz_resource_metadata_apis_shared_If(ref common.ReferenceCal } } +func schema_kmodulesxyz_resource_metadata_apis_shared_ImageRegistrySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "registryFQDN": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "proxies": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.RegistryProxies"), + }, + }, + }, + Required: []string{"registryFQDN", "proxies"}, + }, + }, + Dependencies: []string{ + "kmodules.xyz/resource-metadata/apis/shared.RegistryProxies"}, + } +} + +func schema_kmodulesxyz_resource_metadata_apis_shared_RegistryInfo(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "credentials": { + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"credentials"}, + }, + }, + } +} + +func schema_kmodulesxyz_resource_metadata_apis_shared_RegistryProxies(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "dockerHub": { + SchemaProps: spec.SchemaProps{ + Description: "company/bin:1.23", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "dockerLibrary": { + SchemaProps: spec.SchemaProps{ + Description: "alpine, nginx etc.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "ghcr": { + SchemaProps: spec.SchemaProps{ + Description: "ghcr.io", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "quay": { + SchemaProps: spec.SchemaProps{ + Description: "quay.io", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "kubernetes": { + SchemaProps: spec.SchemaProps{ + Description: "registry.k8s.io", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "appscode": { + SchemaProps: spec.SchemaProps{ + Description: "r.appscode.com", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + func schema_kmodulesxyz_resource_metadata_apis_shared_ResourceLocator(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/apis/shared/helm.go b/apis/shared/helm.go new file mode 100644 index 000000000..d66b42573 --- /dev/null +++ b/apis/shared/helm.go @@ -0,0 +1,111 @@ +/* +Copyright AppsCode Inc. and Contributors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package shared + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +type BootstrapPresets struct { + Image ImageRegistrySpec `json:"image"` + Registry RegistryInfo `json:"registry"` + Helm HelmInfo `json:"helm"` +} + +type ImageRegistrySpec struct { + RegistryFQDN string `json:"registryFQDN"` + Proxies RegistryProxies `json:"proxies"` +} + +type RegistryProxies struct { + // company/bin:1.23 + //+optional + DockerHub string `json:"dockerHub"` + // alpine, nginx etc. + //+optional + DockerLibrary string `json:"dockerLibrary"` + // ghcr.io + //+optional + GHCR string `json:"ghcr"` + // quay.io + //+optional + Quay string `json:"quay"` + // registry.k8s.io + //+optional + Kubernetes string `json:"kubernetes"` + // r.appscode.com + //+optional + AppsCode string `json:"appscode"` +} + +type RepositoryCredential map[string]string + +type RegistryInfo struct { + Credentials RepositoryCredential `json:"credentials"` +} + +type HelmInfo struct { + Repositories map[string]*HelmRepository `json:"repositories"` + Releases map[string]*HelmRelease `json:"releases"` +} + +type HelmRepository struct { + // URL of the Helm repository, a valid URL contains at least a protocol and + // host. + // +required + URL string `json:"url"` + + // SecretRef specifies the Secret containing authentication credentials + // for the HelmRepository. + // For HTTP/S basic auth the secret must contain 'username' and 'password' + // fields. + // For TLS the secret must contain a 'certFile' and 'keyFile', and/or + // 'caFile' fields. + // +optional + SecretName string `json:"secretName,omitempty"` + + // Interval at which to check the URL for updates. + // +kubebuilder:validation:Type=string + // +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ms|s|m|h))+$" + // +optional + Interval *metav1.Duration `json:"interval,omitempty"` + + // The timeout of index downloading, defaults to 60s. + // +optional + Timeout *metav1.Duration `json:"timeout,omitempty"` + + // Type of the HelmRepository. + // When this field is set to "oci", the URL field value must be prefixed with "oci://". + // +kubebuilder:validation:Enum=default;oci + // +optional + Type string `json:"type,omitempty"` + + // Provider used for authentication, can be 'aws', 'azure', 'gcp' or 'generic'. + // This field is optional, and only taken into account if the .spec.type field is set to 'oci'. + // When not specified, defaults to 'generic'. + // +kubebuilder:validation:Enum=generic;aws;azure;gcp + // +kubebuilder:default:=generic + // +optional + Provider string `json:"provider,omitempty"` +} + +type HelmRelease struct { + Enabled bool `json:"enabled"` + Version string `json:"version"` + Values *runtime.RawExtension `json:"values,omitempty"` +} diff --git a/apis/shared/openapi_generated.go b/apis/shared/openapi_generated.go index 212960e98..696729d51 100644 --- a/apis/shared/openapi_generated.go +++ b/apis/shared/openapi_generated.go @@ -35,10 +35,17 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kmodules.xyz/resource-metadata/apis/shared.ActionInfo": schema_kmodulesxyz_resource_metadata_apis_shared_ActionInfo(ref), "kmodules.xyz/resource-metadata/apis/shared.ActionTemplate": schema_kmodulesxyz_resource_metadata_apis_shared_ActionTemplate(ref), "kmodules.xyz/resource-metadata/apis/shared.ActionTemplateGroup": schema_kmodulesxyz_resource_metadata_apis_shared_ActionTemplateGroup(ref), + "kmodules.xyz/resource-metadata/apis/shared.BootstrapPresets": schema_kmodulesxyz_resource_metadata_apis_shared_BootstrapPresets(ref), "kmodules.xyz/resource-metadata/apis/shared.Dashboard": schema_kmodulesxyz_resource_metadata_apis_shared_Dashboard(ref), "kmodules.xyz/resource-metadata/apis/shared.DashboardVar": schema_kmodulesxyz_resource_metadata_apis_shared_DashboardVar(ref), "kmodules.xyz/resource-metadata/apis/shared.DeploymentParameters": schema_kmodulesxyz_resource_metadata_apis_shared_DeploymentParameters(ref), + "kmodules.xyz/resource-metadata/apis/shared.HelmInfo": schema_kmodulesxyz_resource_metadata_apis_shared_HelmInfo(ref), + "kmodules.xyz/resource-metadata/apis/shared.HelmRelease": schema_kmodulesxyz_resource_metadata_apis_shared_HelmRelease(ref), + "kmodules.xyz/resource-metadata/apis/shared.HelmRepository": schema_kmodulesxyz_resource_metadata_apis_shared_HelmRepository(ref), "kmodules.xyz/resource-metadata/apis/shared.If": schema_kmodulesxyz_resource_metadata_apis_shared_If(ref), + "kmodules.xyz/resource-metadata/apis/shared.ImageRegistrySpec": schema_kmodulesxyz_resource_metadata_apis_shared_ImageRegistrySpec(ref), + "kmodules.xyz/resource-metadata/apis/shared.RegistryInfo": schema_kmodulesxyz_resource_metadata_apis_shared_RegistryInfo(ref), + "kmodules.xyz/resource-metadata/apis/shared.RegistryProxies": schema_kmodulesxyz_resource_metadata_apis_shared_RegistryProxies(ref), "kmodules.xyz/resource-metadata/apis/shared.ResourceLocator": schema_kmodulesxyz_resource_metadata_apis_shared_ResourceLocator(ref), "kmodules.xyz/resource-metadata/apis/shared.ResourceQuery": schema_kmodulesxyz_resource_metadata_apis_shared_ResourceQuery(ref), "kmodules.xyz/resource-metadata/apis/shared.SourceLocator": schema_kmodulesxyz_resource_metadata_apis_shared_SourceLocator(ref), @@ -289,6 +296,39 @@ func schema_kmodulesxyz_resource_metadata_apis_shared_ActionTemplateGroup(ref co } } +func schema_kmodulesxyz_resource_metadata_apis_shared_BootstrapPresets(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "image": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.ImageRegistrySpec"), + }, + }, + "registry": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.RegistryInfo"), + }, + }, + "helm": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.HelmInfo"), + }, + }, + }, + Required: []string{"image", "registry", "helm"}, + }, + }, + Dependencies: []string{ + "kmodules.xyz/resource-metadata/apis/shared.HelmInfo", "kmodules.xyz/resource-metadata/apis/shared.ImageRegistrySpec", "kmodules.xyz/resource-metadata/apis/shared.RegistryInfo"}, + } +} + func schema_kmodulesxyz_resource_metadata_apis_shared_Dashboard(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -405,6 +445,137 @@ func schema_kmodulesxyz_resource_metadata_apis_shared_DeploymentParameters(ref c } } +func schema_kmodulesxyz_resource_metadata_apis_shared_HelmInfo(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "repositories": { + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.HelmRepository"), + }, + }, + }, + }, + }, + "releases": { + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.HelmRelease"), + }, + }, + }, + }, + }, + }, + Required: []string{"repositories", "releases"}, + }, + }, + Dependencies: []string{ + "kmodules.xyz/resource-metadata/apis/shared.HelmRelease", "kmodules.xyz/resource-metadata/apis/shared.HelmRepository"}, + } +} + +func schema_kmodulesxyz_resource_metadata_apis_shared_HelmRelease(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "enabled": { + SchemaProps: spec.SchemaProps{ + Default: false, + Type: []string{"boolean"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "values": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), + }, + }, + }, + Required: []string{"enabled", "version"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/runtime.RawExtension"}, + } +} + +func schema_kmodulesxyz_resource_metadata_apis_shared_HelmRepository(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "url": { + SchemaProps: spec.SchemaProps{ + Description: "URL of the Helm repository, a valid URL contains at least a protocol and host.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "secretName": { + SchemaProps: spec.SchemaProps{ + Description: "SecretRef specifies the Secret containing authentication credentials for the HelmRepository. For HTTP/S basic auth the secret must contain 'username' and 'password' fields. For TLS the secret must contain a 'certFile' and 'keyFile', and/or 'caFile' fields.", + Type: []string{"string"}, + Format: "", + }, + }, + "interval": { + SchemaProps: spec.SchemaProps{ + Description: "Interval at which to check the URL for updates.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"), + }, + }, + "timeout": { + SchemaProps: spec.SchemaProps{ + Description: "The timeout of index downloading, defaults to 60s.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"), + }, + }, + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Type of the HelmRepository. When this field is set to \"oci\", the URL field value must be prefixed with \"oci://\".", + Type: []string{"string"}, + Format: "", + }, + }, + "provider": { + SchemaProps: spec.SchemaProps{ + Description: "Provider used for authentication, can be 'aws', 'azure', 'gcp' or 'generic'. This field is optional, and only taken into account if the .spec.type field is set to 'oci'. When not specified, defaults to 'generic'.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"url"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Duration"}, + } +} + func schema_kmodulesxyz_resource_metadata_apis_shared_If(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -430,6 +601,122 @@ func schema_kmodulesxyz_resource_metadata_apis_shared_If(ref common.ReferenceCal } } +func schema_kmodulesxyz_resource_metadata_apis_shared_ImageRegistrySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "registryFQDN": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "proxies": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.RegistryProxies"), + }, + }, + }, + Required: []string{"registryFQDN", "proxies"}, + }, + }, + Dependencies: []string{ + "kmodules.xyz/resource-metadata/apis/shared.RegistryProxies"}, + } +} + +func schema_kmodulesxyz_resource_metadata_apis_shared_RegistryInfo(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "credentials": { + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"credentials"}, + }, + }, + } +} + +func schema_kmodulesxyz_resource_metadata_apis_shared_RegistryProxies(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "dockerHub": { + SchemaProps: spec.SchemaProps{ + Description: "company/bin:1.23", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "dockerLibrary": { + SchemaProps: spec.SchemaProps{ + Description: "alpine, nginx etc.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "ghcr": { + SchemaProps: spec.SchemaProps{ + Description: "ghcr.io", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "quay": { + SchemaProps: spec.SchemaProps{ + Description: "quay.io", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "kubernetes": { + SchemaProps: spec.SchemaProps{ + Description: "registry.k8s.io", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "appscode": { + SchemaProps: spec.SchemaProps{ + Description: "r.appscode.com", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + func schema_kmodulesxyz_resource_metadata_apis_shared_ResourceLocator(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/apis/shared/zz_generated.deepcopy.go b/apis/shared/zz_generated.deepcopy.go index f7f82bd53..d44bb467d 100644 --- a/apis/shared/zz_generated.deepcopy.go +++ b/apis/shared/zz_generated.deepcopy.go @@ -22,6 +22,8 @@ limitations under the License. package shared import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" v1alpha1 "x-helm.dev/apimachinery/apis/releases/v1alpha1" apisshared "x-helm.dev/apimachinery/apis/shared" ) @@ -144,6 +146,25 @@ func (in *ActionTemplateGroup) DeepCopy() *ActionTemplateGroup { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BootstrapPresets) DeepCopyInto(out *BootstrapPresets) { + *out = *in + out.Image = in.Image + in.Registry.DeepCopyInto(&out.Registry) + in.Helm.DeepCopyInto(&out.Helm) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BootstrapPresets. +func (in *BootstrapPresets) DeepCopy() *BootstrapPresets { + if in == nil { + return nil + } + out := new(BootstrapPresets) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Dashboard) DeepCopyInto(out *Dashboard) { *out = *in @@ -212,6 +233,99 @@ func (in *DeploymentParameters) DeepCopy() *DeploymentParameters { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HelmInfo) DeepCopyInto(out *HelmInfo) { + *out = *in + if in.Repositories != nil { + in, out := &in.Repositories, &out.Repositories + *out = make(map[string]*HelmRepository, len(*in)) + for key, val := range *in { + var outVal *HelmRepository + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(HelmRepository) + (*in).DeepCopyInto(*out) + } + (*out)[key] = outVal + } + } + if in.Releases != nil { + in, out := &in.Releases, &out.Releases + *out = make(map[string]*HelmRelease, len(*in)) + for key, val := range *in { + var outVal *HelmRelease + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(HelmRelease) + (*in).DeepCopyInto(*out) + } + (*out)[key] = outVal + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmInfo. +func (in *HelmInfo) DeepCopy() *HelmInfo { + if in == nil { + return nil + } + out := new(HelmInfo) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HelmRelease) DeepCopyInto(out *HelmRelease) { + *out = *in + if in.Values != nil { + in, out := &in.Values, &out.Values + *out = new(runtime.RawExtension) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmRelease. +func (in *HelmRelease) DeepCopy() *HelmRelease { + if in == nil { + return nil + } + out := new(HelmRelease) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HelmRepository) DeepCopyInto(out *HelmRepository) { + *out = *in + if in.Interval != nil { + in, out := &in.Interval, &out.Interval + *out = new(v1.Duration) + **out = **in + } + if in.Timeout != nil { + in, out := &in.Timeout, &out.Timeout + *out = new(v1.Duration) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmRepository. +func (in *HelmRepository) DeepCopy() *HelmRepository { + if in == nil { + return nil + } + out := new(HelmRepository) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *If) DeepCopyInto(out *If) { *out = *in @@ -233,6 +347,84 @@ func (in *If) DeepCopy() *If { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageRegistrySpec) DeepCopyInto(out *ImageRegistrySpec) { + *out = *in + out.Proxies = in.Proxies + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageRegistrySpec. +func (in *ImageRegistrySpec) DeepCopy() *ImageRegistrySpec { + if in == nil { + return nil + } + out := new(ImageRegistrySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RegistryInfo) DeepCopyInto(out *RegistryInfo) { + *out = *in + if in.Credentials != nil { + in, out := &in.Credentials, &out.Credentials + *out = make(RepositoryCredential, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegistryInfo. +func (in *RegistryInfo) DeepCopy() *RegistryInfo { + if in == nil { + return nil + } + out := new(RegistryInfo) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RegistryProxies) DeepCopyInto(out *RegistryProxies) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegistryProxies. +func (in *RegistryProxies) DeepCopy() *RegistryProxies { + if in == nil { + return nil + } + out := new(RegistryProxies) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in RepositoryCredential) DeepCopyInto(out *RepositoryCredential) { + { + in := &in + *out = make(RepositoryCredential, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RepositoryCredential. +func (in RepositoryCredential) DeepCopy() RepositoryCredential { + if in == nil { + return nil + } + out := new(RepositoryCredential) + in.DeepCopyInto(out) + return *out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ResourceLocator) DeepCopyInto(out *ResourceLocator) { *out = *in diff --git a/apis/ui/v1alpha1/openapi_generated.go b/apis/ui/v1alpha1/openapi_generated.go index 188449cce..95802e8d6 100644 --- a/apis/ui/v1alpha1/openapi_generated.go +++ b/apis/ui/v1alpha1/openapi_generated.go @@ -302,10 +302,17 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kmodules.xyz/resource-metadata/apis/shared.ActionInfo": schema_kmodulesxyz_resource_metadata_apis_shared_ActionInfo(ref), "kmodules.xyz/resource-metadata/apis/shared.ActionTemplate": schema_kmodulesxyz_resource_metadata_apis_shared_ActionTemplate(ref), "kmodules.xyz/resource-metadata/apis/shared.ActionTemplateGroup": schema_kmodulesxyz_resource_metadata_apis_shared_ActionTemplateGroup(ref), + "kmodules.xyz/resource-metadata/apis/shared.BootstrapPresets": schema_kmodulesxyz_resource_metadata_apis_shared_BootstrapPresets(ref), "kmodules.xyz/resource-metadata/apis/shared.Dashboard": schema_kmodulesxyz_resource_metadata_apis_shared_Dashboard(ref), "kmodules.xyz/resource-metadata/apis/shared.DashboardVar": schema_kmodulesxyz_resource_metadata_apis_shared_DashboardVar(ref), "kmodules.xyz/resource-metadata/apis/shared.DeploymentParameters": schema_kmodulesxyz_resource_metadata_apis_shared_DeploymentParameters(ref), + "kmodules.xyz/resource-metadata/apis/shared.HelmInfo": schema_kmodulesxyz_resource_metadata_apis_shared_HelmInfo(ref), + "kmodules.xyz/resource-metadata/apis/shared.HelmRelease": schema_kmodulesxyz_resource_metadata_apis_shared_HelmRelease(ref), + "kmodules.xyz/resource-metadata/apis/shared.HelmRepository": schema_kmodulesxyz_resource_metadata_apis_shared_HelmRepository(ref), "kmodules.xyz/resource-metadata/apis/shared.If": schema_kmodulesxyz_resource_metadata_apis_shared_If(ref), + "kmodules.xyz/resource-metadata/apis/shared.ImageRegistrySpec": schema_kmodulesxyz_resource_metadata_apis_shared_ImageRegistrySpec(ref), + "kmodules.xyz/resource-metadata/apis/shared.RegistryInfo": schema_kmodulesxyz_resource_metadata_apis_shared_RegistryInfo(ref), + "kmodules.xyz/resource-metadata/apis/shared.RegistryProxies": schema_kmodulesxyz_resource_metadata_apis_shared_RegistryProxies(ref), "kmodules.xyz/resource-metadata/apis/shared.ResourceLocator": schema_kmodulesxyz_resource_metadata_apis_shared_ResourceLocator(ref), "kmodules.xyz/resource-metadata/apis/shared.ResourceQuery": schema_kmodulesxyz_resource_metadata_apis_shared_ResourceQuery(ref), "kmodules.xyz/resource-metadata/apis/shared.SourceLocator": schema_kmodulesxyz_resource_metadata_apis_shared_SourceLocator(ref), @@ -14845,6 +14852,39 @@ func schema_kmodulesxyz_resource_metadata_apis_shared_ActionTemplateGroup(ref co } } +func schema_kmodulesxyz_resource_metadata_apis_shared_BootstrapPresets(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "image": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.ImageRegistrySpec"), + }, + }, + "registry": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.RegistryInfo"), + }, + }, + "helm": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.HelmInfo"), + }, + }, + }, + Required: []string{"image", "registry", "helm"}, + }, + }, + Dependencies: []string{ + "kmodules.xyz/resource-metadata/apis/shared.HelmInfo", "kmodules.xyz/resource-metadata/apis/shared.ImageRegistrySpec", "kmodules.xyz/resource-metadata/apis/shared.RegistryInfo"}, + } +} + func schema_kmodulesxyz_resource_metadata_apis_shared_Dashboard(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -14961,6 +15001,137 @@ func schema_kmodulesxyz_resource_metadata_apis_shared_DeploymentParameters(ref c } } +func schema_kmodulesxyz_resource_metadata_apis_shared_HelmInfo(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "repositories": { + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.HelmRepository"), + }, + }, + }, + }, + }, + "releases": { + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.HelmRelease"), + }, + }, + }, + }, + }, + }, + Required: []string{"repositories", "releases"}, + }, + }, + Dependencies: []string{ + "kmodules.xyz/resource-metadata/apis/shared.HelmRelease", "kmodules.xyz/resource-metadata/apis/shared.HelmRepository"}, + } +} + +func schema_kmodulesxyz_resource_metadata_apis_shared_HelmRelease(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "enabled": { + SchemaProps: spec.SchemaProps{ + Default: false, + Type: []string{"boolean"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "values": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), + }, + }, + }, + Required: []string{"enabled", "version"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/runtime.RawExtension"}, + } +} + +func schema_kmodulesxyz_resource_metadata_apis_shared_HelmRepository(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "url": { + SchemaProps: spec.SchemaProps{ + Description: "URL of the Helm repository, a valid URL contains at least a protocol and host.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "secretName": { + SchemaProps: spec.SchemaProps{ + Description: "SecretRef specifies the Secret containing authentication credentials for the HelmRepository. For HTTP/S basic auth the secret must contain 'username' and 'password' fields. For TLS the secret must contain a 'certFile' and 'keyFile', and/or 'caFile' fields.", + Type: []string{"string"}, + Format: "", + }, + }, + "interval": { + SchemaProps: spec.SchemaProps{ + Description: "Interval at which to check the URL for updates.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"), + }, + }, + "timeout": { + SchemaProps: spec.SchemaProps{ + Description: "The timeout of index downloading, defaults to 60s.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"), + }, + }, + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Type of the HelmRepository. When this field is set to \"oci\", the URL field value must be prefixed with \"oci://\".", + Type: []string{"string"}, + Format: "", + }, + }, + "provider": { + SchemaProps: spec.SchemaProps{ + Description: "Provider used for authentication, can be 'aws', 'azure', 'gcp' or 'generic'. This field is optional, and only taken into account if the .spec.type field is set to 'oci'. When not specified, defaults to 'generic'.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"url"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Duration"}, + } +} + func schema_kmodulesxyz_resource_metadata_apis_shared_If(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -14986,6 +15157,122 @@ func schema_kmodulesxyz_resource_metadata_apis_shared_If(ref common.ReferenceCal } } +func schema_kmodulesxyz_resource_metadata_apis_shared_ImageRegistrySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "registryFQDN": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "proxies": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/resource-metadata/apis/shared.RegistryProxies"), + }, + }, + }, + Required: []string{"registryFQDN", "proxies"}, + }, + }, + Dependencies: []string{ + "kmodules.xyz/resource-metadata/apis/shared.RegistryProxies"}, + } +} + +func schema_kmodulesxyz_resource_metadata_apis_shared_RegistryInfo(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "credentials": { + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"credentials"}, + }, + }, + } +} + +func schema_kmodulesxyz_resource_metadata_apis_shared_RegistryProxies(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "dockerHub": { + SchemaProps: spec.SchemaProps{ + Description: "company/bin:1.23", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "dockerLibrary": { + SchemaProps: spec.SchemaProps{ + Description: "alpine, nginx etc.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "ghcr": { + SchemaProps: spec.SchemaProps{ + Description: "ghcr.io", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "quay": { + SchemaProps: spec.SchemaProps{ + Description: "quay.io", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "kubernetes": { + SchemaProps: spec.SchemaProps{ + Description: "registry.k8s.io", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "appscode": { + SchemaProps: spec.SchemaProps{ + Description: "r.appscode.com", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + func schema_kmodulesxyz_resource_metadata_apis_shared_ResourceLocator(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/go.mod b/go.mod index 55440e467..39a0deec3 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( sigs.k8s.io/cli-utils v0.34.0 sigs.k8s.io/controller-runtime v0.13.1 sigs.k8s.io/yaml v1.3.0 - x-helm.dev/apimachinery v0.0.12 + x-helm.dev/apimachinery v0.0.15 ) require ( diff --git a/go.sum b/go.sum index 2a2e6ba8a..a03af0e37 100644 --- a/go.sum +++ b/go.sum @@ -754,5 +754,5 @@ sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kF sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E= sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= -x-helm.dev/apimachinery v0.0.12 h1:lEuGH5F+6xqL7/uL+SsoOUXeJZFgC8c2OQgtMMj/fQM= -x-helm.dev/apimachinery v0.0.12/go.mod h1:jjkebU6uv/cS/8pQGE8tbgK/rB39yh4ETiAglPbDWZc= +x-helm.dev/apimachinery v0.0.15 h1:+q1bdvVdDC311RRboRcWk0P2aaM5ZyOhxN/H+VJzJTs= +x-helm.dev/apimachinery v0.0.15/go.mod h1:wpYBmu0U/uETX6Kv6TXequ9FPmhI24KquLK2B30wOs8= diff --git a/hub/helm.go b/hub/helm.go new file mode 100644 index 000000000..c7d83107b --- /dev/null +++ b/hub/helm.go @@ -0,0 +1,142 @@ +/* +Copyright AppsCode Inc. and Contributors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package hub + +import ( + "context" + "encoding/json" + "os" + + kmapi "kmodules.xyz/client-go/api/v1" + "kmodules.xyz/resource-metadata/apis/shared" + + fluxsrc "github.com/fluxcd/source-controller/api/v1beta2" + "sigs.k8s.io/controller-runtime/pkg/client" + chartsapi "x-helm.dev/apimachinery/apis/charts/v1alpha1" + releasesapi "x-helm.dev/apimachinery/apis/releases/v1alpha1" +) + +const ( + AppsCodeChartsLegacyURL = "https://charts.appscode.com/stable" + AppsCodeChartsOCIURL = "oci://r.appscode.com/charts" + FluxCDChartsURL = "https://fluxcd-community.github.io/helm-charts" +) + +const ( + bootstrapHelmRepositoryName = "bootstrap" + EnvVarBootstrapHelmRepositoryName = "BOOTSTRAP_HELM_REPOSITORY_NAME" + + bootstrapHelmRepositoryNamespace = "kubeops" + EnvVarBootstrapHelmRepositoryNamespace = "BOOTSTRAP_HELM_REPOSITORY_NAMESPACE" + + fluxcdHelmRepositoryName = "fluxcd-community" + EnvVarFluxcdHelmRepositoryName = "FLUXCD_HELM_REPOSITORY_NAME" + + BootstrapPresetsName = "bootstrap-presets" + + ChartACE = "ace" + ChartACEInstaller = "ace-installer" + ChartLicenseProxyServer = "license-proxyserver" + ChartOpscenterFeatures = "opscenter-features" + + ChartFluxCD = "flux2" + ChartFluxCDReleaseNamespace = "flux-system" +) + +func BootstrapHelmRepositoryNamespace() string { + ns := os.Getenv(EnvVarBootstrapHelmRepositoryNamespace) + if ns != "" { + return ns + } + return bootstrapHelmRepositoryNamespace +} + +func BootstrapHelmRepositoryName() string { + ns := os.Getenv(EnvVarBootstrapHelmRepositoryName) + if ns != "" { + return ns + } + return bootstrapHelmRepositoryName +} + +func FluxCDHelmRepositoryName() string { + ns := os.Getenv(EnvVarFluxcdHelmRepositoryName) + if ns != "" { + return ns + } + return fluxcdHelmRepositoryName +} + +func BootstrapHelmRepository(kc client.Client) kmapi.TypedObjectReference { + if kc != nil { + var repo fluxsrc.HelmRepository + err := kc.Get(context.TODO(), client.ObjectKey{Name: BootstrapHelmRepositoryName(), Namespace: BootstrapHelmRepositoryNamespace()}, &repo) + if err == nil { + return kmapi.TypedObjectReference{ + APIGroup: releasesapi.SourceGroupHelmRepository, + Kind: releasesapi.SourceKindHelmRepository, + Namespace: BootstrapHelmRepositoryNamespace(), + Name: BootstrapHelmRepositoryName(), + } + } + } + return kmapi.TypedObjectReference{ + APIGroup: releasesapi.SourceGroupLegacy, + Kind: releasesapi.SourceKindLegacy, + Namespace: "", + Name: AppsCodeChartsLegacyURL, + } +} + +func FluxCDHelmRepository(kc client.Client) kmapi.TypedObjectReference { + if kc != nil { + var repo fluxsrc.HelmRepository + err := kc.Get(context.TODO(), client.ObjectKey{Name: FluxCDHelmRepositoryName(), Namespace: BootstrapHelmRepositoryNamespace()}, &repo) + if err == nil { + return kmapi.TypedObjectReference{ + APIGroup: releasesapi.SourceGroupHelmRepository, + Kind: releasesapi.SourceKindHelmRepository, + Namespace: FluxCDHelmRepositoryName(), + Name: BootstrapHelmRepositoryName(), + } + } + } + return kmapi.TypedObjectReference{ + APIGroup: releasesapi.SourceGroupLegacy, + Kind: releasesapi.SourceKindLegacy, + Namespace: "", + Name: FluxCDChartsURL, + } +} + +func FeatureVersion(kc client.Client, featureName string) string { + if kc != nil { + var ccp chartsapi.ClusterChartPreset + err := kc.Get(context.TODO(), client.ObjectKey{Name: BootstrapPresetsName}, &ccp) + if err == nil { + var preset shared.BootstrapPresets + err := json.Unmarshal(ccp.Spec.Values.Raw, &preset) + if err == nil { + hr := preset.Helm.Releases[featureName] + if hr != nil { + return hr.Version + } + } + } + } + return "" +} diff --git a/vendor/modules.txt b/vendor/modules.txt index c9c457255..53b5c54f6 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -768,7 +768,7 @@ sigs.k8s.io/structured-merge-diff/v4/value # sigs.k8s.io/yaml v1.3.0 ## explicit; go 1.12 sigs.k8s.io/yaml -# x-helm.dev/apimachinery v0.0.12 +# x-helm.dev/apimachinery v0.0.15 ## explicit; go 1.19 x-helm.dev/apimachinery/apis/charts/v1alpha1 x-helm.dev/apimachinery/apis/releases/v1alpha1 diff --git a/vendor/x-helm.dev/apimachinery/apis/releases/v1alpha1/editor_types.go b/vendor/x-helm.dev/apimachinery/apis/releases/v1alpha1/editor_types.go index 413b321aa..1569922eb 100644 --- a/vendor/x-helm.dev/apimachinery/apis/releases/v1alpha1/editor_types.go +++ b/vendor/x-helm.dev/apimachinery/apis/releases/v1alpha1/editor_types.go @@ -143,11 +143,13 @@ type ObjectModel struct { type ResourceObject struct { Filename string `json:"filename,omitempty"` + Key string `json:"key,omitempty"` Data *unstructured.Unstructured `json:"data,omitempty"` } type ResourceFile struct { Filename string `json:"filename,omitempty"` + Key string `json:"key,omitempty"` Data string `json:"data,omitempty"` }