feat: update test
This commit is contained in:
parent
28149b86a6
commit
57c5e5526b
@ -28,12 +28,11 @@ import (
|
|||||||
// AppServiceSpec defines the desired state of AppService
|
// AppServiceSpec defines the desired state of AppService
|
||||||
type AppServiceSpec struct {
|
type AppServiceSpec struct {
|
||||||
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
|
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
|
||||||
// Important: Run "make" to regenerate code after modifying this file
|
// Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
|
||||||
|
// Add custom validation using kubebuilder tags: https://book.kubebuilder.io/beyond_basics/generating_crd.html
|
||||||
// Foo is an example field of AppService. Edit appservice_types.go to remove/update
|
|
||||||
Size *int32 `json:"size"`
|
Size *int32 `json:"size"`
|
||||||
Image string `json:"image"`
|
Image string `json:"image"`
|
||||||
Resources *Resources `json:"resource,omitempty"`
|
Resources *Resources `json:"resources,omitempty"`
|
||||||
Envs []corev1.EnvVar `json:"envs,omitempty"`
|
Envs []corev1.EnvVar `json:"envs,omitempty"`
|
||||||
Ports []corev1.ServicePort `json:"ports,omitempty"`
|
Ports []corev1.ServicePort `json:"ports,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ spec:
|
|||||||
- port
|
- port
|
||||||
type: object
|
type: object
|
||||||
type: array
|
type: array
|
||||||
resource:
|
resources:
|
||||||
properties:
|
properties:
|
||||||
limits:
|
limits:
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
@ -225,8 +225,10 @@ spec:
|
|||||||
type: object
|
type: object
|
||||||
type: object
|
type: object
|
||||||
size:
|
size:
|
||||||
description: Foo is an example field of AppService. Edit appservice_types.go
|
description: 'INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
|
||||||
to remove/update
|
Important: Run "operator-sdk generate k8s" to regenerate code after
|
||||||
|
modifying this file Add custom validation using kubebuilder tags:
|
||||||
|
https://book.kubebuilder.io/beyond_basics/generating_crd.html'
|
||||||
format: int32
|
format: int32
|
||||||
type: integer
|
type: integer
|
||||||
required:
|
required:
|
||||||
|
@ -203,17 +203,25 @@ func newContainers(instance *apptreesirpubv1alpha1.AppService) []corev1.Containe
|
|||||||
cport.ContainerPort = svcPort.TargetPort.IntVal
|
cport.ContainerPort = svcPort.TargetPort.IntVal
|
||||||
containerPorts = append(containerPorts, cport)
|
containerPorts = append(containerPorts, cport)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
container := corev1.Container{
|
||||||
|
Name: instance.Name,
|
||||||
|
Image: instance.Spec.Image,
|
||||||
|
Ports: containerPorts,
|
||||||
|
ImagePullPolicy: corev1.PullIfNotPresent,
|
||||||
|
Env: instance.Spec.Envs,
|
||||||
|
}
|
||||||
|
|
||||||
|
if instance.Spec.Resources != nil {
|
||||||
|
if instance.Spec.Resources.Requests != nil {
|
||||||
|
container.Resources.Requests = instance.Spec.Resources.Requests
|
||||||
|
}
|
||||||
|
if instance.Spec.Resources.Limits != nil {
|
||||||
|
container.Resources.Limits = instance.Spec.Resources.Limits
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return []corev1.Container{
|
return []corev1.Container{
|
||||||
{
|
container,
|
||||||
Name: instance.Name,
|
|
||||||
Image: instance.Spec.Image,
|
|
||||||
Resources: corev1.ResourceRequirements{
|
|
||||||
Requests: instance.Spec.Resources.Requests,
|
|
||||||
Limits: instance.Spec.Resources.Limits,
|
|
||||||
},
|
|
||||||
Ports: containerPorts,
|
|
||||||
ImagePullPolicy: corev1.PullIfNotPresent,
|
|
||||||
Env: instance.Spec.Envs,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
17
test.yaml
Normal file
17
test.yaml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
apiVersion: app.treesir.pub.treesir.pub/v1alpha1
|
||||||
|
kind: AppService
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: appservice
|
||||||
|
app.kubernetes.io/instance: appservice-sample
|
||||||
|
app.kubernetes.io/part-of: opdemo
|
||||||
|
app.kubernetes.io/managed-by: kustomize
|
||||||
|
app.kubernetes.io/created-by: opdemo
|
||||||
|
name: appservice-sample
|
||||||
|
spec:
|
||||||
|
size: 2
|
||||||
|
image: nginx:1.7.9
|
||||||
|
ports:
|
||||||
|
- port: 80
|
||||||
|
targetPort: 80
|
||||||
|
nodePort: 30002
|
Loading…
x
Reference in New Issue
Block a user