diff --git a/api/v1beta1/axonopscassandra_types.go b/api/v1beta1/axonopscassandra_types.go index a155038..6ae2338 100644 --- a/api/v1beta1/axonopscassandra_types.go +++ b/api/v1beta1/axonopscassandra_types.go @@ -69,6 +69,7 @@ type AxonOpsCassandraCluster struct { Labels map[string]string `json:"labels,omitempty"` Env []EnvVars `json:"env,omitempty"` Resources corev1.ResourceRequirements `json:"resources,omitempty"` + PullPolicy string `json:"pullPolicy,omitempty"` } // AxonOpsDashboard defines the dashboard @@ -82,6 +83,7 @@ type AxonOpsDashboard struct { Labels map[string]string `json:"labels,omitempty"` Env []EnvVars `json:"env,omitempty"` Resources corev1.ResourceRequirements `json:"resources,omitempty"` + PullPolicy string `json:"pullPolicy,omitempty"` } // AxonOpsServer defines the dashboard @@ -92,6 +94,7 @@ type AxonOpsServer struct { Labels map[string]string `json:"labels,omitempty"` Env []EnvVars `json:"env,omitempty"` Resources corev1.ResourceRequirements `json:"resources,omitempty"` + PullPolicy string `json:"pullPolicy,omitempty"` } // AxonOpsServer defines the dashboard @@ -103,6 +106,7 @@ type Elasticsearch struct { ClusterName string `json:"clusterName,omitempty"` Env []EnvVars `json:"env,omitempty"` Resources corev1.ResourceRequirements `json:"resources,omitempty"` + PullPolicy string `json:"pullPolicy,omitempty"` } // AxonOpsCassandraCluster defines the Apache Cassandra cluster to install diff --git a/apps/cassandra.go b/apps/cassandra.go index 480edad..333205e 100644 --- a/apps/cassandra.go +++ b/apps/cassandra.go @@ -31,8 +31,8 @@ import ( "k8s.io/apimachinery/pkg/util/yaml" ) -const defaultCassandraImage = "registry.axonops.com/axonops-public/axonops-docker/cassandra" -const defaultCassandraTag = "4.1" +const defaultCassandraImage = "ghcr.io/axonops/cassandra" +const defaultCassandraTag = "5.0.2" const cassandraHeadlessServiceTemplate = ` apiVersion: v1 @@ -145,6 +145,7 @@ spec: containers: - name: cassandra image: {{ .Image }} + imagePullPolicy: {{ .PullPolicy }} ports: - containerPort: 9042 name: cql @@ -289,6 +290,7 @@ type CassandraConfig struct { MemoryLimit string CpuRequest string MemoryRequest string + PullPolicy string } func GenerateCassandraConfig(cfg cassandraaxonopscomv1beta1.AxonOpsCassandra) (*appsv1.StatefulSet, error) { @@ -312,6 +314,7 @@ func GenerateCassandraConfig(cfg cassandraaxonopscomv1beta1.AxonOpsCassandra) (* MemoryRequest: utils.ValueOrDefault(cfg.Spec.Cassandra.Resources.Requests.Memory().String(), "1Gi"), CpuLimit: utils.ValueOrDefault(cfg.Spec.Cassandra.Resources.Limits.Cpu().String(), "1000m"), MemoryLimit: utils.ValueOrDefault(cfg.Spec.Cassandra.Resources.Limits.Memory().String(), "2Gi"), + PullPolicy: utils.ValueOrDefault(cfg.Spec.Cassandra.PullPolicy, "IfNotPresent"), } statefulSet := &appsv1.StatefulSet{} diff --git a/charts/axonops-developer-operator/Chart.yaml b/charts/axonops-developer-operator/Chart.yaml index 403bf31..c222537 100644 --- a/charts/axonops-developer-operator/Chart.yaml +++ b/charts/axonops-developer-operator/Chart.yaml @@ -11,10 +11,10 @@ kubeVersion: ">= 1.24.0-0" type: application # Chart version -version: 0.2.0 +version: 0.2.1 # Latest container tag -appVersion: v0.1.0-beta1 +appVersion: v0.1.0 maintainers: - email: info@axonops.com diff --git a/charts/axonops-developer-operator/crds/cassandra.axonops.com_axonopscassandras.yaml b/charts/axonops-developer-operator/crds/cassandra.axonops.com_axonopscassandras.yaml index 020e426..bd48c39 100644 --- a/charts/axonops-developer-operator/crds/cassandra.axonops.com_axonopscassandras.yaml +++ b/charts/axonops-developer-operator/crds/cassandra.axonops.com_axonopscassandras.yaml @@ -52,6 +52,19 @@ spec: additionalProperties: type: string type: object + env: + items: + description: EnvVars lists the environmetn variables to + add to the deployment or statefulset + properties: + name: + description: Environment variable name + type: string + value: + description: Environment variable value + type: string + type: object + type: array image: description: Change the default repository and tag properties: @@ -120,16 +133,87 @@ spec: additionalProperties: type: string type: object + pullPolicy: + type: string replicas: description: Increase the number of replicas if desired from the default, 1 type: integer + resources: + description: ResourceRequirements describes the compute resource + requirements. + properties: + claims: + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + + This field is immutable. It can only be set for containers. + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. Requests cannot exceed Limits. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + type: object type: object elasticsearch: description: AxonOpsServer defines the dashboard properties: clusterName: type: string + env: + items: + description: EnvVars lists the environmetn variables to + add to the deployment or statefulset + properties: + name: + description: Environment variable name + type: string + value: + description: Environment variable value + type: string + type: object + type: array image: description: Container image definition with repository and tag @@ -146,10 +230,70 @@ spec: specification properties: size: + description: Storage size type: string storageClass: + description: Optional Storage Class name type: string type: object + pullPolicy: + type: string + resources: + description: ResourceRequirements describes the compute resource + requirements. + properties: + claims: + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + + This field is immutable. It can only be set for containers. + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. Requests cannot exceed Limits. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + type: object type: object server: description: AxonOpsServer defines the dashboard @@ -158,6 +302,19 @@ spec: additionalProperties: type: string type: object + env: + items: + description: EnvVars lists the environmetn variables to + add to the deployment or statefulset + properties: + name: + description: Environment variable name + type: string + value: + description: Environment variable value + type: string + type: object + type: array image: description: Container image definition with repository and tag @@ -171,6 +328,64 @@ spec: additionalProperties: type: string type: object + pullPolicy: + type: string + resources: + description: ResourceRequirements describes the compute resource + requirements. + properties: + claims: + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + + This field is immutable. It can only be set for containers. + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. Requests cannot exceed Limits. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + type: object type: object type: object cassandra: @@ -186,6 +401,19 @@ spec: type: object clusterName: type: string + env: + items: + description: EnvVars lists the environmetn variables to add + to the deployment or statefulset + properties: + name: + description: Environment variable name + type: string + value: + description: Environment variable value + type: string + type: object + type: array heapSize: type: string image: @@ -206,12 +434,72 @@ spec: specification properties: size: + description: Storage size type: string storageClass: + description: Optional Storage Class name type: string type: object + pullPolicy: + type: string replicas: type: integer + resources: + description: ResourceRequirements describes the compute resource + requirements. + properties: + claims: + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + + This field is immutable. It can only be set for containers. + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. Requests cannot exceed Limits. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + type: object type: object type: object status: diff --git a/config/crd/bases/axonops.com_axonopscassandras.yaml b/config/crd/bases/axonops.com_axonopscassandras.yaml index 0789d8b..622ade5 100644 --- a/config/crd/bases/axonops.com_axonopscassandras.yaml +++ b/config/crd/bases/axonops.com_axonopscassandras.yaml @@ -131,6 +131,8 @@ spec: additionalProperties: type: string type: object + pullPolicy: + type: string replicas: description: Increase the number of replicas if desired from the default, 1 @@ -232,6 +234,8 @@ spec: description: Optional Storage Class name type: string type: object + pullPolicy: + type: string resources: description: ResourceRequirements describes the compute resource requirements. @@ -322,6 +326,8 @@ spec: additionalProperties: type: string type: object + pullPolicy: + type: string resources: description: ResourceRequirements describes the compute resource requirements. @@ -432,6 +438,8 @@ spec: description: Optional Storage Class name type: string type: object + pullPolicy: + type: string replicas: type: integer resources: