You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(docker-to-sealos): omit pull secrets for public images (#34)
Allow public-image workloads to omit imagePullSecrets while still rejecting custom pull secret references when imagePullSecrets are declared. Update the converter, consistency rule, documentation, and tests to match the Sealos template behavior.
Copy file name to clipboardExpand all lines: skills/docker-to-sealos/SKILL.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -140,7 +140,7 @@ If validation fails, fix template/rules/examples first.
140
140
- Avoid floating tags (for example `:v2`, `:2.1`, `:stable`); use an explicit version tag or digest.
141
141
- Managed workload image references must be concrete and must not contain Compose-style variable expressions (for example `${VAR}`, `${VAR:-default}`); resolve to explicit tag or digest before emitting template artifacts.
142
142
- Application `originImageName` must match container image.
143
-
-Managed app workloads must reference the app-scoped image pull Secret `${{ defaults.app_name }}` via `template.spec.imagePullSecrets`.
143
+
-Public-image managed app workloads must omit `template.spec.imagePullSecrets`; private-registry workloads may reference only the app-scoped pull Secret `${{ defaults.app_name }}`.
144
144
- The registry pull Secret is runtime-managed by `sealos-deploy` using local `gh` CLI credentials for private GHCR images; do not expose raw registry credential inputs in generated templates.
145
145
- All containers must explicitly set `imagePullPolicy: IfNotPresent`.
146
146
@@ -156,7 +156,7 @@ If validation fails, fix template/rules/examples first.
156
156
- Non-database sensitive values/inputs use direct `env[].value`.
157
157
- Business containers must source database connection fields (`endpoint`, `host`, `port`, `username`, `password`) from approved Kubeblocks database secrets via `env[].valueFrom.secretKeyRef`; exception: Redis `host`/`port` may use Sealos Redis Service FQDN and `6379` when the Redis secret only exposes credentials, and MongoDB connection URLs may use the Sealos MongoDB Service FQDN plus `27017` when the MongoDB secret exposes credentials only.
158
158
- Business containers must not use custom env/volume `Secret` references except approved Kubeblocks database secrets and object storage secrets.
159
-
- A dedicated app-scoped registry pull Secret is allowed and should be referenced only through `template.spec.imagePullSecrets`.
159
+
- A dedicated app-scoped registry pull Secret is allowed only for private-registry images and must be referenced only through `template.spec.imagePullSecrets`; public images must not add pull secrets.
160
160
- Database connection/bootstrap may use Kubeblocks-provided secrets, and reserved Kubeblocks database secret names must not be redefined by custom `Secret` resources.
161
161
- Env vars must be declared before referenced (for example password before URL composition).
162
162
- Follow official app env var naming; do not invent prefixes.
Copy file name to clipboardExpand all lines: skills/docker-to-sealos/references/must-rules-map.yaml
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -132,7 +132,7 @@ must_rules:
132
132
enforcement:
133
133
type: rule
134
134
target: R015
135
-
- must: "Managed app workloads must reference the app-scoped image pull Secret `${{ defaults.app_name }}` via `template.spec.imagePullSecrets`."
135
+
- must: "Public-image managed app workloads must omit `template.spec.imagePullSecrets`; private-registry workloads may reference only the app-scoped pull Secret `${{ defaults.app_name }}`."
136
136
enforcement:
137
137
type: rule
138
138
target: R035
@@ -172,7 +172,7 @@ must_rules:
172
172
enforcement:
173
173
type: rule
174
174
target: R007
175
-
- must: "A dedicated app-scoped registry pull Secret is allowed and should be referenced only through `template.spec.imagePullSecrets`."
175
+
- must: "A dedicated app-scoped registry pull Secret is allowed only for private-registry images and must be referenced only through `template.spec.imagePullSecrets`; public images must not add pull secrets."
Copy file name to clipboardExpand all lines: skills/docker-to-sealos/references/rules-registry.yaml
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -119,7 +119,7 @@ rules:
119
119
description: Managed app workloads must explicitly set automountServiceAccountToken to false unless Kubernetes API/service account token usage is evidenced by integration settings, serviceAccountName, or a service-account-token reason annotation.
120
120
severity: error
121
121
- id: R035
122
-
description: Managed app workloads must reference the app-scoped image pull secret name via template.spec.imagePullSecrets.
122
+
description: Managed app workloads that declare imagePullSecrets must reference only the app-scoped pull secret name via template.spec.imagePullSecrets; public-image workloads may omit imagePullSecrets.
123
123
severity: error
124
124
- id: R011
125
125
description: All PVC storage requests must be concrete values and less than or equal to 1Gi.
Copy file name to clipboardExpand all lines: skills/docker-to-sealos/references/sealos-specs.md
+4-10Lines changed: 4 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -453,8 +453,6 @@ spec:
453
453
template:
454
454
spec:
455
455
automountServiceAccountToken: false
456
-
imagePullSecrets:
457
-
- name: ${{ defaults.app_name }}
458
456
containers:
459
457
- name: ${{ defaults.app_name }}
460
458
volumeMounts:
@@ -832,17 +830,17 @@ All application Deployments or StatefulSets must include the following configura
832
830
833
831
1. **automountServiceAccountToken**: Must be set to `false` to avoid unnecessary permission exposure. Set it to `true` only when the application explicitly needs the Kubernetes API/service account token, evidenced by Kubernetes integration settings, `serviceAccountName`, or `sealos.io/service-account-token-reason` in workload annotations.
834
832
2. **revisionHistoryLimit**: Must be set to `1` to reduce resources consumed by historical revisions
835
-
3. **imagePullSecrets**: Must reference the app-scoped image pull Secret `${{ defaults.app_name }}`
833
+
3. **imagePullSecrets**: Omit for public images. For private-registry images, reference only the app-scoped pull Secret `${{ defaults.app_name }}`
836
834
4. **metadata.annotations**: Must include the following annotations:
837
835
- `originImageName`: Original image name
838
836
- `deploy.cloud.sealos.io/minReplicas`: Minimum replica count, typically set to `'1'`
839
837
- `deploy.cloud.sealos.io/maxReplicas`: Maximum replica count, typically set to `'1'`
840
838
841
839
Recommended registry pull Secret model:
842
840
843
-
- Managed workloads reference `${{ defaults.app_name }}` in `imagePullSecrets`
844
-
- `sealos-deploy`creates or refreshes that Secret automatically from local `gh` CLI credentials when the image is a private GHCR image
845
-
- If the template is deployed outside `sealos-deploy`, the operator must create the Secret manually before applying the workload
- For private GHCR images, `sealos-deploy` creates or refreshes `${{ defaults.app_name }}` from local `gh` CLI credentials and the workload may reference it through `imagePullSecrets`
843
+
- If a private-registry template is deployed outside `sealos-deploy`, the operator must create the Secret manually before applying the workload
846
844
847
845
```yaml
848
846
apiVersion: apps/v1
@@ -861,8 +859,6 @@ spec:
861
859
template:
862
860
spec:
863
861
automountServiceAccountToken: false # Default; only set true with evidenced Kubernetes API token need
864
-
imagePullSecrets:
865
-
- name: ${{ defaults.app_name }}
866
862
containers:
867
863
- name: ${{ defaults.app_name }}
868
864
# Other container configuration...
@@ -894,8 +890,6 @@ spec:
894
890
app: ${{ defaults.app_name }}
895
891
spec:
896
892
automountServiceAccountToken: false # Disable automatic service account token mounting
0 commit comments