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
Moving Build Dockerfile to be defined in the ConfigMap #160
Moving Build Dockerfile to be defined in the ConfigMap #160
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: yevgeny-shnaidman The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/assign @qbarrand |
@yevgeny-shnaidman: GitHub didn't allow me to assign the following users: mresvanis. Note that only kubernetes-sigs members with read permissions, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/cc @mresvanis |
@yevgeny-shnaidman: GitHub didn't allow me to request PR reviews from the following users: mresvanis. Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Codecov ReportBase: 71.86% // Head: 71.60% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #160 +/- ##
==========================================
- Coverage 71.86% 71.60% -0.27%
==========================================
Files 25 25
Lines 2417 2437 +20
==========================================
+ Hits 1737 1745 +8
- Misses 597 605 +8
- Partials 83 87 +4
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
f674e51
to
3fe00c9
Compare
Fixes #115 |
api/v1beta1/module_types.go
Outdated
@@ -60,7 +60,8 @@ type Build struct { | |||
// BuildArgs is an array of build variables that are provided to the image building backend. | |||
BuildArgs []BuildArg `json:"buildArgs"` | |||
|
|||
Dockerfile string `json:"dockerfile"` | |||
// ConfigMap that holds Dockerfile contents | |||
DockerfileRef *v1.LocalObjectReference `json:"dockerfileRef"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will cause an issue:
Change to the config map won't trigger a reconcile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yevgeny-shnaidman can we leave Dockerfile
as an option? It has the benefit of not breaking the API, which requires a version bump and a conversion webhook...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't want to be triggered by ConfigMap. If the image is already build, then we won't run the Build flow again, and if the build has failed, then the reconcile will be triggered by us
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@qbarrand i think that it cause our code to become confusing: we will need to support both option, decide which one to take, which one to replace, we will also have the same issue in kaniko configuration. Since we have not released the official API yet, maybe it is better to change it and not to support all the options just in order to avoid conversion hooks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT about having both fields and failing the reconciliation? When we implement the validating webhook, we can add that check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the reason to support both options, it is just confusing, both to us and to the customer. Anyway you will have to support both options in the code, which adds to the confusion. Why are you worried about conversion webhook? I think that at this stage we can just tell customers to move to new version and change their code, i think that any customer we have right now is at very starting stage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are already breaking the API. Do you have any objection to have that one as well without a conversion webhook?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you good with that, @qbarrand ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK to remove the field per @bthurber's decision.
How about changing the new field name to DockerfileConfigMap
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are already breaking the API then let's merge this one as well #86.
api/v1beta1/module_types.go
Outdated
@@ -60,7 +60,8 @@ type Build struct { | |||
// BuildArgs is an array of build variables that are provided to the image building backend. | |||
BuildArgs []BuildArg `json:"buildArgs"` | |||
|
|||
Dockerfile string `json:"dockerfile"` | |||
// ConfigMap that holds Dockerfile contents | |||
DockerfileRef *v1.LocalObjectReference `json:"dockerfileRef"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yevgeny-shnaidman can we leave Dockerfile
as an option? It has the benefit of not breaking the API, which requires a version bump and a conversion webhook...
internal/build/job/maker.go
Outdated
dockefileData, err := m.getDockerfileContents(ctx, buildConfig, mod.Namespace) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to get dockerfile contents: %v", err) | ||
} | ||
specTemplate := v1.PodTemplateSpec{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Annotations: map[string]string{"Dockerfile": buildConfig.Dockerfile}, | ||
Annotations: map[string]string{"Dockerfile": dockefileData}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather mount the ConfigMap into the pod.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i will check if kaniko supports that option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yevgeny-shnaidman I believe we only need to change the volume there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Please review the changes:
- new Volume definition\
- new hash calculation
- changed build config pickup implementation
b671cd8
to
7bc6abf
Compare
Currently dockerfile is defined a multiline string in the Build field of the KernelMapping. This PR does the following: 1) dockerfile is now defined in a dedicated configmap (created by customer) with the key being: dockerfile 2) Build struct now contains reference to the ConfigMap, instead of a string 3) change the flow of e2e workflow for the in-cluster build to use the new configuration
7bc6abf
to
6adc5e1
Compare
/lgtm |
…rnetes-sigs#160) This change renames the `config/manifests/bases/kmm-operator.clusterserviceversion.yaml` file to `kernel-module-management.clusterserviceversion.yaml`, in order to fix `make bundle`. The file name must match the `projectName` defined in the `PROJECT` file, or `operator generate kustomize manifests -q` will not find it and ask all the questions to generate it. This change also update some tools to their latest versions: - update golangci-lint - update controller-gen - update kustomize - update OPM, to include file based catalog creation https://olm.operatorframework.io/docs/reference/file-based-catalogs/#design Signed-off-by: Fabien Dupont <fdupont@redhat.com> Signed-off-by: Fabien Dupont <fdupont@redhat.com> Upstream-Commit: 25abfb1 Co-authored-by: Fabien Dupont <fdupont@redhat.com>
Currently dockerfile is defined a multiline string in the Build field of the KernelMapping. This PR does the following: 1) dockerfile is now defined in a dedicated configmap (created by customer)
with the key being: dockerfile
2) Build struct now contains reference to the ConfigMap, instead of
a string
3) change the flow of e2e workflow for the in-cluster build
to use the new configuration