# Tanzu Framework
## Client Config creation
tkg/tkgctl/compatibility.go
```
switch clientConfig.ClientOptions.CLI.Edition {
case configapi.EditionCommunity:
clientConfig.ClientOptions.CLI.BOMRepo = DefaultTCEBomRepo
clientConfig.ClientOptions.CLI.CompatibilityFilePath = DefaultCompatibilityPath
case configapi.EditionStandard:
clientConfig.ClientOptions.CLI.BOMRepo = tkgconfigpaths.TKGDefaultImageRepo
clientConfig.ClientOptions.CLI.CompatibilityFilePath = tkgconfigpaths.TKGDefaultCompatibilityImagePath
}
```
tkg/tkgconfigpaths/zz_bundled_default_bom_files_configdata.go
```
TKGDefaultImageRepo string = "projects-stg.registry.vmware.com/tkg"
TKGDefaultCompatibilityImagePath string = "framework-zshippable/tkg-compatibility"
TKGManagementClusterPluginVersion string = "v0.27.0-dev"
```
### Client Config
```
apiVersion: config.tanzu.vmware.com/v1alpha1
clientOptions:
cli:
bomRepo: projects-stg.registry.vmware.com/tkg
compatibilityFilePath: framework-zshippable/tkg-compatibility
discoverySources:
- contextType: k8s
oci:
image: '/:'
name: default
edition: tkg
features:
cluster:
custom-nameservers: "false"
dual-stack-ipv4-primary: "false"
dual-stack-ipv6-primary: "false"
global:
context-aware-cli-for-plugins: "false"
context-target: "false"
tkr-version-v1alpha3-beta: "false"
management-cluster:
aws-instance-types-exclude-arm: "true"
custom-nameservers: "false"
dual-stack-ipv4-primary: "false"
dual-stack-ipv6-primary: "false"
export-from-confirm: "true"
import: "false"
standalone-cluster-mode: "false"
package:
kctrl-package-command-tree: "false"
kind: ClientConfig
metadata:
creationTimestamp: null
```
## All client creation
```
ClusterCtlClient: clusterctlClient,
ConfigClient: configClient,
FeaturesClient: featuresClient,
RegionManager: regionManager,
TKGBomClient: tkgBomClient,
TKGConfigProvidersClient: tkgConfigProvidersClient,
TKGConfigUpdaterClient: tkgConfigUpdaterClient,
TKGConfigPathsClient: tkgConfigPathsClient,
FeatureFlagClient: featureFlagClient,
```
## tkg client
```
tkgClient, err := client.New(client.Options{
ClusterCtlClient: allClients.ClusterCtlClient,
ReaderWriterConfigClient: allClients.ConfigClient,
RegionManager: allClients.RegionManager,
TKGConfigDir: options.ConfigDir,
Timeout: constants.DefaultOperationTimeout,
FeaturesClient: allClients.FeaturesClient,
TKGConfigProvidersClient: allClients.TKGConfigProvidersClient,
TKGBomClient: allClients.TKGBomClient,
TKGConfigUpdater: allClients.TKGConfigUpdaterClient,
TKGPathsClient: allClients.TKGConfigPathsClient,
ClusterKubeConfig: clusterKubeConfig,
ClusterClientFactory: clusterclient.NewClusterClientFactory(),
FeatureFlagClient: allClients.FeatureFlagClient,
})
```
## tkg config
## tkg compatibility
gets the tkg-compatibility image with the latest tag
```
// DownloadTKGCompatibilityFileFromRegistry resolves the compatibility file
// from an OCI registry. The compatibility files correlates a plugin (e.g.
// management-cluster) version to a compatibility file. Compatibility files
// contain references to the corresponding Bill of Materials (BOM) that is used
// when creating clusters.
func (c *client) DownloadTKGCompatibilityFileFromRegistry(repo, resource string, bomClient registry.Registry) error {
// if a custom repository or image path is set (e.g. via environment variable, override what was passed into this method
customRepository, err := c.tkgConfigReaderWriter.Get(constants.ConfigVariableCustomImageRepository)
if err == nil && customRepository != "" {
repo = customRepository
}
customTKGCompatibilityImagePath, err := c.tkgConfigReaderWriter.Get(constants.ConfigVariableCompatibilityCustomImagePath)
if err == nil && customTKGCompatibilityImagePath != "" {
resource = customTKGCompatibilityImagePath
}
```
```
version: v64
managementClusterPluginVersions:
- version: v0.11.4
supportedTKGBomVersions:
- imagePath: tkg-bom
tag: v1.5.3-tf-v0.11.4
- version: v0.11.5
supportedTKGBomVersions:
- imagePath: tkg-bom
tag: v1.5.4-tf-v0.11.5
- version: v0.11.6
supportedTKGBomVersions:
- imagePath: tkg-bom
tag: v1.5.4-tf-v0.11.6
- version: v0.12.0
supportedTKGBomVersions:
- imagePath: tkg-bom
tag: v1.6.0-tf-v0.12.0
- version: v0.12.0-dev
supportedTKGBomVersions:
- imagePath: tkg-bom
tag: v1.6.0-zshippable
- version: v0.13.0
supportedTKGBomVersions:
- imagePath: tkg-bom
tag: v1.6.0-tf-v0.13.0
```
## tkg bom
## tkr bom
## https://github.com/vmware-tanzu/tanzu-framework/blob/a635c6523823151a7b976fa396a3a0253628ee37/tkg/client/cluster.go#L314
manifest here is cluster template + TKR + other CRDs and controllers
Can we also validate if modifying TKR API is an option?
Maybe have a `TinyKubeSpec` just like this [KubernetesSpec](https://github.com/vmware-tanzu/tanzu-framework/blob/a635c6523823151a7b976fa396a3a0253628ee37/apis/run/v1alpha3/tanzukubernetesrelease_types.go#L50-L73)
~~TinyTKR will not be MC compatible - https://github.com/vmware-tanzu/tanzu-framework/blob/a635c6523823151a7b976fa396a3a0253628ee37/pkg/v2/tkr/controller/tkr-source/compatibility/reconciler.go#L156~~