Giter VIP home page Giter VIP logo

hive-operator's Introduction

hive-operator

// TODO(user): Add simple overview of use/purpose

Description

// TODO(user): An in-depth paragraph about your project and overview of use

Getting Started

Youโ€™ll need a Kubernetes cluster to run against. You can use KIND to get a local cluster for testing, or run against a remote cluster. Note: Your controller will automatically use the current context in your kubeconfig file (i.e. whatever cluster kubectl cluster-info shows).

Running on the cluster

  1. Install Instances of Custom Resources:
kubectl apply -f config/samples/
  1. Build and push your image to the location specified by IMG:
make docker-build docker-push IMG=<some-registry>/hive-operator:tag
  1. Deploy the controller to the cluster with the image specified by IMG:
make deploy IMG=<some-registry>/hive-operator:tag

Uninstall CRDs

To delete the CRDs from the cluster:

make uninstall

Undeploy controller

UnDeploy the controller from the cluster:

make undeploy

Contributing

// TODO(user): Add detailed information on how you would like others to contribute to this project

How it works

This project aims to follow the Kubernetes Operator pattern.

It uses Controllers, which provide a reconcile function responsible for synchronizing resources until the desired state is reached on the cluster.

Test It Out

  1. Install the CRDs into the cluster:
make install
  1. Run your controller (this will run in the foreground, so switch to a new terminal if you want to leave it running):
make run

NOTE: You can also run this in one step by running: make install run

Modifying the API definitions

If you are editing the API definitions, generate the manifests such as CRs or CRDs using:

make manifests

NOTE: Run make --help for more information on all potential make targets

More information can be found via the Kubebuilder Documentation

License

Copyright 2023 zncdatadev.

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.

hive-operator's People

Contributors

whg517 avatar dependabot[bot] avatar bococ avatar lwpk110 avatar wastill avatar

Stargazers

 avatar Alex M avatar  avatar  avatar Martin avatar

Watchers

 avatar  avatar Kostas Georgiou avatar

hive-operator's Issues

[Feature]: Use default affinity Rules if none specified

Duplicates

  • I have searched the existing issues

Summary ๐Ÿ’ก

  1. When creating workload resources (e.g. Deployment, StatefulSet etc.), default affinity rules will be used for scheduling if no affinity or anti-affinity rules are specified.
  2. The default affinity rules will group nodes and schedule pods to different nodes within the same group, avoiding putting everything on one machine. The default number of groups can be configured but no more than half the total number of machines.
  3. Users can still specify their own detailed affinity rules if needed. The system will ignore the default affinity rules if any rules are specified.

Examples ๐ŸŒˆ

        assert_eq!(
            merged_config.affinity,
            StackableAffinity {
                pod_affinity: None,
                pod_anti_affinity: Some(PodAntiAffinity {
                    preferred_during_scheduling_ignored_during_execution: Some(vec![
                        WeightedPodAffinityTerm {
                            pod_affinity_term: PodAffinityTerm {
                                label_selector: Some(LabelSelector {
                                    match_labels: Some(BTreeMap::from([
                                        ("app.kubernetes.io/name".to_string(), "hive".to_string(),),
                                        (
                                            "app.kubernetes.io/instance".to_string(),
                                            "simple-hive".to_string(),
                                        ),
                                        (
                                            "app.kubernetes.io/component".to_string(),
                                            "metastore".to_string(),
                                        )
                                    ])),
                                    ..LabelSelector::default()
                                }),
                                topology_key: "kubernetes.io/hostname".to_string(),
                                ..PodAffinityTerm::default()
                            },
                            weight: 70
                        }
                    ]),
                    required_during_scheduling_ignored_during_execution: None,
                }),
                node_affinity: None,
                node_selector: None,
            }
        );

Motivation ๐Ÿ”ฆ

Currently when creating workload resources like Deployments without specifying any affinity rules, it may lead to unbalanced resource distribution or difficulty in tracking resources. Adding default affinity rules can reduce user errors and better manage resource allocation.

[Bug]: kind is missing when first run make kind-create

desc

When first run make kind-create in a new golang system environment, an error message show bash: /go/bin/bin/kind: No such file or directory

But, run make kind following, and run make kind-create again, everything is fine.

how to show:

Everyone can run a new golang env by docker, and mount project to container, then run make kind-create.

console log

@whg517 โžœ /workspaces/hive-operator (feat/upgrade-go1.22) $ make kind-create
go: downloading sigs.k8s.io/kind v0.22.0
go: downloading github.com/alessio/shellescape v1.4.1
go: downloading github.com/spf13/cobra v1.4.0
go: downloading github.com/mattn/go-isatty v0.0.14
go: downloading github.com/pelletier/go-toml v1.9.4
go: downloading github.com/BurntSushi/toml v1.0.0
go: downloading github.com/evanphx/json-patch/v5 v5.6.0
go: downloading sigs.k8s.io/yaml v1.3.0
go: downloading github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2
go: downloading golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c
/go/bin/bin/kind create cluster --config test/e2e/kind-config.yaml --image kindest/node:v1.26.14 --name hive-operator-1.26.14  --kubeconfig ./kind-kubeconfig-1.26.14  --wait 120s
bash: /go/bin/bin/kind: No such file or directory
make: *** [Makefile:338: kind-create] Error 127
@whg517 โžœ /workspaces/hive-operator (feat/upgrade-go1.22) $ make kind
make: Nothing to be done for 'kind'.
@whg517 โžœ /workspaces/hive-operator (feat/upgrade-go1.22) $ make kind-create
/go/bin/kind create cluster --config test/e2e/kind-config.yaml --image kindest/node:v1.26.14 --name hive-operator-1.26.14  --kubeconfig ./kind-kubeconfig-1.26.14  --wait 120s
Creating cluster "hive-operator-1.26.14" ...
 โœ“ Ensuring node image (kindest/node:v1.26.14) ๐Ÿ–ผ 
 โœ“ Preparing nodes ๐Ÿ“ฆ  
 โœ“ Writing configuration ๐Ÿ“œ 
 โœ“ Starting control-plane ๐Ÿ•น๏ธ 
 โœ“ Installing CNI ๐Ÿ”Œ 
 โœ“ Installing StorageClass ๐Ÿ’พ 
 โœ“ Waiting โ‰ค 2m0s for control-plane = Ready โณ 
 โ€ข Ready after 15s ๐Ÿ’š
Set kubectl context to "kind-hive-operator-1.26.14"
You can now use your cluster with:

kubectl cluster-info --context kind-hive-operator-1.26.14 --kubeconfig ./kind-kubeconfig-1.26.14

Thanks for using kind! ๐Ÿ˜Š
# make kind-setup KUBECONFIG=./kind-kubeconfig-1.26.14

Code of overriding log4j properties miss a dot

What happened:
the code in package controller ,and logging,go file, metastoreLog4j method,the code below miss a dot:

func (r *MetastoreLoggingRecociler) metastoreLog4j(loggingConfig *hivev1alpha1.LoggingConfigSpec) string {
	properties := make(map[string]string)

	if loggingConfig.Loggers != nil {
		for k, level := range loggingConfig.Loggers {
			if level != nil {
				v := *level
				properties["logger."+k+"level"] = v.Level
			}
		}
	}

the bug row is properties["logger."+k+"level"] = v.Level , there is a dot(.) missing before the level word

What you expected to happen:

correct code should be properties["logger."+k+".level"] = v.Level

Add Issue Templates for Bugs and Features

Hi All,

First, thank you for all the hard work and dedication you put into maintaining this project. It's an invaluable resource for the community.

I would like to suggest adding issue templates to this repository to streamline the process of reporting bugs and requesting features. By having predefined templates, contributors can provide consistent and complete information, making it easier for maintainers to triage and address issues.

Suggested Templates

Bug Report Template

  • Title: [Bug] Brief description of the bug
  • Description: Detailed description of the bug.
  • Steps to Reproduce:
    1. Step one
    2. Step two
    3. Step three
  • Expected Behavior: What you expected to happen.
  • Actual Behavior: What actually happened.
  • Screenshots: (if applicable)
  • Environment:
    • OS: [e.g., Windows, Mac, Linux]
    • Browser: [e.g., Chrome, Safari, Firefox]
    • Version: [e.g., 1.0.0]
  • Additional Context: Any other information that might be useful.

Feature Request Template

  • Title: [Feature] Brief description of the feature
  • Description: Detailed description of the feature request.
  • Motivation: Why this feature would be useful.
  • How It Would Work: Description of how you imagine the feature working.
  • Additional Context: Any other information or context.

Implementation

These templates can be added to the repository by creating a .github/ISSUE_TEMPLATE directory and placing the markdown files there. Here are the steps:

  1. Create a directory named .github/ISSUE_TEMPLATE in the root of the repository.
  2. Add bug_report.md and feature_request.md files in the .github/ISSUE_TEMPLATE directory with the corresponding template content.

For detailed instructions, please refer to the GitHub documentation on issue templates.

Benefits

  • Consistency: Ensures that all necessary information is provided.
  • Efficiency: Helps maintainers quickly understand and triage issues.
  • Contributor Guidance: Provides a clear structure for contributors to follow.

Thank you for considering this suggestion. I believe it will enhance the contribution process and help maintain the project's high standards.

Best regards,

[Bug]: The bundle channel is alpha, but the catalog is stable.

Describe the bug

Because channels are not defined in the Makefile, the default channels are used when the bundle is generated.

hive-operator/Makefile

Lines 8 to 25 in a82b0b2

# CHANNELS define the bundle channels used in the bundle.
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
# To re-generate a bundle for other specific channels without changing the standard setup, you can:
# - use the CHANNELS as arg of the bundle target (e.g make bundle CHANNELS=candidate,fast,stable)
# - use environment variables to overwrite this value (e.g export CHANNELS="candidate,fast,stable")
ifneq ($(origin CHANNELS), undefined)
BUNDLE_CHANNELS := --channels=$(CHANNELS)
endif
# DEFAULT_CHANNEL defines the default channel used in the bundle.
# Add a new line here if you would like to change its default config. (E.g DEFAULT_CHANNEL = "stable")
# To re-generate a bundle for any other default channel without changing the default setup, you can:
# - use the DEFAULT_CHANNEL as arg of the bundle target (e.g make bundle DEFAULT_CHANNEL=stable)
# - use environment variables to overwrite this value (e.g export DEFAULT_CHANNEL="stable")
ifneq ($(origin DEFAULT_CHANNEL), undefined)
BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
endif
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)

Have you searched existing issues? ๐Ÿ”Ž

  • I have searched and found no existing issues

Reproduction

hive-operator/Makefile

Lines 8 to 25 in a82b0b2

# CHANNELS define the bundle channels used in the bundle.
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
# To re-generate a bundle for other specific channels without changing the standard setup, you can:
# - use the CHANNELS as arg of the bundle target (e.g make bundle CHANNELS=candidate,fast,stable)
# - use environment variables to overwrite this value (e.g export CHANNELS="candidate,fast,stable")
ifneq ($(origin CHANNELS), undefined)
BUNDLE_CHANNELS := --channels=$(CHANNELS)
endif
# DEFAULT_CHANNEL defines the default channel used in the bundle.
# Add a new line here if you would like to change its default config. (E.g DEFAULT_CHANNEL = "stable")
# To re-generate a bundle for any other default channel without changing the default setup, you can:
# - use the DEFAULT_CHANNEL as arg of the bundle target (e.g make bundle DEFAULT_CHANNEL=stable)
# - use environment variables to overwrite this value (e.g export DEFAULT_CHANNEL="stable")
ifneq ($(origin DEFAULT_CHANNEL), undefined)
BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
endif
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)

wo can fix it :

diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -23,6 +23,7 @@ VERSION ?= 0.0.1
 # To re-generate a bundle for other specific channels without changing the standard setup, you can:
 # - use the CHANNELS as arg of the bundle target (e.g make bundle CHANNELS=candidate,fast,stable)
 # - use environment variables to overwrite this value (e.g export CHANNELS="candidate,fast,stable")
+CHANNELS ?= "stable"
 ifneq ($(origin CHANNELS), undefined)
 BUNDLE_CHANNELS := --channels=$(CHANNELS)
 endif
@@ -32,6 +33,7 @@ endif
 # To re-generate a bundle for any other default channel without changing the default setup, you can:
 # - use the DEFAULT_CHANNEL as arg of the bundle target (e.g make bundle DEFAULT_CHANNEL=stable)
 # - use environment variables to overwrite this value (e.g export DEFAULT_CHANNEL="stable")
+DEFAULT_CHANNEL ?= "stable"
 ifneq ($(origin DEFAULT_CHANNEL), undefined)
 BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
 endif

Screenshot

No response

Logs

No response

System Info

- go 1.22
- operator-sdk 0.18.2
- client-go 0.30.1
- k8s 1.26

Severity

I can work around it

[Bug]: `kustomize` section in `MakeFile` occur make errors

Describe the bug

when execute make kustomize command, the errors will display below:

โžœ  hive-operator git:(feature/affinity) โœ— make kustomize    
mkdir -p /home/luwei/workspace/znc-git/hive-operator/bin
test -s /home/luwei/workspace/znc-git/hive-operator/bin/kustomize || { curl -Ss "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash -s -- 5.3.0 /home/luwei/workspace/znc-git/hive-operator/bin; }
Version v5.3.0 does not exist or is not available for linux/amd64.
make: *** [Makefile:202๏ผš/home/luwei/workspace/znc-git/hive-operator/bin/kustomize] ้”™่ฏฏ 1

Have you searched existing issues? ๐Ÿ”Ž

  • I have searched and found no existing issues

Reproduction

first, delete bin directory

then, execute command in project root:

$ make kustomize

the error also display for make install, make uninstall or make deploy , these commands are all related to kustomize

Screenshot

No response

Logs

โžœ  hive-operator git:(feature/affinity) โœ— make kustomize    
mkdir -p /home/luwei/workspace/znc-git/hive-operator/bin
test -s /home/luwei/workspace/znc-git/hive-operator/bin/kustomize || { curl -Ss "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash -s -- 5.3.0 /home/luwei/workspace/znc-git/hive-operator/bin; }
Version v5.3.0 does not exist or is not available for linux/amd64.
make: *** [Makefile:202๏ผš/home/luwei/workspace/znc-git/hive-operator/bin/kustomize] ้”™่ฏฏ 1

System Info

- go version: go1.21.7 linux/amd64
- Operating System: Deepin 23                       
- Kernel: Linux 6.1.32-amd64-desktop-hwe
- Architecture: x86-64

Severity

I can work around it

[Draft]: Support go 1.30 and update golang1.22.x

Now that kubernetes 1.30 has been released, while bringing a lot of new features, it also requires golang's environment to be 1.22. Start supporting k8s 1.30 now.

Due to the need to upgrade to golang 1.22 upon the introduction of k8s dependencies, the development environment will be upgraded to 1.22 and the related projects will be upgraded simultaneously.

In support of k8s through e2e check tests, the current e2e test coverage to k8s versions 1.26 and 1.27.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.