Skip to content

Commit 98def35

Browse files
updated v1alpha scaffolding (#191)
* updated v1alpha scaffolding * removed print line * updated tutorial with note * modified and reverted changes * updated doc with links
1 parent 14db3a2 commit 98def35

File tree

3 files changed

+7
-114
lines changed

3 files changed

+7
-114
lines changed

docs/tutorial.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ The `init` command generates the RBAC rules in `config/rbac/role.yaml` based on
3232
**Note:**
3333
This creates a project structure that is compatible with both Helm and Go APIs. To learn more about the project directory structure, see the [project layout][[project_layout]] doc.
3434

35+
Hybrid-Helm has not been tested against webhooks and cert manager. Hence, there is no scaffolding for webhooks and cert manager. Go APIs support Webhooks in general. If users, would like to experiment doing so, they can refer to [Operator SDK](https://sdk.operatorframework.io/docs/building-operators/golang/webhook/) or [Kubebuilder](https://book.kubebuilder.io/reference/webhook-overview.html?highlight=webhook#webhook) documentation.
36+
3537
## Create a new Helm API
3638

3739
Use the following command to create a new Helm API:

pkg/plugins/hybrid/v1alpha/scaffolds/init.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates"
2626
"github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/hack"
2727
"github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/rbac"
28+
utils "github.com/operator-framework/helm-operator-plugins/pkg/plugins/util"
2829
"github.com/spf13/afero"
2930
"sigs.k8s.io/kubebuilder/v3/pkg/config"
3031
"sigs.k8s.io/kubebuilder/v3/pkg/machinery"
@@ -76,6 +77,10 @@ func (s *initScaffolder) InjectFS(fs machinery.Filesystem) {
7677
func (s *initScaffolder) Scaffold() error {
7778
fmt.Println("Writing scaffolds for you to edit...")
7879

80+
if err := utils.UpdateKustomizationsInit(); err != nil {
81+
return fmt.Errorf("error updating kustomization.yaml files: %v", err)
82+
}
83+
7984
// Initialize the machinery.Scaffold that will write the files to disk
8085
scaffold := machinery.NewScaffold(s.fs,
8186
machinery.WithDirectoryPermissions(0755),

testdata/hybrid/memcached-operator/config/default/kustomization.yaml

Lines changed: 0 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ resources:
1818
- ../crd
1919
- ../rbac
2020
- ../manager
21-
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
22-
# crd/kustomization.yaml
23-
#- ../webhook
24-
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. 'WEBHOOK' components are required.
25-
#- ../certmanager
2621
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
2722
#- ../prometheus
2823

@@ -35,112 +30,3 @@ patchesStrategicMerge:
3530
# Mount the controller config file for loading manager configurations
3631
# through a ComponentConfig type
3732
#- manager_config_patch.yaml
38-
39-
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
40-
# crd/kustomization.yaml
41-
#- manager_webhook_patch.yaml
42-
43-
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'.
44-
# Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks.
45-
# 'CERTMANAGER' needs to be enabled to use ca injection
46-
#- webhookcainjection_patch.yaml
47-
48-
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix.
49-
# Uncomment the following replacements to add the cert-manager CA injection annotations
50-
#replacements:
51-
# - source: # Add cert-manager annotation to ValidatingWebhookConfiguration, MutatingWebhookConfiguration and CRDs
52-
# kind: Certificate
53-
# group: cert-manager.io
54-
# version: v1
55-
# name: serving-cert # this name should match the one in certificate.yaml
56-
# fieldPath: .metadata.namespace # namespace of the certificate CR
57-
# targets:
58-
# - select:
59-
# kind: ValidatingWebhookConfiguration
60-
# fieldPaths:
61-
# - .metadata.annotations.[cert-manager.io/inject-ca-from]
62-
# options:
63-
# delimiter: '/'
64-
# index: 0
65-
# create: true
66-
# - select:
67-
# kind: MutatingWebhookConfiguration
68-
# fieldPaths:
69-
# - .metadata.annotations.[cert-manager.io/inject-ca-from]
70-
# options:
71-
# delimiter: '/'
72-
# index: 0
73-
# create: true
74-
# - select:
75-
# kind: CustomResourceDefinition
76-
# fieldPaths:
77-
# - .metadata.annotations.[cert-manager.io/inject-ca-from]
78-
# options:
79-
# delimiter: '/'
80-
# index: 0
81-
# create: true
82-
# - source:
83-
# kind: Certificate
84-
# group: cert-manager.io
85-
# version: v1
86-
# name: serving-cert # this name should match the one in certificate.yaml
87-
# fieldPath: .metadata.name
88-
# targets:
89-
# - select:
90-
# kind: ValidatingWebhookConfiguration
91-
# fieldPaths:
92-
# - .metadata.annotations.[cert-manager.io/inject-ca-from]
93-
# options:
94-
# delimiter: '/'
95-
# index: 1
96-
# create: true
97-
# - select:
98-
# kind: MutatingWebhookConfiguration
99-
# fieldPaths:
100-
# - .metadata.annotations.[cert-manager.io/inject-ca-from]
101-
# options:
102-
# delimiter: '/'
103-
# index: 1
104-
# create: true
105-
# - select:
106-
# kind: CustomResourceDefinition
107-
# fieldPaths:
108-
# - .metadata.annotations.[cert-manager.io/inject-ca-from]
109-
# options:
110-
# delimiter: '/'
111-
# index: 1
112-
# create: true
113-
# - source: # Add cert-manager annotation to the webhook Service
114-
# kind: Service
115-
# version: v1
116-
# name: webhook-service
117-
# fieldPath: .metadata.name # namespace of the service
118-
# targets:
119-
# - select:
120-
# kind: Certificate
121-
# group: cert-manager.io
122-
# version: v1
123-
# fieldPaths:
124-
# - .spec.dnsNames.0
125-
# - .spec.dnsNames.1
126-
# options:
127-
# delimiter: '.'
128-
# index: 0
129-
# create: true
130-
# - source:
131-
# kind: Service
132-
# version: v1
133-
# name: webhook-service
134-
# fieldPath: .metadata.namespace # namespace of the service
135-
# targets:
136-
# - select:
137-
# kind: Certificate
138-
# group: cert-manager.io
139-
# version: v1
140-
# fieldPaths:
141-
# - .spec.dnsNames.0
142-
# - .spec.dnsNames.1
143-
# options:
144-
# delimiter: '.'
145-
# index: 1
146-
# create: true

0 commit comments

Comments
 (0)