1
0
mirror of https://github.com/rancher/norman.git synced 2025-09-19 18:16:15 +00:00
Yuki Nishiwaki b18da6edc4 Allow to put Reason in controller.ForgetError
Norman Condition automatically generate condition information based on
the error the handler would return in Condition.Do function.
handler function usually return 2 types of error. the error can be
ignored and the error can not be ignored.
According to current implementation, Condition.Do function generate
condition with error state even if handler return error can be ignored.
The error that can be ignored should be ignored in the context of
condition as well.

So this commit introduce new field which is Reason to ForgetError so
that the developer can put special reason other than Error when
ForgetError is expected to happen by expected procedure like
provisioning and wait for something and Norman Condintion respect to
this field when try to generate condition information based on error

This solution will help us to fix this rancher bug
https://github.com/rancher/rancher/issues/15907
2018-10-03 02:44:42 +09:00
2018-07-24 14:33:56 -07:00
2018-02-09 13:45:22 -07:00
2018-07-19 10:23:17 -07:00
2018-07-19 10:23:17 -07:00
2017-10-11 22:48:07 -07:00
2018-09-24 09:00:20 -07:00
2018-04-02 15:46:10 -07:00
2018-09-25 11:43:11 -07:00
2018-01-22 23:53:21 +00:00
2018-09-18 10:14:28 -07:00
2018-09-25 11:26:23 -07:00
2017-11-10 21:46:30 -07:00
2017-10-11 22:48:07 -07:00
2018-07-11 16:44:45 -07:00
2018-09-25 11:43:11 -07:00
2018-09-25 11:26:23 -07:00
2018-09-25 11:26:23 -07:00
2017-10-11 22:48:07 -07:00
2018-09-25 11:43:11 -07:00
2017-11-10 21:50:42 -07:00

Norman

An API framework for Building Rancher Style APIs backed by K8s CustomResources.

Building

make

Example

Refer to examples/

package main

import (
	"context"
	"fmt"
	"net/http"
	"os"

	"github.com/rancher/norman/generator"
	"github.com/rancher/norman/server"
	"github.com/rancher/norman/types"
)

type Foo struct {
	types.Resource
	Name     string `json:"name"`
	Foo      string `json:"foo"`
	SubThing Baz    `json:"subThing"`
}

type Baz struct {
	Name string `json:"name"`
}

var (
	version = types.APIVersion{
		Version: "v1",
		Group:   "io.cattle.core.example",
		Path:    "/example/v1",
	}

	Schemas = types.NewSchemas()
)

func main() {
	if _, err := Schemas.Import(&version, Foo{}); err != nil {
		panic(err)
	}

	server, err := server.NewAPIServer(context.Background(), os.Getenv("KUBECONFIG"), Schemas)
	if err != nil {
		panic(err)
	}

	fmt.Println("Listening on 0.0.0.0:1234")
	http.ListenAndServe("0.0.0.0:1234", server)
}

License

Copyright (c) 2014-2017 Rancher Labs, Inc.

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.

Description
mirror from GitHub
Readme 28 MiB
Languages
Go 99.5%
Shell 0.4%