Skip to content

Conversation

@afritzler
Copy link
Member

Proposed changes

Refactor Makefile, GH workflows and other project housekeeping tasks.

@afritzler afritzler marked this pull request as ready for review August 20, 2025 11:11
@afritzler afritzler requested a review from a team as a code owner August 20, 2025 11:11
@afritzler afritzler added the enhancement New feature or request label Aug 20, 2025
@afritzler afritzler force-pushed the enh/makefile branch 3 times, most recently from bf206f5 to 6b244ce Compare August 20, 2025 11:27
@afritzler afritzler force-pushed the enh/makefile branch 5 times, most recently from 9890a4b to 6b49a31 Compare August 20, 2025 14:08
Copy link
Contributor

Choose a reason for hiding this comment

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

Things we had previously, which I'd prefer to keep:

  • Spelling Checks
  • License Checks
  • Vulnerability Checks

Copy link
Contributor

Choose a reason for hiding this comment

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

As already said in #7 (comment), we already have this chart in https://github.com/ironcore-dev/network-operator/tree/main/charts/network-operator:

We already have the helm chart under charts/network-operator which seems to be inline with the standard convention used by many other projects.

I'm aware that kubebuilder decided for dist/chart but I don't think that's a good choice. There also seems to be a related issue in kubernetes-sigs/kubebuilder#4320, which hopefully gets resolved soon (there are already open PRs for it) to make this configurable.

And to cite the official Helm Documentation:

The directory name is the name of the chart (without versioning information).

Copy link
Member Author

Choose a reason for hiding this comment

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

How is this chart being created? Can the helm plugin be configured to use a different folder?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's being created with the helm plugin, but then simply moved to another directory, see

@rm -rf charts/network-operator && mv dist/chart charts/network-operator && rm -rf dist

However, there is an open issue on kubebuilder to make this configurable (kubernetes-sigs/kubebuilder#4320) which would simplify this step for us in the future.

As this is already a custom target not included into the kubebuilder scaffold, we can pretty much do what we want here. Also, as this is a complete replacement every time (because the helm plugin just overwrites everything) this step either way always requires some manual efforts.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is already defined in

// Package v1alpha1 contains API Schema definitions for the networking.cloud.sap v1alpha1 API group.
// +kubebuilder:validation:Required
// +kubebuilder:object:generate=true
// +groupName=networking.cloud.sap
package v1alpha1
. I'm fine to move it to a dedicated doc.go, but then we should remove it in the other file.

Copy link
Member Author

Choose a reason for hiding this comment

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

This file is needed by the CRDs to api reference doc generator.

Copy link
Contributor

Choose a reason for hiding this comment

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

As said, we can add it. But then we should remove those lines from ./api/v1alpha1/groupversion_info.go#L4-L8 and make sure we keep the following to set the default for the package:

+kubebuilder:validation:Required

@hardikdr hardikdr added the area/metal-automation Automation processes within the Metal project. label Aug 21, 2025
@hardikdr hardikdr added this to Roadmap Aug 21, 2025
@afritzler afritzler force-pushed the enh/makefile branch 3 times, most recently from dd4f465 to 7a445ba Compare August 21, 2025 08:04
@afritzler afritzler force-pushed the enh/makefile branch 5 times, most recently from 15d85b4 to 49e3275 Compare August 21, 2025 14:58
@afritzler afritzler force-pushed the enh/makefile branch 3 times, most recently from dd55988 to c2feeef Compare August 22, 2025 09:41
Comment on lines 8 to 37
- copyloopvar
- dupl
- errcheck
- ginkgolinter
- goconst
- gocyclo
- govet
- ineffassign
- lll
- misspell
- nakedret
- prealloc
- revive
- staticcheck
- unconvert
- unparam
- unused
Copy link
Contributor

Choose a reason for hiding this comment

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

This uses way less linters as used previously. Do we really want to reduce the linting in this way?

Copy link
Member Author

Choose a reason for hiding this comment

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

Added back all the linters. However I don't think we will need things like sqlclosecheck.

Copy link
Contributor

@felix-kaestner felix-kaestner Aug 22, 2025

Choose a reason for hiding this comment

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

Please revert the changes done here (except renaming of the make targets used), these were some intentional changes made (and also fixed a lot of linter issues).

Copy link
Contributor

Choose a reason for hiding this comment

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

We previously run a check in the Checks workflow to check for license headers. Now that we removed this workflow, can we add this step to this worfklow? In particular it should run the make check-license target we have defined.

Copy link
Contributor

Choose a reason for hiding this comment

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

We were previously running go-licence-detector here. If we remove this now, then we should also remove the .license-scan-rules.json and .license-scan-overrides.jsonl configuration files (or keep it and keep the config).

- name: Run linter
run: |
make golangci-lint
cp ./bin/golangci-lint /usr/local/bin/
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: we otherwise use mv <binary> /usr/local/bin, e.g. in the kustomize-validation workflow. Ideally this would be consistent.

target: ${{ matrix.image.target }}
build-args: |
VERSION=${{ steps.meta.outputs.version }}
GIT_COMMIT=${{ steps.vars.sha_short }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
GIT_COMMIT=${{ steps.vars.sha_short }}
GIT_COMMIT=$(git rev-parse --short HEAD)

nit: if we can run a shell command here as done below with the date command I would also run this command here inline instead of creating a new step.

Did you test, that for the BUILD_DATE arg you are able to invoke a shell command in this scope?

Comment on lines +7 to +26
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
Copy link
Contributor

Choose a reason for hiding this comment

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

As a suggestion, could we at least do:

RUN --mount=type=cache,target=/go/pkg/mod \
    go mod download -x

Instead of the go mod download, so that we have the mod cache to speed up the build process?

_, _ = fmt.Fprintf(GinkgoWriter, "chdir dir: %q\n", err)
}

cmd.Env = append(os.Environ(), "GO111MODULE=on")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
cmd.Env = append(os.Environ(), "GO111MODULE=on")

not needed.

prometheusOperatorVersion = "v0.77.1"
prometheusOperatorURL = "https://github.com/prometheus-operator/prometheus-operator/" +
"releases/download/%s/bundle.yaml"
Copy link
Contributor

Choose a reason for hiding this comment

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

As you removed the prometheus installation in test/e2e/e2e_suite_test.go. I would either also remove everything regarding that (incl. the InstallPrometheusOperator and UninstallPrometheusOperator funcs that are now unused) or keep the prometheus operator installation as previously.

@@ -153,31 +171,8 @@ func LoadImageToKindClusterWithName(name string) error {
if v, ok := os.LookupEnv("KIND_CLUSTER"); ok {
cluster = v
}
// See: https://kind.sigs.k8s.io/docs/user/rootless/#creating-a-kind-cluster-with-rootless-nerdctl
Copy link
Contributor

Choose a reason for hiding this comment

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

Please keep this part from the previous implementation, as it allows to use a different container tool than docker (something that kubebuilder pretents but actually does not support).

Comment on lines 207 to 208
// false positive
// nolint:gosec
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// false positive
// nolint:gosec

I don't get an gosec linter error here. Same for the end of the func.

if idx < 0 {
if strings.Contains(string(content), target[len(prefix):]) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The previous enhancement of detecting an already commented file is superior. Also, this func is now unused (as we don't install the prometheus operator anymore), so I would remove this func (we shouldn't include dead code in the repo).

@afritzler afritzler force-pushed the enh/makefile branch 2 times, most recently from a6f74bb to f2b63de Compare September 9, 2025 15:41
@afritzler afritzler force-pushed the enh/makefile branch 5 times, most recently from 5ab5751 to 5b75547 Compare October 7, 2025 13:02
@github-actions
Copy link

This PR is stale because it has been open for 45 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/metal-automation Automation processes within the Metal project. enhancement New feature or request ok-to-charts ok-to-image

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants