Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ const (
ConditionCertificateReady = "CertificateReady"
)

// RedirectDomainSpec defines the desired state of RedirectDomain.
// DecoRedirectSpec defines the desired state of DecoRedirect.
// +kubebuilder:validation:XValidation:rule="(self.to+'/').contains('.'+self.from+'/') || (self.to+'/').contains('//'+self.from+'/')",message="redirect target must be within the same domain as 'from' (e.g. from: client.com → to: https://www.client.com)"
type RedirectDomainSpec struct {
type DecoRedirectSpec struct {
// From is the apex domain to redirect (e.g. "client.com").
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
Expand All @@ -24,37 +24,38 @@ type RedirectDomainSpec struct {
To string `json:"to"`
}

// RedirectDomainStatus defines the observed state of RedirectDomain.
type RedirectDomainStatus struct {
// Conditions represent the latest observations of the RedirectDomain's state.
// DecoRedirectStatus defines the observed state of DecoRedirect.
type DecoRedirectStatus struct {
// Conditions represent the latest observations of the DecoRedirect's state.
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=decoredict,singular=decoredirect
// +kubebuilder:printcolumn:name="From",type="string",JSONPath=".spec.from"
// +kubebuilder:printcolumn:name="To",type="string",JSONPath=".spec.to"
// +kubebuilder:printcolumn:name="CertReady",type="string",JSONPath=".status.conditions[?(@.type=='CertificateReady')].status"

// RedirectDomain manages a TLS-terminated apex redirect via cert-manager and nginx Ingress.
type RedirectDomain struct {
// DecoRedirect manages a TLS-terminated apex redirect via cert-manager and nginx Ingress.
type DecoRedirect struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec RedirectDomainSpec `json:"spec,omitempty"`
Status RedirectDomainStatus `json:"status,omitempty"`
Spec DecoRedirectSpec `json:"spec,omitempty"`
Status DecoRedirectStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

// RedirectDomainList contains a list of RedirectDomain.
type RedirectDomainList struct {
// DecoRedirectList contains a list of DecoRedirect.
type DecoRedirectList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []RedirectDomain `json:"items"`
Items []DecoRedirect `json:"items"`
}

func init() {
SchemeBuilder.Register(&RedirectDomain{}, &RedirectDomainList{})
SchemeBuilder.Register(&DecoRedirect{}, &DecoRedirectList{})
}
192 changes: 96 additions & 96 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions chart/templates/clusterrole-operator-manager-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ rules:
- deco.sites
resources:
- decofiles
- decoredict
- decos
- redirectdomains
verbs:
- create
- delete
Expand All @@ -92,16 +92,16 @@ rules:
- deco.sites
resources:
- decofiles/finalizers
- decoredict/finalizers
- decos/finalizers
- redirectdomains/finalizers
verbs:
- update
- apiGroups:
- deco.sites
resources:
- decofiles/status
- decoredict/status
- decos/status
- redirectdomains/status
verbs:
- get
- patch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.18.0
name: redirectdomains.deco.sites
name: decoredict.deco.sites
spec:
group: deco.sites
names:
kind: RedirectDomain
listKind: RedirectDomainList
plural: redirectdomains
singular: redirectdomain
kind: DecoRedirect
listKind: DecoRedirectList
plural: decoredict
singular: decoredirect
scope: Namespaced
versions:
- additionalPrinterColumns:
Expand All @@ -26,7 +26,7 @@ spec:
name: v1alpha1
schema:
openAPIV3Schema:
description: RedirectDomain manages a TLS-terminated apex redirect via cert-manager
description: DecoRedirect manages a TLS-terminated apex redirect via cert-manager
and nginx Ingress.
properties:
apiVersion:
Expand All @@ -47,7 +47,7 @@ spec:
metadata:
type: object
spec:
description: RedirectDomainSpec defines the desired state of RedirectDomain.
description: DecoRedirectSpec defines the desired state of DecoRedirect.
properties:
from:
description: From is the apex domain to redirect (e.g. "client.com").
Expand All @@ -71,10 +71,10 @@ spec:
(e.g. from: client.com → to: https://www.client.com)'
rule: (self.to+'/').contains('.'+self.from+'/') || (self.to+'/').contains('//'+self.from+'/')
status:
description: RedirectDomainStatus defines the observed state of RedirectDomain.
description: DecoRedirectStatus defines the observed state of DecoRedirect.
properties:
conditions:
description: Conditions represent the latest observations of the RedirectDomain's
description: Conditions represent the latest observations of the DecoRedirect's
state.
items:
description: Condition contains details for one aspect of the current
Expand Down
6 changes: 3 additions & 3 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ build:
tolerations: [] # Default tolerations for build pods (overridable per-site via spec.build.tolerations)

# ── Operator Management API ──────────────────────────────────────────────────
# General HTTP API for managing operator resources (RedirectDomains, etc.).
# General HTTP API for managing operator resources (DecoRedirects, etc.).
# Enabled when username+password (or existingSecret) are set.
# Set hostname to auto-create an Ingress+Certificate via the cluster default ingress.
operatorApi:
Expand All @@ -129,10 +129,10 @@ operatorApi:

# ── Domain Redirect ──────────────────────────────────────────────────────────
# Application-level redirect config — all features are opt-in.
# Set ingressClass to enable RedirectDomain reconciliation.
# Set ingressClass to enable DecoRedirect reconciliation.
redirect:
namespace: "deco-redirect-system"
ingressClass: "" # set to enable RedirectDomain controller (e.g. "redirect-nginx")
ingressClass: "" # set to enable DecoRedirect controller (e.g. "redirect-nginx")
clusterIssuer:
enabled: false # set true to create the Let's Encrypt ClusterIssuer
name: "" # ClusterIssuer name (e.g. "letsencrypt")
Expand Down
8 changes: 4 additions & 4 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ func main() {
var redirectNamespace string
flag.StringVar(&redirectNamespace, "redirect-namespace",
getEnvOrDefault("REDIRECT_NAMESPACE", "deco-redirect-system"),
"Default namespace for RedirectDomain resources.")
"Default namespace for DecoRedirect resources.")

var redirectIngressClass string
var redirectClusterIssuer string
flag.StringVar(&redirectIngressClass, "redirect-ingress-class",
getEnvOrDefault("REDIRECT_INGRESS_CLASS", "nginx"),
"IngressClass name for RedirectDomain Ingress resources.")
"IngressClass name for DecoRedirect Ingress resources.")
flag.StringVar(&redirectClusterIssuer, "redirect-cluster-issuer",
getEnvOrDefault("REDIRECT_CLUSTER_ISSUER", "letsencrypt"),
"cert-manager ClusterIssuer name (matches redirect.clusterIssuer.name in values).")
Expand Down Expand Up @@ -366,13 +366,13 @@ func main() {
setupLog.Error(err, "unable to create controller", "controller", "Deco")
os.Exit(1)
}
if err := (&controller.RedirectDomainReconciler{
if err := (&controller.DecoRedirectReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
IngressClass: redirectIngressClass,
ClusterIssuer: redirectClusterIssuer,
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "RedirectDomain")
setupLog.Error(err, "unable to create controller", "controller", "DecoRedirect")
os.Exit(1)
}
apiUser := os.Getenv("OPERATOR_API_USER")
Expand Down
Loading
Loading