Skip to content

Commit

Permalink
generate
Browse files Browse the repository at this point in the history
  • Loading branch information
tsuzu committed Feb 15, 2023
1 parent 9d77d0b commit 650615c
Show file tree
Hide file tree
Showing 8 changed files with 309 additions and 5 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ jobs:
with:
context: .
file: Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ Dockerfile.cross
*.swp
*.swo
*~

tmp/
dist/
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,14 @@ $(CONTROLLER_GEN): $(LOCALBIN)
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
$(ENVTEST): $(LOCALBIN)
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest

.PHONY: release
release:
rm -r tmp dist || true
mkdir -p tmp
mkdir -p dist
cd tmp && \
kustomize init && \
kustomize edit add resource ../config/default && \
kustomize edit set image controller=$(IMG) && \
kustomize build > ../dist/components.yaml
49 changes: 46 additions & 3 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.1
creationTimestamp: null
name: bothinstallerconfigs.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
names:
kind: BothInstallerConfig
listKind: BothInstallerConfigList
plural: bothinstallerconfigs
singular: bothinstallerconfig
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: BothInstallerConfig is the Schema for the bothinstallerconfigs
API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: BothInstallerConfigSpec defines the desired state of BothInstallerConfig
properties:
installTemplate:
type: string
repository:
type: string
tagNameTemplate:
type: string
uninstallTemplate:
type: string
required:
- installTemplate
- repository
- uninstallTemplate
type: object
status:
description: BothInstallerConfigStatus defines the observed state of BothInstallerConfig
properties:
installationSecret:
description: InstallationSecret is an optional reference to a generated
installation secret by K8sInstallerConfig controller
properties:
apiVersion:
description: API version of the referent.
type: string
fieldPath:
description: 'If referring to a piece of an object instead of
an entire object, this string should contain a valid JSON/Go
field access statement, such as desiredState.manifest.containers[2].
For example, if the object reference is to a container within
a pod, this would take on a value like: "spec.containers{name}"
(where "name" refers to the name of the container that triggered
the event) or if no container name is specified "spec.containers[2]"
(container with index 2 in this pod). This syntax is chosen
only to have some well-defined way of referencing a part of
an object. TODO: this design is not final and this field is
subject to change in the future.'
type: string
kind:
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
type: string
namespace:
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
type: string
resourceVersion:
description: 'Specific resourceVersion to which this reference
is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
type: string
uid:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
type: object
x-kubernetes-map-type: atomic
ready:
description: Ready indicates the InstallationSecret field is ready
to be consumed
type: boolean
type: object
type: object
served: true
storage: true
subresources:
status: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.1
creationTimestamp: null
name: bothinstallerconfigtemplates.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
names:
kind: BothInstallerConfigTemplate
listKind: BothInstallerConfigTemplateList
plural: bothinstallerconfigtemplates
singular: bothinstallerconfigtemplate
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: BothInstallerConfigTemplate is the Schema for the bothinstallerconfigtemplates
API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: BothInstallerConfigTemplateSpec defines the desired state
of BothInstallerConfigTemplate
properties:
template:
properties:
spec:
description: Spec is the specification of the desired behavior
of the installer config.
properties:
installTemplate:
type: string
repository:
type: string
tagNameTemplate:
type: string
uninstallTemplate:
type: string
required:
- installTemplate
- repository
- uninstallTemplate
type: object
required:
- spec
type: object
required:
- template
type: object
status:
description: BothInstallerConfigTemplateStatus defines the observed state
of BothInstallerConfigTemplate
type: object
type: object
served: true
storage: true
subresources:
status: {}
73 changes: 73 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
name: manager-role
rules:
- apiGroups:
- ""
resources:
- events
- secrets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- cluster.x-k8s.io
resources:
- clusters
- clusters/status
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- infrastructure.cluster.x-k8s.io
resources:
- bothinstallerconfigs
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- infrastructure.cluster.x-k8s.io
resources:
- bothinstallerconfigs/finalizers
verbs:
- update
- apiGroups:
- infrastructure.cluster.x-k8s.io
resources:
- bothinstallerconfigs/status
verbs:
- get
- patch
- update
- apiGroups:
- infrastructure.cluster.x-k8s.io
resources:
- byomachines
verbs:
- get
- list
- watch
- apiGroups:
- infrastructure.cluster.x-k8s.io
resources:
- byomachines/status
verbs:
- get
2 changes: 1 addition & 1 deletion controllers/bothinstallerconfig_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func (r *BothInstallerConfigReconciler) reconcileNormal(ctx context.Context, sco

installTemplate := stringWithDefault(configSpec.InstallTemplate, byohmiscordwinv1alpha1.DefaultInstallTemplate)
uninstallTemplate := stringWithDefault(configSpec.UninstallTemplate, byohmiscordwinv1alpha1.DefaultUninstallTemplate)
repo := stringWithDefault(configSpec.TagTemplate, "")
repo := stringWithDefault(configSpec.Repository, "")
tagTemplate := stringWithDefault(configSpec.TagTemplate, byohmiscordwinv1alpha1.DefaultTagTemplate)

install, uninstall, err := r.Installer.Generate(installer.InstallerConfig{
Expand Down

0 comments on commit 650615c

Please sign in to comment.