🐛 fix: harden operator reconciliation and install

This commit is contained in:
2026-08-13 03:29:29 +07:00
parent ab662a4fa4
commit e90dc8382b
28 changed files with 800 additions and 71 deletions
+6
View File
@@ -1,5 +1,7 @@
package v1alpha1
import corev1 "k8s.io/api/core/v1"
const (
Domain = "minikura.kirameki.cafe"
LabelPrefix = Domain
@@ -18,11 +20,15 @@ const (
ConditionReady = "Ready"
)
// +kubebuilder:validation:XValidation:rule="!(has(self.value) && has(self.valueFrom))",message="value and valueFrom are mutually exclusive"
type EnvVar struct {
Name string `json:"name"`
// +optional
Value string `json:"value,omitempty"`
// +optional
ValueFrom *corev1.EnvVarSource `json:"valueFrom,omitempty"`
}
// +kubebuilder:validation:Enum=ClusterIP;NodePort;LoadBalancer
@@ -46,8 +46,17 @@ type ReverseProxyServerSpec struct {
// +optional
Env []EnvVar `json:"env,omitempty"`
APIKeySecretRef string `json:"apiKeySecretRef"`
// BackendURL is the base URL used by the Minikura proxy plugin, including
// the API path (for example, http://minikura-backend:3000/api).
// +optional
APIKeySecretRef string `json:"apiKeySecretRef,omitempty"`
BackendURL string `json:"backendURL,omitempty"`
// PluginURL is a comma-separated list of download URLs understood by the
// proxy image's PLUGINS installer. It must include plugin dependencies.
// +optional
PluginURL string `json:"pluginURL,omitempty"`
// +optional
BackendSelector *metav1.LabelSelector `json:"backendSelector,omitempty"`
+16 -6
View File
@@ -5,13 +5,19 @@
package v1alpha1
import (
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *EnvVar) DeepCopyInto(out *EnvVar) {
*out = *in
if in.ValueFrom != nil {
in, out := &in.ValueFrom, &out.ValueFrom
*out = new(v1.EnvVarSource)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvVar.
@@ -132,7 +138,9 @@ func (in *MinecraftServerSpec) DeepCopyInto(out *MinecraftServerSpec) {
if in.Env != nil {
in, out := &in.Env, &out.Env
*out = make([]EnvVar, len(*in))
copy(*out, *in)
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
@@ -151,7 +159,7 @@ func (in *MinecraftServerStatus) DeepCopyInto(out *MinecraftServerStatus) {
*out = *in
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]v1.Condition, len(*in))
*out = make([]metav1.Condition, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
@@ -250,11 +258,13 @@ func (in *ReverseProxyServerSpec) DeepCopyInto(out *ReverseProxyServerSpec) {
if in.Env != nil {
in, out := &in.Env, &out.Env
*out = make([]EnvVar, len(*in))
copy(*out, *in)
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.BackendSelector != nil {
in, out := &in.BackendSelector, &out.BackendSelector
*out = new(v1.LabelSelector)
*out = new(metav1.LabelSelector)
(*in).DeepCopyInto(*out)
}
}
@@ -279,7 +289,7 @@ func (in *ReverseProxyServerStatus) DeepCopyInto(out *ReverseProxyServerStatus)
}
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]v1.Condition, len(*in))
*out = make([]metav1.Condition, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}