Skip to content

Commit 8f71a33

Browse files
committed
Add regcache chart and use it as an ace-installer subchart
Add a standalone regcache Helm chart (charts/regcache) that deploys a CNCF Distribution (registry:3) pull-through cache, and consume it from ace-installer as a subchart (file://../regcache, condition regcache.enabled, default true). It proxies the upstream registry (ghcr.io by default) so ghcr.io/appscode-charts images are served from within the cluster. Cache image is ghcr.io/appscode-images/registry:3.1.1. The regcache chart is global-aware (modeled on charts/billing): it resolves its image registry from registryFQDN, OpenShift via Capabilities, and the PVC storage class from persistence.storageClass, else infra.storageClass.name, else the parent's global.infra.storageClass.name, else the cluster default. Its helpers are prefixed (regcache.*) to avoid Helm's global template-name collisions with the parent chart. ace-installer keeps an appscode-wizards-oci HelmRepository used by the platform UI deploy wizards. When regcache is enabled, its URL is rewritten to the in-cluster proxy Service so wizard chart pulls are served from the cache; the proxy serves plain HTTP, so the repository is marked insecure. The regcache.serviceAddress helper mirrors the subchart's fullname so the rewritten URL always matches the Service name. charts/ace-installer-certified and ace-installer-certified-crds are regenerated from charts/ace-installer via chart-packer and depend on ../regcache. update-chart-dependencies.sh now builds the ace-installer dependencies, and the bundled charts/ dirs are gitignored while Chart.lock is tracked. Signed-off-by: Tamal Saha <tamal@appscode.com>
1 parent d2e5cb5 commit 8f71a33

48 files changed

Lines changed: 4509 additions & 1037 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ _testmain.go
3838

3939
/charts/acaas/charts
4040
/charts/ace/charts
41+
/charts/ace-installer/charts
42+
/charts/ace-installer-certified/charts
4143
/charts/opscenter-features/charts
4244
/charts/platform-opscenter/charts
4345
/charts/service-gateway/charts

AGENTS.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,12 @@ Helpers (invoked outside Make):
4444
- License: `LICENSE.md`. Sign off commits (`git commit -s`).
4545
- Vendor directory is checked in; keep `go mod tidy && go mod vendor` clean.
4646
- CRDs for charts are imported via `import-crds.sh`; don't hand-author `charts/*/crds/*.yaml`.
47-
- `-certified` charts mirror the standard charts for Red Hat certification — bumps must apply to both.
47+
- `-certified` charts mirror the standard charts for Red Hat certification. `charts/ace-installer-certified` and `charts/ace-installer-certified-crds` are **generated** — do not edit them directly. After changing `charts/ace-installer`, regenerate them with:
48+
49+
```sh
50+
rm -rf charts/ace-installer-certified charts/ace-installer-certified-crds
51+
chart-packer crd-less --input charts/ace-installer --output charts
52+
chart-packer crd-only --input charts/ace-installer --output charts
53+
make gen-chart-doc
54+
```
4855
- Adding a new chart: create `charts/<name>/`, add a values-schema Go type under `apis/installer/v1alpha1/`, list images in `imagelist.yaml`, then run `make gen`.

apis/installer/v1alpha1/ace_installer_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ type AceInstallerSpec struct {
5858
SelfManagement configapi.SelfManagement `json:"selfManagement"`
5959
Precheck AceInstallerPrecheckSpec `json:"precheck"`
6060
Tester AceInstallerPodSpec `json:"tester"`
61+
// Regcache configures the in-cluster pull-through Docker registry cache
62+
// (CNCF Distribution / registry:3) deployed via the regcache subchart. When
63+
// enabled, it transparently proxies images from the upstream registry
64+
// (ghcr.io by default), so that ghcr.io/appscode-charts images can be served
65+
// from within the cluster.
66+
Regcache RegcacheSpec `json:"regcache"`
6167
// +optional
6268
Options string `json:"options"`
6369
}
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
/*
2+
Copyright AppsCode Inc. and Contributors
3+
4+
Licensed under the AppsCode Community License 1.0.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
https://github.com/appscode/licenses/raw/1.0.0/AppsCode-Community-1.0.0.md
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha1
18+
19+
import (
20+
core "k8s.io/api/core/v1"
21+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22+
"kmodules.xyz/resource-metadata/apis/shared"
23+
)
24+
25+
const (
26+
ResourceKindRegcache = "Regcache"
27+
ResourceRegcache = "regcache"
28+
ResourceRegcaches = "regcaches"
29+
)
30+
31+
// Regcache defines the schema for the regcache chart values.
32+
33+
// +genclient
34+
// +genclient:skipVerbs=updateStatus
35+
// +k8s:openapi-gen=true
36+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
37+
38+
// +kubebuilder:object:root=true
39+
// +kubebuilder:resource:path=regcaches,singular=regcache,categories={kubeops,appscode}
40+
type Regcache struct {
41+
metav1.TypeMeta `json:",inline,omitempty"`
42+
metav1.ObjectMeta `json:"metadata,omitempty"`
43+
Spec RegcacheSpec `json:"spec,omitempty"`
44+
}
45+
46+
// RegcacheSpec is the schema for the regcache chart values. It deploys an
47+
// in-cluster pull-through Docker registry cache (CNCF Distribution / registry:3)
48+
// that transparently proxies images from an upstream registry (ghcr.io by
49+
// default), so that ghcr.io/appscode-charts images can be served from within
50+
// the cluster.
51+
type RegcacheSpec struct {
52+
Enabled bool `json:"enabled"`
53+
ReplicaCount int `json:"replicaCount"`
54+
//+optional
55+
NameOverride string `json:"nameOverride"`
56+
//+optional
57+
FullnameOverride string `json:"fullnameOverride"`
58+
// RegistryFQDN is the docker registry fqdn used to pull the registry image.
59+
RegistryFQDN string `json:"registryFQDN"`
60+
Image ImageReference `json:"image"`
61+
//+optional
62+
ImagePullSecrets []string `json:"imagePullSecrets"`
63+
// RemoteURL is the upstream registry that this instance proxies as a
64+
// pull-through cache.
65+
RemoteURL string `json:"remoteURL"`
66+
// TTL is how long a cached blob/manifest is kept before the pull-through
67+
// cache scheduler purges it. This is the only mechanism that frees disk:
68+
// the cache has no capacity-based (LRU) eviction, so lower values bound
69+
// disk usage at the cost of re-fetching from upstream more often.
70+
//+optional
71+
TTL string `json:"ttl"`
72+
// Username is an optional credential for authenticating against the
73+
// upstream registry. Leave empty for anonymous pulls.
74+
//+optional
75+
Username string `json:"username"`
76+
// Password is an optional credential for authenticating against the
77+
// upstream registry. Leave empty for anonymous pulls.
78+
//+optional
79+
Password string `json:"password"`
80+
//+optional
81+
PodAnnotations map[string]string `json:"podAnnotations"`
82+
//+optional
83+
PodSecurityContext *core.PodSecurityContext `json:"podSecurityContext"`
84+
//+optional
85+
SecurityContext *core.SecurityContext `json:"securityContext"`
86+
Service AceServiceSpec `json:"service"`
87+
Persistence RegcachePersistence `json:"persistence"`
88+
//+optional
89+
Resources core.ResourceRequirements `json:"resources"`
90+
//+optional
91+
NodeSelector map[string]string `json:"nodeSelector"`
92+
// If specified, the pod's tolerations.
93+
//+optional
94+
Tolerations []core.Toleration `json:"tolerations"`
95+
// If specified, the pod's scheduling constraints
96+
//+optional
97+
Affinity *core.Affinity `json:"affinity"`
98+
Infra RegcacheInfra `json:"infra"`
99+
//+optional
100+
Distro shared.DistroSpec `json:"distro"`
101+
}
102+
103+
type RegcacheInfra struct {
104+
StorageClass LocalObjectReference `json:"storageClass"`
105+
}
106+
107+
type RegcachePersistence struct {
108+
Enabled bool `json:"enabled"`
109+
StorageClass string `json:"storageClass"`
110+
AccessMode string `json:"accessMode"`
111+
Size string `json:"size"`
112+
}
113+
114+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
115+
116+
// RegcacheList is a list of Regcaches
117+
type RegcacheList struct {
118+
metav1.TypeMeta `json:",inline"`
119+
metav1.ListMeta `json:"metadata,omitempty"`
120+
// Items is a list of Regcache CRD objects
121+
Items []Regcache `json:"items,omitempty"`
122+
}

apis/installer/v1alpha1/register.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
130130
&NatsList{},
131131
&Openfga{},
132132
&OpenfgaList{},
133+
&Regcache{},
134+
&RegcacheList{},
133135
&Reloader{},
134136
&ReloaderList{},
135137
&S3proxy{},

apis/installer/v1alpha1/zz_generated.deepcopy.go

Lines changed: 152 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)