Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add component template #69

Merged
merged 10 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/helm-publish.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# This is a basic workflow to help you get started with Actions

name: helm-publish

on:
Expand Down Expand Up @@ -31,7 +29,7 @@ jobs:
- name: Setup Go environment
uses: actions/setup-go@v3.0.0
with:
go-version: '1.17'
go-version: '1.21'

- name: Make manifests
run: make manifests
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*.dylib
bin
testbin/*
manager

# Test binary, build with `go test -c`
*.test
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM --platform=$BUILDPLATFORM golang:1.17 as builder
FROM --platform=$BUILDPLATFORM golang:1.21 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
.PHONY: controller-gen
controller-gen: ## Download controller-gen locally if necessary.
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.8.0)
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0)

KUSTOMIZE = $(shell pwd)/bin/kustomize
.PHONY: kustomize
Expand Down
9 changes: 9 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,13 @@ resources:
kind: ElasticsearchInstance
path: github.com/xco-sk/eck-custom-resources/apis/es.eck/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: github.com
group: es.eck
kind: ComponentTemplate
path: github.com/xco-sk/eck-custom-resources/apis/es.eck/v1alpha1
version: v1alpha1
version: "3"
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Currently supported resources:
- [User](docs/cr_user.md)
- [Role](docs/cr_role.md)
- [API key](docs/cr_apikey.md)
- [Component template](docs/cr_component_template.md)
- For Kibana:
- [Kibana Instance](docs/cr_kibana_instance.md)
- [Space](docs/cr_space.md)
Expand All @@ -40,6 +41,12 @@ Configuration options are documented in [chart README file](charts/eck-custom-re

## Upgrade guide

### From 0.6.0 to 0.7.0
There is a new `ComponentTemplate` CRD present. To apply the CRD, run:
```
kubectl apply --server-side -f https://github.com/xco-sk/eck-custom-resources/v0.7.0/config/crd/bases/es.eck.github.com_componenttemplates.yaml
```

### From 0.5.0 to 0.6.0
The Elasticsearch API Key support was introduced. To apply the CRD, run:
```
Expand Down
4 changes: 2 additions & 2 deletions apis/config/v2/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ limitations under the License.
*/

// Package v2 contains API Schema definitions for the es.eck v2 API group
//+kubebuilder:object:generate=true
//+groupName=config.github.com
// +kubebuilder:object:generate=true
// +groupName=config.github.com
package v2

import (
Expand Down
1 change: 0 additions & 1 deletion apis/config/v2/zz_generated.deepcopy.go

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

63 changes: 63 additions & 0 deletions apis/es.eck/v1alpha1/componenttemplate_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
Copyright 2022.

Licensed 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.
*/

package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// ComponentTemplateSpec defines the desired state of ComponentTemplate
type ComponentTemplateSpec struct {
// +optional
TargetConfig CommonElasticsearchConfig `json:"targetInstance,omitempty"`
// +optional
Dependencies Dependencies `json:"dependencies,omitempty"`

Body string `json:"body"`
}

// ComponentTemplateStatus defines the observed state of ComponentTemplate
type ComponentTemplateStatus struct {
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// ComponentTemplate is the Schema for the componenttemplates API
type ComponentTemplate struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ComponentTemplateSpec `json:"spec,omitempty"`
Status ComponentTemplateStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// ComponentTemplateList contains a list of ComponentTemplate
type ComponentTemplateList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ComponentTemplate `json:"items"`
}

func init() {
SchemeBuilder.Register(&ComponentTemplate{}, &ComponentTemplateList{})
}
2 changes: 2 additions & 0 deletions apis/es.eck/v1alpha1/dependency_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@ type Dependencies struct {
// +optional
IndexTemplates []string `json:"indexTemplates,omitempty"`
// +optional
ComponentTemplates []string `json:"conponentTemplates,omitempty"`
// +optional
Indices []string `json:"indices,omitempty"`
}
4 changes: 2 additions & 2 deletions apis/es.eck/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ limitations under the License.
*/

// Package v1alpha1 contains API Schema definitions for the es.eck v1alpha1 API group
//+kubebuilder:object:generate=true
//+groupName=es.eck.github.com
// +kubebuilder:object:generate=true
// +groupName=es.eck.github.com
package v1alpha1

import (
Expand Down
91 changes: 90 additions & 1 deletion apis/es.eck/v1alpha1/zz_generated.deepcopy.go

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

4 changes: 2 additions & 2 deletions apis/kibana.eck/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ limitations under the License.
*/

// Package v1alpha1 contains API Schema definitions for the kibana.eck v1alpha1 API group
//+kubebuilder:object:generate=true
//+groupName=kibana.eck.github.com
// +kubebuilder:object:generate=true
// +groupName=kibana.eck.github.com
package v1alpha1

import (
Expand Down
1 change: 0 additions & 1 deletion apis/kibana.eck/v1alpha1/zz_generated.deepcopy.go

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

4 changes: 2 additions & 2 deletions charts/eck-custom-resources-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ maintainers:
email: marek@xco.sk
url: https://github.com/xco-sk
type: application
version: 0.6.1
appVersion: 0.6.1
version: 0.7.0
appVersion: 0.7.0
2 changes: 1 addition & 1 deletion charts/eck-custom-resources-operator/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Helm chart for eck-custom-resources

![Version: 0.6.1](https://img.shields.io/badge/Version-0.6.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.6.1](https://img.shields.io/badge/AppVersion-0.6.1-informational?style=flat-square)
![Version: 0.7.0](https://img.shields.io/badge/Version-0.7.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.7.0](https://img.shields.io/badge/AppVersion-0.7.0-informational?style=flat-square)

Helm chart for eck-custom-resources operator

Expand Down
12 changes: 12 additions & 0 deletions charts/eck-custom-resources-operator/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ metadata:
creationTimestamp: null
name: {{ include "eck-custom-resources-operator.clusterRoleName" . }}
rules:
- apiGroups:
- es.eck.github.com
resources:
- componenttemplates
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
Expand Down
59 changes: 59 additions & 0 deletions config/crd/bases/es.eck.github.com_componenttemplates.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
name: componenttemplates.es.eck.github.com
spec:
group: es.eck.github.com
names:
kind: ComponentTemplate
listKind: ComponentTemplateList
plural: componenttemplates
singular: componenttemplate
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: ComponentTemplate is the Schema for the componenttemplates 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: ComponentTemplateSpec defines the desired state of ComponentTemplate
properties:
body:
type: string
targetInstance:
properties:
name:
type: string
type: object
required:
- body
type: object
status:
description: ComponentTemplateStatus defines the observed state of ComponentTemplate
type: object
type: object
served: true
storage: true
subresources:
status: {}
Loading