Xe's Kubernetes custom resources
0

Configure Feed

Select the types of activity you want to include in your feed.

fix: use internal.EnvVar instead of corev1.EnvVar

Signed-off-by: Xe Iaso <me@xeiaso.net>

+42 -19
+1 -1
app/nginx.yaml app/example.yaml
··· 13 13 14 14 ingress: 15 15 enabled: true 16 - host: nginx.limsa-lominsa.within.lgbt 16 + host: nginx.alrest.within.lgbt
+9 -9
app/v1/app.go
··· 5 5 "encoding/json" 6 6 "fmt" 7 7 8 - corev1 "k8s.io/api/core/v1" 9 8 rbacv1 "k8s.io/api/rbac/v1" 10 9 "k8s.io/apimachinery/pkg/api/resource" 11 10 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 11 + "tangled.org/xeiaso.net/crds/internal" 12 12 ) 13 13 14 14 const ( ··· 25 25 26 26 // Our Backend Specification 27 27 type AppSpec struct { 28 - AutoUpdate bool `json:"autoUpdate,omitempty" yaml:"autoUpdate,omitempty"` 29 - Image string `json:"image" yaml:"image"` 30 - ImagePullSecrets []string `json:"imagePullSecrets,omitempty" yaml:"imagePullSecrets,omitempty"` 31 - LogLevel string `json:"logLevel,omitempty" yaml:"logLevel,omitempty"` 32 - Replicas int32 `json:"replicas,omitempty" yaml:"replicas,omitempty"` 33 - Port int `json:"port,omitempty" yaml:"port,omitempty"` 34 - RunAsRoot bool `json:"runAsRoot,omitempty" yaml:"runAsRoot,omitempty"` 35 - Env []corev1.EnvVar `json:"env,omitempty" yaml:"env,omitempty"` 28 + AutoUpdate bool `json:"autoUpdate,omitempty" yaml:"autoUpdate,omitempty"` 29 + Image string `json:"image" yaml:"image"` 30 + ImagePullSecrets []string `json:"imagePullSecrets,omitempty" yaml:"imagePullSecrets,omitempty"` 31 + LogLevel string `json:"logLevel,omitempty" yaml:"logLevel,omitempty"` 32 + Replicas int32 `json:"replicas,omitempty" yaml:"replicas,omitempty"` 33 + Port int `json:"port,omitempty" yaml:"port,omitempty"` 34 + RunAsRoot bool `json:"runAsRoot,omitempty" yaml:"runAsRoot,omitempty"` 35 + Env []internal.EnvVar `json:"env,omitempty" yaml:"env,omitempty"` 36 36 37 37 // Resources *corev1.ResourceRequirements `json:"resources,omitempty" yaml:"resources,omitempty"` 38 38
+3 -1
app/v1/flight/main.go
··· 193 193 } 194 194 195 195 if backend.Spec.Env != nil { 196 - result.Spec.Template.Spec.Containers[0].Env = append(result.Spec.Template.Spec.Containers[0].Env, backend.Spec.Env...) 196 + for _, envvar := range backend.Spec.Env { 197 + result.Spec.Template.Spec.Containers[0].Env = append(result.Spec.Template.Spec.Containers[0].Env, envvar.ToCoreV1()) 198 + } 197 199 } 198 200 199 201 // if backend.Spec.Resources != nil {
+3 -1
db/postgres/v1/flight/main.go
··· 150 150 } 151 151 152 152 if backend.Spec.Env != nil { 153 - result.Spec.Template.Spec.Containers[0].Env = append(result.Spec.Template.Spec.Containers[0].Env, backend.Spec.Env...) 153 + for _, envvar := range backend.Spec.Env { 154 + result.Spec.Template.Spec.Containers[0].Env = append(result.Spec.Template.Spec.Containers[0].Env, envvar.ToCoreV1()) 155 + } 154 156 } 155 157 156 158 // Expose generated DB credentials from the conventionally-named secret
+3 -3
db/postgres/v1/postgres.go
··· 4 4 "encoding/json" 5 5 "fmt" 6 6 7 - corev1 "k8s.io/api/core/v1" 8 7 "k8s.io/apimachinery/pkg/api/resource" 9 8 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 9 + "tangled.org/xeiaso.net/crds/internal" 10 10 ) 11 11 12 12 const ( ··· 22 22 } 23 23 24 24 type PostgresSpec struct { 25 - Env []corev1.EnvVar `json:"env,omitempty" yaml:"env,omitempty"` 26 - Healthcheck bool `json:"healthcheck,omitempty" yaml:"healthcheck,omitempty"` 25 + Env []internal.EnvVar `json:"env,omitempty" yaml:"env,omitempty"` 26 + Healthcheck bool `json:"healthcheck,omitempty" yaml:"healthcheck,omitempty"` 27 27 28 28 Storage Storage `json:"storage,omitempty" yaml:"storage,omitempty"` 29 29 Secrets []Secret `json:"secrets,omitempty" yaml:"secrets,omitempty"`
+3 -1
db/valkey/v1/flight/main.go
··· 146 146 } 147 147 148 148 if backend.Spec.Env != nil { 149 - result.Spec.Template.Spec.Containers[0].Env = append(result.Spec.Template.Spec.Containers[0].Env, backend.Spec.Env...) 149 + for _, envvar := range backend.Spec.Env { 150 + result.Spec.Template.Spec.Containers[0].Env = append(result.Spec.Template.Spec.Containers[0].Env, envvar.ToCoreV1()) 151 + } 150 152 } 151 153 152 154 if backend.Spec.Healthcheck {
+3 -3
db/valkey/v1/valkey.go
··· 4 4 "encoding/json" 5 5 "fmt" 6 6 7 - corev1 "k8s.io/api/core/v1" 8 7 "k8s.io/apimachinery/pkg/api/resource" 9 8 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 9 + "tangled.org/xeiaso.net/crds/internal" 10 10 ) 11 11 12 12 const ( ··· 22 22 } 23 23 24 24 type ValkeySpec struct { 25 - Env []corev1.EnvVar `json:"env,omitempty" yaml:"env,omitempty"` 26 - Healthcheck bool `json:"healthcheck,omitempty" yaml:"healthcheck,omitempty"` 25 + Env []internal.EnvVar `json:"env,omitempty" yaml:"env,omitempty"` 26 + Healthcheck bool `json:"healthcheck,omitempty" yaml:"healthcheck,omitempty"` 27 27 28 28 Storage *Storage `json:"storage,omitempty" yaml:"storage,omitempty"` 29 29 Secrets []Secret `json:"secrets,omitempty" yaml:"secrets,omitempty"`
+17
internal/envvar.go
··· 1 + package internal 2 + 3 + import ( 4 + corev1 "k8s.io/api/core/v1" 5 + ) 6 + 7 + type EnvVar struct { 8 + Name string `json:"name" yaml:"name"` 9 + Value string `json:"value,omitempty" yaml:"value,omitempty"` 10 + } 11 + 12 + func (ev EnvVar) ToCoreV1() corev1.EnvVar { 13 + return corev1.EnvVar{ 14 + Name: ev.Name, 15 + Value: ev.Value, 16 + } 17 + }