Skip to content

Commit

Permalink
Merge pull request #71 from SomtochiAma/localdns-lib
Browse files Browse the repository at this point in the history
Uses packages from declarative pattern repo
  • Loading branch information
k8s-ci-robot committed Jul 9, 2020
2 parents 8a52baa + d69b7a0 commit 040a382
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 10 deletions.
8 changes: 4 additions & 4 deletions nodelocaldns/api/v1alpha1/nodelocaldns_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
// 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.

// nodelocaldnsSpec defines the desired state of nodelocaldns
// NodeLocalDNSSpec defines the desired state of NodeLocalDNS
type NodeLocalDNSSpec struct {
addonv1alpha1.CommonSpec `json:",inline"`
addonv1alpha1.PatchSpec `json:",inline"`
Expand All @@ -20,7 +20,7 @@ type NodeLocalDNSSpec struct {
ClusterIP string `json:"clusterIP,omitempty"`
}

// nodelocaldnsStatus defines the observed state of nodelocaldns
// NodeLocalDNSStatus defines the observed state of NodeLocalDNS
type NodeLocalDNSStatus struct {
addonv1alpha1.CommonStatus `json:",inline"`

Expand All @@ -30,7 +30,7 @@ type NodeLocalDNSStatus struct {

// +kubebuilder:object:root=true

// nodelocaldns is the Schema for the nodelocaldns API
// NodeLocalDNS is the Schema for the nodelocaldns API
type NodeLocalDNS struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down Expand Up @@ -63,7 +63,7 @@ func (o *NodeLocalDNS) SetCommonStatus(s addonv1alpha1.CommonStatus) {

// +kubebuilder:object:root=true

// NodelocaldnsList contains a list of nodelocaldns
// NodeLocalDNSList contains a list of nodelocaldns
type NodeLocalDNSList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Expand Down
8 changes: 6 additions & 2 deletions nodelocaldns/controllers/nodelocaldns_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"sigs.k8s.io/kubebuilder-declarative-pattern/pkg/patterns/addon"
"sigs.k8s.io/kubebuilder-declarative-pattern/pkg/patterns/addon/pkg/status"
"sigs.k8s.io/kubebuilder-declarative-pattern/pkg/patterns/declarative"
"sigs.k8s.io/kubebuilder-declarative-pattern/utils"

"github.com/go-logr/logr"
"k8s.io/apimachinery/pkg/runtime"
Expand Down Expand Up @@ -94,11 +95,14 @@ func replaceVariables(mgr ctrl.Manager) declarative.ManifestOperation {
// TODO: port findClusterIP and getDNSDomain from coredns/controllers/utils in the kubebuilder-declarative
// -pattern repo and use it here
if o.Spec.DNSDomain == "" {
o.Spec.DNSDomain = "cluster.local"
o.Spec.DNSDomain = utils.GetDNSDomain()
}

if o.Spec.DNSIP == "" {
o.Spec.DNSIP = "169.254.20.10"
o.Spec.DNSIP, err = utils.FindDNSClusterIP(ctx, mgr.GetClient())
if err != nil {
return "", err
}
}

if o.Spec.ClusterIP == "" {
Expand Down
8 changes: 4 additions & 4 deletions nodelocaldns/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ require (
github.com/go-logr/logr v0.1.0
golang.org/x/tools v0.0.0-20191010075000-0337d82405ff
gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e // indirect
k8s.io/api v0.18.2
k8s.io/apimachinery v0.18.2
k8s.io/client-go v0.18.2
k8s.io/api v0.18.4
k8s.io/apimachinery v0.18.4
k8s.io/client-go v0.18.4
k8s.io/klog v1.0.0
sigs.k8s.io/controller-runtime v0.6.0
sigs.k8s.io/kubebuilder-declarative-pattern v0.0.0-20200512162422-ce639cbf6d4c
sigs.k8s.io/kubebuilder-declarative-pattern v0.0.0-20200702123846-f7388b7841f5
sigs.k8s.io/structured-merge-diff v0.0.0-20190817042607-6149e4549fca // indirect
sigs.k8s.io/testing_frameworks v0.1.2 // indirect
)
Loading

0 comments on commit 040a382

Please sign in to comment.