Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
kairen committed Oct 26, 2018
0 parents commit f0932c9
Show file tree
Hide file tree
Showing 38 changed files with 2,568 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
*.out
*.conf

.DS_Store
vendor/
out/
tmp/


168 changes: 168 additions & 0 deletions Gopkg.lock

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

13 changes: 13 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

required = ["k8s.io/code-generator/cmd/client-gen"]

[[constraint]]
name = "k8s.io/apimachinery"
version = "kubernetes-1.11.0"

[[constraint]]
name = "k8s.io/code-generator"
version = "kubernetes-1.11.0"

[prune]
go-tests = true
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# IPAM APIs and ClientSet
Scheme, typing and client packages for IPAM and Kubernetes-like API objects.
3 changes: 3 additions & 0 deletions apis/inwinstack/register.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package inwinstack

const GroupName = "inwinstack.com"
21 changes: 21 additions & 0 deletions apis/inwinstack/v1/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
Copyright © 2018 inwinSTACK.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.
*/

// +k8s:deepcopy-gen=package,register

// Package v1 is the v1 version of the API.
// +groupName=inwinstack.com
package v1
67 changes: 67 additions & 0 deletions apis/inwinstack/v1/ip_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
Copyright © 2018 inwinSTACK.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.
*/

package v1

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

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// IPList is a list of IP.
type IPList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`

Items []IP `json:"items"`
}

// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// IP represents a Kubernetes IP Custom Resource.
// The IP will be used as IP.
type IP struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`

Spec IPSpec `json:"spec"`
Status IPStatus `json:"status,omitempty"`
}

// IPSpec is the spec for a IP resource.
type IPSpec struct {
PoolName string `json:"poolName"`
UpdateNamespace bool `json:"updateNamespace"`
}

type IPPhase string

// These are the valid phases of a IP.
const (
IPActive IPPhase = "Active"
IPFailed IPPhase = "Failed"
IPTerminating IPPhase = "Terminating"
)

// IPStatus represents the current state of a IP resource.
type IPStatus struct {
Phase IPPhase `json:"phase"`
Reason string `json:"reason,omitempty"`
LastUpdateTime metav1.Time `json:"lastUpdateTime"`
Address string `json:"address,omitempty"`
}
71 changes: 71 additions & 0 deletions apis/inwinstack/v1/pool_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
Copyright © 2018 inwinSTACK.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.
*/

package v1

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

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// PoolList is a list of Pool.
type PoolList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`

Items []Pool `json:"items"`
}

// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// Pool represents a Kubernetes Pool Custom Resource.
// The Pool will be used as IP pools.
type Pool struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`

Spec PoolSpec `json:"spec"`
Status PoolStatus `json:"status,omitempty"`
}

// PoolSpec is the spec for a pool resource.
type PoolSpec struct {
Address string `json:"address"`
IgnoreNamespaces []string `json:"ignoreNamespaces"`
IgnoreNamespaceAnnotation bool `json:"ignoreNamespaceAnnotation"`
AutoAssignToNamespace bool `json:"autoAssignToNamespace"`
}

type PoolPhase string

// These are the valid phases of a pool.
const (
PoolActive PoolPhase = "Active"
PoolFailed PoolPhase = "Failed"
PoolTerminating PoolPhase = "Terminating"
)

// PoolStatus represents the current state of a pool resource.
type PoolStatus struct {
Phase PoolPhase `json:"phase"`
Reason string `json:"reason,omitempty"`
LastUpdateTime metav1.Time `json:"lastUpdateTime"`
AllocatedIPs []string `json:"allocatedIPs"`
Capacity int `json:"capacity"`
}
Loading

0 comments on commit f0932c9

Please sign in to comment.