Skip to content

Commit

Permalink
add support for gardener v1.48
Browse files Browse the repository at this point in the history
  • Loading branch information
schrodit committed Jul 11, 2022
1 parent a8f9914 commit 70c2a6b
Show file tree
Hide file tree
Showing 9 changed files with 115 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ gardener-dashboard:
- The new DNSRecords are not used as not all dns providers like cloudlfare are supported.
- The host backup bucket has to be manually setup once and the provided in the values as `.backup.container`
- Not all extensions are currently installed.
See the [Extension values](./extensions.yaml) for all default extensions.
See the [Extension values](src/ts/versions/v1.48/extensions.yaml) for all default extensions.
Others can be added via the values.yaml.

#### Known issues
Expand Down
2 changes: 1 addition & 1 deletion default.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

version: v1.47.2
version: v1.48.6

landscapeName: gardener-installation

Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
"files": [
"lib/**/*",
"src/charts/**/*",
"default.yaml",
"extensions.yaml"
"default.yaml"
]
}
31 changes: 24 additions & 7 deletions src/ts/Landscape.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import {readFile} from 'fs/promises';
import path from 'path';
import {KubeConfig} from '@kubernetes/client-node';
import yaml from 'yaml';
import {has} from '@0cfg/utils-common/lib/has';
import {SemVer} from 'semver';
import {DefaultKubeClient} from './utils/DefaultKubeClient';
import {LocalKeyValueState, LocalState} from './state/LocalState';
import {KubernetesKeyValueState, KubernetesState} from './state/KubernetesState';
Expand All @@ -14,7 +16,7 @@ import {createLogger} from './log/Logger';
import {convertStateValues, getInstallation} from './versions/installations';
import {Flow} from './flow/Flow';
import {KubeClient} from './utils/KubeClient';
import {DefaultNamespace, emptyState, StateValues} from './versions/v1.46/Values';
import {DefaultNamespace, emptyState, required, StateValues} from './versions/v1.46/Values';
import {VERSION} from './versions/v1.46/installation';
import {NotFound} from './utils/exceptions';

Expand Down Expand Up @@ -106,14 +108,17 @@ const setUp = async (config: LandscapeInstallationConfig) => {
);
}

const valueFiles = [
internalFile(defaultValuesFile),
internalFile(extensionsValuesFile),
].concat(config.valueFiles ?? []);
const values = deepMergeObject(
const defaultValues = await readValueFiles([internalFile(defaultValuesFile)]);
let values = mergeObjects(
defaultValues,
config.values ?? {},
await readValueFiles(valueFiles),
await readValueFiles(config.valueFiles ?? []),
) as VersionedValues;
required(values, 'version');
values = deepMergeObject(
await readValueFiles([extensionsDefaultsFile(values.version)]),
values,
);

return {
kubeClient,
Expand Down Expand Up @@ -175,6 +180,12 @@ const getCurrentState = async (newState: KeyValueState, kubeClient: KubeClient,
}
};

const extensionsDefaultsFile = (version: string): string => {
const v = new SemVer(version);
const f = internalFile(path.join('src/ts/versions', `v${v.major}.${v.minor}`, extensionsValuesFile));
return f;
};

const readValueFiles = async(valueFiles: string[]): Promise<any> => {
const allValues = await Promise.all(
valueFiles.map(path => readValues(path))
Expand All @@ -186,6 +197,12 @@ const readValueFiles = async(valueFiles: string[]): Promise<any> => {
return val;
};

const mergeObjects = (...objects: Values[]): Values => {
const r = {};
objects.forEach(o => deepMergeObject(r, o));
return r;
};

const readValues = async (path: string): Promise<any> => {
log.info(`Read values from ${path}`);
return yaml.parse(await readFile(path, 'utf-8'));
Expand Down
1 change: 1 addition & 0 deletions src/ts/versions/installations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export interface InstallationConstructor {
const versions: Record<string, InstallationConstructor> = {
'v1.46.x': Installation_1_46,
'v1.47.x': Installation_1_47,
'v1.48.x': Installation_1_47,
};

export class VersionNotFound extends Exception {
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions src/ts/versions/v1.46/installation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export class Installation implements IInstallation {
if (stateValues === null) {
stateValues = emptyState(inputValues.version);
}

const values = await generateGardenerInstallationValues(stateValues, inputValues);
await this.state.store(values);
log.info('Successfully stored state');
Expand Down
1 change: 1 addition & 0 deletions src/ts/versions/v1.47/extensions.yaml
85 changes: 85 additions & 0 deletions src/ts/versions/v1.48/extensions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@

gardener:
extensions:
os-coreos:
enabled: true
version: v1.12.0
controllerRegistration:
repositoryName: gardener-extension-os-coreos

provider-gcp:
enabled: true
version: v1.23.1
controllerRegistration:
repositoryName: gardener-extension-provider-gcp

provider-dns-cloudflare:
enabled: true
version: v0.0.2
controllerRegistration:
org: schrodit
repositoryName: gardener-extension-provider-dns-cloudflare

external-dns:
enabled: true
version: v0.12.0
controllerRegistration:
repositoryName: external-dns-management
path: /examples/controller-registration.yaml

values:
configuration:
controllers: dnscontrollers

provider-equinix:
enabled: true
version: v2.4.0
controllerRegistration:
repositoryName: gardener-extension-provider-equinix-metal

networking-cilium:
enabled: true
version: v1.13.2
controllerRegistration:
repositoryName: gardener-extension-networking-cilium

networking-calico:
enabled: true
version: v1.24.3
controllerRegistration:
repositoryName: gardener-extension-networking-calico

shoot-dns-service:
enabled: true
global: true

version: v1.21.0
controllerRegistration:
repositoryName: gardener-extension-shoot-dns-service

values:
dnsProviderReplication:
enabled: true

shoot-cert-service:
enabled: true
global: true

version: v1.23.0
controllerRegistration:
repositoryName: gardener-extension-shoot-cert-service

values:
certificateConfig:
defaultIssuer:
acme:
email: foo@example.com
server: https://acme-v02.api.letsencrypt.org/directory
name: default-issuer

imageVectorOverwrite: |
images:
- name: cert-management
sourceRepository: github.com/gardener/cert-management
repository: eu.gcr.io/gardener-project/cert-controller-manager
tag: "v0.8.7"

0 comments on commit 70c2a6b

Please sign in to comment.