diff --git a/Makefile b/Makefile index 5d684afe..cd6704b5 100644 --- a/Makefile +++ b/Makefile @@ -332,11 +332,11 @@ helm-uninstall-pulsar: ## Uninstall Apache Pulsar using Helm. .PHONY: helm-install-postgres helm-install-postgres: helm-repos ## Install PostgreSQL using Helm. - helm upgrade --install postgres bitnami/postgresql --values dev/quickstart/postgres.values.yaml --create-namespace --namespace data + helm upgrade --install postgresql bitnami/postgresql --values dev/quickstart/postgres.values.yaml --create-namespace --namespace data .PHONY: helm-uninstall-postgres helm-uninstall-postgres: ## Uninstall PostgreSQL using Helm. - helm uninstall postgres --namespace data + helm uninstall postgresql --namespace data .PHONY: helm-install-redis helm-install-redis: helm-repos ## Install Redis using Helm. diff --git a/api/install/v1alpha1/common.go b/api/install/v1alpha1/common.go index 8d7a3f40..d71bef84 100644 --- a/api/install/v1alpha1/common.go +++ b/api/install/v1alpha1/common.go @@ -23,6 +23,12 @@ import ( "sigs.k8s.io/yaml" ) +const ( + defaultHTTPPort = 8080 + defaultGRPCPort = 50051 + defaultMetricsPort = 9000 +) + type Image struct { // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:Pattern:="^([a-z0-9]+(?:[._-][a-z0-9]+)*/*)+$" @@ -73,6 +79,7 @@ type PortConfig struct { MetricsPort int32 `json:"metricsPort"` } +// CommonSpecBase is the common configuration for all services. // NOTE(Clif): You must label this with `json:""` when using it as an embedded // struct in order for controller-gen to use the promoted fields as expected. type CommonSpecBase struct { @@ -114,9 +121,9 @@ func BuildPortConfig(rawAppConfig runtime.RawExtension) (PortConfig, error) { } // defaults portConfig := PortConfig{ - HttpPort: 8080, - GrpcPort: 50051, - MetricsPort: 9000, + HttpPort: defaultHTTPPort, + GrpcPort: defaultGRPCPort, + MetricsPort: defaultMetricsPort, } err = yaml.Unmarshal([]byte(appConfig), &portConfig) if err != nil { diff --git a/dev/crd/out.md b/dev/crd/out.md index f2692f10..ce56405b 100644 --- a/dev/crd/out.md +++ b/dev/crd/out.md @@ -289,6 +289,7 @@ _Appears in:_ +CommonSpecBase is the common configuration for all services. NOTE(Clif): You must label this with `json:""` when using it as an embedded struct in order for controller-gen to use the promoted fields as expected. diff --git a/dev/quickstart/armada-crs.yaml b/dev/quickstart/armada-crs.yaml index 9a5fd534..09f099f4 100644 --- a/dev/quickstart/armada-crs.yaml +++ b/dev/quickstart/armada-crs.yaml @@ -10,10 +10,18 @@ spec: replicas: 1 image: repository: gresearch/armada-server - tag: 0.8.2 + tag: latest applicationConfig: httpNodePort: 30001 grpcNodePort: 30002 + schedulerApiConnection: + armadaUrl: "armada-scheduler.armada.svc.cluster.local:50051" + forceNoTls: true + corsAllowedOrigins: + - "http://localhost:3000" + - "http://localhost:8089" + - "http://localhost:10000" + - "http://localhost:30000" auth: anonymousAuth: true permissionGroupMapping: @@ -33,7 +41,7 @@ spec: - redis-ha.data.svc.cluster.local:6379 postgres: connection: - host: postgres-postgresql.data.svc.cluster.local + host: postgresql.data.svc.cluster.local port: 5432 user: postgres password: psw @@ -42,7 +50,7 @@ spec: queryapi: postgres: connection: - host: postgres-postgresql.data.svc.cluster.local + host: postgresql.data.svc.cluster.local port: 5432 user: postgres password: psw @@ -62,7 +70,7 @@ metadata: spec: image: repository: gresearch/armada-executor - tag: 0.8.2 + tag: latest applicationConfig: executorApiConnection: armadaUrl: armada-scheduler.armada.svc.cluster.local:50051 @@ -79,7 +87,7 @@ spec: ingressClass: "nginx" image: repository: gresearch/armada-lookout-v2 - tag: 0.8.2 + tag: latest prometheus: enabled: true applicationConfig: @@ -89,9 +97,11 @@ spec: apiPort: 8080 corsAllowedOrigins: - "http://localhost" + uiConfig: + armadaApiBaseUrl: "http://localhost:30001" postgres: connection: - host: postgres-postgresql.data.svc.cluster.local + host: postgresql.data.svc.cluster.local port: 5432 user: postgres password: psw @@ -106,11 +116,11 @@ metadata: spec: image: repository: gresearch/armada-lookout-ingester-v2 - tag: 0.8.2 + tag: latest applicationConfig: postgres: connection: - host: postgres-postgresql.data.svc.cluster.local + host: postgresql.data.svc.cluster.local port: 5432 user: postgres password: psw @@ -130,7 +140,7 @@ spec: ingressClass: "nginx" image: repository: gresearch/armada-scheduler - tag: 0.8.2 + tag: latest applicationConfig: grpc: port: 50051 @@ -143,7 +153,7 @@ spec: URL: pulsar://pulsar-broker.data.svc.cluster.local:6650 postgres: connection: - host: postgres-postgresql.data.svc.cluster.local + host: postgresql.data.svc.cluster.local port: 5432 user: postgres password: psw @@ -159,11 +169,11 @@ spec: replicas: 1 image: repository: gresearch/armada-scheduler-ingester - tag: 0.8.2 + tag: latest applicationConfig: postgres: connection: - host: postgres-postgresql.data.svc.cluster.local + host: postgresql.data.svc.cluster.local port: 5432 user: postgres password: psw @@ -181,7 +191,7 @@ spec: replicas: 1 image: repository: gresearch/armada-event-ingester - tag: 0.8.2 + tag: latest applicationConfig: pulsar: URL: pulsar://pulsar-broker.data.svc.cluster.local:6650 diff --git a/dev/quickstart/example-job-preemptible.yaml b/dev/quickstart/example-job-preemptible.yaml new file mode 100644 index 00000000..922f87f2 --- /dev/null +++ b/dev/quickstart/example-job-preemptible.yaml @@ -0,0 +1,24 @@ +queue: example +jobSetId: job-set-1 +jobs: + - namespace: default + priority: 0 + podSpec: + priorityClassName: armada-preemptible + terminationGracePeriodSeconds: 0 + restartPolicy: Never + containers: + - name: sleeper + image: alpine:latest + command: + - sh + args: + - -c + - sleep $(( (RANDOM % 60) + 10 )) + resources: + limits: + memory: 128Mi + cpu: 0.5 + requests: + memory: 128Mi + cpu: 0.5 diff --git a/dev/quickstart/example-job.yaml b/dev/quickstart/example-job.yaml index 952a6654..beb225a1 100644 --- a/dev/quickstart/example-job.yaml +++ b/dev/quickstart/example-job.yaml @@ -4,6 +4,7 @@ jobs: - namespace: default priority: 0 podSpec: + priorityClassName: armada-default terminationGracePeriodSeconds: 0 restartPolicy: Never containers: @@ -17,7 +18,7 @@ jobs: resources: limits: memory: 128Mi - cpu: 0.2 + cpu: 2 requests: memory: 128Mi - cpu: 0.2 + cpu: 2 diff --git a/dev/quickstart/preemptible-priority-class.yaml b/dev/quickstart/preemptible-priority-class.yaml new file mode 100644 index 00000000..16966816 --- /dev/null +++ b/dev/quickstart/preemptible-priority-class.yaml @@ -0,0 +1,7 @@ +apiVersion: scheduling.k8s.io/v1 +kind: PriorityClass +metadata: + name: armada-preemptible +value: 1000 +globalDefault: false +description: "Priority class for armada preemptible pods." diff --git a/dev/quickstart/priority-class.yaml b/dev/quickstart/priority-class.yaml index 464b8d6e..1016e239 100644 --- a/dev/quickstart/priority-class.yaml +++ b/dev/quickstart/priority-class.yaml @@ -2,6 +2,6 @@ apiVersion: scheduling.k8s.io/v1 kind: PriorityClass metadata: name: armada-default -value: 1000000 +value: 1000 globalDefault: false description: "This priority class should be as a default for Armada jobs." diff --git a/dev/quickstart/redis.values.yaml b/dev/quickstart/redis.values.yaml index 71ffd9f2..3b3a9950 100644 --- a/dev/quickstart/redis.values.yaml +++ b/dev/quickstart/redis.values.yaml @@ -1 +1 @@ -replicas: 3 +replicas: 1 diff --git a/hack/kind-config.yaml b/hack/kind-config.yaml index 2c47c3cf..a8d45c34 100644 --- a/hack/kind-config.yaml +++ b/hack/kind-config.yaml @@ -2,22 +2,17 @@ kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 nodes: - role: control-plane - kubeadmConfigPatches: - - | - kind: InitConfiguration - nodeRegistration: - kubeletExtraArgs: - node-labels: "ingress-ready=true" extraPortMappings: + # Lookout UI - containerPort: 30000 hostPort: 30000 protocol: TCP + # Armada Server REST API - containerPort: 30001 hostPort: 30001 protocol: TCP + # Armada Server gRPC API - containerPort: 30002 hostPort: 30002 protocol: TCP - # Add two worker nodes -- role: worker - role: worker diff --git a/hack/wait-for-deps.sh b/hack/wait-for-deps.sh index 8a922947..9567caaf 100755 --- a/hack/wait-for-deps.sh +++ b/hack/wait-for-deps.sh @@ -1,7 +1,7 @@ #!/bin/bash STATEFULSETS=( - "postgres-postgresql" + "postgresql" "pulsar-bookie" "pulsar-broker" "pulsar-proxy" diff --git a/internal/controller/install/armadaserver_controller.go b/internal/controller/install/armadaserver_controller.go index 992df2da..a126ee3a 100644 --- a/internal/controller/install/armadaserver_controller.go +++ b/internal/controller/install/armadaserver_controller.go @@ -82,6 +82,7 @@ func (r *ArmadaServerReconciler) Reconcile(ctx context.Context, req ctrl.Request return ctrl.Result{}, err } as.Spec.PortConfig = pc + var components *CommonComponents components, err = generateArmadaServerInstallComponents(&as, r.Scheme) if err != nil { @@ -192,7 +193,7 @@ func (r *ArmadaServerReconciler) Reconcile(ctx context.Context, req ctrl.Request } if components.IngressHttp != nil { - logger.Info("Upserting ArmadaServer IngressHttp object") + logger.Info("Upserting ArmadaServer REST Ingress object") if _, err := controllerutil.CreateOrUpdate(ctx, r.Client, components.IngressHttp, mutateFn); err != nil { return ctrl.Result{}, err } diff --git a/internal/controller/install/common_helpers.go b/internal/controller/install/common_helpers.go index e3bde1da..9d6858df 100644 --- a/internal/controller/install/common_helpers.go +++ b/internal/controller/install/common_helpers.go @@ -34,20 +34,12 @@ import ( type AppName string const ( - defaultPrometheusInterval = 1 * time.Second - appConfigFlag = "--config" - appConfigFilepath = "/config/application_config.yaml" - AppArmada AppName = "armada" - AppExecutor AppName = "executor" - AppScheduler AppName = "scheduler" - AppSchedulerIngester AppName = "scheduleringester" - AppLookout AppName = "lookout" - AppLookoutIngester AppName = "lookoutingesterv2" - AppEventIngester AppName = "eventingester" - AppBinoculars AppName = "binoculars" + defaultPrometheusInterval = 1 * time.Second + appConfigFlag = "--config" + appConfigFilepath = "/config/application_config.yaml" ) -// CommonComponents are the base components for all of the Armada services +// CommonComponents are the base components for all Armada services type CommonComponents struct { Deployment *appsv1.Deployment IngressGrpc *networkingv1.Ingress diff --git a/internal/controller/install/scheduler_controller.go b/internal/controller/install/scheduler_controller.go index c0f980eb..a881b9b0 100644 --- a/internal/controller/install/scheduler_controller.go +++ b/internal/controller/install/scheduler_controller.go @@ -78,7 +78,7 @@ func (r *SchedulerReconciler) Reconcile(ctx context.Context, req ctrl.Request) ( return ctrl.Result{}, err } - pc, err := buildSchedulerPortConfig(scheduler.Spec.ApplicationConfig) + pc, err := installv1alpha1.BuildPortConfig(scheduler.Spec.ApplicationConfig) if err != nil { return ctrl.Result{}, err } @@ -675,44 +675,6 @@ func createSchedulerCronJob(scheduler *installv1alpha1.Scheduler) (*batchv1.Cron return &job, nil } -// schedulerPortConfigs will unmarshal ports from the scheduler app config -type schedulerPortConfigs struct { - Grpc schedulerPortConfig - Metrics schedulerPortConfig -} - -// schedulerPortConfig will unmarshal a port from the scheduler app config -type schedulerPortConfig struct { - Port int32 -} - -// buildSchedulerPortConfig extracts ports from the ApplicationConfig and applies inplace -// as the PortConfig -func buildSchedulerPortConfig(rawAppConfig runtime.RawExtension) (installv1alpha1.PortConfig, error) { - appConfig, err := installv1alpha1.ConvertRawExtensionToYaml(rawAppConfig) - if err != nil { - return installv1alpha1.PortConfig{}, err - } - - // default ports - schedulerPorts := schedulerPortConfigs{ - Grpc: schedulerPortConfig{Port: 50051}, - Metrics: schedulerPortConfig{Port: 9000}, - } - - // unmarshall app config - err = yaml.Unmarshal([]byte(appConfig), &schedulerPorts) - if err != nil { - return installv1alpha1.PortConfig{}, err - } - - portConfig := installv1alpha1.PortConfig{ - GrpcPort: schedulerPorts.Grpc.Port, - MetricsPort: schedulerPorts.Metrics.Port, - } - return portConfig, nil -} - // SetupWithManager sets up the controller with the Manager. func (r *SchedulerReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr).