Skip to content

Commit 2458fd8

Browse files
bump kubebuilder to v3.13.0 and fixup scaffolding (#79)
* bump kubebuilder to v3.13.0 and fixup scaffolding Signed-off-by: Joe Lanford <[email protected]> * adding pinning to python/ansible dependencies that are used during testing, also adding an ignore to CVE-2019-8341(70612) in saftey scanning, since this is a transient dependency in the builder container Signed-off-by: Adam D. Cornett <[email protected]> --------- Signed-off-by: Joe Lanford <[email protected]> Signed-off-by: Adam D. Cornett <[email protected]> Co-authored-by: Adam D. Cornett <[email protected]>
1 parent 5f5e41f commit 2458fd8

File tree

15 files changed

+27
-35
lines changed

15 files changed

+27
-35
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ require (
2626
k8s.io/kubectl v0.28.5
2727
k8s.io/utils v0.0.0-20240102154912-e7106e64919e
2828
sigs.k8s.io/controller-runtime v0.16.3
29-
sigs.k8s.io/kubebuilder/v3 v3.12.0
29+
sigs.k8s.io/kubebuilder/v3 v3.13.0
3030
sigs.k8s.io/yaml v1.4.0
3131
)
3232

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,8 +454,8 @@ sigs.k8s.io/controller-runtime v0.16.3 h1:2TuvuokmfXvDUamSx1SuAOO3eTyye+47mJCigw
454454
sigs.k8s.io/controller-runtime v0.16.3/go.mod h1:j7bialYoSn142nv9sCOJmQgDXQXxnroFU4VnX/brVJ0=
455455
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
456456
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
457-
sigs.k8s.io/kubebuilder/v3 v3.12.0 h1:POh46v+T2wPGzAzcIE/eKlwZr17nn+R49elJg2Wz2qU=
458-
sigs.k8s.io/kubebuilder/v3 v3.12.0/go.mod h1:ZJZ6jpjhh0skfehrYl7b8X/SCozhfLAU7IYV8ZN/f3s=
457+
sigs.k8s.io/kubebuilder/v3 v3.13.0 h1:ft1r2HdI29hEgtbuk3AEjOGX5A0N3jjbSA54oZzXH5I=
458+
sigs.k8s.io/kubebuilder/v3 v3.13.0/go.mod h1:BA3wwWd7P31jNLH9x+l5TzK6Of61SwY469ChO1+G2Cc=
459459
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE=
460460
sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E=
461461
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=

hack/generate/samples/ansible/advanced_molecule.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,6 @@ func ImplementAdvancedMolecule(sample sample.Sample, image string) {
7575
addMocksFromTestdata(sample.Dir(), sample.CommandContext())
7676
updateDockerfile(sample.Dir())
7777
updateConfig(sample.Dir())
78-
79-
// Replace kustomize version to v5.2.1 to enable running the
80-
// tests on a mac with Apple Silicon
81-
replaceKustomizeVersion(sample.Dir(), "v5.2.1")
8278
}
8379

8480
func updateConfig(dir string) {

hack/generate/samples/ansible/memcached.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ func ImplementMemcached(sample sample.Sample, image string) {
4040
addingMoleculeMockData(sample.Dir(), sample.Name(), gvk)
4141
}
4242
}
43-
44-
// Replace kustomize version to v5.2.1 to enable running the
45-
// tests on a mac with Apple Silicon
46-
replaceKustomizeVersion(sample.Dir(), "v5.2.1")
4743
}
4844

4945
// addingMoleculeMockData will customize the molecule data
@@ -77,12 +73,3 @@ func addingAnsibleTask(dir string, gvk schema.GroupVersionKind) {
7773
"# TODO(user): Add fields here", "size: 1")
7874
pkg.CheckError("updating sample CR", err)
7975
}
80-
81-
// replaceKustomizeVersion will replace the kustomize version used in the
82-
// Makefile to the version specified
83-
func replaceKustomizeVersion(dir string, version string) {
84-
err := kbutil.ReplaceInFile(filepath.Join(dir, "Makefile"),
85-
"curl -sSLo - https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v5.1.1/kustomize_v5.1.1_$(OS)_$(ARCH).tar.gz | \\",
86-
fmt.Sprintf("curl -sSLo - https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/%s/kustomize_%s_$(OS)_$(ARCH).tar.gz | \\", version, version))
87-
pkg.CheckError(fmt.Sprintf("replacing kustomize version to %s", version), err)
88-
}

hack/tests/e2e-ansible-molecule.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ pip3 install pyasn1==0.4.7 pyasn1-modules==0.2.6 idna==2.8 ipaddress==1.0.23
3030
pip3 install cryptography molecule==5.1.0
3131
pip3 install ansible-lint yamllint
3232
pip3 install docker kubernetes jmespath
33+
pip3 install requests==2.32.2
3334
ansible-galaxy collection install 'kubernetes.core:==2.4.0'
3435
ansible-galaxy collection install 'operator_sdk.util:==0.4.0'
35-
ansible-galaxy collection install 'community.docker:==3.4.0'
36+
ansible-galaxy collection install 'community.docker:==3.10.3'
3637

3738
header_text "Copying molecule testdata scenarios"
3839
ROOTDIR="$(pwd)"

images/ansible-operator/Dockerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ RUN set -e && yum clean all && rm -rf /var/cache/yum/* \
2525
&& pip3 install --upgrade pip~=23.3.2 \
2626
&& pip3 install pipenv==2023.11.15 \
2727
&& pipenv install --deploy \
28-
&& pipenv check \
28+
# NOTE: This ignored vulnerability (70612) was detected in jinja2, \
29+
# but the vulnerability is disputed and may never be fixed. See: \
30+
# - https://github.com/advisories/GHSA-f6pv-j8mr-w6rr \
31+
# - https://github.com/dbt-labs/dbt-core/issues/10250 \
32+
# - https://data.safetycli.com/v/70612/97c/ \
33+
&& pipenv check --ignore 70612 \
2934
&& yum remove -y gcc libffi-devel openssl-devel python39-devel \
3035
&& yum clean all \
3136
&& rm -rf /var/cache/yum

images/ansible-operator/pipfile.Dockerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ RUN set -e && yum clean all && rm -rf /var/cache/yum/* \
2121
&& pip3 install --upgrade pip~=23.3.2 \
2222
&& pip3 install pipenv==2023.11.15 \
2323
&& pipenv lock \
24-
&& pipenv check \
24+
# NOTE: This ignored vulnerability (70612) was detected in jinja2, \
25+
# but the vulnerability is disputed and may never be fixed. See: \
26+
# - https://github.com/advisories/GHSA-f6pv-j8mr-w6rr \
27+
# - https://github.com/dbt-labs/dbt-core/issues/10250 \
28+
# - https://data.safetycli.com/v/70612/97c/ \
29+
&& pipenv check --ignore 70612 \
2530
&& yum remove -y gcc libffi-devel openssl-devel python39-devel \
2631
&& yum clean all \
2732
&& rm -rf /var/cache/yum

pkg/plugins/ansible/v1/scaffolds/internal/templates/config/rbac/role.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ func (f *ManagerRole) SetTemplateDefaults() error {
3939
}
4040

4141
f.TemplateBody = fmt.Sprintf(roleTemplate, machinery.NewMarkerFor(f.Path, rulesMarker))
42+
f.IfExistsAction = machinery.OverwriteFile
4243

4344
return nil
4445
}

pkg/plugins/ansible/v1/scaffolds/internal/templates/requirements.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ collections:
4242
- name: cloud.common
4343
version: "2.1.1"
4444
- name: community.docker
45-
version: "3.4.5"
45+
version: "3.10.3"
4646
`

pkg/plugins/util/cleanup.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ func UpdateKustomizationsInit() error {
7676
`
7777
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
7878
# crd/kustomization.yaml
79-
#- manager_webhook_patch.yaml
79+
#- path: manager_webhook_patch.yaml
8080
8181
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'.
8282
# Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks.
8383
# 'CERTMANAGER' needs to be enabled to use ca injection
84-
#- webhookcainjection_patch.yaml
84+
#- path: webhookcainjection_patch.yaml
8585
8686
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix.
8787
# Uncomment the following replacements to add the cert-manager CA injection annotations

testdata/memcached-molecule-operator/config/default/kustomization.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@ resources:
2121
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
2222
- ../prometheus
2323

24-
patchesStrategicMerge:
24+
patches:
2525
# Protect the /metrics endpoint by putting it behind auth.
2626
# If you want your controller-manager to expose the /metrics
2727
# endpoint w/o any authn/z, please comment the following line.
28-
- manager_auth_proxy_patch.yaml
29-
30-
28+
- path: manager_auth_proxy_patch.yaml

testdata/memcached-molecule-operator/config/default/manager_auth_proxy_patch.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ spec:
1414
allowPrivilegeEscalation: false
1515
capabilities:
1616
drop:
17-
- "ALL"
18-
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.14.1
17+
- "ALL"
18+
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.15.0
1919
args:
2020
- "--secure-listen-address=0.0.0.0:8443"
2121
- "--upstream=http://127.0.0.1:8080/"

testdata/memcached-molecule-operator/config/manager/manager.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ spec:
7878
allowPrivilegeEscalation: false
7979
capabilities:
8080
drop:
81-
- "ALL"
81+
- "ALL"
8282
livenessProbe:
8383
httpGet:
8484
path: /healthz

testdata/memcached-molecule-operator/config/prometheus/monitor.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Prometheus Monitor Service (Metrics)
32
apiVersion: monitoring.coreos.com/v1
43
kind: ServiceMonitor

testdata/memcached-molecule-operator/requirements.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ collections:
77
- name: cloud.common
88
version: "2.1.1"
99
- name: community.docker
10-
version: "3.4.5"
10+
version: "3.10.3"

0 commit comments

Comments
 (0)