Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ CAPI_KIND_CLUSTER_NAME ?= capi-test

# It is set by Prow GIT_TAG, a git-based tag of the form vYYYYMMDD-hash, e.g., v20210120-v0.3.10-308-gc61521971

TAG ?= v0.2.1-alpha
TAG ?= v0.2.4-alpha
ARCH ?= $(shell go env GOARCH)
ALL_ARCH = amd64 arm arm64

Expand Down
10 changes: 7 additions & 3 deletions api/v1alpha1/cdk8sappproxy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package v1alpha1

import (
corev1 "k8s.io/api/core/v1" // Ensure this import
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
)
Expand Down Expand Up @@ -84,8 +84,12 @@ type Cdk8sAppProxyStatus struct {
LastRemoteGitHash string `json:"lastRemoteGitHash,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].reason"
// +kubebuilder:printcolumn:name="Message",type="string",priority=1,JSONPath=".status.conditions[?(@.type=='Ready')].message"
// +kubebuilder:resource:shortName=cap

// Cdk8sAppProxy is the Schema for the cdk8sappproxies API.
type Cdk8sAppProxy struct {
Expand Down
18 changes: 8 additions & 10 deletions api/v1alpha1/cdk8sappproxy_webook.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package v1alpha1

import (
"context"
"fmt"

"k8s.io/apimachinery/pkg/runtime"
runtime "k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/webhook"
Expand All @@ -22,10 +21,11 @@ func (r *Cdk8sAppProxy) SetupWebhookWithManager(mgr ctrl.Manager) error {

// +kubebuilder:webhook:path=/mutate-addons-cluster-x-k8s-io-v1alpha1-cdk8sappproxy,mutating=true,failurePolicy=fail,sideEffects=None,groups=addons.cluster.x-k8s.io,resources=cdk8sappproxies,verbs=create;update,versions=v1alpha1,name=cdk8sappproxy.kb.io,admissionReviewVersions=v1

var _ webhook.CustomDefaulter = &Cdk8sAppProxy{}
// var _ webhook.CustomDefaulter = &Cdk8sAppProxy{}
var _ webhook.Defaulter = &Cdk8sAppProxy{}

// Default implements webhook.CustomDefaulter so a webhook will be registered for the type
func (r *Cdk8sAppProxy) Default(ctx context.Context, obj runtime.Object) error {
func (r *Cdk8sAppProxy) Default() {
cdk8sappproxylog.Info("default", "name", r.Name)

// Set default git reference if not specified
Expand All @@ -37,30 +37,28 @@ func (r *Cdk8sAppProxy) Default(ctx context.Context, obj runtime.Object) error {
if r.Spec.GitRepository != nil && r.Spec.GitRepository.Path == "" {
r.Spec.GitRepository.Path = "."
}

return nil
}

// +kubebuilder:webhook:path=/validate-addons-cluster-x-k8s-io-v1alpha1-cdk8sappproxy,mutating=false,failurePolicy=fail,sideEffects=None,groups=addons.cluster.x-k8s.io,resources=cdk8sappproxies,verbs=create;update,versions=v1alpha1,name=cdk8sappproxy.kb.io,admissionReviewVersions=v1

var _ webhook.CustomValidator = &Cdk8sAppProxy{}
var _ webhook.Validator = &Cdk8sAppProxy{}

// ValidateCreate implements webhook.CustomValidator so a webhook will be registered for the type
func (r *Cdk8sAppProxy) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
func (r *Cdk8sAppProxy) ValidateCreate() (admission.Warnings, error) {
cdk8sappproxylog.Info("validate create", "name", r.Name)

return r.validateCdk8sAppProxy()
}

// ValidateUpdate implements webhook.CustomValidator so a webhook will be registered for the type
func (r *Cdk8sAppProxy) ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) (admission.Warnings, error) {
func (r *Cdk8sAppProxy) ValidateUpdate(oldRaw runtime.Object) (admission.Warnings, error) {
cdk8sappproxylog.Info("validate update", "name", r.Name)

return r.validateCdk8sAppProxy()
}

// ValidateDelete implements webhook.CustomValidator so a webhook will be registered for the type
func (r *Cdk8sAppProxy) ValidateDelete(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
func (r *Cdk8sAppProxy) ValidateDelete() (admission.Warnings, error) {
cdk8sappproxylog.Info("validate delete", "name", r.Name)

// No validation needed for delete
Expand Down
4 changes: 0 additions & 4 deletions api/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,3 @@ var (
// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)

func init() {
SchemeBuilder.Register(&Cdk8sAppProxy{}, &Cdk8sAppProxyList{})
}
28 changes: 17 additions & 11 deletions config/crd/bases/addons.cluster.x-k8s.io_cdk8sappproxies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,23 @@ spec:
kind: Cdk8sAppProxy
listKind: Cdk8sAppProxyList
plural: cdk8sappproxies
shortNames:
- cap
singular: cdk8sappproxy
scope: Namespaced
versions:
- name: v1alpha1
- additionalPrinterColumns:
- jsonPath: .status.conditions[?(@.type=='Ready')].status
name: Ready
type: string
- jsonPath: .status.conditions[?(@.type=='Ready')].reason
name: Reason
type: string
- jsonPath: .status.conditions[?(@.type=='Ready')].message
name: Message
priority: 1
type: string
name: v1alpha1
schema:
openAPIV3Schema:
description: Cdk8sAppProxy is the Schema for the cdk8sappproxies API.
Expand Down Expand Up @@ -145,32 +158,27 @@ spec:
properties:
lastTransitionTime:
description: |-
lastTransitionTime is the last time the condition transitioned from one status to another.
Last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when
the API field changed is acceptable.
format: date-time
type: string
message:
description: |-
message is a human readable message indicating details about the transition.
A human readable message indicating details about the transition.
This field may be empty.
maxLength: 10240
minLength: 1
type: string
reason:
description: |-
reason is the reason for the condition's last transition in CamelCase.
The reason for the condition's last transition in CamelCase.
The specific API may choose whether or not this field is considered a guaranteed API.
This field may be empty.
maxLength: 256
minLength: 1
type: string
severity:
description: |-
severity provides an explicit classification of Reason code, so the users or machines can immediately
understand the current situation and act accordingly.
The Severity field MUST be set only when Status=False.
maxLength: 32
type: string
status:
description: status of the condition, one of True, False, Unknown.
Expand All @@ -180,8 +188,6 @@ spec:
type of condition in CamelCase or in foo.example.com/CamelCase.
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions
can be useful (see .node.status.conditions), the ability to deconflict is important.
maxLength: 256
minLength: 1
type: string
required:
- lastTransitionTime
Expand Down
2 changes: 1 addition & 1 deletion config/default/manager_image_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ spec:
template:
spec:
containers:
- image: ghcr.io/patricklaabs/cluster-api-addon-provider-cdk8s/cluster-api-cdk8s-controller:v0.2.1-alpha
- image: ghcr.io/patricklaabs/cluster-api-addon-provider-cdk8s/cluster-api-cdk8s-controller:v0.2.4-alpha
name: manager
2 changes: 1 addition & 1 deletion config/default/manager_image_patch.yaml-e
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ spec:
template:
spec:
containers:
- image: ghcr.io/patricklaabs/cluster-api-addon-provider-cdk8s/cluster-api-cdk8s-controller-arm64:v0.2.1-alpha
- image: ghcr.io/patricklaabs/cluster-api-addon-provider-cdk8s/cluster-api-cdk8s-controller:v0.2.4-alpha
name: manager
2 changes: 1 addition & 1 deletion config/default/manager_pull_policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ spec:
spec:
containers:
- name: manager
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
2 changes: 1 addition & 1 deletion config/default/manager_pull_policy.yaml-e
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ spec:
spec:
containers:
- name: manager
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
21 changes: 12 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ require (
github.com/pkg/errors v0.9.1
github.com/spf13/pflag v1.0.6
github.com/stretchr/testify v1.10.0
k8s.io/api v0.33.1
k8s.io/apimachinery v0.33.1
k8s.io/client-go v0.33.1
k8s.io/component-base v0.33.1
k8s.io/api v0.32.3
k8s.io/apimachinery v0.32.3
k8s.io/client-go v0.32.3
k8s.io/component-base v0.32.3
k8s.io/klog/v2 v2.130.1
sigs.k8s.io/cluster-api v1.10.2
sigs.k8s.io/controller-runtime v0.21.0
sigs.k8s.io/cluster-api v1.9.8
sigs.k8s.io/controller-runtime v0.19.6
)

require (
Expand All @@ -29,6 +29,7 @@ require (
github.com/NYTimes/gziphandler v1.1.1 // indirect
github.com/ProtonMail/go-crypto v1.1.6 // indirect
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
Expand All @@ -53,10 +54,12 @@ require (
github.com/gobuffalo/flect v1.0.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/btree v1.1.3 // indirect
github.com/google/cel-go v0.23.2 // indirect
github.com/google/cel-go v0.22.0 // indirect
github.com/google/gnostic-models v0.6.9 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.24.0 // indirect
Expand Down Expand Up @@ -119,8 +122,8 @@ require (
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.33.0 // indirect
k8s.io/apiserver v0.33.0 // indirect
k8s.io/apiextensions-apiserver v0.32.3 // indirect
k8s.io/apiserver v0.32.3 // indirect
k8s.io/cluster-bootstrap v0.32.3 // indirect
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect
Expand Down
Loading
Loading