Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 185a65c

Browse files
committed
major refactor
1 parent 3297a87 commit 185a65c

15 files changed

+532
-555
lines changed

Dockerfile

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,27 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
7272
FROM ${deployment_base_image}:${deployment_base_image_tag}
7373

7474
# Set shell with pipefail option for better error handling
75-
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
75+
SHELL ["/bin/sh", "-o", "pipefail", "-c"]
7676

7777
# Install Node.js and cdk8s-cli directly
7878
# hadolint ignore=DL3015
79-
RUN apt-get update && \
80-
apt-get install -y --no-install-recommends ca-certificates=20240203~22.04.1 curl=7.81.0-1ubuntu1.20 && \
81-
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
82-
apt-get install -y nodejs=18.19.1-1nodesource1 && \
83-
npm install -g [email protected] && \
84-
curl -fsSL -o go1.24.4.linux-amd64.tar.gz https://go.dev/dl/go1.24.4.linux-amd64.tar.gz && \
85-
tar -C /usr/local -xzf go1.24.4.linux-amd64.tar.gz && \
86-
rm go1.24.4.linux-amd64.tar.gz && \
87-
apt-get clean && \
88-
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
79+
#RUN apt-get update && \
80+
# apt-get install -y --no-install-recommends ca-certificates=20240203~22.04.1 curl=7.81.0-1ubuntu1.20 && \
81+
# curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
82+
# apt-get install -y nodejs=18.19.1-1nodesource1 && \
83+
# npm install -g [email protected] && \
84+
# curl -fsSL -o go1.24.4.linux-amd64.tar.gz https://go.dev/dl/go1.24.4.linux-amd64.tar.gz && \
85+
# tar -C /usr/local -xzf go1.24.4.linux-amd64.tar.gz && \
86+
# rm go1.24.4.linux-amd64.tar.gz && \
87+
# apt-get clean && \
88+
# rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
89+
90+
RUN apk add --no-cache ca-certificates curl nodejs npm \
91+
&& npm install -g [email protected] \
92+
&& curl -fsSL -o go1.24.4.linux-amd64.tar.gz https://go.dev/dl/go1.24.4.linux-amd64.tar.gz \
93+
&& tar -C /usr/local -xzf go1.24.4.linux-amd64.tar.gz \
94+
&& rm go1.24.4.linux-amd64.tar.gz \
95+
&& rm -rf /tmp/*
8996

9097
# Set Go environment variables
9198
ENV PATH=$PATH:/usr/local/go/bin
@@ -95,7 +102,7 @@ WORKDIR /
95102
COPY --from=builder /workspace/manager .
96103

97104
# Create non-root user
98-
RUN useradd --uid 65532 --create-home --shell /bin/bash nonroot
105+
RUN adduser -u 65532 -D -h /home/nonroot -s /bin/sh nonroot
99106

100107
# Switch back to non-root user (this line should already exist)
101108
# USER root # This was part of the removed direct install, ensure it's not re-added here unless needed for COPY permissions

Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ export GO111MODULE=on
4545
# Base docker images
4646

4747
DOCKERFILE_CONTAINER_IMAGE ?= docker.io/docker/dockerfile:1.4
48-
DEPLOYMENT_BASE_IMAGE ?= ubuntu
49-
DEPLOYMENT_BASE_IMAGE_TAG ?= 22.04
48+
DEPLOYMENT_BASE_IMAGE ?= alpine
49+
DEPLOYMENT_BASE_IMAGE_TAG ?= 3.20
5050
BUILD_CONTAINER_ADDITIONAL_ARGS ?=
5151

5252
#
@@ -231,11 +231,10 @@ CAPI_KIND_CLUSTER_NAME ?= capi-test
231231
# It is set by Prow GIT_TAG, a git-based tag of the form vYYYYMMDD-hash, e.g., v20210120-v0.3.10-308-gc61521971
232232

233233
# Next release is: v0.3.2
234-
TAG ?= v0.3.2-preview.28
234+
TAG ?= v0.3.2-preview.39
235235
ARCH ?= $(shell go env GOARCH)
236236
ALL_ARCH = amd64 arm arm64
237237

238-
239238
# Allow overriding manifest generation destination directory
240239
MANIFEST_ROOT ?= config
241240
CRD_ROOT ?= $(MANIFEST_ROOT)/crd/bases

README.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,9 @@ spec:
5050
reference: "main"
5151
referencePollInterval: '5'
5252
path: "examples/cdk8s-sample-deployment"
53-
# authSecretRef:
54-
# name: git-credentials
5553
clusterSelector: {}
5654
# matchLabels:
5755
# environment: development
58-
# ---
59-
# apiVersion: v1
60-
# kind: Secret
61-
# metadata:
62-
# name: git-credentials
63-
# namespace: default
64-
# type: Opaque
65-
# data:
66-
# # Base64 encoded username
67-
# username: <base64-encoded-username>
68-
# # Base64 encoded password/token
69-
# password: <base64-encoded-password-or-token>
70-
7156
```
7257

7358
### Cdk8sAppProxySpec Fields

api/v1alpha1/cdk8sappproxy_types.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package v1alpha1
1818

1919
import (
20-
corev1 "k8s.io/api/core/v1"
2120
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2221
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
2322
)
@@ -41,12 +40,6 @@ type GitRepositorySpec struct {
4140
// Defaults to the root of the repository.
4241
// +kubebuilder:validation:Required
4342
Path string `json:"path"`
44-
45-
// AuthSecretRef is a reference to a Secret in the same namespace
46-
// containing authentication credentials for the Git repository.
47-
// The secret must contain 'username' and 'password' fields.
48-
// +kubebuilder:validation:Optional
49-
AuthSecretRef *corev1.LocalObjectReference `json:"authSecretRef,omitempty"`
5043
}
5144

5245
// Cdk8sAppProxySpec defines the desired state of Cdk8sAppProxy.

api/v1alpha1/condition_consts.go

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,20 @@ import clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
2222
const (
2323
// DeploymentProgressingCondition indicates that the cdk8s application deployment is progressing.
2424
DeploymentProgressingCondition clusterv1.ConditionType = "DeploymentProgressing"
25-
// GitCloneFailedReason indicates that git clone operation failed.
26-
GitCloneFailedReason = "GitCloneFailed"
27-
// GitCheckoutFailedReason indicates that git checkout operation failed.
28-
GitCheckoutFailedReason = "GitCheckoutFailed"
29-
// SourceNotSpecifiedReason indicates that no source (GitRepository) was specified.
30-
SourceNotSpecifiedReason = "SourceNotSpecified"
25+
// GitCloneSuccessCondition indicates that the git clone operation was successful.
26+
GitCloneSuccessCondition = "GitCloneSuccess"
27+
// GitCloneFailedCondition indicates that git clone operation failed.
28+
GitCloneFailedCondition = "GitCloneFailed"
29+
// ValidGitRepositoryReason indicates that the given repository is valid.
30+
ValidGitRepositoryReason = "ValidGitRepository"
31+
// InvalidGitRepositoryReason indicates that the given repository is invalid.
32+
InvalidGitRepositoryReason = "InvalidGitRepository"
33+
// EmptyGitRepositoryReason indicates that no repository has been defined.
34+
EmptyGitRepositoryReason = "EmptyGitRepository"
35+
// GitHashSuccessReason indicates that the current commit hash was retrievable.
36+
GitHashSuccessReason = "GitHashSuccess"
37+
// GitHashFailureReason indicates that the current commit hash was not retrievable.
38+
GitHashFailureReason = "GitHashFailure"
3139
GitOperationFailedReason = "GitOperationFailed"
3240
// Cdk8sSynthFailedReason indicates that cdk8s synth operation failed.
3341
Cdk8sSynthFailedReason = "Cdk8sSynthFailed"
@@ -53,8 +61,6 @@ const (
5361
KubeconfigUnavailableReason = "KubeconfigUnavailable"
5462
// ResourceApplyFailedReason indicates that applying a resource to a target cluster failed.
5563
ResourceApplyFailedReason = "ResourceApplyFailed"
56-
// GitAuthSecretInvalidReason indicates that the specified Git authentication Secret is invalid or missing required fields.
57-
GitAuthSecretInvalidReason string = "GitAuthSecretInvalid"
5864
// GitAuthenticationFailedReason indicates that Git authentication failed (e.g., bad credentials).
5965
GitAuthenticationFailedReason string = "GitAuthenticationFailed"
6066
)

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/addons.cluster.x-k8s.io_cdk8sappproxies.yaml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -103,23 +103,6 @@ spec:
103103
description: GitRepository specifies the Git repository for the cdk8s
104104
app.
105105
properties:
106-
authSecretRef:
107-
description: |-
108-
AuthSecretRef is a reference to a Secret in the same namespace
109-
containing authentication credentials for the Git repository.
110-
The secret must contain 'username' and 'password' fields.
111-
properties:
112-
name:
113-
default: ""
114-
description: |-
115-
Name of the referent.
116-
This field is effectively required, but due to backwards compatibility is
117-
allowed to be empty. Instances of this type with an empty value here are
118-
almost certainly wrong.
119-
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
120-
type: string
121-
type: object
122-
x-kubernetes-map-type: atomic
123106
path:
124107
description: |-
125108
Path is the path within the repository where the cdk8s application is located.

config/default/manager_image_patch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ spec:
77
template:
88
spec:
99
containers:
10-
- image: ghcr.io/patricklaabs/cluster-api-addon-provider-cdk8s/cluster-api-cdk8s-controller:v0.3.2-preview.28
10+
- image: ghcr.io/patricklaabs/cluster-api-addon-provider-cdk8s/cluster-api-cdk8s-controller:v0.3.2-preview.39
1111
name: manager

config/default/manager_image_patch.yaml-e

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ spec:
77
template:
88
spec:
99
containers:
10-
- image: ghcr.io/patricklaabs/cluster-api-addon-provider-cdk8s/cluster-api-cdk8s-controller:v0.3.2-preview.28
10+
- image: ghcr.io/patricklaabs/cluster-api-addon-provider-cdk8s/cluster-api-cdk8s-controller:v0.3.2-preview.39
1111
name: manager

0 commit comments

Comments
 (0)