You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "MonkeyCanCode (via GitHub)" <gi...@apache.org> on 2026/06/14 15:07:56 UTC

[PR] Helm: Add maintenance suport in helm [polaris]

MonkeyCanCode opened a new pull request, #4755:
URL: https://github.com/apache/polaris/pull/4755

   <!--
   ๐Ÿ“ Describe what changes you're proposing, especially breaking or user-facing changes. 
   ๐Ÿ“– See https://github.com/apache/polaris/blob/main/CONTRIBUTING.md for more.
   -->
   
   This PR introduces maintenance support for helm via generic K8S CronJob where users can define various jobs supported (or will be support soon) by polaris admin tool.
   
   Couple designed decisions made in this PR:
   1. User should be able to choose which jobs to enable/disable without comment out in-used ones in values.yaml but via `enabled` flag per job
   2. No strict jobs associations with persistent type. Instead of tie an given job to a given persistent type, we should let user handle those as job name is just a key and users should make the call on which jobs are needed for their persistent type/bakcend.
   3. Default `restartPolicy` to `Never` as oppose to default K8S `Always` as each retry creates a fresh pod, it is cleaner logs per attempt.
   4. Default `concurrencyPolicy` to `Forbid` as oppose to default K8S `Allow` as there shouldn't be multiple maintenance jobs of same job running in parallel.
   5. Set `automountServiceAccountToken` to `false` as oppose to default K8S `true` (not change-able) as admin tool doesn't call the K8S API.
   6. Allow per job level resources/config and also inheritance certain configs from root level (e.g. securityContext and serviceAccountName) 
   7. Allow maintenance level configs to all jobs such as `annotations`, `extraEnv`, `envFrom`, `extraVolumes`, `extraVolumeMounts`, and `image`. Those are not overwritable at the job level as they are global to the maintenance level.
   8. Added a new helper `polaris.maintenanceConfigVolume` to ensure we exclude token-broker auth artifacts from cron jobs. 
   9. Set correct `quarkus.config.locations` as the admin-tool image's working dir is `/home/polaris` as oppose to `/deployment`.
   10. Set correct `quarkus.mongodb.active` when persistence type is `nosql` and nosql.backend is `MongoDb`.
   
   Couple things I am not sure if we should do:
   1. Use different service account for global maintenance jobs to enforce least-privilege. Currently this is shared SA from the parent one which will likely has way more access than it really needed such as IAM role annotation attached to the SA
   2. As the workdir for admin image is not default to `/deployment`, I had to fix it in chart, maybe we should fix this in Dockerfile instead
   
   
   Here are sample jobs (manual and scheduled):
   ```
   โžœ  polaris git:(helm_maintenance_jobs) โœ— k get pods -n polaris | grep Completed
   manual-6bd8f                                     0/1     Completed   0          37m
   polaris-maint-nosql-maintenance-29690795-5nv4z   0/1     Completed   0          32m
   ```
   
   Sample logs from the completed job:
   ```
   โžœ  polaris git:(helm_maintenance_jobs) โœ— k logs pods/polaris-maint-nosql-maintenance-29690795-5nv4z -n polaris
   2026-06-14 14:35:00,997 WARN  [io.qua.config] [,] [,,,] (main) Unrecognized configuration key "quarkus.otel.sdk.disabled" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
   2026-06-14 14:35:00,997 WARN  [io.qua.config] [,] [,,,] (main) Unrecognized configuration key "quarkus.log.file.json.enabled" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
   2026-06-14 14:35:01,206 INFO  [org.mon.dri.client] [,] [,,,] (main) MongoClient with metadata {"driver": {"name": "mongo-java-driver|quarkus|reactive-streams", "version": "5.6.5"}, "os": {"type": "Linux", "name": "Linux", "architecture": "aarch64", "version": "6.12.76-linuxkit"}, "platform": "Java/Red Hat, Inc./21.0.11+10-LTS", "env": {"container": {"orchestrator": "kubernetes"}}} created with settings MongoClientSettings{readPreference=primary, writeConcern=WriteConcern{w=null, wTimeout=null ms, journal=true}, retryWrites=false, retryReads=true, readConcern=ReadConcern{level=null}, credential=null, transportSettings=NettyTransportSettings{eventLoopGroup=io.netty.channel.nio.NioEventLoopGroup@158f4cfe, socketChannelClass=class io.netty.channel.socket.nio.NioSocketChannel, allocator=PooledByteBufAllocator(directByDefault: true), sslContext=null}, commandListeners=[], codecRegistry=ProvidersCodecRegistry{codecProviders=[ProvidersCodecRegistry{codecProviders=[ValueCodecProvider{}, Bs
 onValueCodecProvider{}, DBRefCodecProvider{}, DBObjectCodecProvider{}, DocumentCodecProvider{}, CollectionCodecProvider{}, IterableCodecProvider{}, MapCodecProvider{}, GeoJsonCodecProvider{}, GridFSFileCodecProvider{}, Jsr310CodecProvider{}, JsonObjectCodecProvider{}, BsonCodecProvider{}, com.mongodb.client.model.mql.ExpressionCodecProvider@35f639fa, com.mongodb.Jep395RecordCodecProvider@5aaaa446, com.mongodb.KotlinCodecProvider@6c6333cd, EnumCodecProvider{}]}, ProvidersCodecRegistry{codecProviders=[org.bson.codecs.pojo.PojoCodecProvider@3e47a03]}]}, loggerSettings=LoggerSettings{maxDocumentLength=1000}, clusterSettings={hosts=[mongodb:27017], srvServiceName=mongodb, mode=SINGLE, requiredClusterType=UNKNOWN, requiredReplicaSetName='null', serverSelector='null', clusterListeners='[]', serverSelectionTimeout='30000 ms', localThreshold='15 ms'}, socketSettings=SocketSettings{connectTimeoutMS=10000, readTimeoutMS=0, receiveBufferSize=0, proxySettings=ProxySettings{host=null, port=null, 
 username=null, password=null}}, heartbeatSocketSettings=SocketSettings{connectTimeoutMS=10000, readTimeoutMS=10000, receiveBufferSize=0, proxySettings=ProxySettings{host=null, port=null, username=null, password=null}}, connectionPoolSettings=ConnectionPoolSettings{maxSize=100, minSize=0, maxWaitTimeMS=120000, maxConnectionLifeTimeMS=0, maxConnectionIdleTimeMS=0, maintenanceInitialDelayMS=0, maintenanceFrequencyMS=60000, connectionPoolListeners=[], maxConnecting=2}, serverSettings=ServerSettings{heartbeatFrequencyMS=10000, minHeartbeatFrequencyMS=500, serverMonitoringMode=AUTO, serverListeners='[]', serverMonitorListeners='[]'}, sslSettings=SslSettings{enabled=false, invalidHostNameAllowed=false, context=null}, applicationName='null', compressorList=[], uuidRepresentation=UNSPECIFIED, serverApi=null, autoEncryptionSettings=null, dnsClient=null, inetAddressResolver=null, contextProvider=null, timeoutMS=null}
   2026-06-14 14:35:01,239 INFO  [org.mon.dri.cluster] [,] [,,,] (cluster-ClusterId{value='6a2ebc15c78056edf3db20c2', description='null'}-mongodb:27017) Monitor thread successfully connected to server with description ServerDescription{address=mongodb:27017, type=STANDALONE, cryptd=false, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=27, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=16290417, minRoundTripTimeNanos=0}
   2026-06-14 14:35:01,277 INFO  [org.apa.pol.per.nos.qua.dis.AddressResolver] [,] [,,,] (main) Using nameserver kube-dns.kube-system.svc.cluster.local/10.96.0.10 with search list [polaris.svc.cluster.local, svc.cluster.local, cluster.local]
   2026-06-14 14:35:01,302 INFO  [org.mon.dri.client] [,] [,,,] (main) MongoClient with metadata {"driver": {"name": "mongo-java-driver|quarkus|sync", "version": "5.6.5"}, "os": {"type": "Linux", "name": "Linux", "architecture": "aarch64", "version": "6.12.76-linuxkit"}, "platform": "Java/Red Hat, Inc./21.0.11+10-LTS", "env": {"container": {"orchestrator": "kubernetes"}}} created with settings MongoClientSettings{readPreference=primary, writeConcern=WriteConcern{w=null, wTimeout=null ms, journal=true}, retryWrites=false, retryReads=true, readConcern=ReadConcern{level=null}, credential=null, transportSettings=null, commandListeners=[], codecRegistry=ProvidersCodecRegistry{codecProviders=[ProvidersCodecRegistry{codecProviders=[ValueCodecProvider{}, BsonValueCodecProvider{}, DBRefCodecProvider{}, DBObjectCodecProvider{}, DocumentCodecProvider{}, CollectionCodecProvider{}, IterableCodecProvider{}, MapCodecProvider{}, GeoJsonCodecProvider{}, GridFSFileCodecProvider{}, Jsr310CodecProvider{
 }, JsonObjectCodecProvider{}, BsonCodecProvider{}, com.mongodb.client.model.mql.ExpressionCodecProvider@35f639fa, com.mongodb.Jep395RecordCodecProvider@5aaaa446, com.mongodb.KotlinCodecProvider@6c6333cd, EnumCodecProvider{}]}, ProvidersCodecRegistry{codecProviders=[org.bson.codecs.pojo.PojoCodecProvider@1abebef3]}]}, loggerSettings=LoggerSettings{maxDocumentLength=1000}, clusterSettings={hosts=[mongodb:27017], srvServiceName=mongodb, mode=SINGLE, requiredClusterType=UNKNOWN, requiredReplicaSetName='null', serverSelector='null', clusterListeners='[]', serverSelectionTimeout='30000 ms', localThreshold='15 ms'}, socketSettings=SocketSettings{connectTimeoutMS=10000, readTimeoutMS=0, receiveBufferSize=0, proxySettings=ProxySettings{host=null, port=null, username=null, password=null}}, heartbeatSocketSettings=SocketSettings{connectTimeoutMS=10000, readTimeoutMS=10000, receiveBufferSize=0, proxySettings=ProxySettings{host=null, port=null, username=null, password=null}}, connectionPoolSetti
 ngs=ConnectionPoolSettings{maxSize=100, minSize=0, maxWaitTimeMS=120000, maxConnectionLifeTimeMS=0, maxConnectionIdleTimeMS=0, maintenanceInitialDelayMS=0, maintenanceFrequencyMS=60000, connectionPoolListeners=[], maxConnecting=2}, serverSettings=ServerSettings{heartbeatFrequencyMS=10000, minHeartbeatFrequencyMS=500, serverMonitoringMode=AUTO, serverListeners='[]', serverMonitorListeners='[]'}, sslSettings=SslSettings{enabled=false, invalidHostNameAllowed=false, context=null}, applicationName='null', compressorList=[], uuidRepresentation=UNSPECIFIED, serverApi=null, autoEncryptionSettings=null, dnsClient=null, inetAddressResolver=null, contextProvider=null, timeoutMS=null}
   2026-06-14 14:35:01,307 INFO  [org.mon.dri.cluster] [,] [,,,] (cluster-ClusterId{value='6a2ebc15c78056edf3db20c3', description='null'}-mongodb:27017) Monitor thread successfully connected to server with description ServerDescription{address=mongodb:27017, type=STANDALONE, cryptd=false, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=27, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=1920291, minRoundTripTimeNanos=0}
   2026-06-14 14:35:01,360 INFO  [io.quarkus] [,] [,,,] (main) Apache Polaris Admin Tool 1.6.0-SNAPSHOT on JVM (powered by Quarkus 3.36.2) started in 0.728s. Listening on: http://0.0.0.0:8181
   2026-06-14 14:35:01,361 INFO  [io.quarkus] [,] [,,,] (main) Profile prod activated.
   2026-06-14 14:35:01,361 INFO  [io.quarkus] [,] [,,,] (main) Installed features: [agroal, amazon-sdk-rds, cdi, jdbc-postgresql, micrometer, mongodb-client, narayana-jta, picocli, smallrye-context-propagation, vertx]
   2026-06-14 14:35:01,416 INFO  [org.apa.pol.per.nos.qua.bac.BackendProvider] [,] [,,,] (main) Opened new persistence backend 'MongoDb' database name: polaris
   
   Maintenance configuration:
               created-at grace time: PT3H
                   delete batch size: 10
                       retained runs: 50
               expected object count: 100000
            expected reference count: 100
                 last-run multiplier: 1.100000
                     initialized FPP: 0.000010
                        expected FPP: 0.000050
     reference scan rate limit / sec: (unlimited)
     object    scan rate limit / sec: (unlimited)
   2026-06-14 14:35:01,448 INFO  [org.apa.pol.per.nos.imp.cac.CaffeineCacheBackend] [,] [,,,] (main) Initialized persistence cache with a capacity of ~ 1040 MB
   2026-06-14 14:35:01,459 INFO  [org.apa.pol.per.nos.mai.imp.MaintenanceServiceImpl] [,] [,,,] (main) Using 5 realm retained identifiers
   2026-06-14 14:35:01,459 INFO  [org.apa.pol.per.nos.mai.imp.MaintenanceServiceImpl] [,] [,,,] (main) Realm retained identifier: Privileges Mapping
   2026-06-14 14:35:01,459 INFO  [org.apa.pol.per.nos.mai.imp.MaintenanceServiceImpl] [,] [,,,] (main) Realm retained identifier: Maintenance service
   2026-06-14 14:35:01,460 INFO  [org.apa.pol.per.nos.mai.imp.MaintenanceServiceImpl] [,] [,,,] (main) Realm retained identifier: Catalog data
   2026-06-14 14:35:01,460 INFO  [org.apa.pol.per.nos.mai.imp.MaintenanceServiceImpl] [,] [,,,] (main) Realm retained identifier: Nodes
   2026-06-14 14:35:01,460 INFO  [org.apa.pol.per.nos.mai.imp.MaintenanceServiceImpl] [,] [,,,] (main) Realm retained identifier: Realm management
   2026-06-14 14:35:01,460 INFO  [org.apa.pol.per.nos.mai.imp.MaintenanceServiceImpl] [,] [,,,] (main) Using 0 object type identifiers:
   
   Process system realm: true
   Realms to process:
   (none)
   Realms to purge:
   (none)
   
   Starting NoSql persistence maintenance run...
   This can run for quite some time, messages may be not be printed immediately, stay patient...
   
   2026-06-14 14:35:01,539 INFO  [org.apa.pol.per.nos.mai.imp.MaintenanceServiceImpl] [,] [,,,] (main) Triggering maintenance run with 0 realms to purge and 0 realms to process
   2026-06-14 14:35:01,602 INFO  [org.apa.pol.per.nos.mai.imp.MaintenanceServiceImpl] [,] [,,,] (main) Sized retained collector for 1000 references and 100000 objects with an fpp of 1.0E-5, approximate bloom filter heap sizes: 375 and 37442 bytes
   2026-06-14 14:35:01,604 DEBUG [org.apa.pol.per.nos.imp.com.CommitterImpl] [,] [,,,] (main) commit start
   2026-06-14 14:35:01,608 DEBUG [org.apa.pol.per.nos.imp.com.CommitterImpl] [,] [,,,] (main) commitAttempt
   2026-06-14 14:35:01,614 DEBUG [org.apa.pol.per.nos.imp.com.CommitterImpl] [,] [,,,] (main) Referenced object Optional[MaintenanceRunsObj{id=170541215596052480, numParts=1, seq=1, tail=[], maintenanceRunId=ObjRef{type=mtr, id=170541215583469568}}] for commit attempt for reference 'maintenance-runs'
   2026-06-14 14:35:01,632 DEBUG [org.apa.pol.per.nos.nod.imp.NodeManagementImpl] [,] [,,,] (main) Leasing a node ID...
   2026-06-14 14:35:01,634 DEBUG [org.apa.pol.per.nos.nod.imp.NodeManagementImpl] [,] [,,,] (main) Try lease node ID 802 ...
   2026-06-14 14:35:01,645 INFO  [org.apa.pol.per.nos.nod.imp.NodeManagementImpl] [,] [,,,] (main) New lease for node#802 acquired, valid until 2026-06-14T15:35:01.635246291Z (renewal scheduled in PT44M59S).
   2026-06-14 14:35:01,656 DEBUG [org.apa.pol.per.nos.imp.com.CommitterImpl] [,] [,,,] (main) Successfully committed change from Reference{name=maintenance-runs, pointer=ObjRef{type=mtrs, id=170541215596052480}, createdAtMicros=1781447394131320, previousPointers=[]} to Reference{name=maintenance-runs, pointer=ObjRef{type=mtrs, id=170542504699109377}, createdAtMicros=1781447394131320, previousPointers=[170541215596052480]}
   2026-06-14 14:35:01,656 DEBUG [org.apa.pol.per.nos.imp.com.CommitterImpl] [,] [,,,] (main) commit() yielding result
   2026-06-14 14:35:01,657 INFO  [org.apa.pol.per.nos.mai.imp.MaintenanceServiceImpl] [,] [,,,] (main) Identifying referenced data in realm '::system::'
   2026-06-14 14:35:01,658 INFO  [org.apa.pol.per.nos.mai.imp.MaintenanceServiceImpl] [,] [,,,] (main) Running maintenance for realm '::system::' via 'Privileges Mapping'
   2026-06-14 14:35:01,660 INFO  [org.apa.pol.per.nos.mai.imp.MaintenanceServiceImpl] [,] [,,,] (main) Realm identifier 'Privileges Mapping' did not handle ::system::
   2026-06-14 14:35:01,660 INFO  [org.apa.pol.per.nos.mai.imp.MaintenanceServiceImpl] [,] [,,,] (main) Running maintenance for realm '::system::' via 'Maintenance service'
   2026-06-14 14:35:01,663 INFO  [org.apa.pol.per.nos.mai.imp.MaintenanceServiceImpl] [,] [,,,] (main) Realm identifier 'Maintenance service' handled ::system::
   2026-06-14 14:35:01,664 INFO  [org.apa.pol.per.nos.mai.imp.MaintenanceServiceImpl] [,] [,,,] (main) Running maintenance for realm '::system::' via 'Catalog data'
   2026-06-14 14:35:01,664 INFO  [org.apa.pol.per.nos.met.mai.CatalogRetainedIdentifier] [,] [,,,] (main) Cleaning stale grant records...
   2026-06-14 14:35:01,665 DEBUG [org.apa.pol.per.nos.met.mai.CatalogRetainedIdentifier] [,] [,,,] (main) Reference not found: grants
   2026-06-14 14:35:01,665 INFO  [org.apa.pol.per.nos.met.mai.CatalogRetainedIdentifier] [,] [,,,] (main) Cleaning stale policy mappings...
   2026-06-14 14:35:01,666 DEBUG [org.apa.pol.per.nos.met.mai.CatalogRetainedIdentifier] [,] [,,,] (main) Reference not found: policy-mappings
   2026-06-14 14:35:01,666 INFO  [org.apa.pol.per.nos.met.mai.CatalogRetainedIdentifier] [,] [,,,] (main) Identifying root object...
   2026-06-14 14:35:01,667 DEBUG [org.apa.pol.per.nos.met.mai.CatalogRetainedIdentifier] [,] [,,,] (main) Reference not found: root
   2026-06-14 14:35:01,667 INFO  [org.apa.pol.per.nos.met.mai.CatalogRetainedIdentifier] [,] [,,,] (main) Identifying principals...
   2026-06-14 14:35:01,784 DEBUG [org.apa.pol.per.nos.met.mai.CatalogRetainedIdentifier] [,] [,,,] (main) Reference not found: principals
   2026-06-14 14:35:01,784 INFO  [org.apa.pol.per.nos.met.mai.CatalogRetainedIdentifier] [,] [,,,] (main) Identifying principal roles...
   2026-06-14 14:35:01,786 DEBUG [org.apa.pol.per.nos.met.mai.CatalogRetainedIdentifier] [,] [,,,] (main) Reference not found: principal-roles
   2026-06-14 14:35:01,786 INFO  [org.apa.pol.per.nos.met.mai.CatalogRetainedIdentifier] [,] [,,,] (main) Identifying grants...
   2026-06-14 14:35:01,787 DEBUG [org.apa.pol.per.nos.met.mai.CatalogRetainedIdentifier] [,] [,,,] (main) Reference not found: grants
   2026-06-14 14:35:01,787 INFO  [org.apa.pol.per.nos.met.mai.CatalogRetainedIdentifier] [,] [,,,] (main) Identifying immediate tasks...
   2026-06-14 14:35:01,788 DEBUG [org.apa.pol.per.nos.met.mai.CatalogRetainedIdentifier] [,] [,,,] (main) Reference not found: immediate-tasks
   2026-06-14 14:35:01,788 INFO  [org.apa.pol.per.nos.met.mai.CatalogRetainedIdentifier] [,] [,,,] (main) Identifying policy mappings...
   2026-06-14 14:35:01,789 DEBUG [org.apa.pol.per.nos.met.mai.CatalogRetainedIdentifier] [,] [,,,] (main) Reference not found: policy-mappings
   2026-06-14 14:35:01,789 INFO  [org.apa.pol.per.nos.met.mai.CatalogRetainedIdentifier] [,] [,,,] (main) Identifying catalogs...
   2026-06-14 14:35:01,790 DEBUG [org.apa.pol.per.nos.met.mai.CatalogRetainedIdentifier] [,] [,,,] (main) Reference not found: catalogs
   2026-06-14 14:35:01,790 INFO  [org.apa.pol.per.nos.mai.imp.MaintenanceServiceImpl] [,] [,,,] (main) Realm identifier 'Catalog data' handled ::system::
   2026-06-14 14:35:01,790 INFO  [org.apa.pol.per.nos.mai.imp.MaintenanceServiceImpl] [,] [,,,] (main) Running maintenance for realm '::system::' via 'Nodes'
   2026-06-14 14:35:01,798 INFO  [org.apa.pol.per.nos.mai.imp.MaintenanceServiceImpl] [,] [,,,] (main) Realm identifier 'Nodes' did not handle ::system::
   2026-06-14 14:35:01,798 INFO  [org.apa.pol.per.nos.mai.imp.MaintenanceServiceImpl] [,] [,,,] (main) Running maintenance for realm '::system::' via 'Realm management'
   2026-06-14 14:35:01,800 INFO  [org.apa.pol.per.nos.mai.imp.MaintenanceServiceImpl] [,] [,,,] (main) Realm identifier 'Realm management' did not handle ::system::
   2026-06-14 14:35:01,801 INFO  [org.apa.pol.per.nos.mai.imp.MaintenanceServiceImpl] [,] [,,,] (main) Start scanning backend database, too-new: 1781436901657488 ...
   2026-06-14 14:35:01,804 DEBUG [org.apa.pol.per.nos.mai.imp.ScanHandler] [,] [,,,] (main) Got '::system::' reference maintenance-runs -> too new, createdAtMicros = 1781447394131320
   2026-06-14 14:35:01,804 DEBUG [org.apa.pol.per.nos.mai.imp.ScanHandler] [,] [,,,] (main) Got '::system::' reference realms -> too new, createdAtMicros = 1781447394183477
   2026-06-14 14:35:01,805 DEBUG [org.apa.pol.per.nos.mai.imp.ScanHandler] [,] [,,,] (main) Got '::system::' object ObjRef{type=nodes, id=9223372036854775807} -> too new, createdAtMicros = 1781447394274600
   2026-06-14 14:35:01,805 DEBUG [org.apa.pol.per.nos.mai.imp.ScanHandler] [,] [,,,] (main) Got '::system::' object ObjRef{type=node, id=9223372036853366784} -> too new, createdAtMicros = 1781447394544878
   2026-06-14 14:35:01,805 DEBUG [org.apa.pol.per.nos.mai.imp.ScanHandler] [,] [,,,] (main) Got '::system::' object ObjRef{type=mtr, id=170541215583469568} -> too new, createdAtMicros = 1781447394522099
   2026-06-14 14:35:01,805 DEBUG [org.apa.pol.per.nos.mai.imp.ScanHandler] [,] [,,,] (main) Got '::system::' object ObjRef{type=mtrs, id=170541215596052480} -> too new, createdAtMicros = 1781447394301272
   2026-06-14 14:35:01,805 DEBUG [org.apa.pol.per.nos.mai.imp.ScanHandler] [,] [,,,] (main) Got '::system::' object ObjRef{type=node, id=9223372036853866496} -> too new, createdAtMicros = 1781447701638304
   2026-06-14 14:35:01,805 DEBUG [org.apa.pol.per.nos.mai.imp.ScanHandler] [,] [,,,] (main) Got '::system::' object ObjRef{type=mtr, id=170542504699109376} -> too new, createdAtMicros = 1781447701646462
   2026-06-14 14:35:01,806 DEBUG [org.apa.pol.per.nos.mai.imp.ScanHandler] [,] [,,,] (main) Got '::system::' object ObjRef{type=mtrs, id=170542504699109377} -> too new, createdAtMicros = 1781447701646462
   2026-06-14 14:35:01,806 INFO  [org.apa.pol.per.nos.mai.imp.MaintenanceServiceImpl] [,] [,,,] (main) Finished scanning backend database
   2026-06-14 14:35:01,807 INFO  [org.apa.pol.per.nos.mai.imp.MaintenanceServiceImpl] [,] [,,,] (main) Maintenance run completed successfully
   2026-06-14 14:35:01,807 INFO  [org.apa.pol.per.nos.mai.imp.MaintenanceServiceImpl] [,] [,,,] (main) Persisting maintenance result MaintenanceRunInformation{started=2026-06-14T14:35:01.646156833Z, finished=2026-06-14T14:35:01.807584458Z, success=true, detailedInformation=, referenceStats=MaintenanceStats{scanned=2, retained=0, newer=2, purged=0}, objStats=MaintenanceStats{scanned=7, retained=0, newer=7, purged=0}, perRealmReferenceStats={::system::=MaintenanceStats{scanned=2, retained=0, newer=2, purged=0}}, perRealmPerObjTypeStats={::system::={node=MaintenanceStats{scanned=2, retained=0, newer=2, purged=0}, nodes=MaintenanceStats{scanned=1, retained=0, newer=1, purged=0}, mtr=MaintenanceStats{scanned=2, retained=0, newer=2, purged=0}, mtrs=MaintenanceStats{scanned=2, retained=0, newer=2, purged=0}}}, purgedRealms=0, identifiedObjs=1030, identifiedReferences=10}
   
   ==================================================================================
   
   Run started: 2026-06-14T14:35:01.646156833Z
        status: (no exceptional information, all good so far)
      finished: 2026-06-14T14:35:01.807584458Z
       details:
   
   Realms:
        purged: 0
   
   References:
       scanned: 2
      retained: 0
       too new: 2
        purged: 0
     Realm: ::system::
           scanned: 2
          retained: 0
           too new: 2
            purged: 0
   
   Objects:
       scanned: 7
      retained: 0
       too new: 7
        purged: 0
     Realm: ::system::
       Type: node (Node)
             scanned: 2
            retained: 0
             too new: 2
              purged: 0
       Type: nodes (Nodes)
             scanned: 1
            retained: 0
             too new: 1
              purged: 0
       Type: mtr (Maintenance Run)
             scanned: 2
            retained: 0
             too new: 2
              purged: 0
       Type: mtrs (Maintenance Runs)
             scanned: 2
            retained: 0
             too new: 2
              purged: 0
   2026-06-14 14:35:01,819 DEBUG [org.apa.pol.per.nos.nod.imp.NodeManagementImpl] [,] [,,,] (main) Closing NodeManagement
   2026-06-14 14:35:01,819 INFO  [org.apa.pol.per.nos.nod.imp.NodeManagementImpl] [,] [,,,] (main) Releasing lease for node id 802
   2026-06-14 14:35:01,879 INFO  [io.quarkus] [,] [,,,] (main) Apache Polaris Admin Tool stopped in 0.066s
   ```
   
   ML: https://lists.apache.org/thread/5nst0f2ygnl2gj3j910q7m8nk2fvokc7
   
   ## Checklist
   - [x] ๐Ÿ›ก๏ธ Don't disclose security issues! (contact security@apache.org)
   - [x] ๐Ÿ”— Clearly explained why the changes are needed, or linked related issues: Fixes #
   - [x] ๐Ÿงช Added/updated tests with good coverage, or manually tested (and explained how)
   - [x] ๐Ÿ’ก Added comments for complex logic
   - [x] ๐Ÿงพ Updated `CHANGELOG.md` (if needed)
   - [x] ๐Ÿ“š Updated documentation in `site/content/in-dev/unreleased` (if needed)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Helm: Add maintenance suport in helm [polaris]

Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on code in PR #4755:
URL: https://github.com/apache/polaris/pull/4755#discussion_r3418977024


##########
helm/polaris/values.yaml:
##########
@@ -1167,3 +1167,104 @@ tasks:
   # -- The maximum number of tasks that can be queued up for execution. If unspecified or zero, defaults to Integer.MAX_VALUE.
   # @section -- Tasks
   maxQueuedTasks: 0  # 1000
+
+# @schema type: object
+# -- Configuration for maintenance tasks using as Kubernetes CronJob
+# @section -- Maintenance
+maintenance:
+  # @schema additionalProperties: {type: string}
+  # -- Annotations to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  annotations: {}
+
+  # @schema item: object
+  # -- Extra environment variables to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraEnv: []
+  #  - name: AWS_STORAGE_BUCKET
+  #    value: s3://xxxxx/
+  #  - name: AWS_ACCESS_KEY_ID
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: access_key_id
+  #  - name: AWS_SECRET_ACCESS_KEY
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: secret_access_key
+
+  # @schema item: object
+  # -- Bulk import environment variables from Secrets or ConfigMaps to every maintenance Cronjob object.
+  # @section -- Maintenance
+  envFrom: []
+  #  - secretRef:
+  #      name: polaris-env-secret
+  #  - configMapRef:
+  #      name: polaris-env-configmap
+
+  # @schema item: object
+  # -- Extra volumes to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumes: []
+    # - name: extra-volume
+    #   emptyDir: {}
+
+  # @schema item: object
+  # -- Extra volume mounts to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumeMounts: []
+    # - name: extra-volume
+    #   mountPath: /usr/share/extra-volume
+
+  # -- The container image used by every maintenance Cronjob object.
+  # @section -- Maintenance
+  image:
+    # -- The image repository to pull from for the Polaris admin tool.
+    # @section -- Maintenance
+    repository: apache/polaris-admin-tool
+    # @schema enum: [Always, IfNotPresent, Never]
+    # -- The image pull policy.
+    # @section -- Maintenance
+    pullPolicy: IfNotPresent
+    # -- The image tag.
+    # @section -- Maintenance
+    tag: "latest"  # This tag will be replaced with the chart version at release time.

Review Comment:
   You now need to update the `update_helm_version` in `./releasey/libs/_version.sh:107` and include a new replacement for this tag:
   
   https://github.com/apache/polaris/blob/0c730504ee5bbfee6761823e4a914546f35074a9/releasey/libs/_version.sh#L107-L125



##########
helm/polaris/values.yaml:
##########
@@ -1167,3 +1167,104 @@ tasks:
   # -- The maximum number of tasks that can be queued up for execution. If unspecified or zero, defaults to Integer.MAX_VALUE.
   # @section -- Tasks
   maxQueuedTasks: 0  # 1000
+
+# @schema type: object
+# -- Configuration for maintenance tasks using as Kubernetes CronJob
+# @section -- Maintenance
+maintenance:
+  # @schema additionalProperties: {type: string}
+  # -- Annotations to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  annotations: {}
+
+  # @schema item: object
+  # -- Extra environment variables to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraEnv: []
+  #  - name: AWS_STORAGE_BUCKET
+  #    value: s3://xxxxx/
+  #  - name: AWS_ACCESS_KEY_ID
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: access_key_id
+  #  - name: AWS_SECRET_ACCESS_KEY
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: secret_access_key
+
+  # @schema item: object
+  # -- Bulk import environment variables from Secrets or ConfigMaps to every maintenance Cronjob object.
+  # @section -- Maintenance
+  envFrom: []
+  #  - secretRef:
+  #      name: polaris-env-secret
+  #  - configMapRef:
+  #      name: polaris-env-configmap
+
+  # @schema item: object
+  # -- Extra volumes to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumes: []
+    # - name: extra-volume
+    #   emptyDir: {}
+
+  # @schema item: object
+  # -- Extra volume mounts to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumeMounts: []
+    # - name: extra-volume
+    #   mountPath: /usr/share/extra-volume
+
+  # -- The container image used by every maintenance Cronjob object.
+  # @section -- Maintenance
+  image:
+    # -- The image repository to pull from for the Polaris admin tool.
+    # @section -- Maintenance
+    repository: apache/polaris-admin-tool
+    # @schema enum: [Always, IfNotPresent, Never]
+    # -- The image pull policy.
+    # @section -- Maintenance
+    pullPolicy: IfNotPresent
+    # -- The image tag.
+    # @section -- Maintenance
+    tag: "latest"  # This tag will be replaced with the chart version at release time.
+
+  # @schema additionalProperties: {type: object, required: [schedule]}
+  # -- Define maintenance CronJobs. The key is the name of the job.
+  # @section -- Maintenance
+  jobs:
+    nosql-maintenance:
+      # -- Enable this maintenance job.
+      # @section -- Maintenance
+      enabled: false
+      # -- The schedule in Cron format.
+      # @section -- Maintenance
+      schedule: "0 2 * * *"
+      # -- The arguments to pass to the admin tool.
+      # @section -- Maintenance
+      args: ["nosql", "maintenance-run"]
+      # @schema enum: [Allow, Forbid, Replace]
+      # -- The concurrency policy, Valid values are: Allow, Forbid, Replace.
+      # @section -- Maintenance
+      concurrencyPolicy: Forbid
+      # @schema type: object
+      # -- Configures the resources requests and limits for this job's container.
+      # @section -- Maintenance
+      resources:
+        {}
+        # limits:
+        #   cpu: 100m
+        #   memory: 128Mi
+        # requests:
+        #   cpu: 100m
+        #   memory: 128Mi
+      # Optional per-job knobs (uncomment to use):
+      # restartPolicy: Never

Review Comment:
   I think you should uncomment these so that they get properly documented / included in the values.schema.json file. 
   
   The tricky thing with auto-generated docs and schema is that we should avoid commented-out values as much as possible.



##########
helm/polaris/templates/_helpers.tpl:
##########
@@ -215,6 +232,16 @@ Prints an environment variable for a secret key reference.
 {{- end -}}
 {{- end -}}
 
+{{/*
+Prints database/persistence connection environment variables.
+*/}}
+{{- define "polaris.persistenceEnv" -}}
+{{- include "polaris.secretToEnv" (list .Values.persistence.relationalJdbc.secret "username" "quarkus.datasource.username") -}}

Review Comment:
   These secrets are now duplicated here:
   
   https://github.com/apache/polaris/blob/11b713a6d8fb1c1efc9733ae4cd60af22a2f7155/helm/polaris/templates/deployment.yaml#L98-L101
   
   Can we call the new template there?



##########
helm/polaris/values.yaml:
##########
@@ -1167,3 +1167,104 @@ tasks:
   # -- The maximum number of tasks that can be queued up for execution. If unspecified or zero, defaults to Integer.MAX_VALUE.
   # @section -- Tasks
   maxQueuedTasks: 0  # 1000
+
+# @schema type: object
+# -- Configuration for maintenance tasks using as Kubernetes CronJob
+# @section -- Maintenance
+maintenance:
+  # @schema additionalProperties: {type: string}
+  # -- Annotations to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  annotations: {}
+
+  # @schema item: object
+  # -- Extra environment variables to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraEnv: []
+  #  - name: AWS_STORAGE_BUCKET
+  #    value: s3://xxxxx/
+  #  - name: AWS_ACCESS_KEY_ID
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: access_key_id
+  #  - name: AWS_SECRET_ACCESS_KEY
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: secret_access_key
+
+  # @schema item: object
+  # -- Bulk import environment variables from Secrets or ConfigMaps to every maintenance Cronjob object.
+  # @section -- Maintenance
+  envFrom: []
+  #  - secretRef:
+  #      name: polaris-env-secret
+  #  - configMapRef:
+  #      name: polaris-env-configmap
+
+  # @schema item: object
+  # -- Extra volumes to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumes: []
+    # - name: extra-volume
+    #   emptyDir: {}
+
+  # @schema item: object
+  # -- Extra volume mounts to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumeMounts: []
+    # - name: extra-volume
+    #   mountPath: /usr/share/extra-volume
+
+  # -- The container image used by every maintenance Cronjob object.
+  # @section -- Maintenance
+  image:
+    # -- The image repository to pull from for the Polaris admin tool.
+    # @section -- Maintenance
+    repository: apache/polaris-admin-tool
+    # @schema enum: [Always, IfNotPresent, Never]
+    # -- The image pull policy.
+    # @section -- Maintenance
+    pullPolicy: IfNotPresent
+    # -- The image tag.
+    # @section -- Maintenance
+    tag: "latest"  # This tag will be replaced with the chart version at release time.
+
+  # @schema additionalProperties: {type: object, required: [schedule]}
+  # -- Define maintenance CronJobs. The key is the name of the job.

Review Comment:
   ```suggestion
     # -- Define maintenance CronJobs. By default, only a `nosql-maintenance` job is included, but other jobs can be defined by adding more fields to the `jobs` object. The field name becomes the job name.
   ```



##########
helm/polaris/values.yaml:
##########
@@ -1167,3 +1167,104 @@ tasks:
   # -- The maximum number of tasks that can be queued up for execution. If unspecified or zero, defaults to Integer.MAX_VALUE.
   # @section -- Tasks
   maxQueuedTasks: 0  # 1000
+
+# @schema type: object
+# -- Configuration for maintenance tasks using as Kubernetes CronJob
+# @section -- Maintenance
+maintenance:
+  # @schema additionalProperties: {type: string}
+  # -- Annotations to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  annotations: {}
+
+  # @schema item: object
+  # -- Extra environment variables to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraEnv: []
+  #  - name: AWS_STORAGE_BUCKET
+  #    value: s3://xxxxx/
+  #  - name: AWS_ACCESS_KEY_ID
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: access_key_id
+  #  - name: AWS_SECRET_ACCESS_KEY
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: secret_access_key
+
+  # @schema item: object
+  # -- Bulk import environment variables from Secrets or ConfigMaps to every maintenance Cronjob object.
+  # @section -- Maintenance
+  envFrom: []
+  #  - secretRef:
+  #      name: polaris-env-secret
+  #  - configMapRef:
+  #      name: polaris-env-configmap
+
+  # @schema item: object
+  # -- Extra volumes to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumes: []
+    # - name: extra-volume
+    #   emptyDir: {}
+
+  # @schema item: object
+  # -- Extra volume mounts to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumeMounts: []
+    # - name: extra-volume
+    #   mountPath: /usr/share/extra-volume
+
+  # -- The container image used by every maintenance Cronjob object.
+  # @section -- Maintenance
+  image:
+    # -- The image repository to pull from for the Polaris admin tool.
+    # @section -- Maintenance
+    repository: apache/polaris-admin-tool
+    # @schema enum: [Always, IfNotPresent, Never]
+    # -- The image pull policy.
+    # @section -- Maintenance
+    pullPolicy: IfNotPresent
+    # -- The image tag.
+    # @section -- Maintenance
+    tag: "latest"  # This tag will be replaced with the chart version at release time.
+
+  # @schema additionalProperties: {type: object, required: [schedule]}
+  # -- Define maintenance CronJobs. The key is the name of the job.
+  # @section -- Maintenance
+  jobs:
+    nosql-maintenance:
+      # -- Enable this maintenance job.
+      # @section -- Maintenance
+      enabled: false
+      # -- The schedule in Cron format.
+      # @section -- Maintenance
+      schedule: "0 2 * * *"
+      # -- The arguments to pass to the admin tool.
+      # @section -- Maintenance
+      args: ["nosql", "maintenance-run"]

Review Comment:
   Should we add support for `command` as well ? If the image has no entrypoint, `args` will fail. And since we allow users to define their own jobs, we cannot know which image they will use.



##########
helm/polaris/templates/cronjob-maintenance.yaml:
##########
@@ -0,0 +1,149 @@
+{{/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/}}
+
+{{- range $jobName, $jobSpec := .Values.maintenance.jobs }}
+{{- if $jobSpec.enabled }}
+{{- $cronName := printf "%s-maint-%s" (include "polaris.fullname" $) $jobName }}
+{{- if gt (len $cronName) 52 }}
+  {{- fail (printf "Maintenance CronJob name %q is %d chars; must be <= 52 (K8s appends a timestamp+random suffix to generated Pod names, which are capped at 63). Shorten release name, nameOverride/fullnameOverride, or the job key %q." $cronName (len $cronName) $jobName) }}
+{{- end }}
+---
+apiVersion: batch/v1
+kind: CronJob
+metadata:
+  name: {{ $cronName }}
+  namespace: {{ $.Release.Namespace }}
+  labels:
+    {{- include "polaris.labels" $ | nindent 4 }}
+  {{- with $.Values.maintenance.annotations }}
+  annotations:
+    {{- tpl (toYaml .) $ | nindent 4 }}
+  {{- end }}
+spec:
+  schedule: {{ $jobSpec.schedule | quote }}
+  concurrencyPolicy: {{ default "Forbid" $jobSpec.concurrencyPolicy }}
+  {{- if hasKey $jobSpec "successfulJobsHistoryLimit" }}
+  successfulJobsHistoryLimit: {{ $jobSpec.successfulJobsHistoryLimit }}
+  {{- end }}
+  {{- if hasKey $jobSpec "failedJobsHistoryLimit" }}
+  failedJobsHistoryLimit: {{ $jobSpec.failedJobsHistoryLimit }}
+  {{- end }}
+  jobTemplate:
+    spec:
+      {{- if hasKey $jobSpec "backoffLimit" }}
+      backoffLimit: {{ $jobSpec.backoffLimit }}
+      {{- end }}
+      {{- with $jobSpec.activeDeadlineSeconds }}
+      activeDeadlineSeconds: {{ . }}
+      {{- end }}
+      template:
+        metadata:
+          labels:
+            helm.sh/chart: {{ include "polaris.chart" $ }}
+            app.kubernetes.io/name: {{ include "polaris.name" $ }}-maintenance
+            app.kubernetes.io/instance: {{ $.Release.Name }}
+            app.kubernetes.io/component: maintenance
+            app.kubernetes.io/managed-by: {{ $.Release.Service }}
+            {{- if $.Chart.AppVersion }}
+            app.kubernetes.io/version: {{ $.Chart.AppVersion | quote }}
+            {{- end }}
+          {{- with $jobSpec.podAnnotations }}
+          annotations:
+            {{- tpl (toYaml .) $ | nindent 12 }}
+          {{- end }}
+        spec:
+          {{- if $.Values.imagePullSecrets }}
+          imagePullSecrets:
+          {{- range $.Values.imagePullSecrets }}
+            - name: {{ . | quote }}
+          {{- end }}
+          {{- end }}
+          restartPolicy: {{ default "Never" $jobSpec.restartPolicy }}
+          {{- with $.Values.priorityClassName }}
+          priorityClassName: {{ tpl . $ | quote }}
+          {{- end }}
+          serviceAccountName: {{ include "polaris.serviceAccountName" $ }}

Review Comment:
   I think indeed we should give users the ability to use a different SA, defaulting to the global SA if not overridden at job level. Wdyt?



##########
helm/polaris/values.yaml:
##########
@@ -1167,3 +1167,104 @@ tasks:
   # -- The maximum number of tasks that can be queued up for execution. If unspecified or zero, defaults to Integer.MAX_VALUE.
   # @section -- Tasks
   maxQueuedTasks: 0  # 1000
+
+# @schema type: object
+# -- Configuration for maintenance tasks using as Kubernetes CronJob
+# @section -- Maintenance
+maintenance:
+  # @schema additionalProperties: {type: string}
+  # -- Annotations to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  annotations: {}
+
+  # @schema item: object
+  # -- Extra environment variables to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraEnv: []

Review Comment:
   Shouldn't we merge `maintenant.extraEnv` with `extraEnv`? Same for `envFrom`, `extraVolumes` and `extraVolumeMounts`?
   
   I'm fine either way, but I think this should be documented since users will likely wonder, since some things are inherited from the global level (e.g. `podSecurityContext`).



##########
helm/polaris/values.yaml:
##########
@@ -1167,3 +1167,104 @@ tasks:
   # -- The maximum number of tasks that can be queued up for execution. If unspecified or zero, defaults to Integer.MAX_VALUE.
   # @section -- Tasks
   maxQueuedTasks: 0  # 1000
+
+# @schema type: object
+# -- Configuration for maintenance tasks using as Kubernetes CronJob
+# @section -- Maintenance
+maintenance:
+  # @schema additionalProperties: {type: string}
+  # -- Annotations to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  annotations: {}
+
+  # @schema item: object
+  # -- Extra environment variables to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraEnv: []
+  #  - name: AWS_STORAGE_BUCKET
+  #    value: s3://xxxxx/
+  #  - name: AWS_ACCESS_KEY_ID
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: access_key_id
+  #  - name: AWS_SECRET_ACCESS_KEY
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: secret_access_key
+
+  # @schema item: object
+  # -- Bulk import environment variables from Secrets or ConfigMaps to every maintenance Cronjob object.
+  # @section -- Maintenance
+  envFrom: []
+  #  - secretRef:
+  #      name: polaris-env-secret
+  #  - configMapRef:
+  #      name: polaris-env-configmap
+
+  # @schema item: object
+  # -- Extra volumes to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumes: []
+    # - name: extra-volume
+    #   emptyDir: {}
+
+  # @schema item: object
+  # -- Extra volume mounts to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumeMounts: []
+    # - name: extra-volume
+    #   mountPath: /usr/share/extra-volume
+
+  # -- The container image used by every maintenance Cronjob object.
+  # @section -- Maintenance
+  image:
+    # -- The image repository to pull from for the Polaris admin tool.
+    # @section -- Maintenance
+    repository: apache/polaris-admin-tool
+    # @schema enum: [Always, IfNotPresent, Never]
+    # -- The image pull policy.
+    # @section -- Maintenance
+    pullPolicy: IfNotPresent
+    # -- The image tag.
+    # @section -- Maintenance
+    tag: "latest"  # This tag will be replaced with the chart version at release time.
+
+  # @schema additionalProperties: {type: object, required: [schedule]}

Review Comment:
   ```suggestion
     # @schema additionalProperties: {type: object, required: [enabled,schedule]}
   ```



##########
helm/polaris/values.yaml:
##########
@@ -1167,3 +1167,104 @@ tasks:
   # -- The maximum number of tasks that can be queued up for execution. If unspecified or zero, defaults to Integer.MAX_VALUE.
   # @section -- Tasks
   maxQueuedTasks: 0  # 1000
+
+# @schema type: object
+# -- Configuration for maintenance tasks using as Kubernetes CronJob
+# @section -- Maintenance
+maintenance:
+  # @schema additionalProperties: {type: string}
+  # -- Annotations to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  annotations: {}
+
+  # @schema item: object
+  # -- Extra environment variables to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraEnv: []
+  #  - name: AWS_STORAGE_BUCKET
+  #    value: s3://xxxxx/
+  #  - name: AWS_ACCESS_KEY_ID
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: access_key_id
+  #  - name: AWS_SECRET_ACCESS_KEY
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: secret_access_key
+
+  # @schema item: object
+  # -- Bulk import environment variables from Secrets or ConfigMaps to every maintenance Cronjob object.
+  # @section -- Maintenance
+  envFrom: []
+  #  - secretRef:
+  #      name: polaris-env-secret
+  #  - configMapRef:
+  #      name: polaris-env-configmap
+
+  # @schema item: object
+  # -- Extra volumes to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumes: []
+    # - name: extra-volume
+    #   emptyDir: {}
+
+  # @schema item: object
+  # -- Extra volume mounts to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumeMounts: []
+    # - name: extra-volume
+    #   mountPath: /usr/share/extra-volume
+
+  # -- The container image used by every maintenance Cronjob object.
+  # @section -- Maintenance
+  image:
+    # -- The image repository to pull from for the Polaris admin tool.
+    # @section -- Maintenance
+    repository: apache/polaris-admin-tool
+    # @schema enum: [Always, IfNotPresent, Never]
+    # -- The image pull policy.
+    # @section -- Maintenance
+    pullPolicy: IfNotPresent
+    # -- The image tag.
+    # @section -- Maintenance
+    tag: "latest"  # This tag will be replaced with the chart version at release time.
+
+  # @schema additionalProperties: {type: object, required: [schedule]}
+  # -- Define maintenance CronJobs. The key is the name of the job.
+  # @section -- Maintenance
+  jobs:
+    nosql-maintenance:
+      # -- Enable this maintenance job.
+      # @section -- Maintenance
+      enabled: false
+      # -- The schedule in Cron format.
+      # @section -- Maintenance
+      schedule: "0 2 * * *"
+      # -- The arguments to pass to the admin tool.
+      # @section -- Maintenance
+      args: ["nosql", "maintenance-run"]
+      # @schema enum: [Allow, Forbid, Replace]
+      # -- The concurrency policy, Valid values are: Allow, Forbid, Replace.
+      # @section -- Maintenance
+      concurrencyPolicy: Forbid
+      # @schema type: object
+      # -- Configures the resources requests and limits for this job's container.
+      # @section -- Maintenance
+      resources:

Review Comment:
   Same here, I think users will wonder whether the global `resources` will be merged with this or not. Let's document this.



##########
helm/polaris/templates/cronjob-maintenance.yaml:
##########
@@ -0,0 +1,149 @@
+{{/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/}}
+
+{{- range $jobName, $jobSpec := .Values.maintenance.jobs }}
+{{- if $jobSpec.enabled }}
+{{- $cronName := printf "%s-maint-%s" (include "polaris.fullname" $) $jobName }}

Review Comment:
   We already have a template called `polaris.fullnameWithSuffix`, maybe we can reuse that if we add a new parameter `maxLength` (by default 63, and here: 52)?
   
   Also: I wonder if we should drop the `-maint-` segment. Even a moderately long release name, e.g. `argocd-us-west2-release` would cross the limits: it would generate the name `argocd-us-west2-release-polaris-maint-nosql-maintenance` which is 55 chars.
   
   And lastly, I wonder if we should fail hard here when the limit is crossed, as opposed to trim. If we fail hard, this means that some pipelines may fail to deploy the chart with no simple way for operators to fix the issue, unless they can pick a shorter release name.



##########
helm/polaris/templates/cronjob-maintenance.yaml:
##########
@@ -0,0 +1,149 @@
+{{/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/}}
+
+{{- range $jobName, $jobSpec := .Values.maintenance.jobs }}
+{{- if $jobSpec.enabled }}
+{{- $cronName := printf "%s-maint-%s" (include "polaris.fullname" $) $jobName }}
+{{- if gt (len $cronName) 52 }}
+  {{- fail (printf "Maintenance CronJob name %q is %d chars; must be <= 52 (K8s appends a timestamp+random suffix to generated Pod names, which are capped at 63). Shorten release name, nameOverride/fullnameOverride, or the job key %q." $cronName (len $cronName) $jobName) }}
+{{- end }}
+---
+apiVersion: batch/v1
+kind: CronJob
+metadata:
+  name: {{ $cronName }}
+  namespace: {{ $.Release.Namespace }}
+  labels:
+    {{- include "polaris.labels" $ | nindent 4 }}
+  {{- with $.Values.maintenance.annotations }}
+  annotations:
+    {{- tpl (toYaml .) $ | nindent 4 }}
+  {{- end }}
+spec:
+  schedule: {{ $jobSpec.schedule | quote }}
+  concurrencyPolicy: {{ default "Forbid" $jobSpec.concurrencyPolicy }}
+  {{- if hasKey $jobSpec "successfulJobsHistoryLimit" }}
+  successfulJobsHistoryLimit: {{ $jobSpec.successfulJobsHistoryLimit }}
+  {{- end }}
+  {{- if hasKey $jobSpec "failedJobsHistoryLimit" }}
+  failedJobsHistoryLimit: {{ $jobSpec.failedJobsHistoryLimit }}
+  {{- end }}
+  jobTemplate:
+    spec:
+      {{- if hasKey $jobSpec "backoffLimit" }}
+      backoffLimit: {{ $jobSpec.backoffLimit }}
+      {{- end }}
+      {{- with $jobSpec.activeDeadlineSeconds }}
+      activeDeadlineSeconds: {{ . }}
+      {{- end }}
+      template:
+        metadata:
+          labels:
+            helm.sh/chart: {{ include "polaris.chart" $ }}

Review Comment:
   Should we call the `polaris.labels` template here instead? Why do you need to customize `app.kubernetes.io/name`?



##########
helm/polaris/values.yaml:
##########
@@ -1167,3 +1167,104 @@ tasks:
   # -- The maximum number of tasks that can be queued up for execution. If unspecified or zero, defaults to Integer.MAX_VALUE.
   # @section -- Tasks
   maxQueuedTasks: 0  # 1000
+
+# @schema type: object
+# -- Configuration for maintenance tasks using as Kubernetes CronJob
+# @section -- Maintenance
+maintenance:
+  # @schema additionalProperties: {type: string}
+  # -- Annotations to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  annotations: {}
+
+  # @schema item: object
+  # -- Extra environment variables to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraEnv: []
+  #  - name: AWS_STORAGE_BUCKET
+  #    value: s3://xxxxx/
+  #  - name: AWS_ACCESS_KEY_ID
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: access_key_id
+  #  - name: AWS_SECRET_ACCESS_KEY
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: secret_access_key
+
+  # @schema item: object
+  # -- Bulk import environment variables from Secrets or ConfigMaps to every maintenance Cronjob object.
+  # @section -- Maintenance
+  envFrom: []
+  #  - secretRef:
+  #      name: polaris-env-secret
+  #  - configMapRef:
+  #      name: polaris-env-configmap
+
+  # @schema item: object
+  # -- Extra volumes to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumes: []
+    # - name: extra-volume
+    #   emptyDir: {}
+
+  # @schema item: object
+  # -- Extra volume mounts to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumeMounts: []
+    # - name: extra-volume
+    #   mountPath: /usr/share/extra-volume
+
+  # -- The container image used by every maintenance Cronjob object.
+  # @section -- Maintenance
+  image:
+    # -- The image repository to pull from for the Polaris admin tool.
+    # @section -- Maintenance
+    repository: apache/polaris-admin-tool
+    # @schema enum: [Always, IfNotPresent, Never]
+    # -- The image pull policy.
+    # @section -- Maintenance
+    pullPolicy: IfNotPresent
+    # -- The image tag.
+    # @section -- Maintenance
+    tag: "latest"  # This tag will be replaced with the chart version at release time.
+
+  # @schema additionalProperties: {type: object, required: [schedule]}
+  # -- Define maintenance CronJobs. The key is the name of the job.
+  # @section -- Maintenance
+  jobs:
+    nosql-maintenance:
+      # -- Enable this maintenance job.
+      # @section -- Maintenance
+      enabled: false
+      # -- The schedule in Cron format.
+      # @section -- Maintenance
+      schedule: "0 2 * * *"
+      # -- The arguments to pass to the admin tool.
+      # @section -- Maintenance
+      args: ["nosql", "maintenance-run"]
+      # @schema enum: [Allow, Forbid, Replace]
+      # -- The concurrency policy, Valid values are: Allow, Forbid, Replace.
+      # @section -- Maintenance
+      concurrencyPolicy: Forbid
+      # @schema type: object
+      # -- Configures the resources requests and limits for this job's container.
+      # @section -- Maintenance
+      resources:
+        {}
+        # limits:
+        #   cpu: 100m
+        #   memory: 128Mi
+        # requests:
+        #   cpu: 100m
+        #   memory: 128Mi
+      # Optional per-job knobs (uncomment to use):
+      # restartPolicy: Never
+      # backoffLimit: 6
+      # activeDeadlineSeconds: 1800
+      # successfulJobsHistoryLimit: 3
+      # failedjobsHistoryLimit: 1
+      # podAnnotations:

Review Comment:
   1. Same here: users will wonder if `podAnnotations` will be merged with the global `podAnnotations`
   2. No `podLabels`?



##########
helm/polaris/templates/cronjob-maintenance.yaml:
##########
@@ -0,0 +1,149 @@
+{{/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/}}
+
+{{- range $jobName, $jobSpec := .Values.maintenance.jobs }}
+{{- if $jobSpec.enabled }}
+{{- $cronName := printf "%s-maint-%s" (include "polaris.fullname" $) $jobName }}
+{{- if gt (len $cronName) 52 }}
+  {{- fail (printf "Maintenance CronJob name %q is %d chars; must be <= 52 (K8s appends a timestamp+random suffix to generated Pod names, which are capped at 63). Shorten release name, nameOverride/fullnameOverride, or the job key %q." $cronName (len $cronName) $jobName) }}
+{{- end }}
+---
+apiVersion: batch/v1
+kind: CronJob
+metadata:
+  name: {{ $cronName }}
+  namespace: {{ $.Release.Namespace }}
+  labels:
+    {{- include "polaris.labels" $ | nindent 4 }}
+  {{- with $.Values.maintenance.annotations }}
+  annotations:
+    {{- tpl (toYaml .) $ | nindent 4 }}
+  {{- end }}
+spec:
+  schedule: {{ $jobSpec.schedule | quote }}
+  concurrencyPolicy: {{ default "Forbid" $jobSpec.concurrencyPolicy }}
+  {{- if hasKey $jobSpec "successfulJobsHistoryLimit" }}
+  successfulJobsHistoryLimit: {{ $jobSpec.successfulJobsHistoryLimit }}
+  {{- end }}
+  {{- if hasKey $jobSpec "failedJobsHistoryLimit" }}
+  failedJobsHistoryLimit: {{ $jobSpec.failedJobsHistoryLimit }}
+  {{- end }}
+  jobTemplate:
+    spec:
+      {{- if hasKey $jobSpec "backoffLimit" }}
+      backoffLimit: {{ $jobSpec.backoffLimit }}
+      {{- end }}
+      {{- with $jobSpec.activeDeadlineSeconds }}
+      activeDeadlineSeconds: {{ . }}
+      {{- end }}
+      template:
+        metadata:
+          labels:
+            helm.sh/chart: {{ include "polaris.chart" $ }}
+            app.kubernetes.io/name: {{ include "polaris.name" $ }}-maintenance
+            app.kubernetes.io/instance: {{ $.Release.Name }}
+            app.kubernetes.io/component: maintenance
+            app.kubernetes.io/managed-by: {{ $.Release.Service }}
+            {{- if $.Chart.AppVersion }}
+            app.kubernetes.io/version: {{ $.Chart.AppVersion | quote }}
+            {{- end }}
+          {{- with $jobSpec.podAnnotations }}
+          annotations:
+            {{- tpl (toYaml .) $ | nindent 12 }}
+          {{- end }}
+        spec:
+          {{- if $.Values.imagePullSecrets }}
+          imagePullSecrets:
+          {{- range $.Values.imagePullSecrets }}
+            - name: {{ . | quote }}
+          {{- end }}
+          {{- end }}
+          restartPolicy: {{ default "Never" $jobSpec.restartPolicy }}
+          {{- with $.Values.priorityClassName }}
+          priorityClassName: {{ tpl . $ | quote }}
+          {{- end }}
+          serviceAccountName: {{ include "polaris.serviceAccountName" $ }}
+          automountServiceAccountToken: false
+          {{- if $.Values.podSecurityContext }}
+          securityContext:
+            {{- tpl (toYaml $.Values.podSecurityContext) $ | nindent 12 }}
+          {{- end }}
+          containers:
+            - name: polaris-admin-tool

Review Comment:
   nit: we don't know what job users can run here, so I'd go with a more generic name, e.g. `polaris-job`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Helm: Add maintenance suport in helm [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on PR #4755:
URL: https://github.com/apache/polaris/pull/4755#issuecomment-4758674133

   @adutra @dimas-b mind take another look?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Helm: Add maintenance suport in helm [polaris]

Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on code in PR #4755:
URL: https://github.com/apache/polaris/pull/4755#discussion_r3437270093


##########
helm/polaris/values.yaml:
##########
@@ -1167,3 +1167,104 @@ tasks:
   # -- The maximum number of tasks that can be queued up for execution. If unspecified or zero, defaults to Integer.MAX_VALUE.
   # @section -- Tasks
   maxQueuedTasks: 0  # 1000
+
+# @schema type: object
+# -- Configuration for maintenance tasks using as Kubernetes CronJob
+# @section -- Maintenance
+maintenance:
+  # @schema additionalProperties: {type: string}
+  # -- Annotations to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  annotations: {}
+
+  # @schema item: object
+  # -- Extra environment variables to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraEnv: []
+  #  - name: AWS_STORAGE_BUCKET
+  #    value: s3://xxxxx/
+  #  - name: AWS_ACCESS_KEY_ID
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: access_key_id
+  #  - name: AWS_SECRET_ACCESS_KEY
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: secret_access_key
+
+  # @schema item: object
+  # -- Bulk import environment variables from Secrets or ConfigMaps to every maintenance Cronjob object.
+  # @section -- Maintenance
+  envFrom: []
+  #  - secretRef:
+  #      name: polaris-env-secret
+  #  - configMapRef:
+  #      name: polaris-env-configmap
+
+  # @schema item: object
+  # -- Extra volumes to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumes: []
+    # - name: extra-volume
+    #   emptyDir: {}
+
+  # @schema item: object
+  # -- Extra volume mounts to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumeMounts: []
+    # - name: extra-volume
+    #   mountPath: /usr/share/extra-volume
+
+  # -- The container image used by every maintenance Cronjob object.
+  # @section -- Maintenance
+  image:

Review Comment:
   Yeah, same answer as well: I think we can safely assume that the image specified here has to be either the official admin tool image, or a fully compatible one.
   
   So, I'm fine leaving the image definition here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Helm: Add maintenance suport in helm [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4755:
URL: https://github.com/apache/polaris/pull/4755#discussion_r3456215334


##########
releasey/libs/_version.sh:
##########
@@ -121,7 +121,7 @@ function update_helm_version {
   # It's not necessary to update $HELM_VALUES_SCHEMA_FILE or $HELM_REFERENCE_DOC_FILE here, because
   # these files will be generated from $HELM_VALUES_FILE during the release process, and they will
   # automatically reflect the updated version.
-  exec_process sed -E -i~ 's/^(  tag: )"latest".*$/\1"'"${new_version}"'"/' "$HELM_VALUES_FILE"
+  exec_process sed -E -i~ 's/^([[:space:]]+tag: )"latest".*$/\1"'"${new_version}"'"/' "$HELM_VALUES_FILE"

Review Comment:
   nit: unrelated change?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Helm: Add maintenance suport in helm [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode merged PR #4755:
URL: https://github.com/apache/polaris/pull/4755


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Helm: Add maintenance suport in helm [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on code in PR #4755:
URL: https://github.com/apache/polaris/pull/4755#discussion_r3418136666


##########
helm/polaris/templates/cronjob-maintenance.yaml:
##########
@@ -0,0 +1,153 @@
+{{/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/}}
+
+{{- range $jobName, $jobSpec := .Values.maintenance.jobs }}
+{{- if $jobSpec.enabled }}
+{{- $cronName := printf "%s-maint-%s" (include "polaris.fullname" $) $jobName }}
+{{- if gt (len $cronName) 52 }}
+  {{- fail (printf "Maintenance CronJob name %q is %d chars; must be <= 52 (K8s appends a timestamp+random suffix to generated Pod names, which are capped at 63). Shorten release name, nameOverride/fullnameOverride, or the job key %q." $cronName (len $cronName) $jobName) }}
+{{- end }}
+---
+apiVersion: batch/v1
+kind: CronJob
+metadata:
+  name: {{ $cronName }}
+  namespace: {{ $.Release.Namespace }}
+  labels:
+    {{- include "polaris.labels" $ | nindent 4 }}
+  {{- with $.Values.maintenance.annotations }}
+  annotations:
+    {{- tpl (toYaml .) $ | nindent 4 }}
+  {{- end }}
+spec:
+  schedule: {{ $jobSpec.schedule | quote }}
+  concurrencyPolicy: {{ default "Forbid" $jobSpec.concurrencyPolicy }}
+  {{- if hasKey $jobSpec "successfulJobsHistoryLimit" }}
+  successfulJobsHistoryLimit: {{ $jobSpec.successfulJobsHistoryLimit }}
+  {{- end }}
+  {{- if hasKey $jobSpec "failedJobsHistoryLimit" }}
+  failedJobsHistoryLimit: {{ $jobSpec.failedJobsHistoryLimit }}
+  {{- end }}
+  jobTemplate:
+    spec:
+      {{- if hasKey $jobSpec "backoffLimit" }}
+      backoffLimit: {{ $jobSpec.backoffLimit }}
+      {{- end }}
+      {{- with $jobSpec.activeDeadlineSeconds }}
+      activeDeadlineSeconds: {{ . }}
+      {{- end }}
+      template:
+        metadata:
+          labels:
+            helm.sh/chart: {{ include "polaris.chart" $ }}
+            app.kubernetes.io/name: {{ include "polaris.name" $ }}-maintenance
+            app.kubernetes.io/instance: {{ $.Release.Name }}
+            app.kubernetes.io/component: maintenance
+            app.kubernetes.io/managed-by: {{ $.Release.Service }}
+            {{- if $.Chart.AppVersion }}
+            app.kubernetes.io/version: {{ $.Chart.AppVersion | quote }}
+            {{- end }}
+          {{- with $jobSpec.podAnnotations }}
+          annotations:
+            {{- tpl (toYaml .) $ | nindent 12 }}
+          {{- end }}
+        spec:
+          {{- if $.Values.imagePullSecrets }}
+          imagePullSecrets:
+          {{- range $.Values.imagePullSecrets }}
+            - name: {{ . | quote }}
+          {{- end }}
+          {{- end }}
+          restartPolicy: {{ default "Never" $jobSpec.restartPolicy }}
+          {{- with $.Values.priorityClassName }}
+          priorityClassName: {{ tpl . $ | quote }}
+          {{- end }}
+          serviceAccountName: {{ include "polaris.serviceAccountName" $ }}
+          automountServiceAccountToken: false
+          {{- if $.Values.podSecurityContext }}
+          securityContext:
+            {{- tpl (toYaml $.Values.podSecurityContext) $ | nindent 12 }}
+          {{- end }}
+          containers:
+            - name: polaris-admin-tool
+              {{- if $.Values.containerSecurityContext }}
+              securityContext:
+                {{- tpl (toYaml $.Values.containerSecurityContext) $ | nindent 16 }}
+              {{- end }}
+              image: "{{ tpl $.Values.maintenance.image.repository $ }}:{{ tpl $.Values.maintenance.image.tag $ | default $.Chart.Version }}"
+              imagePullPolicy: {{ tpl $.Values.maintenance.image.pullPolicy $ }}
+              {{- if $jobSpec.args }}
+              args:
+                {{- range $jobSpec.args }}
+                - {{ . | quote }}
+                {{- end }}
+              {{- end }}
+              {{- with $jobSpec.resources }}
+              resources:
+                {{- tpl (toYaml .) $ | nindent 16 }}
+              {{- end }}
+              env:
+                - name: quarkus.config.locations
+                  value: "file:{{ trimSuffix "/" $.Values.image.configDir }}/application.properties"
+                {{- $persistenceEnv := include "polaris.persistenceEnv" $ -}}
+                {{- if and (eq $.Values.persistence.type "nosql") (eq $.Values.persistence.nosql.backend "MongoDb") }}
+                - name: quarkus.mongodb.active
+                  value: "true"

Review Comment:
   I would think so. Once that is completed, we will then be able to remove this section. Currently if anyone tried to use the cli for no-sql maintenance, they would get the following:
   ```
   โžœ docker run -it apache/polaris-admin-tool:latest nosql
   INFO exec -a "java" java -XX:MaxRAMPercentage=80.0 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:+ExitOnOutOfMemoryError -cp "." -jar /deployments/polaris-admin-tool.jar nosql
   INFO running in /deployments
   Polaris NoSql persistence has multiple subcommands,
   use the 'help nosql' command.
   
   java.lang.IllegalStateException: Mandatory configuration option polaris.persistence.nosql.backend is missing!
   ...
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Helm: Add maintenance suport in helm [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on code in PR #4755:
URL: https://github.com/apache/polaris/pull/4755#discussion_r3446767725


##########
helm/polaris/values.yaml:
##########
@@ -1167,3 +1167,104 @@ tasks:
   # -- The maximum number of tasks that can be queued up for execution. If unspecified or zero, defaults to Integer.MAX_VALUE.
   # @section -- Tasks
   maxQueuedTasks: 0  # 1000
+
+# @schema type: object
+# -- Configuration for maintenance tasks using as Kubernetes CronJob
+# @section -- Maintenance
+maintenance:
+  # @schema additionalProperties: {type: string}
+  # -- Annotations to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  annotations: {}
+
+  # @schema item: object
+  # -- Extra environment variables to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraEnv: []
+  #  - name: AWS_STORAGE_BUCKET
+  #    value: s3://xxxxx/
+  #  - name: AWS_ACCESS_KEY_ID
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: access_key_id
+  #  - name: AWS_SECRET_ACCESS_KEY
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: secret_access_key
+
+  # @schema item: object
+  # -- Bulk import environment variables from Secrets or ConfigMaps to every maintenance Cronjob object.
+  # @section -- Maintenance
+  envFrom: []
+  #  - secretRef:
+  #      name: polaris-env-secret
+  #  - configMapRef:
+  #      name: polaris-env-configmap
+
+  # @schema item: object
+  # -- Extra volumes to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumes: []
+    # - name: extra-volume
+    #   emptyDir: {}
+
+  # @schema item: object
+  # -- Extra volume mounts to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumeMounts: []
+    # - name: extra-volume
+    #   mountPath: /usr/share/extra-volume
+
+  # -- The container image used by every maintenance Cronjob object.
+  # @section -- Maintenance
+  image:
+    # -- The image repository to pull from for the Polaris admin tool.
+    # @section -- Maintenance
+    repository: apache/polaris-admin-tool
+    # @schema enum: [Always, IfNotPresent, Never]
+    # -- The image pull policy.
+    # @section -- Maintenance
+    pullPolicy: IfNotPresent
+    # -- The image tag.
+    # @section -- Maintenance
+    tag: "latest"  # This tag will be replaced with the chart version at release time.

Review Comment:
   This is took care.



##########
helm/polaris/templates/_helpers.tpl:
##########
@@ -215,6 +232,16 @@ Prints an environment variable for a secret key reference.
 {{- end -}}
 {{- end -}}
 
+{{/*
+Prints database/persistence connection environment variables.
+*/}}
+{{- define "polaris.persistenceEnv" -}}
+{{- include "polaris.secretToEnv" (list .Values.persistence.relationalJdbc.secret "username" "quarkus.datasource.username") -}}

Review Comment:
   This is took care.



##########
helm/polaris/values.yaml:
##########
@@ -1167,3 +1167,104 @@ tasks:
   # -- The maximum number of tasks that can be queued up for execution. If unspecified or zero, defaults to Integer.MAX_VALUE.
   # @section -- Tasks
   maxQueuedTasks: 0  # 1000
+
+# @schema type: object
+# -- Configuration for maintenance tasks using as Kubernetes CronJob
+# @section -- Maintenance
+maintenance:
+  # @schema additionalProperties: {type: string}
+  # -- Annotations to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  annotations: {}
+
+  # @schema item: object
+  # -- Extra environment variables to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraEnv: []
+  #  - name: AWS_STORAGE_BUCKET
+  #    value: s3://xxxxx/
+  #  - name: AWS_ACCESS_KEY_ID
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: access_key_id
+  #  - name: AWS_SECRET_ACCESS_KEY
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: secret_access_key
+
+  # @schema item: object
+  # -- Bulk import environment variables from Secrets or ConfigMaps to every maintenance Cronjob object.
+  # @section -- Maintenance
+  envFrom: []
+  #  - secretRef:
+  #      name: polaris-env-secret
+  #  - configMapRef:
+  #      name: polaris-env-configmap
+
+  # @schema item: object
+  # -- Extra volumes to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumes: []
+    # - name: extra-volume
+    #   emptyDir: {}
+
+  # @schema item: object
+  # -- Extra volume mounts to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumeMounts: []
+    # - name: extra-volume
+    #   mountPath: /usr/share/extra-volume
+
+  # -- The container image used by every maintenance Cronjob object.
+  # @section -- Maintenance
+  image:
+    # -- The image repository to pull from for the Polaris admin tool.
+    # @section -- Maintenance
+    repository: apache/polaris-admin-tool
+    # @schema enum: [Always, IfNotPresent, Never]
+    # -- The image pull policy.
+    # @section -- Maintenance
+    pullPolicy: IfNotPresent
+    # -- The image tag.
+    # @section -- Maintenance
+    tag: "latest"  # This tag will be replaced with the chart version at release time.
+
+  # @schema additionalProperties: {type: object, required: [schedule]}
+  # -- Define maintenance CronJobs. The key is the name of the job.
+  # @section -- Maintenance
+  jobs:
+    nosql-maintenance:
+      # -- Enable this maintenance job.
+      # @section -- Maintenance
+      enabled: false
+      # -- The schedule in Cron format.
+      # @section -- Maintenance
+      schedule: "0 2 * * *"
+      # -- The arguments to pass to the admin tool.
+      # @section -- Maintenance
+      args: ["nosql", "maintenance-run"]
+      # @schema enum: [Allow, Forbid, Replace]
+      # -- The concurrency policy, Valid values are: Allow, Forbid, Replace.
+      # @section -- Maintenance
+      concurrencyPolicy: Forbid
+      # @schema type: object
+      # -- Configures the resources requests and limits for this job's container.
+      # @section -- Maintenance
+      resources:
+        {}
+        # limits:
+        #   cpu: 100m
+        #   memory: 128Mi
+        # requests:
+        #   cpu: 100m
+        #   memory: 128Mi
+      # Optional per-job knobs (uncomment to use):
+      # restartPolicy: Never

Review Comment:
   This is took care.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Helm: Add maintenance suport in helm [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4755:
URL: https://github.com/apache/polaris/pull/4755#discussion_r3417902034


##########
helm/polaris/values.yaml:
##########
@@ -1167,3 +1167,104 @@ tasks:
   # -- The maximum number of tasks that can be queued up for execution. If unspecified or zero, defaults to Integer.MAX_VALUE.
   # @section -- Tasks
   maxQueuedTasks: 0  # 1000
+
+# @schema type: object
+# -- Configuration for maintenance tasks using as Kubernetes CronJob
+# @section -- Maintenance
+maintenance:
+  # @schema additionalProperties: {type: string}
+  # -- Annotations to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  annotations: {}
+
+  # @schema item: object
+  # -- Extra environment variables to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraEnv: []
+  #  - name: AWS_STORAGE_BUCKET
+  #    value: s3://xxxxx/
+  #  - name: AWS_ACCESS_KEY_ID
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: access_key_id
+  #  - name: AWS_SECRET_ACCESS_KEY
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: secret_access_key
+
+  # @schema item: object
+  # -- Bulk import environment variables from Secrets or ConfigMaps to every maintenance Cronjob object.
+  # @section -- Maintenance
+  envFrom: []
+  #  - secretRef:
+  #      name: polaris-env-secret
+  #  - configMapRef:
+  #      name: polaris-env-configmap
+
+  # @schema item: object
+  # -- Extra volumes to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumes: []
+    # - name: extra-volume
+    #   emptyDir: {}
+
+  # @schema item: object
+  # -- Extra volume mounts to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumeMounts: []
+    # - name: extra-volume
+    #   mountPath: /usr/share/extra-volume
+
+  # -- The container image used by every maintenance Cronjob object.
+  # @section -- Maintenance
+  image:
+    # -- The image repository to pull from for the Polaris admin tool.
+    # @section -- Maintenance
+    repository: apache/polaris-admin-tool
+    # @schema enum: [Always, IfNotPresent, Never]
+    # -- The image pull policy.
+    # @section -- Maintenance
+    pullPolicy: IfNotPresent
+    # -- The image tag.
+    # @section -- Maintenance
+    tag: "latest"  # This tag will be replaced with the chart version at release time.
+
+  # @schema additionalProperties: {type: object, required: [schedule]}
+  # -- Define maintenance CronJobs. The key is the name of the job.
+  # @section -- Maintenance
+  jobs:
+    nosql-maintenance:
+      # -- Enable this maintenance job.
+      # @section -- Maintenance
+      enabled: false
+      # -- The schedule in Cron format.
+      # @section -- Maintenance
+      schedule: "0 2 * * *"
+      # -- The arguments to pass tothe admin tool.

Review Comment:
   nit: `to the` (space)



##########
helm/polaris/templates/cronjob-maintenance.yaml:
##########
@@ -0,0 +1,153 @@
+{{/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/}}
+
+{{- range $jobName, $jobSpec := .Values.maintenance.jobs }}
+{{- if $jobSpec.enabled }}
+{{- $cronName := printf "%s-maint-%s" (include "polaris.fullname" $) $jobName }}
+{{- if gt (len $cronName) 52 }}
+  {{- fail (printf "Maintenance CronJob name %q is %d chars; must be <= 52 (K8s appends a timestamp+random suffix to generated Pod names, which are capped at 63). Shorten release name, nameOverride/fullnameOverride, or the job key %q." $cronName (len $cronName) $jobName) }}
+{{- end }}
+---
+apiVersion: batch/v1
+kind: CronJob
+metadata:
+  name: {{ $cronName }}
+  namespace: {{ $.Release.Namespace }}
+  labels:
+    {{- include "polaris.labels" $ | nindent 4 }}
+  {{- with $.Values.maintenance.annotations }}
+  annotations:
+    {{- tpl (toYaml .) $ | nindent 4 }}
+  {{- end }}
+spec:
+  schedule: {{ $jobSpec.schedule | quote }}
+  concurrencyPolicy: {{ default "Forbid" $jobSpec.concurrencyPolicy }}
+  {{- if hasKey $jobSpec "successfulJobsHistoryLimit" }}
+  successfulJobsHistoryLimit: {{ $jobSpec.successfulJobsHistoryLimit }}
+  {{- end }}
+  {{- if hasKey $jobSpec "failedJobsHistoryLimit" }}
+  failedJobsHistoryLimit: {{ $jobSpec.failedJobsHistoryLimit }}
+  {{- end }}
+  jobTemplate:
+    spec:
+      {{- if hasKey $jobSpec "backoffLimit" }}
+      backoffLimit: {{ $jobSpec.backoffLimit }}
+      {{- end }}
+      {{- with $jobSpec.activeDeadlineSeconds }}
+      activeDeadlineSeconds: {{ . }}
+      {{- end }}
+      template:
+        metadata:
+          labels:
+            helm.sh/chart: {{ include "polaris.chart" $ }}
+            app.kubernetes.io/name: {{ include "polaris.name" $ }}-maintenance
+            app.kubernetes.io/instance: {{ $.Release.Name }}
+            app.kubernetes.io/component: maintenance
+            app.kubernetes.io/managed-by: {{ $.Release.Service }}
+            {{- if $.Chart.AppVersion }}
+            app.kubernetes.io/version: {{ $.Chart.AppVersion | quote }}
+            {{- end }}
+          {{- with $jobSpec.podAnnotations }}
+          annotations:
+            {{- tpl (toYaml .) $ | nindent 12 }}
+          {{- end }}
+        spec:
+          {{- if $.Values.imagePullSecrets }}
+          imagePullSecrets:
+          {{- range $.Values.imagePullSecrets }}
+            - name: {{ . | quote }}
+          {{- end }}
+          {{- end }}
+          restartPolicy: {{ default "Never" $jobSpec.restartPolicy }}
+          {{- with $.Values.priorityClassName }}
+          priorityClassName: {{ tpl . $ | quote }}
+          {{- end }}
+          serviceAccountName: {{ include "polaris.serviceAccountName" $ }}
+          automountServiceAccountToken: false
+          {{- if $.Values.podSecurityContext }}
+          securityContext:
+            {{- tpl (toYaml $.Values.podSecurityContext) $ | nindent 12 }}
+          {{- end }}
+          containers:
+            - name: polaris-admin-tool
+              {{- if $.Values.containerSecurityContext }}
+              securityContext:
+                {{- tpl (toYaml $.Values.containerSecurityContext) $ | nindent 16 }}
+              {{- end }}
+              image: "{{ tpl $.Values.maintenance.image.repository $ }}:{{ tpl $.Values.maintenance.image.tag $ | default $.Chart.Version }}"
+              imagePullPolicy: {{ tpl $.Values.maintenance.image.pullPolicy $ }}
+              {{- if $jobSpec.args }}
+              args:
+                {{- range $jobSpec.args }}
+                - {{ . | quote }}
+                {{- end }}
+              {{- end }}
+              {{- with $jobSpec.resources }}
+              resources:
+                {{- tpl (toYaml .) $ | nindent 16 }}
+              {{- end }}
+              env:
+                - name: quarkus.config.locations
+                  value: "file:{{ trimSuffix "/" $.Values.image.configDir }}/application.properties"
+                {{- $persistenceEnv := include "polaris.persistenceEnv" $ -}}
+                {{- if and (eq $.Values.persistence.type "nosql") (eq $.Values.persistence.nosql.backend "MongoDb") }}
+                - name: quarkus.mongodb.active
+                  value: "true"

Review Comment:
   side note: can we do it in java code? ๐Ÿค” 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Helm: Add maintenance suport in helm [polaris]

Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on code in PR #4755:
URL: https://github.com/apache/polaris/pull/4755#discussion_r3437257032


##########
helm/polaris/templates/cronjob-maintenance.yaml:
##########
@@ -0,0 +1,149 @@
+{{/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/}}
+
+{{- range $jobName, $jobSpec := .Values.maintenance.jobs }}
+{{- if $jobSpec.enabled }}
+{{- $cronName := printf "%s-maint-%s" (include "polaris.fullname" $) $jobName }}
+{{- if gt (len $cronName) 52 }}
+  {{- fail (printf "Maintenance CronJob name %q is %d chars; must be <= 52 (K8s appends a timestamp+random suffix to generated Pod names, which are capped at 63). Shorten release name, nameOverride/fullnameOverride, or the job key %q." $cronName (len $cronName) $jobName) }}
+{{- end }}
+---
+apiVersion: batch/v1
+kind: CronJob
+metadata:
+  name: {{ $cronName }}
+  namespace: {{ $.Release.Namespace }}
+  labels:
+    {{- include "polaris.labels" $ | nindent 4 }}
+  {{- with $.Values.maintenance.annotations }}
+  annotations:
+    {{- tpl (toYaml .) $ | nindent 4 }}
+  {{- end }}
+spec:
+  schedule: {{ $jobSpec.schedule | quote }}
+  concurrencyPolicy: {{ default "Forbid" $jobSpec.concurrencyPolicy }}
+  {{- if hasKey $jobSpec "successfulJobsHistoryLimit" }}
+  successfulJobsHistoryLimit: {{ $jobSpec.successfulJobsHistoryLimit }}
+  {{- end }}
+  {{- if hasKey $jobSpec "failedJobsHistoryLimit" }}
+  failedJobsHistoryLimit: {{ $jobSpec.failedJobsHistoryLimit }}
+  {{- end }}
+  jobTemplate:
+    spec:
+      {{- if hasKey $jobSpec "backoffLimit" }}
+      backoffLimit: {{ $jobSpec.backoffLimit }}
+      {{- end }}
+      {{- with $jobSpec.activeDeadlineSeconds }}
+      activeDeadlineSeconds: {{ . }}
+      {{- end }}
+      template:
+        metadata:
+          labels:
+            helm.sh/chart: {{ include "polaris.chart" $ }}
+            app.kubernetes.io/name: {{ include "polaris.name" $ }}-maintenance
+            app.kubernetes.io/instance: {{ $.Release.Name }}
+            app.kubernetes.io/component: maintenance
+            app.kubernetes.io/managed-by: {{ $.Release.Service }}
+            {{- if $.Chart.AppVersion }}
+            app.kubernetes.io/version: {{ $.Chart.AppVersion | quote }}
+            {{- end }}
+          {{- with $jobSpec.podAnnotations }}
+          annotations:
+            {{- tpl (toYaml .) $ | nindent 12 }}
+          {{- end }}
+        spec:
+          {{- if $.Values.imagePullSecrets }}
+          imagePullSecrets:
+          {{- range $.Values.imagePullSecrets }}
+            - name: {{ . | quote }}
+          {{- end }}
+          {{- end }}
+          restartPolicy: {{ default "Never" $jobSpec.restartPolicy }}
+          {{- with $.Values.priorityClassName }}
+          priorityClassName: {{ tpl . $ | quote }}
+          {{- end }}
+          serviceAccountName: {{ include "polaris.serviceAccountName" $ }}
+          automountServiceAccountToken: false
+          {{- if $.Values.podSecurityContext }}
+          securityContext:
+            {{- tpl (toYaml $.Values.podSecurityContext) $ | nindent 12 }}
+          {{- end }}
+          containers:
+            - name: polaris-admin-tool

Review Comment:
   I actually don't know. But from my experience, if you let users use custom images, they WILL use custom images ๐Ÿ˜„ 
   
   But, I think it's reasonable to assume that if they customize the admin tool image, the customized image needs to stay compatible with the official one.
   
   So, I take back my comment. No need to change the container name.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Helm: Add maintenance suport in helm [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on code in PR #4755:
URL: https://github.com/apache/polaris/pull/4755#discussion_r3418184266


##########
helm/polaris/templates/cronjob-maintenance.yaml:
##########
@@ -0,0 +1,153 @@
+{{/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/}}
+
+{{- range $jobName, $jobSpec := .Values.maintenance.jobs }}
+{{- if $jobSpec.enabled }}
+{{- $cronName := printf "%s-maint-%s" (include "polaris.fullname" $) $jobName }}
+{{- if gt (len $cronName) 52 }}
+  {{- fail (printf "Maintenance CronJob name %q is %d chars; must be <= 52 (K8s appends a timestamp+random suffix to generated Pod names, which are capped at 63). Shorten release name, nameOverride/fullnameOverride, or the job key %q." $cronName (len $cronName) $jobName) }}
+{{- end }}
+---
+apiVersion: batch/v1
+kind: CronJob
+metadata:
+  name: {{ $cronName }}
+  namespace: {{ $.Release.Namespace }}
+  labels:
+    {{- include "polaris.labels" $ | nindent 4 }}
+  {{- with $.Values.maintenance.annotations }}
+  annotations:
+    {{- tpl (toYaml .) $ | nindent 4 }}
+  {{- end }}
+spec:
+  schedule: {{ $jobSpec.schedule | quote }}
+  concurrencyPolicy: {{ default "Forbid" $jobSpec.concurrencyPolicy }}
+  {{- if hasKey $jobSpec "successfulJobsHistoryLimit" }}
+  successfulJobsHistoryLimit: {{ $jobSpec.successfulJobsHistoryLimit }}
+  {{- end }}
+  {{- if hasKey $jobSpec "failedJobsHistoryLimit" }}
+  failedJobsHistoryLimit: {{ $jobSpec.failedJobsHistoryLimit }}
+  {{- end }}
+  jobTemplate:
+    spec:
+      {{- if hasKey $jobSpec "backoffLimit" }}
+      backoffLimit: {{ $jobSpec.backoffLimit }}
+      {{- end }}
+      {{- with $jobSpec.activeDeadlineSeconds }}
+      activeDeadlineSeconds: {{ . }}
+      {{- end }}
+      template:
+        metadata:
+          labels:
+            helm.sh/chart: {{ include "polaris.chart" $ }}
+            app.kubernetes.io/name: {{ include "polaris.name" $ }}-maintenance
+            app.kubernetes.io/instance: {{ $.Release.Name }}
+            app.kubernetes.io/component: maintenance
+            app.kubernetes.io/managed-by: {{ $.Release.Service }}
+            {{- if $.Chart.AppVersion }}
+            app.kubernetes.io/version: {{ $.Chart.AppVersion | quote }}
+            {{- end }}
+          {{- with $jobSpec.podAnnotations }}
+          annotations:
+            {{- tpl (toYaml .) $ | nindent 12 }}
+          {{- end }}
+        spec:
+          {{- if $.Values.imagePullSecrets }}
+          imagePullSecrets:
+          {{- range $.Values.imagePullSecrets }}
+            - name: {{ . | quote }}
+          {{- end }}
+          {{- end }}
+          restartPolicy: {{ default "Never" $jobSpec.restartPolicy }}
+          {{- with $.Values.priorityClassName }}
+          priorityClassName: {{ tpl . $ | quote }}
+          {{- end }}
+          serviceAccountName: {{ include "polaris.serviceAccountName" $ }}
+          automountServiceAccountToken: false
+          {{- if $.Values.podSecurityContext }}
+          securityContext:
+            {{- tpl (toYaml $.Values.podSecurityContext) $ | nindent 12 }}
+          {{- end }}
+          containers:
+            - name: polaris-admin-tool
+              {{- if $.Values.containerSecurityContext }}
+              securityContext:
+                {{- tpl (toYaml $.Values.containerSecurityContext) $ | nindent 16 }}
+              {{- end }}
+              image: "{{ tpl $.Values.maintenance.image.repository $ }}:{{ tpl $.Values.maintenance.image.tag $ | default $.Chart.Version }}"
+              imagePullPolicy: {{ tpl $.Values.maintenance.image.pullPolicy $ }}
+              {{- if $jobSpec.args }}
+              args:
+                {{- range $jobSpec.args }}
+                - {{ . | quote }}
+                {{- end }}
+              {{- end }}
+              {{- with $jobSpec.resources }}
+              resources:
+                {{- tpl (toYaml .) $ | nindent 16 }}
+              {{- end }}
+              env:
+                - name: quarkus.config.locations
+                  value: "file:{{ trimSuffix "/" $.Values.image.configDir }}/application.properties"
+                {{- $persistenceEnv := include "polaris.persistenceEnv" $ -}}
+                {{- if and (eq $.Values.persistence.type "nosql") (eq $.Values.persistence.nosql.backend "MongoDb") }}
+                - name: quarkus.mongodb.active
+                  value: "true"

Review Comment:
   Actually, I just tested the latest main and the admin image change, this doesn't appear to be needed any more as sample cronjob is not able to proceed without this block. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Helm: Add maintenance suport in helm [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on code in PR #4755:
URL: https://github.com/apache/polaris/pull/4755#discussion_r3446768370


##########
helm/polaris/values.yaml:
##########
@@ -1167,3 +1167,104 @@ tasks:
   # -- The maximum number of tasks that can be queued up for execution. If unspecified or zero, defaults to Integer.MAX_VALUE.
   # @section -- Tasks
   maxQueuedTasks: 0  # 1000
+
+# @schema type: object
+# -- Configuration for maintenance tasks using as Kubernetes CronJob
+# @section -- Maintenance
+maintenance:
+  # @schema additionalProperties: {type: string}
+  # -- Annotations to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  annotations: {}
+
+  # @schema item: object
+  # -- Extra environment variables to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraEnv: []
+  #  - name: AWS_STORAGE_BUCKET
+  #    value: s3://xxxxx/
+  #  - name: AWS_ACCESS_KEY_ID
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: access_key_id
+  #  - name: AWS_SECRET_ACCESS_KEY
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: secret_access_key
+
+  # @schema item: object
+  # -- Bulk import environment variables from Secrets or ConfigMaps to every maintenance Cronjob object.
+  # @section -- Maintenance
+  envFrom: []
+  #  - secretRef:
+  #      name: polaris-env-secret
+  #  - configMapRef:
+  #      name: polaris-env-configmap
+
+  # @schema item: object
+  # -- Extra volumes to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumes: []
+    # - name: extra-volume
+    #   emptyDir: {}
+
+  # @schema item: object
+  # -- Extra volume mounts to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumeMounts: []
+    # - name: extra-volume
+    #   mountPath: /usr/share/extra-volume
+
+  # -- The container image used by every maintenance Cronjob object.
+  # @section -- Maintenance
+  image:
+    # -- The image repository to pull from for the Polaris admin tool.
+    # @section -- Maintenance
+    repository: apache/polaris-admin-tool
+    # @schema enum: [Always, IfNotPresent, Never]
+    # -- The image pull policy.
+    # @section -- Maintenance
+    pullPolicy: IfNotPresent
+    # -- The image tag.
+    # @section -- Maintenance
+    tag: "latest"  # This tag will be replaced with the chart version at release time.
+
+  # @schema additionalProperties: {type: object, required: [schedule]}

Review Comment:
   This is took care.



##########
helm/polaris/values.yaml:
##########
@@ -1167,3 +1167,104 @@ tasks:
   # -- The maximum number of tasks that can be queued up for execution. If unspecified or zero, defaults to Integer.MAX_VALUE.
   # @section -- Tasks
   maxQueuedTasks: 0  # 1000
+
+# @schema type: object
+# -- Configuration for maintenance tasks using as Kubernetes CronJob
+# @section -- Maintenance
+maintenance:
+  # @schema additionalProperties: {type: string}
+  # -- Annotations to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  annotations: {}
+
+  # @schema item: object
+  # -- Extra environment variables to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraEnv: []

Review Comment:
   This is took care.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Helm: Add maintenance suport in helm [polaris]

Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on code in PR #4755:
URL: https://github.com/apache/polaris/pull/4755#discussion_r3419294728


##########
helm/polaris/values.yaml:
##########
@@ -1167,3 +1167,104 @@ tasks:
   # -- The maximum number of tasks that can be queued up for execution. If unspecified or zero, defaults to Integer.MAX_VALUE.
   # @section -- Tasks
   maxQueuedTasks: 0  # 1000
+
+# @schema type: object
+# -- Configuration for maintenance tasks using as Kubernetes CronJob
+# @section -- Maintenance
+maintenance:
+  # @schema additionalProperties: {type: string}
+  # -- Annotations to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  annotations: {}
+
+  # @schema item: object
+  # -- Extra environment variables to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraEnv: []
+  #  - name: AWS_STORAGE_BUCKET
+  #    value: s3://xxxxx/
+  #  - name: AWS_ACCESS_KEY_ID
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: access_key_id
+  #  - name: AWS_SECRET_ACCESS_KEY
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: secret_access_key
+
+  # @schema item: object
+  # -- Bulk import environment variables from Secrets or ConfigMaps to every maintenance Cronjob object.
+  # @section -- Maintenance
+  envFrom: []
+  #  - secretRef:
+  #      name: polaris-env-secret
+  #  - configMapRef:
+  #      name: polaris-env-configmap
+
+  # @schema item: object
+  # -- Extra volumes to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumes: []
+    # - name: extra-volume
+    #   emptyDir: {}
+
+  # @schema item: object
+  # -- Extra volume mounts to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumeMounts: []
+    # - name: extra-volume
+    #   mountPath: /usr/share/extra-volume
+
+  # -- The container image used by every maintenance Cronjob object.
+  # @section -- Maintenance
+  image:

Review Comment:
   By declaring the image at this level, we are determining that all jobs will share the same image. I wonder if this isn't too rigid? IOW should we allow individual jobs to define their own images?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Helm: Add maintenance suport in helm [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on code in PR #4755:
URL: https://github.com/apache/polaris/pull/4755#discussion_r3422570575


##########
helm/polaris/templates/cronjob-maintenance.yaml:
##########
@@ -0,0 +1,149 @@
+{{/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/}}
+
+{{- range $jobName, $jobSpec := .Values.maintenance.jobs }}
+{{- if $jobSpec.enabled }}
+{{- $cronName := printf "%s-maint-%s" (include "polaris.fullname" $) $jobName }}

Review Comment:
   Good idea. I will work on this refactor. Yes, the scheduled cj will added timestamp and suffix (thus I capped at 52). 



##########
helm/polaris/templates/cronjob-maintenance.yaml:
##########
@@ -0,0 +1,149 @@
+{{/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/}}
+
+{{- range $jobName, $jobSpec := .Values.maintenance.jobs }}
+{{- if $jobSpec.enabled }}
+{{- $cronName := printf "%s-maint-%s" (include "polaris.fullname" $) $jobName }}
+{{- if gt (len $cronName) 52 }}
+  {{- fail (printf "Maintenance CronJob name %q is %d chars; must be <= 52 (K8s appends a timestamp+random suffix to generated Pod names, which are capped at 63). Shorten release name, nameOverride/fullnameOverride, or the job key %q." $cronName (len $cronName) $jobName) }}
+{{- end }}
+---
+apiVersion: batch/v1
+kind: CronJob
+metadata:
+  name: {{ $cronName }}
+  namespace: {{ $.Release.Namespace }}
+  labels:
+    {{- include "polaris.labels" $ | nindent 4 }}
+  {{- with $.Values.maintenance.annotations }}
+  annotations:
+    {{- tpl (toYaml .) $ | nindent 4 }}
+  {{- end }}
+spec:
+  schedule: {{ $jobSpec.schedule | quote }}
+  concurrencyPolicy: {{ default "Forbid" $jobSpec.concurrencyPolicy }}
+  {{- if hasKey $jobSpec "successfulJobsHistoryLimit" }}
+  successfulJobsHistoryLimit: {{ $jobSpec.successfulJobsHistoryLimit }}
+  {{- end }}
+  {{- if hasKey $jobSpec "failedJobsHistoryLimit" }}
+  failedJobsHistoryLimit: {{ $jobSpec.failedJobsHistoryLimit }}
+  {{- end }}
+  jobTemplate:
+    spec:
+      {{- if hasKey $jobSpec "backoffLimit" }}
+      backoffLimit: {{ $jobSpec.backoffLimit }}
+      {{- end }}
+      {{- with $jobSpec.activeDeadlineSeconds }}
+      activeDeadlineSeconds: {{ . }}
+      {{- end }}
+      template:
+        metadata:
+          labels:
+            helm.sh/chart: {{ include "polaris.chart" $ }}

Review Comment:
   This is done so they don't get pick up by pod selector:
   ```
   {{/*
     Common labels
   */}}
   {{- define "polaris.labels" -}}
   helm.sh/chart: {{ include "polaris.chart" . }}
   {{ include "polaris.selectorLabels" . }}
   {{- if .Chart.AppVersion }}
   app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
   {{- end }}
   app.kubernetes.io/managed-by: {{ .Release.Service }}
   {{- end }}
   
   {{/*
     Selector labels
   */}}
   {{- define "polaris.selectorLabels" -}}
   app.kubernetes.io/name: {{ include "polaris.name" . }}
   app.kubernetes.io/instance: {{ .Release.Name }}
   {{- end }}
   ```



##########
helm/polaris/values.yaml:
##########
@@ -1167,3 +1167,104 @@ tasks:
   # -- The maximum number of tasks that can be queued up for execution. If unspecified or zero, defaults to Integer.MAX_VALUE.
   # @section -- Tasks
   maxQueuedTasks: 0  # 1000
+
+# @schema type: object
+# -- Configuration for maintenance tasks using as Kubernetes CronJob
+# @section -- Maintenance
+maintenance:
+  # @schema additionalProperties: {type: string}
+  # -- Annotations to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  annotations: {}
+
+  # @schema item: object
+  # -- Extra environment variables to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraEnv: []
+  #  - name: AWS_STORAGE_BUCKET
+  #    value: s3://xxxxx/
+  #  - name: AWS_ACCESS_KEY_ID
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: access_key_id
+  #  - name: AWS_SECRET_ACCESS_KEY
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: secret_access_key
+
+  # @schema item: object
+  # -- Bulk import environment variables from Secrets or ConfigMaps to every maintenance Cronjob object.
+  # @section -- Maintenance
+  envFrom: []
+  #  - secretRef:
+  #      name: polaris-env-secret
+  #  - configMapRef:
+  #      name: polaris-env-configmap
+
+  # @schema item: object
+  # -- Extra volumes to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumes: []
+    # - name: extra-volume
+    #   emptyDir: {}
+
+  # @schema item: object
+  # -- Extra volume mounts to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumeMounts: []
+    # - name: extra-volume
+    #   mountPath: /usr/share/extra-volume
+
+  # -- The container image used by every maintenance Cronjob object.
+  # @section -- Maintenance
+  image:

Review Comment:
   This is assuming all jobs are based off polaris admin tool. Same commented on the other one, do we want to support true "generic" job which users can define any arbitrary jobs and run whatever images they want?



##########
helm/polaris/values.yaml:
##########
@@ -1167,3 +1167,104 @@ tasks:
   # -- The maximum number of tasks that can be queued up for execution. If unspecified or zero, defaults to Integer.MAX_VALUE.
   # @section -- Tasks
   maxQueuedTasks: 0  # 1000
+
+# @schema type: object
+# -- Configuration for maintenance tasks using as Kubernetes CronJob
+# @section -- Maintenance
+maintenance:
+  # @schema additionalProperties: {type: string}
+  # -- Annotations to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  annotations: {}
+
+  # @schema item: object
+  # -- Extra environment variables to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraEnv: []
+  #  - name: AWS_STORAGE_BUCKET
+  #    value: s3://xxxxx/
+  #  - name: AWS_ACCESS_KEY_ID
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: access_key_id
+  #  - name: AWS_SECRET_ACCESS_KEY
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: secret_access_key
+
+  # @schema item: object
+  # -- Bulk import environment variables from Secrets or ConfigMaps to every maintenance Cronjob object.
+  # @section -- Maintenance
+  envFrom: []
+  #  - secretRef:
+  #      name: polaris-env-secret
+  #  - configMapRef:
+  #      name: polaris-env-configmap
+
+  # @schema item: object
+  # -- Extra volumes to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumes: []
+    # - name: extra-volume
+    #   emptyDir: {}
+
+  # @schema item: object
+  # -- Extra volume mounts to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumeMounts: []
+    # - name: extra-volume
+    #   mountPath: /usr/share/extra-volume
+
+  # -- The container image used by every maintenance Cronjob object.
+  # @section -- Maintenance
+  image:
+    # -- The image repository to pull from for the Polaris admin tool.
+    # @section -- Maintenance
+    repository: apache/polaris-admin-tool
+    # @schema enum: [Always, IfNotPresent, Never]
+    # -- The image pull policy.
+    # @section -- Maintenance
+    pullPolicy: IfNotPresent
+    # -- The image tag.
+    # @section -- Maintenance
+    tag: "latest"  # This tag will be replaced with the chart version at release time.
+
+  # @schema additionalProperties: {type: object, required: [schedule]}
+  # -- Define maintenance CronJobs. The key is the name of the job.
+  # @section -- Maintenance
+  jobs:
+    nosql-maintenance:
+      # -- Enable this maintenance job.
+      # @section -- Maintenance
+      enabled: false
+      # -- The schedule in Cron format.
+      # @section -- Maintenance
+      schedule: "0 2 * * *"
+      # -- The arguments to pass to the admin tool.
+      # @section -- Maintenance
+      args: ["nosql", "maintenance-run"]

Review Comment:
   We can if we want to support true "generic" job. Same commented above. This is assuming we will only support polaris admin tool images here thus only args should be support.



##########
helm/polaris/templates/cronjob-maintenance.yaml:
##########
@@ -0,0 +1,149 @@
+{{/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/}}
+
+{{- range $jobName, $jobSpec := .Values.maintenance.jobs }}
+{{- if $jobSpec.enabled }}
+{{- $cronName := printf "%s-maint-%s" (include "polaris.fullname" $) $jobName }}
+{{- if gt (len $cronName) 52 }}
+  {{- fail (printf "Maintenance CronJob name %q is %d chars; must be <= 52 (K8s appends a timestamp+random suffix to generated Pod names, which are capped at 63). Shorten release name, nameOverride/fullnameOverride, or the job key %q." $cronName (len $cronName) $jobName) }}
+{{- end }}
+---
+apiVersion: batch/v1
+kind: CronJob
+metadata:
+  name: {{ $cronName }}
+  namespace: {{ $.Release.Namespace }}
+  labels:
+    {{- include "polaris.labels" $ | nindent 4 }}
+  {{- with $.Values.maintenance.annotations }}
+  annotations:
+    {{- tpl (toYaml .) $ | nindent 4 }}
+  {{- end }}
+spec:
+  schedule: {{ $jobSpec.schedule | quote }}
+  concurrencyPolicy: {{ default "Forbid" $jobSpec.concurrencyPolicy }}
+  {{- if hasKey $jobSpec "successfulJobsHistoryLimit" }}
+  successfulJobsHistoryLimit: {{ $jobSpec.successfulJobsHistoryLimit }}
+  {{- end }}
+  {{- if hasKey $jobSpec "failedJobsHistoryLimit" }}
+  failedJobsHistoryLimit: {{ $jobSpec.failedJobsHistoryLimit }}
+  {{- end }}
+  jobTemplate:
+    spec:
+      {{- if hasKey $jobSpec "backoffLimit" }}
+      backoffLimit: {{ $jobSpec.backoffLimit }}
+      {{- end }}
+      {{- with $jobSpec.activeDeadlineSeconds }}
+      activeDeadlineSeconds: {{ . }}
+      {{- end }}
+      template:
+        metadata:
+          labels:
+            helm.sh/chart: {{ include "polaris.chart" $ }}
+            app.kubernetes.io/name: {{ include "polaris.name" $ }}-maintenance
+            app.kubernetes.io/instance: {{ $.Release.Name }}
+            app.kubernetes.io/component: maintenance
+            app.kubernetes.io/managed-by: {{ $.Release.Service }}
+            {{- if $.Chart.AppVersion }}
+            app.kubernetes.io/version: {{ $.Chart.AppVersion | quote }}
+            {{- end }}
+          {{- with $jobSpec.podAnnotations }}
+          annotations:
+            {{- tpl (toYaml .) $ | nindent 12 }}
+          {{- end }}
+        spec:
+          {{- if $.Values.imagePullSecrets }}
+          imagePullSecrets:
+          {{- range $.Values.imagePullSecrets }}
+            - name: {{ . | quote }}
+          {{- end }}
+          {{- end }}
+          restartPolicy: {{ default "Never" $jobSpec.restartPolicy }}
+          {{- with $.Values.priorityClassName }}
+          priorityClassName: {{ tpl . $ | quote }}
+          {{- end }}
+          serviceAccountName: {{ include "polaris.serviceAccountName" $ }}

Review Comment:
   Yes. I also worried the global one may has too much access than it really needed. I will proceed with a diff SA and default back to global one if not defined.



##########
helm/polaris/values.yaml:
##########
@@ -1167,3 +1167,104 @@ tasks:
   # -- The maximum number of tasks that can be queued up for execution. If unspecified or zero, defaults to Integer.MAX_VALUE.
   # @section -- Tasks
   maxQueuedTasks: 0  # 1000
+
+# @schema type: object
+# -- Configuration for maintenance tasks using as Kubernetes CronJob
+# @section -- Maintenance
+maintenance:
+  # @schema additionalProperties: {type: string}
+  # -- Annotations to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  annotations: {}
+
+  # @schema item: object
+  # -- Extra environment variables to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraEnv: []
+  #  - name: AWS_STORAGE_BUCKET
+  #    value: s3://xxxxx/
+  #  - name: AWS_ACCESS_KEY_ID
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: access_key_id
+  #  - name: AWS_SECRET_ACCESS_KEY
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: secret_access_key
+
+  # @schema item: object
+  # -- Bulk import environment variables from Secrets or ConfigMaps to every maintenance Cronjob object.
+  # @section -- Maintenance
+  envFrom: []
+  #  - secretRef:
+  #      name: polaris-env-secret
+  #  - configMapRef:
+  #      name: polaris-env-configmap
+
+  # @schema item: object
+  # -- Extra volumes to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumes: []
+    # - name: extra-volume
+    #   emptyDir: {}
+
+  # @schema item: object
+  # -- Extra volume mounts to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumeMounts: []
+    # - name: extra-volume
+    #   mountPath: /usr/share/extra-volume
+
+  # -- The container image used by every maintenance Cronjob object.
+  # @section -- Maintenance
+  image:
+    # -- The image repository to pull from for the Polaris admin tool.
+    # @section -- Maintenance
+    repository: apache/polaris-admin-tool
+    # @schema enum: [Always, IfNotPresent, Never]
+    # -- The image pull policy.
+    # @section -- Maintenance
+    pullPolicy: IfNotPresent
+    # -- The image tag.
+    # @section -- Maintenance
+    tag: "latest"  # This tag will be replaced with the chart version at release time.
+
+  # @schema additionalProperties: {type: object, required: [schedule]}
+  # -- Define maintenance CronJobs. The key is the name of the job.
+  # @section -- Maintenance
+  jobs:
+    nosql-maintenance:
+      # -- Enable this maintenance job.
+      # @section -- Maintenance
+      enabled: false
+      # -- The schedule in Cron format.
+      # @section -- Maintenance
+      schedule: "0 2 * * *"
+      # -- The arguments to pass to the admin tool.
+      # @section -- Maintenance
+      args: ["nosql", "maintenance-run"]
+      # @schema enum: [Allow, Forbid, Replace]
+      # -- The concurrency policy, Valid values are: Allow, Forbid, Replace.
+      # @section -- Maintenance
+      concurrencyPolicy: Forbid
+      # @schema type: object
+      # -- Configures the resources requests and limits for this job's container.
+      # @section -- Maintenance
+      resources:
+        {}
+        # limits:
+        #   cpu: 100m
+        #   memory: 128Mi
+        # requests:
+        #   cpu: 100m
+        #   memory: 128Mi
+      # Optional per-job knobs (uncomment to use):
+      # restartPolicy: Never
+      # backoffLimit: 6
+      # activeDeadlineSeconds: 1800
+      # successfulJobsHistoryLimit: 3
+      # failedjobsHistoryLimit: 1
+      # podAnnotations:

Review Comment:
   1. annotations can be really powerful and potentially grant more access via it. This is done to ensure the job pods don't get extra access from global when it is not required.
   2. let me add this. I pre-populated a set of labels to avoid pods get pick up by service via pod selector. I was avoiding this in case if people add those labels back. Maybe that will be more toward to operator issues? 



##########
helm/polaris/templates/cronjob-maintenance.yaml:
##########
@@ -0,0 +1,149 @@
+{{/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/}}
+
+{{- range $jobName, $jobSpec := .Values.maintenance.jobs }}
+{{- if $jobSpec.enabled }}
+{{- $cronName := printf "%s-maint-%s" (include "polaris.fullname" $) $jobName }}
+{{- if gt (len $cronName) 52 }}
+  {{- fail (printf "Maintenance CronJob name %q is %d chars; must be <= 52 (K8s appends a timestamp+random suffix to generated Pod names, which are capped at 63). Shorten release name, nameOverride/fullnameOverride, or the job key %q." $cronName (len $cronName) $jobName) }}
+{{- end }}
+---
+apiVersion: batch/v1
+kind: CronJob
+metadata:
+  name: {{ $cronName }}
+  namespace: {{ $.Release.Namespace }}
+  labels:
+    {{- include "polaris.labels" $ | nindent 4 }}
+  {{- with $.Values.maintenance.annotations }}
+  annotations:
+    {{- tpl (toYaml .) $ | nindent 4 }}
+  {{- end }}
+spec:
+  schedule: {{ $jobSpec.schedule | quote }}
+  concurrencyPolicy: {{ default "Forbid" $jobSpec.concurrencyPolicy }}
+  {{- if hasKey $jobSpec "successfulJobsHistoryLimit" }}
+  successfulJobsHistoryLimit: {{ $jobSpec.successfulJobsHistoryLimit }}
+  {{- end }}
+  {{- if hasKey $jobSpec "failedJobsHistoryLimit" }}
+  failedJobsHistoryLimit: {{ $jobSpec.failedJobsHistoryLimit }}
+  {{- end }}
+  jobTemplate:
+    spec:
+      {{- if hasKey $jobSpec "backoffLimit" }}
+      backoffLimit: {{ $jobSpec.backoffLimit }}
+      {{- end }}
+      {{- with $jobSpec.activeDeadlineSeconds }}
+      activeDeadlineSeconds: {{ . }}
+      {{- end }}
+      template:
+        metadata:
+          labels:
+            helm.sh/chart: {{ include "polaris.chart" $ }}
+            app.kubernetes.io/name: {{ include "polaris.name" $ }}-maintenance
+            app.kubernetes.io/instance: {{ $.Release.Name }}
+            app.kubernetes.io/component: maintenance
+            app.kubernetes.io/managed-by: {{ $.Release.Service }}
+            {{- if $.Chart.AppVersion }}
+            app.kubernetes.io/version: {{ $.Chart.AppVersion | quote }}
+            {{- end }}
+          {{- with $jobSpec.podAnnotations }}
+          annotations:
+            {{- tpl (toYaml .) $ | nindent 12 }}
+          {{- end }}
+        spec:
+          {{- if $.Values.imagePullSecrets }}
+          imagePullSecrets:
+          {{- range $.Values.imagePullSecrets }}
+            - name: {{ . | quote }}
+          {{- end }}
+          {{- end }}
+          restartPolicy: {{ default "Never" $jobSpec.restartPolicy }}
+          {{- with $.Values.priorityClassName }}
+          priorityClassName: {{ tpl . $ | quote }}
+          {{- end }}
+          serviceAccountName: {{ include "polaris.serviceAccountName" $ }}
+          automountServiceAccountToken: false
+          {{- if $.Values.podSecurityContext }}
+          securityContext:
+            {{- tpl (toYaml $.Values.podSecurityContext) $ | nindent 12 }}
+          {{- end }}
+          containers:
+            - name: polaris-admin-tool

Review Comment:
   That is an interesting aspect. So you think people may be running non-polaris admin jobs here? I thought we only want to support people to define what type of maintenance jobs they want to run (with assumptions everything will be from polaris-admin-tool).



##########
helm/polaris/values.yaml:
##########
@@ -1167,3 +1167,104 @@ tasks:
   # -- The maximum number of tasks that can be queued up for execution. If unspecified or zero, defaults to Integer.MAX_VALUE.
   # @section -- Tasks
   maxQueuedTasks: 0  # 1000
+
+# @schema type: object
+# -- Configuration for maintenance tasks using as Kubernetes CronJob
+# @section -- Maintenance
+maintenance:
+  # @schema additionalProperties: {type: string}
+  # -- Annotations to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  annotations: {}
+
+  # @schema item: object
+  # -- Extra environment variables to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraEnv: []

Review Comment:
   I am not sure if it is a good idea to merge those. For example, assuming people is using `extraEnv` to populate AWS related credential info (such as the commented out values), we won't need them on those maintenance jobs as they are interacting with backend database directly. Thus, for anything that may expose extra privileges, I think it is better to keep them seperate. For others such as pod security context, those just tied down the access, which I think we should get from global. Thoughts?  



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Helm: Add maintenance suport in helm [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on code in PR #4755:
URL: https://github.com/apache/polaris/pull/4755#discussion_r3422475950


##########
helm/polaris/values.yaml:
##########
@@ -1167,3 +1167,104 @@ tasks:
   # -- The maximum number of tasks that can be queued up for execution. If unspecified or zero, defaults to Integer.MAX_VALUE.
   # @section -- Tasks
   maxQueuedTasks: 0  # 1000
+
+# @schema type: object
+# -- Configuration for maintenance tasks using as Kubernetes CronJob
+# @section -- Maintenance
+maintenance:
+  # @schema additionalProperties: {type: string}
+  # -- Annotations to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  annotations: {}
+
+  # @schema item: object
+  # -- Extra environment variables to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraEnv: []
+  #  - name: AWS_STORAGE_BUCKET
+  #    value: s3://xxxxx/
+  #  - name: AWS_ACCESS_KEY_ID
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: access_key_id
+  #  - name: AWS_SECRET_ACCESS_KEY
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: secret_access_key
+
+  # @schema item: object
+  # -- Bulk import environment variables from Secrets or ConfigMaps to every maintenance Cronjob object.
+  # @section -- Maintenance
+  envFrom: []
+  #  - secretRef:
+  #      name: polaris-env-secret
+  #  - configMapRef:
+  #      name: polaris-env-configmap
+
+  # @schema item: object
+  # -- Extra volumes to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumes: []
+    # - name: extra-volume
+    #   emptyDir: {}
+
+  # @schema item: object
+  # -- Extra volume mounts to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumeMounts: []
+    # - name: extra-volume
+    #   mountPath: /usr/share/extra-volume
+
+  # -- The container image used by every maintenance Cronjob object.
+  # @section -- Maintenance
+  image:
+    # -- The image repository to pull from for the Polaris admin tool.
+    # @section -- Maintenance
+    repository: apache/polaris-admin-tool
+    # @schema enum: [Always, IfNotPresent, Never]
+    # -- The image pull policy.
+    # @section -- Maintenance
+    pullPolicy: IfNotPresent
+    # -- The image tag.
+    # @section -- Maintenance
+    tag: "latest"  # This tag will be replaced with the chart version at release time.

Review Comment:
   Thanks for the headup. I will take care this later tonight.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Helm: Add maintenance suport in helm [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on code in PR #4755:
URL: https://github.com/apache/polaris/pull/4755#discussion_r3446772926


##########
helm/polaris/values.yaml:
##########
@@ -1167,3 +1167,104 @@ tasks:
   # -- The maximum number of tasks that can be queued up for execution. If unspecified or zero, defaults to Integer.MAX_VALUE.
   # @section -- Tasks
   maxQueuedTasks: 0  # 1000
+
+# @schema type: object
+# -- Configuration for maintenance tasks using as Kubernetes CronJob
+# @section -- Maintenance
+maintenance:
+  # @schema additionalProperties: {type: string}
+  # -- Annotations to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  annotations: {}
+
+  # @schema item: object
+  # -- Extra environment variables to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraEnv: []
+  #  - name: AWS_STORAGE_BUCKET
+  #    value: s3://xxxxx/
+  #  - name: AWS_ACCESS_KEY_ID
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: access_key_id
+  #  - name: AWS_SECRET_ACCESS_KEY
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: secret_access_key
+
+  # @schema item: object
+  # -- Bulk import environment variables from Secrets or ConfigMaps to every maintenance Cronjob object.
+  # @section -- Maintenance
+  envFrom: []
+  #  - secretRef:
+  #      name: polaris-env-secret
+  #  - configMapRef:
+  #      name: polaris-env-configmap
+
+  # @schema item: object
+  # -- Extra volumes to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumes: []
+    # - name: extra-volume
+    #   emptyDir: {}
+
+  # @schema item: object
+  # -- Extra volume mounts to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumeMounts: []
+    # - name: extra-volume
+    #   mountPath: /usr/share/extra-volume
+
+  # -- The container image used by every maintenance Cronjob object.
+  # @section -- Maintenance
+  image:
+    # -- The image repository to pull from for the Polaris admin tool.
+    # @section -- Maintenance
+    repository: apache/polaris-admin-tool
+    # @schema enum: [Always, IfNotPresent, Never]
+    # -- The image pull policy.
+    # @section -- Maintenance
+    pullPolicy: IfNotPresent
+    # -- The image tag.
+    # @section -- Maintenance
+    tag: "latest"  # This tag will be replaced with the chart version at release time.
+
+  # @schema additionalProperties: {type: object, required: [schedule]}
+  # -- Define maintenance CronJobs. The key is the name of the job.
+  # @section -- Maintenance
+  jobs:
+    nosql-maintenance:
+      # -- Enable this maintenance job.
+      # @section -- Maintenance
+      enabled: false
+      # -- The schedule in Cron format.
+      # @section -- Maintenance
+      schedule: "0 2 * * *"
+      # -- The arguments to pass to the admin tool.
+      # @section -- Maintenance
+      args: ["nosql", "maintenance-run"]
+      # @schema enum: [Allow, Forbid, Replace]
+      # -- The concurrency policy, Valid values are: Allow, Forbid, Replace.
+      # @section -- Maintenance
+      concurrencyPolicy: Forbid
+      # @schema type: object
+      # -- Configures the resources requests and limits for this job's container.
+      # @section -- Maintenance
+      resources:

Review Comment:
   This is took care.



##########
releasey/libs/_version.sh:
##########
@@ -121,7 +121,7 @@ function update_helm_version {
   # It's not necessary to update $HELM_VALUES_SCHEMA_FILE or $HELM_REFERENCE_DOC_FILE here, because
   # these files will be generated from $HELM_VALUES_FILE during the release process, and they will
   # automatically reflect the updated version.
-  exec_process sed -E -i~ 's/^(  tag: )"latest".*$/\1"'"${new_version}"'"/' "$HELM_VALUES_FILE"
+  exec_process sed -E -i~ 's/^([[:space:]]+tag: )"latest".*$/\1"'"${new_version}"'"/' "$HELM_VALUES_FILE"

Review Comment:
   This is needed as release script changed the version from "latest" to the actual release version. Previously we only check tag with two leading space (which is the pattern used by the server image). For jobs, it is tag with four spaces. This, instead of dup the line for tag version substitution, I changed to this to handle both cases. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Helm: Add maintenance suport in helm [polaris]

Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on code in PR #4755:
URL: https://github.com/apache/polaris/pull/4755#discussion_r3437221354


##########
helm/polaris/values.yaml:
##########
@@ -1167,3 +1167,104 @@ tasks:
   # -- The maximum number of tasks that can be queued up for execution. If unspecified or zero, defaults to Integer.MAX_VALUE.
   # @section -- Tasks
   maxQueuedTasks: 0  # 1000
+
+# @schema type: object
+# -- Configuration for maintenance tasks using as Kubernetes CronJob
+# @section -- Maintenance
+maintenance:
+  # @schema additionalProperties: {type: string}
+  # -- Annotations to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  annotations: {}
+
+  # @schema item: object
+  # -- Extra environment variables to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraEnv: []

Review Comment:
   Yes, I agree with your reasoning. But in this case, let's document each field and clearly state that they are NOT merged.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Helm: Add maintenance suport in helm [polaris]

Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on code in PR #4755:
URL: https://github.com/apache/polaris/pull/4755#discussion_r3437230718


##########
helm/polaris/values.yaml:
##########
@@ -1167,3 +1167,104 @@ tasks:
   # -- The maximum number of tasks that can be queued up for execution. If unspecified or zero, defaults to Integer.MAX_VALUE.
   # @section -- Tasks
   maxQueuedTasks: 0  # 1000
+
+# @schema type: object
+# -- Configuration for maintenance tasks using as Kubernetes CronJob
+# @section -- Maintenance
+maintenance:
+  # @schema additionalProperties: {type: string}
+  # -- Annotations to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  annotations: {}
+
+  # @schema item: object
+  # -- Extra environment variables to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraEnv: []
+  #  - name: AWS_STORAGE_BUCKET
+  #    value: s3://xxxxx/
+  #  - name: AWS_ACCESS_KEY_ID
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: access_key_id
+  #  - name: AWS_SECRET_ACCESS_KEY
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: secret_access_key
+
+  # @schema item: object
+  # -- Bulk import environment variables from Secrets or ConfigMaps to every maintenance Cronjob object.
+  # @section -- Maintenance
+  envFrom: []
+  #  - secretRef:
+  #      name: polaris-env-secret
+  #  - configMapRef:
+  #      name: polaris-env-configmap
+
+  # @schema item: object
+  # -- Extra volumes to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumes: []
+    # - name: extra-volume
+    #   emptyDir: {}
+
+  # @schema item: object
+  # -- Extra volume mounts to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumeMounts: []
+    # - name: extra-volume
+    #   mountPath: /usr/share/extra-volume
+
+  # -- The container image used by every maintenance Cronjob object.
+  # @section -- Maintenance
+  image:
+    # -- The image repository to pull from for the Polaris admin tool.
+    # @section -- Maintenance
+    repository: apache/polaris-admin-tool
+    # @schema enum: [Always, IfNotPresent, Never]
+    # -- The image pull policy.
+    # @section -- Maintenance
+    pullPolicy: IfNotPresent
+    # -- The image tag.
+    # @section -- Maintenance
+    tag: "latest"  # This tag will be replaced with the chart version at release time.
+
+  # @schema additionalProperties: {type: object, required: [schedule]}
+  # -- Define maintenance CronJobs. The key is the name of the job.
+  # @section -- Maintenance
+  jobs:
+    nosql-maintenance:
+      # -- Enable this maintenance job.
+      # @section -- Maintenance
+      enabled: false
+      # -- The schedule in Cron format.
+      # @section -- Maintenance
+      schedule: "0 2 * * *"
+      # -- The arguments to pass to the admin tool.
+      # @section -- Maintenance
+      args: ["nosql", "maintenance-run"]
+      # @schema enum: [Allow, Forbid, Replace]
+      # -- The concurrency policy, Valid values are: Allow, Forbid, Replace.
+      # @section -- Maintenance
+      concurrencyPolicy: Forbid
+      # @schema type: object
+      # -- Configures the resources requests and limits for this job's container.
+      # @section -- Maintenance
+      resources:
+        {}
+        # limits:
+        #   cpu: 100m
+        #   memory: 128Mi
+        # requests:
+        #   cpu: 100m
+        #   memory: 128Mi
+      # Optional per-job knobs (uncomment to use):
+      # restartPolicy: Never
+      # backoffLimit: 6
+      # activeDeadlineSeconds: 1800
+      # successfulJobsHistoryLimit: 3
+      # failedjobsHistoryLimit: 1
+      # podAnnotations:

Review Comment:
   Thanks, I agree to not merge. Let's just document this.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Helm: Add maintenance suport in helm [polaris]

Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on code in PR #4755:
URL: https://github.com/apache/polaris/pull/4755#discussion_r3437239390


##########
helm/polaris/templates/cronjob-maintenance.yaml:
##########
@@ -0,0 +1,149 @@
+{{/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/}}
+
+{{- range $jobName, $jobSpec := .Values.maintenance.jobs }}
+{{- if $jobSpec.enabled }}
+{{- $cronName := printf "%s-maint-%s" (include "polaris.fullname" $) $jobName }}
+{{- if gt (len $cronName) 52 }}
+  {{- fail (printf "Maintenance CronJob name %q is %d chars; must be <= 52 (K8s appends a timestamp+random suffix to generated Pod names, which are capped at 63). Shorten release name, nameOverride/fullnameOverride, or the job key %q." $cronName (len $cronName) $jobName) }}
+{{- end }}
+---
+apiVersion: batch/v1
+kind: CronJob
+metadata:
+  name: {{ $cronName }}
+  namespace: {{ $.Release.Namespace }}
+  labels:
+    {{- include "polaris.labels" $ | nindent 4 }}
+  {{- with $.Values.maintenance.annotations }}
+  annotations:
+    {{- tpl (toYaml .) $ | nindent 4 }}
+  {{- end }}
+spec:
+  schedule: {{ $jobSpec.schedule | quote }}
+  concurrencyPolicy: {{ default "Forbid" $jobSpec.concurrencyPolicy }}
+  {{- if hasKey $jobSpec "successfulJobsHistoryLimit" }}
+  successfulJobsHistoryLimit: {{ $jobSpec.successfulJobsHistoryLimit }}
+  {{- end }}
+  {{- if hasKey $jobSpec "failedJobsHistoryLimit" }}
+  failedJobsHistoryLimit: {{ $jobSpec.failedJobsHistoryLimit }}
+  {{- end }}
+  jobTemplate:
+    spec:
+      {{- if hasKey $jobSpec "backoffLimit" }}
+      backoffLimit: {{ $jobSpec.backoffLimit }}
+      {{- end }}
+      {{- with $jobSpec.activeDeadlineSeconds }}
+      activeDeadlineSeconds: {{ . }}
+      {{- end }}
+      template:
+        metadata:
+          labels:
+            helm.sh/chart: {{ include "polaris.chart" $ }}

Review Comment:
   Maybe create a separate template then? I'm concerned that the labels could get out of sync if we change the `polaris.labels` template.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Helm: Add maintenance suport in helm [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on code in PR #4755:
URL: https://github.com/apache/polaris/pull/4755#discussion_r3418136666


##########
helm/polaris/templates/cronjob-maintenance.yaml:
##########
@@ -0,0 +1,153 @@
+{{/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/}}
+
+{{- range $jobName, $jobSpec := .Values.maintenance.jobs }}
+{{- if $jobSpec.enabled }}
+{{- $cronName := printf "%s-maint-%s" (include "polaris.fullname" $) $jobName }}
+{{- if gt (len $cronName) 52 }}
+  {{- fail (printf "Maintenance CronJob name %q is %d chars; must be <= 52 (K8s appends a timestamp+random suffix to generated Pod names, which are capped at 63). Shorten release name, nameOverride/fullnameOverride, or the job key %q." $cronName (len $cronName) $jobName) }}
+{{- end }}
+---
+apiVersion: batch/v1
+kind: CronJob
+metadata:
+  name: {{ $cronName }}
+  namespace: {{ $.Release.Namespace }}
+  labels:
+    {{- include "polaris.labels" $ | nindent 4 }}
+  {{- with $.Values.maintenance.annotations }}
+  annotations:
+    {{- tpl (toYaml .) $ | nindent 4 }}
+  {{- end }}
+spec:
+  schedule: {{ $jobSpec.schedule | quote }}
+  concurrencyPolicy: {{ default "Forbid" $jobSpec.concurrencyPolicy }}
+  {{- if hasKey $jobSpec "successfulJobsHistoryLimit" }}
+  successfulJobsHistoryLimit: {{ $jobSpec.successfulJobsHistoryLimit }}
+  {{- end }}
+  {{- if hasKey $jobSpec "failedJobsHistoryLimit" }}
+  failedJobsHistoryLimit: {{ $jobSpec.failedJobsHistoryLimit }}
+  {{- end }}
+  jobTemplate:
+    spec:
+      {{- if hasKey $jobSpec "backoffLimit" }}
+      backoffLimit: {{ $jobSpec.backoffLimit }}
+      {{- end }}
+      {{- with $jobSpec.activeDeadlineSeconds }}
+      activeDeadlineSeconds: {{ . }}
+      {{- end }}
+      template:
+        metadata:
+          labels:
+            helm.sh/chart: {{ include "polaris.chart" $ }}
+            app.kubernetes.io/name: {{ include "polaris.name" $ }}-maintenance
+            app.kubernetes.io/instance: {{ $.Release.Name }}
+            app.kubernetes.io/component: maintenance
+            app.kubernetes.io/managed-by: {{ $.Release.Service }}
+            {{- if $.Chart.AppVersion }}
+            app.kubernetes.io/version: {{ $.Chart.AppVersion | quote }}
+            {{- end }}
+          {{- with $jobSpec.podAnnotations }}
+          annotations:
+            {{- tpl (toYaml .) $ | nindent 12 }}
+          {{- end }}
+        spec:
+          {{- if $.Values.imagePullSecrets }}
+          imagePullSecrets:
+          {{- range $.Values.imagePullSecrets }}
+            - name: {{ . | quote }}
+          {{- end }}
+          {{- end }}
+          restartPolicy: {{ default "Never" $jobSpec.restartPolicy }}
+          {{- with $.Values.priorityClassName }}
+          priorityClassName: {{ tpl . $ | quote }}
+          {{- end }}
+          serviceAccountName: {{ include "polaris.serviceAccountName" $ }}
+          automountServiceAccountToken: false
+          {{- if $.Values.podSecurityContext }}
+          securityContext:
+            {{- tpl (toYaml $.Values.podSecurityContext) $ | nindent 12 }}
+          {{- end }}
+          containers:
+            - name: polaris-admin-tool
+              {{- if $.Values.containerSecurityContext }}
+              securityContext:
+                {{- tpl (toYaml $.Values.containerSecurityContext) $ | nindent 16 }}
+              {{- end }}
+              image: "{{ tpl $.Values.maintenance.image.repository $ }}:{{ tpl $.Values.maintenance.image.tag $ | default $.Chart.Version }}"
+              imagePullPolicy: {{ tpl $.Values.maintenance.image.pullPolicy $ }}
+              {{- if $jobSpec.args }}
+              args:
+                {{- range $jobSpec.args }}
+                - {{ . | quote }}
+                {{- end }}
+              {{- end }}
+              {{- with $jobSpec.resources }}
+              resources:
+                {{- tpl (toYaml .) $ | nindent 16 }}
+              {{- end }}
+              env:
+                - name: quarkus.config.locations
+                  value: "file:{{ trimSuffix "/" $.Values.image.configDir }}/application.properties"
+                {{- $persistenceEnv := include "polaris.persistenceEnv" $ -}}
+                {{- if and (eq $.Values.persistence.type "nosql") (eq $.Values.persistence.nosql.backend "MongoDb") }}
+                - name: quarkus.mongodb.active
+                  value: "true"

Review Comment:
   I would think so. Once that is completed, we will then be able to remove this section. Currently if anyone tried to use the cli for no-sql maintenance, they would get the following:
   ```
   โžœ docker run -it apache/polaris-admin-tool:latest nosql
   INFO exec -a "java" java -XX:MaxRAMPercentage=80.0 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:+ExitOnOutOfMemoryError -cp "." -jar /deployments/polaris-admin-tool.jar nosql
   INFO running in /deployments
   Polaris NoSql persistence has multiple subcommands,
   use the 'help nosql' command.
   
   java.lang.IllegalStateException: Mandatory configuration option polaris.persistence.nosql.backend is missing!
   ...
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Helm: Add maintenance suport in helm [polaris]

Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on code in PR #4755:
URL: https://github.com/apache/polaris/pull/4755#discussion_r3418977024


##########
helm/polaris/values.yaml:
##########
@@ -1167,3 +1167,104 @@ tasks:
   # -- The maximum number of tasks that can be queued up for execution. If unspecified or zero, defaults to Integer.MAX_VALUE.
   # @section -- Tasks
   maxQueuedTasks: 0  # 1000
+
+# @schema type: object
+# -- Configuration for maintenance tasks using as Kubernetes CronJob
+# @section -- Maintenance
+maintenance:
+  # @schema additionalProperties: {type: string}
+  # -- Annotations to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  annotations: {}
+
+  # @schema item: object
+  # -- Extra environment variables to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraEnv: []
+  #  - name: AWS_STORAGE_BUCKET
+  #    value: s3://xxxxx/
+  #  - name: AWS_ACCESS_KEY_ID
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: access_key_id
+  #  - name: AWS_SECRET_ACCESS_KEY
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: secret_access_key
+
+  # @schema item: object
+  # -- Bulk import environment variables from Secrets or ConfigMaps to every maintenance Cronjob object.
+  # @section -- Maintenance
+  envFrom: []
+  #  - secretRef:
+  #      name: polaris-env-secret
+  #  - configMapRef:
+  #      name: polaris-env-configmap
+
+  # @schema item: object
+  # -- Extra volumes to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumes: []
+    # - name: extra-volume
+    #   emptyDir: {}
+
+  # @schema item: object
+  # -- Extra volume mounts to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumeMounts: []
+    # - name: extra-volume
+    #   mountPath: /usr/share/extra-volume
+
+  # -- The container image used by every maintenance Cronjob object.
+  # @section -- Maintenance
+  image:
+    # -- The image repository to pull from for the Polaris admin tool.
+    # @section -- Maintenance
+    repository: apache/polaris-admin-tool
+    # @schema enum: [Always, IfNotPresent, Never]
+    # -- The image pull policy.
+    # @section -- Maintenance
+    pullPolicy: IfNotPresent
+    # -- The image tag.
+    # @section -- Maintenance
+    tag: "latest"  # This tag will be replaced with the chart version at release time.

Review Comment:
   You now need to update the `update_helm_version` function in `./releasey/libs/_version.sh:107` and include a new replacement for this tag:
   
   https://github.com/apache/polaris/blob/0c730504ee5bbfee6761823e4a914546f35074a9/releasey/libs/_version.sh#L107-L125



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Helm: Add maintenance suport in helm [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on code in PR #4755:
URL: https://github.com/apache/polaris/pull/4755#discussion_r3446769896


##########
helm/polaris/values.yaml:
##########
@@ -1167,3 +1167,104 @@ tasks:
   # -- The maximum number of tasks that can be queued up for execution. If unspecified or zero, defaults to Integer.MAX_VALUE.
   # @section -- Tasks
   maxQueuedTasks: 0  # 1000
+
+# @schema type: object
+# -- Configuration for maintenance tasks using as Kubernetes CronJob
+# @section -- Maintenance
+maintenance:
+  # @schema additionalProperties: {type: string}
+  # -- Annotations to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  annotations: {}
+
+  # @schema item: object
+  # -- Extra environment variables to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraEnv: []
+  #  - name: AWS_STORAGE_BUCKET
+  #    value: s3://xxxxx/
+  #  - name: AWS_ACCESS_KEY_ID
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: access_key_id
+  #  - name: AWS_SECRET_ACCESS_KEY
+  #    valueFrom:
+  #      secretKeyRef:
+  #        name: aws-secret
+  #        key: secret_access_key
+
+  # @schema item: object
+  # -- Bulk import environment variables from Secrets or ConfigMaps to every maintenance Cronjob object.
+  # @section -- Maintenance
+  envFrom: []
+  #  - secretRef:
+  #      name: polaris-env-secret
+  #  - configMapRef:
+  #      name: polaris-env-configmap
+
+  # @schema item: object
+  # -- Extra volumes to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumes: []
+    # - name: extra-volume
+    #   emptyDir: {}
+
+  # @schema item: object
+  # -- Extra volume mounts to add to every maintenance Cronjob object.
+  # @section -- Maintenance
+  extraVolumeMounts: []
+    # - name: extra-volume
+    #   mountPath: /usr/share/extra-volume
+
+  # -- The container image used by every maintenance Cronjob object.
+  # @section -- Maintenance
+  image:
+    # -- The image repository to pull from for the Polaris admin tool.
+    # @section -- Maintenance
+    repository: apache/polaris-admin-tool
+    # @schema enum: [Always, IfNotPresent, Never]
+    # -- The image pull policy.
+    # @section -- Maintenance
+    pullPolicy: IfNotPresent
+    # -- The image tag.
+    # @section -- Maintenance
+    tag: "latest"  # This tag will be replaced with the chart version at release time.
+
+  # @schema additionalProperties: {type: object, required: [schedule]}
+  # -- Define maintenance CronJobs. The key is the name of the job.
+  # @section -- Maintenance
+  jobs:
+    nosql-maintenance:
+      # -- Enable this maintenance job.
+      # @section -- Maintenance
+      enabled: false
+      # -- The schedule in Cron format.
+      # @section -- Maintenance
+      schedule: "0 2 * * *"
+      # -- The arguments to pass to the admin tool.
+      # @section -- Maintenance
+      args: ["nosql", "maintenance-run"]
+      # @schema enum: [Allow, Forbid, Replace]
+      # -- The concurrency policy, Valid values are: Allow, Forbid, Replace.
+      # @section -- Maintenance
+      concurrencyPolicy: Forbid
+      # @schema type: object
+      # -- Configures the resources requests and limits for this job's container.
+      # @section -- Maintenance
+      resources:
+        {}
+        # limits:
+        #   cpu: 100m
+        #   memory: 128Mi
+        # requests:
+        #   cpu: 100m
+        #   memory: 128Mi
+      # Optional per-job knobs (uncomment to use):
+      # restartPolicy: Never
+      # backoffLimit: 6
+      # activeDeadlineSeconds: 1800
+      # successfulJobsHistoryLimit: 3
+      # failedjobsHistoryLimit: 1
+      # podAnnotations:

Review Comment:
   This is took care.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Helm: Add maintenance suport in helm [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on code in PR #4755:
URL: https://github.com/apache/polaris/pull/4755#discussion_r3446769009


##########
helm/polaris/templates/cronjob-maintenance.yaml:
##########
@@ -0,0 +1,149 @@
+{{/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/}}
+
+{{- range $jobName, $jobSpec := .Values.maintenance.jobs }}
+{{- if $jobSpec.enabled }}
+{{- $cronName := printf "%s-maint-%s" (include "polaris.fullname" $) $jobName }}
+{{- if gt (len $cronName) 52 }}
+  {{- fail (printf "Maintenance CronJob name %q is %d chars; must be <= 52 (K8s appends a timestamp+random suffix to generated Pod names, which are capped at 63). Shorten release name, nameOverride/fullnameOverride, or the job key %q." $cronName (len $cronName) $jobName) }}
+{{- end }}
+---
+apiVersion: batch/v1
+kind: CronJob
+metadata:
+  name: {{ $cronName }}
+  namespace: {{ $.Release.Namespace }}
+  labels:
+    {{- include "polaris.labels" $ | nindent 4 }}
+  {{- with $.Values.maintenance.annotations }}
+  annotations:
+    {{- tpl (toYaml .) $ | nindent 4 }}
+  {{- end }}
+spec:
+  schedule: {{ $jobSpec.schedule | quote }}
+  concurrencyPolicy: {{ default "Forbid" $jobSpec.concurrencyPolicy }}
+  {{- if hasKey $jobSpec "successfulJobsHistoryLimit" }}
+  successfulJobsHistoryLimit: {{ $jobSpec.successfulJobsHistoryLimit }}
+  {{- end }}
+  {{- if hasKey $jobSpec "failedJobsHistoryLimit" }}
+  failedJobsHistoryLimit: {{ $jobSpec.failedJobsHistoryLimit }}
+  {{- end }}
+  jobTemplate:
+    spec:
+      {{- if hasKey $jobSpec "backoffLimit" }}
+      backoffLimit: {{ $jobSpec.backoffLimit }}
+      {{- end }}
+      {{- with $jobSpec.activeDeadlineSeconds }}
+      activeDeadlineSeconds: {{ . }}
+      {{- end }}
+      template:
+        metadata:
+          labels:
+            helm.sh/chart: {{ include "polaris.chart" $ }}

Review Comment:
   This is took care.



##########
helm/polaris/templates/cronjob-maintenance.yaml:
##########
@@ -0,0 +1,149 @@
+{{/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/}}
+
+{{- range $jobName, $jobSpec := .Values.maintenance.jobs }}
+{{- if $jobSpec.enabled }}
+{{- $cronName := printf "%s-maint-%s" (include "polaris.fullname" $) $jobName }}
+{{- if gt (len $cronName) 52 }}
+  {{- fail (printf "Maintenance CronJob name %q is %d chars; must be <= 52 (K8s appends a timestamp+random suffix to generated Pod names, which are capped at 63). Shorten release name, nameOverride/fullnameOverride, or the job key %q." $cronName (len $cronName) $jobName) }}
+{{- end }}
+---
+apiVersion: batch/v1
+kind: CronJob
+metadata:
+  name: {{ $cronName }}
+  namespace: {{ $.Release.Namespace }}
+  labels:
+    {{- include "polaris.labels" $ | nindent 4 }}
+  {{- with $.Values.maintenance.annotations }}
+  annotations:
+    {{- tpl (toYaml .) $ | nindent 4 }}
+  {{- end }}
+spec:
+  schedule: {{ $jobSpec.schedule | quote }}
+  concurrencyPolicy: {{ default "Forbid" $jobSpec.concurrencyPolicy }}
+  {{- if hasKey $jobSpec "successfulJobsHistoryLimit" }}
+  successfulJobsHistoryLimit: {{ $jobSpec.successfulJobsHistoryLimit }}
+  {{- end }}
+  {{- if hasKey $jobSpec "failedJobsHistoryLimit" }}
+  failedJobsHistoryLimit: {{ $jobSpec.failedJobsHistoryLimit }}
+  {{- end }}
+  jobTemplate:
+    spec:
+      {{- if hasKey $jobSpec "backoffLimit" }}
+      backoffLimit: {{ $jobSpec.backoffLimit }}
+      {{- end }}
+      {{- with $jobSpec.activeDeadlineSeconds }}
+      activeDeadlineSeconds: {{ . }}
+      {{- end }}
+      template:
+        metadata:
+          labels:
+            helm.sh/chart: {{ include "polaris.chart" $ }}
+            app.kubernetes.io/name: {{ include "polaris.name" $ }}-maintenance
+            app.kubernetes.io/instance: {{ $.Release.Name }}
+            app.kubernetes.io/component: maintenance
+            app.kubernetes.io/managed-by: {{ $.Release.Service }}
+            {{- if $.Chart.AppVersion }}
+            app.kubernetes.io/version: {{ $.Chart.AppVersion | quote }}
+            {{- end }}
+          {{- with $jobSpec.podAnnotations }}
+          annotations:
+            {{- tpl (toYaml .) $ | nindent 12 }}
+          {{- end }}
+        spec:
+          {{- if $.Values.imagePullSecrets }}
+          imagePullSecrets:
+          {{- range $.Values.imagePullSecrets }}
+            - name: {{ . | quote }}
+          {{- end }}
+          {{- end }}
+          restartPolicy: {{ default "Never" $jobSpec.restartPolicy }}
+          {{- with $.Values.priorityClassName }}
+          priorityClassName: {{ tpl . $ | quote }}
+          {{- end }}
+          serviceAccountName: {{ include "polaris.serviceAccountName" $ }}

Review Comment:
   This is took care.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org