Skip to content

Commit

Permalink
Merge pull request #1 from simster7/apiserverimpl
Browse files Browse the repository at this point in the history
Fixed format and dependency issues
  • Loading branch information
sarabala1979 authored Nov 22, 2019
2 parents 0987a21 + 8f6972c commit 68d2b17
Show file tree
Hide file tree
Showing 25 changed files with 510 additions and 489 deletions.
10 changes: 9 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ RUN cd ${GOPATH}/src/dummy && \
# Perform the build
WORKDIR /go/src/github.com/argoproj/argo
COPY . .
ARG MAKE_TARGET="controller executor cli-linux-amd64"
ARG MAKE_TARGET="controller executor cli-linux-amd64 argo-server"
RUN make $MAKE_TARGET


Expand All @@ -100,3 +100,11 @@ ENTRYPOINT [ "workflow-controller" ]
FROM scratch as argocli
COPY --from=argo-build /go/src/github.com/argoproj/argo/dist/argo-linux-amd64 /bin/argo
ENTRYPOINT [ "argo" ]


####################################################################################################
# argo-server
####################################################################################################
FROM scratch as argo-server
COPY --from=argo-build /go/src/github.com/argoproj/argo/dist/argo-server /bin/argo-server
ENTRYPOINT [ "argo-server" ]
6 changes: 6 additions & 0 deletions Dockerfile.argo-server-dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
####################################################################################################
# argo-server-dev
####################################################################################################
FROM scratch
COPY argo-server /bin/
ENTRYPOINT [ "argo-server" ]
40 changes: 40 additions & 0 deletions Gopkg.lock

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

2 changes: 2 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ required = [
"k8s.io/code-generator/cmd/deepcopy-gen",
"k8s.io/code-generator/cmd/informer-gen",
"k8s.io/code-generator/cmd/lister-gen",
"gonum.org/v1/gonum/graph",
"github.com/golang/glog",
]

[[constraint]]
Expand Down
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,22 @@ else
endif
@if [ "$(DOCKER_PUSH)" = "true" ] ; then docker push $(IMAGE_PREFIX)workflow-controller:$(IMAGE_TAG) ; fi

.PHONY: argo-server
argo-server:
CGO_ENABLED=0 go build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argo-server ./cmd/server

.PHONY: argo-server-image
argo-server-image:
ifeq ($(DEV_IMAGE), true)
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -i -ldflags '${LDFLAGS}' -o argo-server ./cmd/server
docker build -t $(IMAGE_PREFIX)argo-server:$(IMAGE_TAG) -f Dockerfile.argo-server-dev .
rm -f argo-server
else
docker build -t $(IMAGE_PREFIX)argo-server:$(IMAGE_TAG) --target argo-server .
endif
@if [ "$(DOCKER_PUSH)" = "true" ] ; then docker push $(IMAGE_PREFIX)argo-server:$(IMAGE_TAG) ; fi


.PHONY: executor
executor:
go build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argoexec ./cmd/argoexec
Expand Down
2 changes: 2 additions & 0 deletions api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1538,6 +1538,7 @@
"format": "int64"
},
"podGC": {
"description": "PodGC describes the strategy to use when to deleting completed pods",
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.PodGC"
},
"podPriority": {
Expand All @@ -1563,6 +1564,7 @@
"type": "string"
},
"securityContext": {
"description": "SecurityContext holds pod-level security attributes and common container settings. Optional: Defaults to empty. See type description for default values of each field.",
"$ref": "#/definitions/io.k8s.api.core.v1.PodSecurityContext"
},
"serviceAccountName": {
Expand Down
5 changes: 0 additions & 5 deletions cmd/argo/commands/common.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package commands

import (
"encoding/json"
"fmt"
"log"
"os"
Expand Down Expand Up @@ -72,11 +71,7 @@ func InitKubeClient() *kubernetes.Clientset {
if err != nil {
log.Fatal(err)
}
b,err :=json.Marshal(restConfig)

fmt.Println(err)

fmt.Println(string(b))
// create the clientset
clientset, err = kubernetes.NewForConfig(restConfig)
if err != nil {
Expand Down
126 changes: 24 additions & 102 deletions cmd/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,60 +5,13 @@ import (
"encoding/json"
"fmt"
"github.com/argoproj/argo/cmd/server/workflow"
wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1"
"github.com/argoproj/argo/util"
"github.com/prometheus/common/log"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
"os"
"sigs.k8s.io/yaml"

)

var wfStr = `
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: hello-world-
spec:
entrypoint: whalesay
templates:
- name: whalesay
container:
image: docker/whalesay:latest
command: [cowsay]
args: ["hello world"]
`


func unmarshalWF(yamlStr string) *wfv1.Workflow {
var wf wfv1.Workflow
err := yaml.Unmarshal([]byte(yamlStr), &wf)
if err != nil {
panic(err)
}
return &wf
}

func homeDir() string {
if h := os.Getenv("HOME"); h != "" {
return h
}
return os.Getenv("USERPROFILE") // windows
}



//func generate(){
//
// kubeConfigFlags := genericclioptions.NewConfigFlags(true)
// //kubeConfigFlags.AddFlags(flags)
// matchVersionKubeConfigFlags := cmdutil.NewMatchVersionFlags(kubeConfigFlags)
// //matchVersionKubeConfigFlags.AddFlags(cmds.PersistentFlags())
// f := cmdutil.NewFactory(nil)
// f.RESTClient()
//
//}
func main(){
func main() {
//generate()
conn, err := grpc.Dial("localhost:8080", grpc.WithInsecure())
if err != nil {
Expand All @@ -68,61 +21,30 @@ func main(){
client := workflow.NewWorkflowServiceClient(conn)
//wf := unmarshalWF(wfStr)
config := util.InitKubeClient()
//
////tc, err :=config.TransportConfig()
//
var clientConfig workflow.ClientConfig
//
clientConfig.Host = config.Host
clientConfig.APIPath = config.APIPath
clientConfig.TLSClientConfig = config.TLSClientConfig
clientConfig.Username = config.Username
clientConfig.Password = config.Password
clientConfig.AuthProvider = config.AuthProvider
//
//
//
by,err := json.Marshal(clientConfig)
fmt.Println(err)
//
md := metadata.Pairs(workflow.CLIENT_REST_CONFIG, string(by))

clientConfig := workflow.ClientConfig{
Host: config.Host,
APIPath: config.APIPath,
TLSClientConfig: config.TLSClientConfig,
Username: config.Username,
Password: config.Password,
AuthProvider: config.AuthProvider,
}

marshalledClientConfig, err := json.Marshal(clientConfig)
if err != nil {
log.Fatal(err)
}

md := metadata.Pairs(workflow.CLIENT_REST_CONFIG, string(marshalledClientConfig))
ctx := metadata.NewOutgoingContext(context.Background(), md)
//wq := workflow.WorkflowQuery{}
//created, err :=client.Get(ctx,&wq)
//
//fmt.Println("errr",err)
//
fmt.Println(string(by))
wq := workflow.WorkflowListRequest { Namespace:"default"}
fmt.Println(string(marshalledClientConfig))

wq := workflow.WorkflowListRequest{Namespace: "default"}

queried, err := client.List(ctx, &wq)
if err !=nil {
fmt.Println("errr",err)
if err != nil {
log.Fatal(err)
}
fmt.Println(queried)
//var wuq workflow.WorkflowUpdateQuery
////wuq.Workflow = queried
////wur, err := client.Retry(context.TODO(), &wuq)
////
////if err !=nil {
//// fmt.Println("errr",err)
////}
////fmt.Println(wur)
////
////name := "scripts-bash-5ksp4"
////query := workflow.WorkflowQuery{Name: name,}
////
////
//created, err :=client.Create(ctx,wf)
//if err !=nil {
// fmt.Println("errr",err)
//}
//fmt.Println(created)
//
////byte1, err := wflist.Workflows.Marshal()
////for inx,_ := range wflist.Workflows {
//// fmt.Println("Response:", wflist.Workflows[inx].Name)
////
////}


}
Loading

0 comments on commit 68d2b17

Please sign in to comment.