Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(manager): add sveltos manager #30087

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

oliverbaehler
Copy link

@oliverbaehler oliverbaehler commented Jul 8, 2024

Changes

This adds the manager for sveltos for GitOps managed Cluster Fleets. Essentially we have the same functionality as argoCD, so we were able to take the argocd manager and adjust the schema etc. I hope that's okay.

Context

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

Not sure if there's more?

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@CLAassistant

This comment was marked as resolved.

@secustor

This comment was marked as resolved.

@secustor secustor marked this pull request as draft July 8, 2024 17:18
@oliverbaehler

This comment was marked as resolved.

@secustor secustor marked this pull request as ready for review July 8, 2024 20:13
@secustor
Copy link
Collaborator

secustor commented Jul 8, 2024

Package manager details can be found here: #30090 (comment)

lib/modules/manager/sveltos/extract.spec.ts Outdated Show resolved Hide resolved
lib/modules/manager/sveltos/index.ts Outdated Show resolved Hide resolved
lib/modules/manager/sveltos/extract.ts Outdated Show resolved Hide resolved
lib/modules/manager/sveltos/extract.ts Outdated Show resolved Hide resolved
secustor

This comment was marked as resolved.

@oliverbaehler

This comment was marked as resolved.

@secustor

This comment was marked as resolved.

Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>
@oliverbaehler

This comment was marked as resolved.

@secustor secustor self-requested a review August 12, 2024 08:11
@secustor
Copy link
Collaborator

Is this ready for another review?
Please use the re-review button so we maintainers know that you are ready for a new review.

BTW It isn't necessary to merge main if there are no conflicts.

@oliverbaehler
Copy link
Author

@secustor Yes this is ready for review, Sorry!

lib/modules/manager/sveltos/extract.spec.ts Outdated Show resolved Hide resolved
lib/modules/manager/sveltos/readme.md Outdated Show resolved Hide resolved
lib/modules/manager/sveltos/readme.md Outdated Show resolved Hide resolved
lib/modules/manager/sveltos/readme.md Outdated Show resolved Hide resolved
lib/modules/manager/sveltos/readme.md Show resolved Hide resolved
lib/modules/manager/sveltos/readme.md Outdated Show resolved Hide resolved
lib/modules/manager/sveltos/readme.md Outdated Show resolved Hide resolved
@viceice viceice self-requested a review August 14, 2024 15:58
Copy link
Collaborator

@secustor secustor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs code coverage ( see the failing CI ) and docs changes requested by @HonkingGoose

lib/modules/manager/sveltos/util.ts Outdated Show resolved Hide resolved
import { z } from 'zod';
import { LooseArray } from '../../../util/schema-utils';

export const KubernetesResource = z.object({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we reuse the schema from kubernetes/ kustomize?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, i have extended the object. Is that okay or not?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should unify it

export const KubernetesResource = z.object({
apiVersion: z.string(),
kind: z.string(),
metadata: z.object({
name: z.string(),
// For Flux, the namespace property is optional, but matching HelmReleases to HelmRepositories would be
// much more difficult without it (we'd have to examine the parent Kustomizations to discover the value),
// so we require it for renovation.
namespace: z.string().optional(),
}),
});

lib/modules/manager/sveltos/extract.ts Outdated Show resolved Hide resolved
lib/modules/manager/sveltos/extract.ts Outdated Show resolved Hide resolved
lib/modules/manager/sveltos/extract.ts Outdated Show resolved Hide resolved
lib/modules/manager/sveltos/extract.ts Outdated Show resolved Hide resolved
lib/modules/manager/sveltos/extract.ts Outdated Show resolved Hide resolved
oliverbaehler and others added 5 commits August 20, 2024 11:43
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
oliverbaehler and others added 11 commits August 20, 2024 11:45
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>
Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>
Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>
Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>
lib/modules/manager/sveltos/extract.spec.ts Show resolved Hide resolved
lib/modules/manager/sveltos/extract.ts Outdated Show resolved Hide resolved
import { z } from 'zod';
import { LooseArray } from '../../../util/schema-utils';

export const KubernetesResource = z.object({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should unify it

export const KubernetesResource = z.object({
apiVersion: z.string(),
kind: z.string(),
metadata: z.object({
name: z.string(),
// For Flux, the namespace property is optional, but matching HelmReleases to HelmRepositories would be
// much more difficult without it (we'd have to examine the parent Kustomizations to discover the value),
// so we require it for renovation.
namespace: z.string().optional(),
}),
});

export function extractPackageFile(
content: string,
packageFile: string,
_config?: ExtractConfig,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should support config.registryAliases.

if (matchingRepositories.length) {
dep.registryUrls = matchingRepositories
.map((repo) => {
if (repo.spec.type === 'oci' || isOCIRegistry(repo.spec.url)) {
// Change datasource to Docker
dep.datasource = DockerDatasource.id;
// Ensure the URL is a valid OCI path
dep.packageName = getDep(
`${removeOCIPrefix(repo.spec.url)}/${
resource.spec.chart.spec.chart
}`,
false,
registryAliases,
).depName;
return null;
} else {
return repo.spec.url;
}
})
.filter(is.string);
// if registryUrls is empty, delete it from dep
if (!dep.registryUrls?.length) {
delete dep.registryUrls;
}
} else {
dep.skipReason = 'unknown-registry';
}

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
try {
definitions = parseYaml(content, {
customSchema: ProfileDefinition,
}) as any;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}) as any;
});

Do not use any

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants